Scene Capture 2D capturing depth of back of objects

I am working on a problem where I need to manually render shadows, where I need an object to be unlit but receive shadows. The only way I can think of doing this is to use a Scene Capture 2D to capture depth then use that depth to determine shadows, however I need to only capture the depth of the back of the object, capturing the depth of the front won’t be effective as I want the object to cast shadows and receive shadows but it itself shouldn’t be shaded(its back side shouldn’t get shaded because of its own geometry). Basically I need to make objects unlit but cast and receive shadows for the effect to work. For additional context, the surface of the object is going to have a very specific texture which needs to display its diffuse color without being effected by different light intensities on the surface otherwise it will look terrible. Every 3D object in the game will have this effect.

Sorry so my question is, is there a simple way to just capture the depth information of the back of the mesh rather than the front?

Unless your object is completely convex, it will still self-shadow even when capturing only the backfaces.

To answer your actual question, for regular shadows you can use the shadow pass switch node and a masked, two-sided, material. Otherwise if it needs to be a scene capture then you can use a duplicate mesh with its faces reversed that isn’t rendered to the main pass, but is visible to scene captures. There’s a checkbox in the actor panel for this.

Thank you! I will try the second one, I couldn’t quite make sense of the first suggestion, I watched a video on the shadow pass switch and it seems to only be used for changing the shape of a casted shadow?

It will do whatever you tell it to do in the material. In your case you would mask the front faces but allow the backfaces to be visible, thus rendering the backfaces into depth.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.