I’m attempting to render spherical volumetric clouds using post-processing. I believe I’m 90% of the way there; I just have three issues that are hindering my progress:
- Washed-out colors from previous scenes (the cube should be red)
- Clouds that are behind the object showing through the object.
For this post I would appreciate assistance in addressing problem 3. The ray-marched clouds that are drawn behind the object can be seen through it. I have a feeling that using the depth buffer might fix this problem, but I’m not sure how to go about doing that.
Here is a simplified working demo: https://codesandbox.io/p/sandbox/webgl-clouds-forked-c4s88h?file=%2Fsrc%2Fshaders.js%3A7%2C19