This week I just spent more time on fog since I have not had an opportunity to meet with Shain in a week or so. I also imported the built in SSAO effect that Unity has an messed with it a bit to get some contact shadows.
I first looked at the performance of actually tracing through a volume of fog. I first looked at just doing it completely height-based where the fog would reach its minimum intensity at about a meter off the ground. This was decent for performance and looked decent, but it was a little too uniform and I could achieve the same effect using the same analytic solution I used in previous weeks.
Secondly I looked at integrating this with a 4D simplex noise function to have varying intensities throughout the volume and putting in the global elapsed time variable for the fourth dimension to allow the fog to move around over time. As I expected, this was too performance intensive. While it did allow the game to run at 60 fps fine, it still took about 10ms to calculate which is far too much compared to just the normal exponential falloff which was on the order of probably ~0.05ms or less. On older computers this would ruin the performance.
Next I looked at using a 3D Perlin noise function to reduce the amount of calculations needed per sample through the volume. Instead of using W for the time i just used the Z value to pan through the height of the fog. This looks decent, but the performance is still worrying. I’m not sure if Unity has a way to see exactly how much time a Shader spends. The profiler only gives me the % of time taken which is pretty useless especially since the frame rate is capped at 60 fps.