Hi all, Here is my problem. I want to create objects which react to light by displaying an different texture. Something like the clues in Alan Wake I think I need to write a shader, with 2 textures, the first would be rendered when no light, the other would be rendered when the object is enlightened. I'm just starting wirth "shader stuff" and I'm not sure it's possible. Am I in the right way ? Any advice are welcome Thank you !
It's possible but if you use Surface Shaders (and also in other cases ) you will have to implement a special "light" for this because all lights in Surface Shaders are supposed to be additive while you need a light that replaces the color of one texture by the color of another texture. (I don't see how you could implement this by adding colors; except maybe with negative intensities but those are probably not possible.)
If you are using deferred lighting you can do this quite easily in a custom surface shader. In your shader write two 'textures' to the surface output (for example have a albedo1 and albedo2). In the lighting portion of the shader you will have a final per texel light value, you can use this to pick how much of each albedo channel to use You should be able to hook something similar up for forward rendering also as it is additive and will work also, but might require a bit more work
Thanks ! stramit, this is what I was thinking to do it, but I just don't know how to code it I never wrote a shader, so I need to study a bit