# 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:** 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 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();

            // ..
        }

}

```

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-get-the-scene-accelerate-structure-tlas-for-custom-ray-tracing/696723)._
