Rendering with Replaced Shaders ignores default value in Properties block?

using the shader “Tutorial/Textured Colored” provided in the unity manual:
http://docs.unity3d.com/Documentation/Manual/ShaderTut2.html

modify the default color to some none white value

_Color ("Main Color", Color) = (0.2,0,0,1)

then render with replaced shader by setting replacement shader for the camera

camera.SetReplacementShader( Shader.Find( "Tutorial/Textured Colored" ), "" );

the result indicates _Color is white but not (0.2,0,0,1).

It’s correct on a material.

1 Like

The replacement camera will copy any values with the same name from the normal shader of the object to the replacement shader. If you do not want that behavior, simply rename the _Color variable in the replacement shader to something that does not occur in any of the shaders you use for normal shading.

changed the name, now the color is black…

You can also hard-code the color into the shader if you want. There is no need to use a color variable if you know it has to become white.

replacement shader will copy whatever the values are in the original material of your object and use it IF there is/are any unless they are already overwriten in the replacement shader itself.