Download

Directly Access Surfels from Component?

Hey everyon!

I’ve fairly new to unreal, and have been lurking for a while. Currently my group is looking for a way to simulate some underwater sensors, which can be done either via (a) a LOT of ray tracing, which will likely be too slow, or (b) a discretization of the level map. We’ve stumbled upon the “surfels” which UE4 already computes, and which may be perfect for (b).

I’d like to access these surfels from a USceneComponent C++ class, but have been struggling to do so. I’ve attempted it a few ways, generally along the lines of



const FScene* Scene = (const FScene*)View.Family->Scene;
FUnorderedAccessViewRHIParamRef UniformMeshUAVs[1];
UniformMeshUAVs[0] = Scene->DistanceFieldSceneData.SurfelBuffers->Surfels.UAV;

which does compile, but usually gets mad at me for dereferencing a NULL pointer when attempting to do anything with UniformMeshUAVs[0]. Could anyone point me in the right direction, or help me out here? It would be much appreciated!