# Set transparency depending on angle to light source

While trying to recreate my windows in Blender, I came up with the problem of making the window shades. They are made of some kind of fabric, such that the Sun will shine trough. I notices, that the amount of light that comes trough depends on the angle between the surface normal and the light source (in this case the sun). For example, in this photograph, see the left side of the inner frame:

Now, I tried to recreate it in Blender. I tried various material nodes and the best I could come up with was a combination of Translucent, Transparent and Diffuse BSDF, mixed together in some proportion.

This lets the sunlight through, however, it ignores the zig-zag pattern of the window shade. The same amount shines through, no matter how the surface is oriented. This is, what I get rendered in Cycles.

Now, is there a shader or a node setup that works like the Transparent BSDF, but respects the surface normals, such that the amount of light is dependent of the orientation of the surface relative to the sun? Basically: How do I get the "shadow" correctly?

Here is a picture for Illustration :)

You can get good results by adjusting the Fresnel Value.
It specifies at which angle the surface becomes transparent for incoming light.

• Thanks for the answer and the animation! But did you notice the shadow is the wrong way? The parts that should be dark are light. For example see the eighths stripe from the top. It is almost perpendicular to the sun ray and should pass the most light. But when you count the eighths stripe in the shadow its darker than its surroundings. Oct 29 '20 at 10:39
• I knew something wasn't right, thanks! Inverting the fresnel value solved it :). Oct 29 '20 at 10:58
• I still get some weird issues under certain angles with the Fresnel node. I now tried to feed in the Normal Vector from a Geometry Node into a Vector Math Node set to Dot Product with the Sun Position (calculated manually), then a Math Node where I subtract the result from 1. That looks realistic, until I change the position of the Sun. Is there a way to get the vector of the incoming light ray as a Node? Oct 29 '20 at 12:03
• In the first version, there was a IOR < 1 which generated some artifacts. But with IOR > 1 and inverting, it seems to work quite well. I'm marking this as accepted. Thanks very much! :) Oct 29 '20 at 14:41
• Glad you made it work. Keep the fun questions coming :). Cheers. Oct 29 '20 at 14:44

Here is what I came up with myself. Just for future reference or until I get a better solution.

I just calculate the transparency using the Sun's position (Taking it as a vector and normalizing it to length 1) and the surface normal vector in a dot product (this gives me the Cosine of the angle) and then inverting it.

To get it mathematically correct, I would have to calculate $$1 - \cos(\phi)^2$$ and then use the absolute value, but this is sufficient.

This gives me the following result:

However, I am still not satisfied, because I have to calculate the position of the sun manually, so it's cheating and it stops working when using a HDR map for the environment.

• Hey :). You could use a driver from the Sun rotation, so you don't need to calculate it manually. Perhaps related: How to parent my sun to environment hdri? Oct 29 '20 at 14:35