Download

Surfacing Mesh Distance Field Info for Materials?

This is more a theoretical discussion of pros, cons, and potential as I don’t actually need help solving a problem. I have an effect right now in a test environment that uses the BoxMask3D node with very small XY dimensions and a high falloff value to create a capsule-like distance field around the player, then uses that node’s output to control the opacity of the material based on player position and create a roughly player sized hole in the object the material is applied to.This works fine, with the exception that you can’t do any effects with the fall-off because it’s so massive that I can only really just sheer a hard hole through a material. It’s basically just a tinkered with version of the one million material mask tutorials out there on YouTube. A bit janky, and with less control than I wanted, but still perfectly functional.

It did make me wonder, when paired with the Jerome Platteaux talk from 2017 where SDF is surfaced as a node in the materials editor to fiddle with it functioning in a static environment, if the effect could be achieved with UE4’s built-in mesh distance field info, or if that is too centered around shadow generation (Platteaux’s talk is, at the end of the day, still centered on lighting). Or if I could write a node that does it more efficiently (and preferably just for a single object) than guessing at values that warp the standard box distance field generated by BoxMask3D into what I wanted. I assume this would, at the very least, require some coding on the back end, but I have no idea if I can even tap into that info outside of lighting at all at this point.