Distance Field shader doesn't appear in editor but does when changing values

I’m working on some more complex uses for Distance Fields in shaders and for some reason they don’t seem to be seen in editor, I made a simple test material and even the distance field tonearestsurface in a simple linear int doesn’t stick once I’ve changed those values. The weirdest part is I can see it working when changing the values but once that’s done it resets to nothing.

Has anyone experienced anything similar, or knows of why this might be happening?

DistanceToNearestSurface is not a texture lookup the material editor can preview reliably. The preview mesh has no mesh distance field, and that viewport does not keep a global distance field resident. While you drag a value the editor invalidates the field and you get one update. When the drag ends it settles back to 0, which looks like the shader reset itself.

Test it on a mesh in the level, not in the material preview.

Turn on Project Settings, Rendering, Generate Mesh Distance Fields, then restart the editor. The setting does not exist until the shaders rebuild. The static mesh also needs Generate Mesh Distance Fields enabled on the asset, and it has to be static mobility. A Nanite mesh does not contribute a distance field unless that mesh’s own distance field generation is on. Nanite does not replace it.

Put the material on a cube in the level, with a few other closed meshes nearby, and move the camera. The global distance field clipmaps update when the camera moves and when something invalidates them. That is the same reason scrubbing a parameter flashes a result and then it dies.

If it is still 0 in the level, open the mesh and check Distance Field Resolution Scale is not 0, then turn on Show, Visualize, Mesh Distance Fields. If that view is empty, the node has nothing to read and the material is not the problem.

A lerp cannot hold a value the node is not returning. Once the visualization shows a field, the same lerp will stick.