Hi all shader gurus. I have been digging on my own via Google, Unity Answers and this forum to self help tweaking this shader (but I’ve come up with no working solution). What I need to add to this is: The ability to plug in a black/white masking texture that will mask portions of the diffuse texture so that I can adjust the color property in the Inspector on only the masked areas. This will allow me to set a color for a vehicle and the color only changes on the masked areas of the car…this way color won’t be adjusted on the wiper blades, taillights, etc.
I figure if someone could help me get this shader working I would set them up with a full (16) vehicle low poly car pack of mine found here:
is great to learn about shaders, to begin with, I’m guessing you will need to use the blend settings
although I don’t know who will write the shader for you still, it could be cool to see the different blend options, essentially you can substract one colour value from the other, multiply them pretend like one shader has 0 basic blend value and another one has 1, so that it goes through completely or it is masked completely, I just coded this the other day, it was a case of adding one line and experimenting with the different options, of which there are about 20 combinations. how much of the model of the car do you want to change colour, is like a decal or for garage with spray paints etc?
Just tested it and got some result. Never worked with that ShaderLab and I know why, it is so annoying.
What you where searching for was the lerp function.
The first shader seems to work but I struggle with the second one. May you can play with it and get it to work. I currently don’t know how to apply the lighting to it. Do you really need that blending step? May you do it in the second pass and do the base texture in the first.
Ohh the masking works on this! Unfortunately though, I’ve lost the reflection strength being controlled by the diffuse’s alpha on the masked colored areas. It’s insanely reflective, so I’m guessing the colored areas aren’t using the reflection strength in the diffuse alpha?
Not to hi-jack the thread but as a “newb to ShaderLab” but experienced in shader programming (GLSL, Cg) I’m kinda curious what happens to these non-programmable fixed-function “shaders” at runtime, especially on mobile. Does Unity invoke the GL ES 1.x fixed-function pipeline at runtime, or does it auto-generate Cg shaders from those fixed-function definitions?
Unity generates programmable pipeline versions of all fixed function shaders, and runs those if the target supports them. So on mobile, targeting OGLES 2.0 will cause the player to use only the programmable versions.
Okay I’m pretty close, so now what is happening that is wrong is this. The “PaintColor” color slider is working and coloring the mesh, but it’s covering OVER the main diffuse texture that was painted. So the color masked areas aren’t showing any of the diffuse texture, just the color overlay. Somehow need to blend the color overlay with the main diffuse texture.
Still trying to tackle this one with no luck. I think the issue might be needing to multiply the main car texture with the color overlay. Right now it’s faintly visible underneath, but it should mult through.