- Home /
adding texture to vertex color darkens color
Hi I am trying to make my own simple shader for matching color of the background with color of my objects(clifs). Its all for doing chasms, or pitfalls that blend to one color.
Adding only vertex color to shaders(binding) gives accurate color: shader code:
Shader "Custom/VColDiffBlnd" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
BindChannels {
bind "color", color
Bind "vertex", vertex
Bind "TexCoord", texcoord
}
}
but when adding setTexture it darkens the texture.
Shader "Custom/VColDiffBlnd" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
BindChannels {
bind "color", color
Bind "vertex", vertex
Bind "TexCoord", texcoord
}
pass {
SetTexture[_MainTex] {
Combine texture * primary
}
}
}
And i know that is normal, but is there a way to add my color to the texture and preserving the bright color of both of them(texture and vertex color)?
And i cant make one gradient or alpha map to use in this because this shader will be used for different textures with different uv coords.
Should I double(or quad) primary? But How?
I'm either going blind or both of those shaders are the same..?
yes, im sorry. Edited.
And found a solution. Just change the combine to:
Combine primary lerp(primary) texture
and dont forget to set the color.a of all the verts that you want to preserve to 0. That worked for me.
Could you post your solution as an answer? I'd be interested to see it. Thinking of learning shaders myself...
Your answer
Follow this Question
Related Questions
Combining 2 black-white textures 2 Answers
Transparent texture and object with changing color 0 Answers
lightmap plus per material color 1 Answer
Real time vertex paint (or similar solution) possible? 2 Answers
Texture color is not right after import 0 Answers