# How to get the scene Accelerate Structure (TLAS) for custom Ray Tracing

**URL:** <https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723>\
**Category:** Rendering\
**Tags:** Ray-Tracing, UE5-0, Rendering\
**Created:** [November 22, 2022, 12:57pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723 "2022-11-22T12:57:29Z")\
**Posts on this page:** 8\
**Page:** 1

<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:** [November 22, 2022, 12:57pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/1 "2022-11-22T12:57:30Z")

</div>

I want to cast custom rays in order to compute something specific. I will be casting 1 ray per texture pixel, probably 1024X1024.  
I’ve set up everything I need in order to do so; shader, parameters, buffers, render thread function and even the actual call for RayTrace().

I’m missing only 1 thing: the Accelerated Structure (AKA TLAS).

I’ve been searching high and low and there is a severe lack of documentation for that. I’ve found example on how to create your own TLAS, but that means using my own geometry, and not the scene’s (See RayTracingTestbed.cpp).

All the actual usages in UE get their TLAS injected as input. and when I trace it back it leads to hard coded calls and private APIs which I don’t have any access to via my plugin.

I would appreciate any help on how to find access to it.  
Thanks!

---

<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:** [December 5, 2022, 9:27am UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/2 "2022-12-05T09:27:14Z")

</div>

```auto
GetWorld()->Scene->GetRenderScene()->RayTracingScene->GetLayerSRVChecked(ERayTracingSceneLayer::Base);

```

---

<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:** [May 1, 2023, 5:04am UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/3 "2023-05-01T05:04:28Z")

</div>

Made it work  
here’s a full tutorial

> **[How to Create a Custom Ray Tracing Shader as a Plugin | Community tutorial](https://dev.epicgames.com/community/learning/tutorials/1lGL/unreal-engine-how-to-create-a-custom-ray-tracing-shader-as-a-plugin)**
>
> In this tutorial I will explain how to create a new ray tracing shader without touching the engine code.
> We will not create our own ray tracing function...

---

<div class="post-metadata">

**Author:** ![ceccocats](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ceccocats](https://forums.unrealengine.com/u/ceccocats)\
**Post date:** [December 23, 2023, 2:05pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/4 "2023-12-23T14:05:56Z")

</div>

> [@FluffyBunnyO](#):
>
> ```auto
> GetWorld()->Scene->GetRenderScene()->RayTracingScene->GetLayerSRVChecked(ERayTracingSceneLayer::Base);
> 
> ```

Do you know if this feature is available on linux? I tried to run it on linux but I have the same issue of this topic: [Help needed: have a problem with custom RTX shader plugin](https://forums.unrealengine.com/t/help-needed-have-a-problem-with-custom-rtx-shader-plugin/1189733)

Off course I enabled Ray Traced Shadows and Ray Traced Skylight but on linux is still failing on GetLayerSRVChecked.

---

<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 12, 2024, 6:28pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/5 "2024-02-12T18:28:10Z")

</div>

This works in UE 5.1 & 5.2.

```auto
GetWorld()->Scene->GetRenderScene()->RayTracingScene->GetLayerSRVChecked(ERayTracingSceneLayer::Base);

```

In 5.3, it was replaced with `GetLayerView` which does not return a `FRHIShaderResourceView`. Instead, it returns a `FRDGBufferSRVRef`.

```auto
GetWorld()->Scene->GetRenderScene()->RayTracingScene->GetLayerView(ERayTracingSceneLayer::Base);

```

Does anyone know how to get the TLAS from the `FRDGBufferSRVRef` without it failing an assert? I tried using `GetRHI()`, but it fails on an assert:

```auto
checkf(DebugData->bAllowRHIAccess || GRDGAllowRHIAccess,
	TEXT("Accessing the RHI resource of %s at this time is not allowed. If you hit this check in pass, ")
	TEXT("that is due to this resource not being referenced in the parameters of your pass."),
	Name);

```

**UPDATE** : I was able to get it to work in 5.3. `GetRHI()` must be called inside the render pass, otherwise it fails the assert.

```auto
FRDGBufferSRVRef layerView = GetWorld()->Scene->GetRenderScene()->RayTracingScene->GetLayerView(ERayTracingSceneLayer::Base);

if (layerView)
{
    GraphBuilder->AddPass(...,
        [PassParameters, layerView](FRHIRayTracingCommandList& RHICmdList)
        {
            // Must call GetRHI() inside the render pass like this!
            PassParameters->TLAS = layerView->GetRHI();

            // ..
        }

}

```

---

<div class="post-metadata">

**Author:** ![ceccocats](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ceccocats](https://forums.unrealengine.com/u/ceccocats)\
**Post date:** [April 23, 2024, 8:09pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/6 "2024-04-23T20:09:05Z")

</div>

with 5.4 it should be possible to run on Linux with Vulkan, or its still missing something? The shader should be written with vulkan API?

---

<div class="post-metadata">

**Author:** ![X-perto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@X-perto](https://forums.unrealengine.com/u/X-perto)\
**Post date:** [June 6, 2025, 7:11pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/7 "2025-06-06T19:11:28Z")

</div>

Hey could you show the includes for this by any chance?  
I have a similar setup and in 5.6 I’m now getting the following error when including `Runtime/Renderer/Private/ScenePrivate.h`

> MeshDrawCommands.h(10,1): Error C1083 : Cannot open include file: ‘TranslucentPassResource.h’: No such file or directory

This worked fine in 5.5

---

<div class="post-metadata">

**Author:** ![GunintheOven](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GunintheOven](https://forums.unrealengine.com/u/GunintheOven)\
**Post date:** [November 17, 2025, 3:53pm UTC](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723/8 "2025-11-17T15:53:08Z")

</div>

This is a known issue in UE 5.6, for now the workaround I am using is to add your `Source/Runtime/Renderer/Internal` directory to your `PublicIncludePaths` in the `build.cs` of the Plugin or whatever you are using - wherever you have (probably) added `Source/Runtime/Renderer/Private` already. This is not advised by Epic, but it’s the quickest way I found to get around it for now.
