Hi everyone!
I’m trying to hide some emissive planes that we use only as light sources. On the Static Mesh Component, Visible is disabled and Affect Indirect Lighting While Hidden is enabled. This works fine for normal rendering, but the planes are still visible in reflections. The project uses HWRT Lumen in Unreal Engine 5.6.1.
To hide them, this line was added:
Context.InstanceMask |= RAY_TRACING_MASK_UNUSED_0;
after creating the context (Context = CreateRayTracedLightingContext) in these files:
LumenRadianceCacheHardwareRayTracing.usf -> TraceRadianceCacheProbeTexel
LumenRadiosityHardwareRayTracing.usf -> LumenRadiosityHardwareRayTracing
RayTracingInstanceMask.cpp was also modified in SetupRayTracingMeshCommandMaskAndStatus:
if (PrimitiveSceneProxy->IsEmissiveLightSource())
{
MeshCommand.InstanceMask = RAY_TRACING_MASK_UNUSED_0;
}
This solution works, but in ue5-main the RAY_TRACING_MASK_UNUSED_0 flag no longer exists, although another bit seems to be free.
Is there a simpler or more correct way to hide emissive meshes from reflections?
Thanks in advance!
[Attachment Removed]
I was going to post for the exact same thing as we don’t want emissive to be in the reflections using the same setup as you are.
[Attachment Removed]
Hello,
Thank you for reaching out.
I’ve been assigned this issue, and we will be looking into hiding objects from reflections while keeping them affecting diffuse GI for you.
[Attachment Removed]
Hello,
Since you are already using Lumen HWRT, there is an option that does not involve using ray tracing mask flags.
The CVar “r.Lumen.HardwareRayTracing.LightingMode” must be set to “2”, as that will allow the evaluation of the Material at the point of impact for reflection traces only, but rely on the Lumen Scene for general GI traces.
Then, the Material on the plane can use Opacity Mask = 0 when rendered with Ray Tracing, and 1 otherwise.
An example of the implementation, and the result:
[Image Removed]
Please let us know if this helps.
[Attachment Removed]
Got the same numbers on my workstation with a 4090 and on a low spec PC it’s 15ms but I don’t expect to have RT Reflection on Low spec. I tried on consoles and it changes nothing ? (I can start a confidential post for the consoles)
[Attachment Removed]
Hello Stephen! This method works but changing r.Lumen.HardwareRayTracing.LightingMode to 2 adds 1-2 ms to the lumen reflections stat in our scenes. Is there any way to achieve the same performance?
[Attachment Removed]
Hello,
The extra cost comes from the reflection rays now evaluating the Material on hit, rather than sampling the Lumen Scene. That being said, there are features you can leverage to mitigate this cost increase:
- Use the same “RayTracingQualitySwitchReplace” Material Expression to simplify Materials for the Ray Tracing scene exclusively. Keep in mind this will affect their appearance in reflections. Remember to profile the GPU to determine the worst-offending Materials.
- In the Post-Process volume, adjust “Max Roughness to Trace” in the Lumen Reflections section. Lower values will result in less pixels sending out dedicated reflection rays. This might not have an effect if your project prominently features highly reflective surfaces. Keep in mind that lowering this can cause surfaces to look rougher if their roughness is above the value.
- The CVar “r.Lumen.Reflections.DownsampleFactor” controls the resolution of Lumen Reflections, with higher values being smaller. Keep in mind this also impacts the visual quality of the reflections.
Please let us know if this helps.
[Attachment Removed]