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_Example![](http://wiki.polycount.com/w/images/5/58/Tree_front.jpg)
![](http://wiki.polycount.com/w/images/7/72/Tree_back.jpg)
Shader is on the middle quad here. N dot L is working fine, at least for the front faces.
![](https://us.v-cdn.net/5021068/uploads/editor/9t/1rfe6dnq03n5.jpg)
I tried inverting the normal, and now the backside of the quad is lit. But the shadow is not visible on the backfaces.
![](https://us.v-cdn.net/5021068/uploads/editor/um/ilv61ocllg9e.jpg)
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.
![Image: https://us.v-cdn.net/5021068/uploads/editor/lw/ojk942wtrlau.jpg](https://us.v-cdn.net/5021068/uploads/editor/lw/ojk942wtrlau.jpg)
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.