Sampling DistanceFieldVolumeTexture for a single mesh UE5

So I’m trying to retrieve the distance field data of some mesh to use it as an SDF to generate a procedural mesh using marching cubes.

The point is to sample the texture using a position (X,Y,Z), but I can’t really seem to find a way to access that data.

FStaticMeshRenderData* Data = MeshLod->GetRenderData();
const FStaticMeshLODResources* LodRessource = Data->GetCurrentFirstLOD(0);
const FDistanceFieldVolumeData* SDF = LodRessource->DistanceFieldData;

I’ve tried searching through FStaticMeshLODResources and FDistanceFieldVolumeData but I’m kinda stuck at that point.


It’s probably in here.
It seem to have unique life scope because they need to defer cleanup to sync with rendering thread’s command queue.

You may need to look in MeshDistanceFieldUtilities.cpp. The generated volume logic is in there.
Doesn’t look like they want to expose the api for user to play around.

By the way, This file is in developer module and Epic don’t allow to package it into release build.