Bug with constantColor ?

I’m currently wrinting a shader that tints specific parts of a texture with a specific color.

Now with the pixel program everything works well but when it comes to fallback implementation I get a weird behavior:

I took the Normal-Diffuse shader as base (this is the fallback for Radeon 7000) and changed to following ambient pass:

// Ambient pass
Pass {
			Name "BASE"
			Tags {"LightMode" = "PixelOrNone"}
			Color [_PPLAmbient]
			Lighting Off
			SetTexture [_MainTex] {Combine texture * primary DOUBLE, primary * texture}
}

to

// Ambient pass
Pass {
			Name "BASE"
			Tags {"LightMode" = "PixelOrNone"}
			Color [_PPLAmbient]
			Lighting Off
			SetTexture[_MainTex] { constantColor [_TintColor] Combine texture * primary DOUBLE, primary * texture }
}

So the only thing I did is defining a constantColor and even if I don’t realy use it, the complete texture get’s tinted with this color.

Isn’t this a strange behavior??

I’m curious if you’re using the property name _Color instead of _TintColor in the actual shader your using. The _Color property is automatically multiplied into _PPLAmbient. Yeah, I don’t think that’s documented anywhere. :slight_smile:

Yeah, _TintColor is a second color I defined to tint the texture parts.

What you’re saying sounds interesting but I don’t think that’s the problem why the complete texture gets tinted with this color automatically…

Or am I wrong?

If you have _Color in your shader at all it will end up as a part of Primary in the texture combiner because of the Color[_PPLAmbient] line.

Eeeehh… you know what, it seems like it was a bug inside the editor. I noticed when changing the shader very often, strange things can occure. Now it works perfect and I use the same code as 4 hours ago…

Anyway… it works :slight_smile:

Thanks for taking your time!