# Help needed: have a problem with custom RTX shader plugin

**URL:** <https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733>\
**Category:** Plugins\
**Tags:** unreal-engine, question\
**Created:** [June 5, 2023, 4:07pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733 "2023-06-05T16:07:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![YamWR450F](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yamwr450f/32/769506_2.png) [@YamWR450F](https://forums.unrealengine.com/u/YamWR450F)\
**Post date:** [June 5, 2023, 4:07pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/1 "2023-06-05T16:07:41Z")

</div>

Hi,

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.

Thanks!

I’m using UE5.2  
Link to tutorial: [How to Create a Custom Ray Tracing Shader as a Plugin](https://dev.epicgames.com/community/learning/tutorials/1lGL/unreal-engine-how-to-create-a-custom-ray-tracing-shader-as-a-plugin)

Link to the plugin I’ve built following the tutorial: [https://github.com/tamiroff/CustomShaders](https://github.com/tamiroff/CustomShaders)

Screenshots of the problem:

 ![01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/c/6fc019422899c84df77fffef2397993e962ae2ee.png)  
 ![02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/7/717148cb984228832467c00a6fa987f1d73b0b14.png)  
 ![03](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/5/0454bf39e318a40e08d907c842521b59b0e1da6e.png)  
 ![04](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/2/4a238d8a303842f88f044ca7079134918629a58b.png)

---

<div class="post-metadata">

**Author:** ![FluffyBunnyO](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fluffybunnyo/32/692675_2.png) [@FluffyBunnyO](https://forums.unrealengine.com/u/FluffyBunnyO)\
**Post date:** [June 14, 2023, 10:50am UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/2 "2023-06-14T10:50:00Z")

</div>

@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:

```auto
if(RenderTarget != nullptr && TranscurredTime>1.0f)

```

If that does not work, please write back and I’ll further investigate.

---

<div class="post-metadata">

**Author:** ![YamWR450F](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yamwr450f/32/769506_2.png) [@YamWR450F](https://forums.unrealengine.com/u/YamWR450F)\
**Post date:** [June 18, 2023, 1:16pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/3 "2023-06-18T13:16:48Z")

</div>

Hi FluffyBunnyO,

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?

Link to github code: [GitHub - tamiroff/CustomShaders](https://github.com/tamiroff/CustomShaders)

Thank you very much!  
Tamir.

---

<div class="post-metadata">

**Author:** ![FluffyBunnyO](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fluffybunnyo/32/692675_2.png) [@FluffyBunnyO](https://forums.unrealengine.com/u/FluffyBunnyO)\
**Post date:** [June 28, 2023, 7:10am UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/4 "2023-06-28T07:10:17Z")

</div>

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

Let me know if it works for you 😁

---

<div class="post-metadata">

**Author:** ![NicolasBrugie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NicolasBrugie](https://forums.unrealengine.com/u/NicolasBrugie)\
**Post date:** [August 4, 2023, 1:34pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/5 "2023-08-04T13:34:24Z")

</div>

Hi,

I clone the repo and changed the settings and it works now, thank you very much !

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [August 4, 2023, 1:37pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/6 "2023-08-04T13:37:04Z")

</div>

Hey @YamWR450F!

Just checking to see if FluffyBunnyO’s last post worked for you! Let us know by marking the solution, so we can close this up! 🙂

---

<div class="post-metadata">

**Author:** ![YamWR450F](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yamwr450f/32/769506_2.png) [@YamWR450F](https://forums.unrealengine.com/u/YamWR450F)\
**Post date:** [August 6, 2023, 12:21pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/7 "2023-08-06T12:21:33Z")

</div>

Hi FluffyBunnyO  
Your solution works.  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 5, 2023, 12:21pm UTC](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733/8 "2023-09-05T12:21:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
