Good evening! I want to implement volumetric fog in HLSL on DirectX 11. But I can't find a mathematical summary anywhere. Can someone provide the code in hlsl in what order and what variables I need to use to get volumetric fog like in Unreal Engine. In my current simple fog I use camera position, vertex position to get pixel color. I want 3D fog on the ground, or in the air. Is it simple planes with perlin noise? Show me literature on volumetric fog in hlsl or OpenGL. Maybe this has already been described in some book? Thank you.
Generally its easy to implement constant volumetrics, when amount of "water" in the air is aproximatelly the same evrywhere, for example exponential fog (you can google it out to find some formulas, they are quite easy). But if you want to do something more complex like clouds, where amount of "water" in the air isnt the same at any point, then you should do some sampling and aproximations.
This video might be really helpful with understanding these concepts: https://www.youtube.com/watch?v=y4KdxaMC69w&t