Creating a distance field pseudo volume texture from a mesh?

Does anyone know how to do this or if it is even possible?

My first thought was that since UE4 generates distance field meshes automatically, in theory it seems like it should be possible to use them but I’ve yet to find any way to export them or save them to a file. Plus I don’t know how they’re actually stored, are mesh distance fields stored as volume textures like regular UE4 volume texture assets?

In the Volumetrics plugin, there is a blueprint that voxelizes a static mesh and generates a distance field for it, but I’m baffled by how it works and there doesn’t seem to be a function to generate a static texture.

I also thought perhaps I could just sample the global distance field using Distance to Nearest surface with the EncodeVolumeCoordinates node, but it doesn’t seem to work, it just seems to output nothing. I don’t think the global distance field would have enough resolution for any meaningful detail anyway but I figured it was worth trying.

Not sure what else to try at this point…

Solved this using the voxelize static mesh bp, the jumpflood3d component writes the distance to the alpha of a texture object, but only while simulating apparently. RGB channels contain the gradient. Midpoint is 0.5.

Once you know that you can set up your own static texture event that uses an MID that takes the texture object as an input to write it to a render target.

1 Like

I made some tools/process to do this. If ths is what you mean. :slight_smile:

That looks neat, but in my case I needed a distance field, not just a voxel representation.