0

Shader Using Wrong Layer for Lights

Argento Dragone 10 years ago 0
The problem I'm having has to do with the shader I wrote with ShaderForge, as setting the material back to default-diffuse makes the problem go away.

Basically, I am having trouble adding additional light to some objects being rendered by a orthographic camera set to render only layer 31.  The plain cube I had on this layer (a placeholder object) receives the light correctly, but the other objects were not.  In messing around it appears that they are pulling light as if the objects were set to a different layer than they actually are.

Below, I've set the light which has its culling mask set to only illuminate layer 31 and have set its intensity to maximum:



Upper left: these objects are on layer 0 and use the custom shader.
Center: this object is on layer 29 and uses the custom shader.
Bottom two: these objects is on layer 31, the one on the right uses the default diffuse shader.

Notice which ones get blown out: the objects uses the custom shader and which are NOT on layer 31.

If I switch the two lights so that the overhead light illuminates layer 31 and not layer 29, and the horizontal light to illuminate 29 and not 31, the effect switches: all of the objects on 31 blow out and everything else is not.

I don't know what's going on here or how to fix it.