Community Tutorial: How to Create a Custom Ray Tracing Shader as a Plugin

Hey, I found the solution for that “failed assert” error.

The error was “Ray tracing scene SRV was not created. Perhaps Create() was not called.”

I fixed it by changing how I get the FScene pointer. Instead of using CachedParams.Scene, I now get it directly from the view parameters within the render thread.

Here’s the fix:

void FCustomRayTracing::Execute_RenderThread(FPostOpaqueRenderParameters& Parameters)
{
    // ...
    // FScene* Scene = CachedParams.Scene; // Old way, caused the error
    FScene* Scene = Parameters.View->Family->Scene->GetRenderScene(); // New way, this fixes it
    FRayTracingScene* RayTracingScene = &Scene->RayTracingScene;
    // ...
}

This resolves the synchronization issue and the error no longer occurs.

1 Like