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

**URL:** <https://forums.unrealengine.com/t/community-tutorial-how-to-create-a-custom-ray-tracing-shader-as-a-plugin/1139396>\
**Category:** Tutorial & Course Discussions\
**Tags:** unreal-engine\
**Created:** [April 24, 2023, 3:01pm UTC](https://forums.unrealengine.com/t/community-tutorial-how-to-create-a-custom-ray-tracing-shader-as-a-plugin/1139396 "2023-04-24T15:01:33Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![T.Ashby-CPP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@T.Ashby-CPP](https://forums.unrealengine.com/u/T.Ashby-CPP)\
**Post date:** [February 9, 2024, 9:22pm UTC](https://forums.unrealengine.com/t/community-tutorial-how-to-create-a-custom-ray-tracing-shader-as-a-plugin/1139396/5 "2024-02-09T21:22:05Z")

</div>

Hi @FluffyBunnyO ,

I’m following your tutorial, but I’m running in UE5.3. When I got your example running, I kept getting a crash on `RHICreateUnorderedAccessView`. Internally, that function is running an assert with `(!IsImmediate() || IsInRenderingThread() || IsInRHIThread())` and is failing the assert.

I updated the Test Runner actor to call `FRayGenTest::BeginRendering()` on the rendering thread instead of the update function using `ENQUEUE_RENDER_COMMAND` and this fixes the crash on `BeginRendering()`.

```
FRayGenTestParams* pParams = new FRayGenTestParams();
pParams->pTest = &Test;
pParams->bInitialized = false;

ENQUEUE_RENDER_COMMAND(FRayGenTestParams) (
	[&pParams](FRHICommandListImmediate& RHICmdList)
	{
		pParams->bInitialized = pParams->pTest->BeginRendering();
		return true;
	});

```

In 5.3, `GetLayerSRVChecked()` was replaced with `GetLayerView()` which returns a different object. You have to call `GetRHI()` on while inside the render pass to get the TLAS from the LayerView object that was returned.

See this thread for more details on getting the TLAS: [How to get the scene Accelerate Structure (TLAS) for custom Ray Tracing - #5 by TJ.Ashby-ARA](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/5)

---

_[View the full topic](https://forums.unrealengine.com/t/community-tutorial-how-to-create-a-custom-ray-tracing-shader-as-a-plugin/1139396)._
