I was given this example to enable backface culling with Cycles Render but I wish to eliminate the shadow from the backface culling without eliminating the shadow on the other.

How do I prevent shadows to emit form a specific material in cycles render while that material is using backface culling render nodes?

enter image description here

  • $\begingroup$ I thought I erased that title and put the correct one. It was very late and still wasn't able to get it on my own. $\endgroup$ – Eric Huelin Nov 13 '16 at 15:46

To remove the entire shadow as well as the backface culling you could simply combine the Backfacing socket of the Geometry node and the Is Shadow Ray socket of the Light Path node and use that as the input of your Mix Shader as follows :

hide all shadow

However, removal of the shadows of just those culled 'backfaces' is compilcated by the fact that the 'Backfacing' socket is dependent on the actual ray being considered. This means that using the Backfacing output to cull the backfaces for the Shadow rays will result in different faces being culled for the shadow than are culled for the camera view - this is presumably not the desired behavior. This would be less apparent when the light sources are close to or behind the camera and would become more significant as the light sources move away from the line of sight of the camera or viewport - and the shadow would not match the mesh.

To resolve this must use a fixed point of view for the backface culling for the Camera rays and the Shadow rays and, ideally, all rays. This will ensure that the view of the material will match its shadow. As the hidden faces are based on the camera view it will be possible to see the back of the faces via reflections.

To acheive this, use the following node setup :

shadowed culled material 1

The Combine XYZ node defines the Vector of the Point of View. For 'traditional' backface culling this would point directly between the object and the camera and this would then result in all 'true' backfaces being culled. The node tree is split into a number of frames for clarity. These are as follows :

Shader - Transparent and Diffuse shaders mixed via the Mix shader based on the combined output of the other frames.

Frontfacing - Uses the Dot Product to determine the direction of the surface Normal in relation to the Point of View vector. A positive result will indicate that the Vector is in the same direction as the Normal - ie, it has been struck on its 'Front' face. The Subtract and Multiply nodes are used to filter out the actual 'Backfacing' rays since those need to be handled differently due to the 'Normal' of the face will having been negated.

Backfacing - Similar to Frontfacing but to deal with Normals that have been negated due to the incoming ray being incident on the 'backface'.

The results of the Frontfacing and Backfacing frames are combined via an Add node and then passed into the Mix factor.

The input Vector can be manipulated in Worldspace coordinates to point in the direction of the camera. However, a more versatile approach is toautomatically generate the vector based on the position of the camera or other target object. As the camera or objects moves, drivers can be used to get the associated coordinates and these can be used to generate the required vector for the culling as follows :

tracking the camera object

Here is an example of the back face culling with shadow emitted only from the 'visible' non-culled parts of the mesh :

back face culling with shadow

And a demonstration of moving the culling viewpoint (shown as a glowing disc) :

moving culling viewpoint

Blend file available here

| improve this answer | |
  • $\begingroup$ I don't have a node called Maximum, is that an addon? $\endgroup$ – Eric Huelin Nov 15 '16 at 20:06
  • $\begingroup$ I don't think I am asking the right question or being clear on what I want to accomplish. This seems to be way over my skill level as the simpler example node connections do don't work as described on my side. I'm just gonna call it impossible to recreate and give up on this and try another way. $\endgroup$ – Eric Huelin Nov 15 '16 at 20:16
  • $\begingroup$ Hi @EricHuelin. Sounds like I've over analysed your problem. The Maximum node is a Math node (Add/Converter/Math) set to Maximum - it is a bit confusing if you don't know it changes the heading. If you can clarify what you're trying to achieve I'd be happy to help. $\endgroup$ – Rich Sedman Nov 15 '16 at 21:04
  • $\begingroup$ Thanks Rich but when I started to learn how to do this I never expected it to be so complicated. All I wanted to do was make toon lines by duplicating a mesh add a modifier to displace + reverse normals + material is black. I don't want to use cycles render but seems blender render doesn't allow this but I could be wrong. Cycles does allow to do this except the mesh under it doesn't get any light because it is covered over by the mesh that makes the toon lines. So I wanted the toon line mesh to not cast a shadow but the material below needs to have shading in order to apply ramp shading. $\endgroup$ – Eric Huelin Nov 15 '16 at 21:41
  • $\begingroup$ @EricHuelin Would Freestyle be of any use for your toon lines - instead of duplicating the mesh? I've not got much experience of it but it does sound like that's the kind of thing you're trying to do. You activate it via the Render properties and you can set the line style and properties and these are automatically overlayed onto the render. $\endgroup$ – Rich Sedman Nov 15 '16 at 23:22

You don't have to use material to make object to not emit shadow. You just need to uncheck Shadow in Object Cycles settings.

enter image description here

If you necessarily want to make it by use of materials, this is a node setup, which does exactly the same: enter image description here And this is a material nodes setup, that allows to see only shadow emitted by visible faces (and bottom) of an object with back face culling enter image description here This is expected outcome of the last node setup: enter image description here

| improve this answer | |
  • 1
    $\begingroup$ Please can you explain how that works? Especially the use of the Tangent node. $\endgroup$ – Rich Sedman Nov 14 '16 at 9:58
  • $\begingroup$ Not really. I came to that node setup by doodling around with what I felt to be useful :) $\endgroup$ – Mzidare Nov 14 '16 at 10:18
  • $\begingroup$ Ah - I see... use of Tangent has always been a bit of a mystery to me. I'll give it a try and see if Ican figure out what it's doing. I've got a different solution that I'll add later when I get chance. $\endgroup$ – Rich Sedman Nov 14 '16 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.