I have tried to follow a tutorial to create a custom shader RTX plugin for unreal.
I have a problem with function FRayTracingScene::GetLayerSRVChecked that is not documented.
The member LayerSRVs has 0 elements and the plugin crashes with assert.
I think there is some configuration or code line that is missing from the plugin although I think I followed the tutorial instructions.
@YamWR450F
You probably already did this, but please make sure RT is enable in your project.
Ok so my main suspect would be the test runner which calls for BeginRendering()
I’ve found that a slight delay might be needed in order to make sure everything was set by the scene. I have a rather powerful PC so it might be faster for me.
On the ATestRunner::Tick() try to increase the delay. In my guide the delay was hardcoded to 1.0f like so:
I’ve validated that RT is on, and the delay code exists (like in your tutorial)
It seams there is a missing code in some of the files that does not include in your tutorial and I guessed what should be in them.
I’ve posted github code of the plugin as close as I managed to do according to your tutorial.
Could you try to run it and identify what is missing?
Ok so I cloned your repo and added it as a plugin and I did get the crash you mentioned.
I’ve managed to resolved this by enabling the following project settings:
Engine->Rendering->Hardware Ray Tracing->Ray Traced Shadows
Engine->Rendering->Hardware Ray Tracing->Ray Traced Skylight