Get Mesh's Distance Fields Texture?

Hi, is there any way that I can get the SDF data built for individual meshes so that I can do a post-process on them to do raymarching? I intend to make raymarching meta-object with static mesh as the render data instead of coding SDF in a material and having it without collision.

This may be way beyond me at this point, but I came across this documentation info which has a section about using raytracing with the SDF Texture. I do not quite exactly understand what it is you are trying to describe what your purpose is. However, the documentation states the info is rendered offline and stored in a volume texture, so it does not seem like it can be done for a single mesh? Can you try to explain a little clearer what the end result is you are trying to achieve?

Hi, my intention is to use the static mesh or skeletal mesh as the distance field data for raymarching.

Looking at this Unreal training, link text Ryan created a material with a CustomExpression to do the raymarching, but that expression also takes in 3 sphere parameters which are SDFs. So my intention is to remove the 3 sphere parameters, use the mesh’s SDF, plug them into a Post Process to create “metaball” effect of any mesh with the Post Process material on.

Example use case: A skeletal mesh walk towards a sphere and as they get closer, they will form the “metaball” effect as if both of them extending out to pull each other in.

What in blazes is a “metaball”? Have you read any of the UDK docs on SDFs? There’s also a valuable slide presentation here: Unreal Engine guides and white papers - Unreal Engine It’s called “Dynamic Occlusion with Signed Distance Fields”. It may have a hint or two of how to achieve a “metaball” effect, in conjunction with other information obviously.

The link that you gave corresponds to this link text . I know Unreal has this feature integrated long ago but my concern is: Is there anyway to get the data generated by Unreal, or do I have to do it myself?

Distance field data for each mesh is accessible through LOD resources, but by default, it is not used in any of passes, where material editor is involved, and you would need to extend the engine to have such functionality.

Live Training:

Another tutorial:

From DAniel Wright:
You can leave the project setting off and then enable ‘Generate Mesh Distance Field’ on select static meshes. Then you can enable CastDistanceFieldIndirectShadow on the component to get an indirect shadow.

The naming of ‘Generate Mesh Distance Field’ is indeed poor because it makes you think you can use it to disable the distance field, when in reality it can only enable.

Some more info from the comment:

         * Whether to use the mesh distance field representation (when present) for shadowing indirect lighting (from lightmaps or skylight) on Movable components.
         * This works like capsule shadows on skeletal meshes, except using the mesh distance field so no physics asset is required.
         * The StaticMesh must have 'Generate Mesh Distance Field' enabled, or the project must have 'Generate Mesh Distance Fields' enabled for this feature to work.
        UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=Lighting, meta=(DisplayName = "Distance Field Indirect Shadow"))
        uint8 bCastDistanceFieldIndirectShadow:1;


Link to discussion:

Could it be rendered in a CustomDepth pass?