Smoke


The smoke coming out of the volcanoe is a little more complicated than the other procedural textures used so far.

It implements the ray-marching algorithm inside a RenderMan shader. It then uses turbulence to give different opacities to particles within the volume which is being raymarched.

I have used a stretched sphere as the bounding box for the smoke but any other primitve can be used but the shader needs to be changed for these other geometries to work correctly. When the renderer finds a visible point on the object it calls the shader for that surface; for my ray-marching shader I follow the path of the ray through the object and accumulate the opacities at fixed intervals until I reach the bounding box. The accumulated opacity is that opacity of the original point chosen by the renderer.

I use turbulence to give different densities to areas of the object being ray-marched. This gives a patchy look. In order to make the smoke look like it is rising, I translate through turbulence space. If I move down in turbulence space then it will look as if the smoke is rising.

Here is all the above mentioned effects in one shader. Other little things such as ramping off the maximum opacity as we get closer to the edges of the object and as the smoke rises causes a more realistic effect.