RTX backface issue

Hello all,
I experienced and strange behavior with backface on a simple plane : shadow is not casted in the right direction.
Just add a directionnal that cast ray traced shadows and add a plane.

Is there a settings somewhere in the engine to fix this issue?


This is a known current issue. We currently trace rays from the surface towards the light source, which is opposite to what happens for shadow map rendering.
Workaround is to set r.RayTracing.Shadows.EnableTwoSidedGeometry 1. This disabled back face culling for shadows. Results will still not always match shadow maps, but will be closer to them when scene contains non-watertight geometry.

Yes, I noticed using this cvar indeed fix the issue.
Thanks for your quickly response!

@YuriyODonnell Heavily impacts foliage/trees as well. It looks cool with the above cvar but it does wreck the subsurface effect. Docs says the foliage lighting model should be fully supported but I’m just guessing it’s still a WiP? (hope so :rolleyes:)

@Chesire We are considering making **r.RayTracing.Shadows.EnableTwoSidedGeometry 1 **default. What kind of issues do you see with subsurface effect?

@YuriyODonnell First of all my apologies for the late reply. Normally I get notifications but in this case I did not. About the issue with subsurface when having EnabledTwoSidedGeometry cvar set to 1, I guess it works but it does look different in the foliage lighting model. Where without raytracing it’s very easy to achieve this almost translucent look on leaves due to SSS, with raytracing this is harder because -and please correct me if I’m totally off here, it seems the shader calculates the areas that can now receive ‘proper SSS’ (meaning not boosting it manually with multiplies or normal trickey) is smaller. Almost like the 2-sided shadowing cuts into parts that should actually be able to receive SSS. Best way to see this is by using just about any tree, put a directional light behind it so it gets this nice SSS corona and only then move that scene to -dx12 RT ON. Tbh raytraced foliage and trees look absolutely stunning but the SSS part I believe is currently not correct.

Here is a comparison between raytraced directional light and CSM :


Raytraced :

Should we log this as a bug @YuriyODonnell ? Just rly hoping it’s not ‘working as intended’ cause hopefully you’ll agree from @Klass ’ shots that the SS effect with CSM looks far superior to the one with raytracing enabled.

Clearly superior!

Yes, please file a bug. If you are able to provide example project that demonstrates the issue and a few screenshots of desired vs current look, it would be super helpful.

In general, there are some limits to how ray tracing works with subsurface scattering. Shadow maps are currently required for certain effects (such as transmission) to work correctly. This is because ray traced shadows work by starting a ray at the receiving surface and tracing it toward the light. Shadow maps do the opposite: start from light and “trace” towards scene. Shadow maps therefore allow us to approximate object thickness.

My gut feeling is that a shadow map will be required to achieve the subsurface look you are after (i.e. shadow maps would still need to be rendered even when RT shadows are on, but only used for SSS). Perhaps a specialized path can be also implemented using ray tracing, but no work has been done on this specifically so far.

Have there been any new developments on this issue? Currently I’m using both 4.23 and 4.25 for separate projects. I’m using ray tracing and DX12 in my projects for the nicer looking more accurate lighting, but would also really like to use subsurface on some materials. I tried the cvar mentioned above and it doesn’t seem to have any effect for me though my situation isn’t exactly the same as the OP. I mainly want to use it for foliage, but in a particular project I have a large canvas roof structure that would really benefit from it.

I’ve found that if disable ray traced shadows on the light, then that light will work, but that’s not really a practical solution for me.