Planet Blueprint made by Aharon Rabinowitz, Earth Texture attributed to Solar Textures and NASA.
Space Texture generated with wwwtyro.net by Rye Terrell.
This project was about making a dynamic effect for atmospheric re-entry, recently seen in games like Helldivers 2. I wanted to enable the effect for any given mesh and rotation.
The mesh that enters is part of a blueprint system that uses the Axis-Aligned bounding box to calculate the scale for the friction effect, and for the SceneCaptureComponent that captures the depth of the mesh from the front.
The Rendertarget for the depth capture is a set 512x512, same as the quads of the plane used for the effect. In that way, the UVs for the capture and mesh align without much trouble.
The captured depth RT is fed into a JumpFlood Algorithm to make a 2D Distance Field to control the outline of the effect a bit better.
The JFA seed
The mask of the mesh
The JFA loop, Canvas letting me Ping-pong render with ease.
The distance field of the front profile
Turning a flat plane into an enveloping effect required vertex position offsetting. Each vertex is pushed in by the depth value and by their distance value.
Slight offset towards camera to lessen clipping
To achieve some trailing along the tail of the effect, I stretched worldspace positions along the effect axis and fed them into a noise function to add variation to alpha and color values. After that
Stretched world position noise
Finally some falloff is added using the distance field to decay it.
After that, some color and a similar effect disc mesh for the shockwave effect, and we're done.
A learning experience with several setbacks, I got familiar with JFA and what it can and can't do. I learned of a way to avoid having to establish two rendertargets assets for ping-pong rendering in Unreal.
Mesh Generation. JFA was a good learning experience, but not the best tool for the job. A prebaked shell mesh with some distance offset would allow better control over the profile of the effect, as well as better topology to avoid stretching and intersection.
SDF Generation. My first effort involved attempts of generating a Signed Distance Field texture of the mesh object. However, the built-in methods were obfuscated from direct use, and the global distance fields functions were of low precision.
Flowmap Generation. Accurate aerodynamics require more information than what a single depthmap can give. A windtunnel simulation in niagara would allow a correct path for the effect.
Shading mode. I made attempts to dampen the high shader complexity that happens when the mesh folds over itself and Unreal has to solve for the overlapping alphas. Dithered masked opacity, while performant, could not solve for the movement of the effect. Stenciling out the mesh and blending with the underlying scene could reduce the complexity and allow for more volumetric shading.