Generating Distance Fields for VirtualHeightfieldMesh


I’ve been looking into ways of generating Distance Field data for the VirtualHeightfieldMesh. I’ve been able to pinpoint a few functions that handle distance field generation for typical static meshes (IMeshUtilities::GenerateSignedDistanceFieldVolumeData) and an overridable function (FPrimitiveSceneProxy::GetDistancefieldAtlasData) - so far the logic around it is complex and not that easy to follow, especially when looking at distance fields for the first time.

So before I go into the rabbit hole - Is there any plans for Epic to address this in the future? Is iteven feasible? Lumen seems to rely purely on Distance Fields, so is it fair to expect any solution for HeightfieldMeshes anytime soon?

Open for any other examples or suggestions!

Not sure if we will support VirtualHeightfieldMesh for 5.0, we need to support Landscape first and we’ll see how much time we have after that.

That said, we wouldn’t generate distance fields from VirtualHeightfieldMesh, which already is in an efficient format for ray tracing directly. Distance fields are a volumetric representation and not nearly as efficient or accurate as the heightfield itself. We’d implement ray tracing against the virtual heightfield and composite the hit results into Lumen’s hybrid ray tracing pipeline.