I'm using Shader Forge in Unity to make a shader for translucent cloth. But I can't figure out how to get shadows to show on the back side of the surface.
I did this a few years ago in a custom game engine. It worked great, but the shader was done under-the-hood, not exposed to me.
http://wiki.polycount.com/wiki/Normal_map#Back_Lighting_ExampleShader is on the middle quad here. N dot L is working fine, at least for the front faces.
I tried inverting the normal, and now the backside of the quad is lit. But the shadow is not visible on the backfaces.
Also the unlit part of the shadow-casting long box is showing through the backfaces of the quad.
If I 1-minus the Light Attenuation, the shadow is merely inverted (shadows are white, lit parts are black). The shadow
direction is not inverted.
Replies
Apparently there's no node for rotating a vector...
https://shaderforge.userecho.com/topics/504-rotating-vectors/
... but maybe I can use the uv Rotator.
http://acegikmo.com/shaderforge/nodes/#rotator
White = 1, black = 0, and I would think black also = -1. ??
Multiplying one vector with another, interesting! I guess times -1?
This is basically transmittance I think. But Im not in front of a shader editor. I could check tomorrow
The shader forge definition of a dot product is accurate.
The backlight works from all angles. It is blending two materials... one is lit same direction as light and shows a regular leaf texture, the other material is lit the inverse direction (inverted normal map) and shows an under-leaf texture.
However, my original problem has to do with self-shadowing. I did not solve this in Unity.
this works. just tested it.
haha .Today solved some problems.Now the effect is not bad