We are happy to announce that as of Unity 6, the Ray Tracing API is officially out of experimental. This change is introduced after recent improvements to the Ray Tracing API, ranging from stability and performance to additional compatibility with the engine’s existing feature set.
Unity’s Ray Tracing API is utilized by the High Definition Render Pipeline, in order to implement a collection of cutting-edge raytracing effects such as:
- Ambient Occlusion
- Contact Shadow
- Global Illumination
- Reflections
- Shadows
- Subsurface Scattering
- Recursive Ray Tracing
- Path Tracing
“Enemies” - HDRP Ray Tracing in Unity 2022.2
In order to experiment with HDRP’s raytracing effects, you can now utilize the HDRP Sample Scene which has been updated to provide new raytracing quality settings:
“HDRP Sample Scene” - Raytraced GI, Reflections, Shadows and AO enabled
Unity 6 improves the performance of Ray Tracing with optimizations such as Solid Angle Culling, which reduce the Ray Tracing Acceleration Structure (RTAS) overhead. You can set the culling mode through the HDRP settings.
Ray tracing memory usage is also significantly reduced via various RTAS optimizations:
- BLAS compaction to optimize static meshes.
- New BLAS allocator to optimize small meshes and detail.
- RTAS build flags, including the “Minimize Memory” flag.
This release also expands the Ray Tracing API in order to simplify the configuration of meshes added to the Ray Tracing Acceleration Structure (RTAS). This is achieved by introducing a new overload for “RaytracingAccelerationStructure.AddInstance”:
RaytracingAceelerationStructure.AddInstance(ref Rendering.RayTracingMeshInstanceConfig config, Matrix4x4 matrix, Nullable<Matrix4x4> prevMatrix = null, uint id);
The new API allows to pass the new “RaytracingMeshInstanceConfig” struct in order to conveniently configure the mesh and material parameters of instances to be included in the RTAS. For example, it is now straightforward to process/animate the geometry of ray-traced meshes by retrieving the mesh vertex buffer using “Mesh.GetVertexBuffer” and binding it to a compute shader using “ComputeShader.SetBuffer”.
RayTracingAccelerationStructure.AddInstances is also introduced, and provides full instancing support to the Ray Tracing API, allowing to add large amounts of mesh instances to the RTAS, and to use the instance ID in hit shaders for accessing per-instance data.
Using instancing, it is now possible to more efficiently ray-trace large and dense scenes that include high-frequency repeating meshes and detail. For more information on Raytracing Instancing, including performance testing figures and a reference sample project, please check out the following slides.
With the Ray Tracing API out of experimental in Unity 6, we can’t wait to see the amazing results you achieve using HDRP’s comprehensive ray tracing effects! Your feedback is crucial, so please let us know if you encounter any issues, and share any features and changes you would like to see. You can contact us directly in this thread, or by submitting a feature/change request using the official Roadmap Request Form.