I came across this repository and I was very interested as it claims to provide lightweight and inexpensive volumetric fog rendering for VR and Mobile in Unity.
It does this by computing the fog values offline and storing it inside a 3D texture to be sampled at runtime.
It looks like an amazing package, but one of the noted drawbacks is.
“High-resolution 3D textures can eat up VRAM and disk space easily, so to keep it small they have to be low resolution which isn’t good for crisp shadows.”
I’m just thinking if there’s anyway to ‘compress’ a 3D texture, or instead of storing values in a voxel grid they can be stored in an octree so large areas of uniform fog density, color and luminosity are not repeated in memory?
[Header(Raymarching)]
_RaymarchStepSize("Raymarch Step Size", Float) = 25
[Header(Rendering)]
[Toggle(_HALF_RESOLUTION)] _HalfResolution("Half Resolution", Float) = 0
[Toggle(_ANIMATED_NOISE)] _EnableAnimatedJitter("Animated Noise", Float) = 0
[Toggle(_KILL_RAYS_EXITING_VOLUME)] _StopRaysExitingVolume("Kill Rays Exiting Volume", Float) = 1
_JitterTexture("Jitter Texture", 2D) = "white" {}
_RaymarchJitterStrength("Raymarch Jitter", Float) = 2
I always thought ray marching was an expensive shader to run? Or is that only when you’re using it for real time lighting calculations?
Just based on some very rough tests It seems to add 1-2ms per frame, which is pretty great.
