Cycles: Volume refraction shader

There is another addition I wanted to suggest for the Cycles engine. Since there’s no feature discussion forum, I assume this is the best place, although I don’t know enough programming and Blender coding to do much myself.

One thing that’s always been difficult to do in both Blender Internal and Cycles are volumetric refractions, for air distortions in precise areas. The heat haze effect is often used above flames, over hot ovens, or behind a firing rocket engine. Needless to say, the RefractionBDSF and GlassBDSF shaders only work for the surface and not for the volume.

The only workaround is to render the volume a second time on a different render layer, and feed the alpha pass into a Distort composite node, through which the normal render output is transformed. While this looks okay in most cases, it’s still a hack to something that should ideally be done by the material, and requires multiple render layers which heavily wastes render time. The method is exemplified here, and there is also an example image of the result:

http://fat.gfycat.com/HeavySorrowfulAfricanmolesnake.gif

Would it be possible to implement a new volume shader called Volume Refraction? In regard to how rays are calculated, I imagine it could work the same way as Volume Scatter… with the difference that it doesn’t return a color inside the volume, but whatever the ray hits after it has left the volume. A setting can control the IOR, specifying how far the rays can be deviated by the volume content. This would allow flames and smoke to properly refract rays and simulate heat distortions, and is a very welcome and needed feature in my opinion. What are your thoughts?

1 Like

Having it as a true volumetric effect might actually be a good idea and would be easier to handle for complex materials and meshes.

You can already do this with the layer weight and with the refraction node, but as you said it may not work so good with smoke.

I used a similar methot few years ago in this animation:

I used a particle system emitting spheres from the engine and I rendered Normal pass with only the particles and fed that into the distort node. Even that it is not accurate it looks fairly realistic. It is very easy to setup and you have a lot of control over the effect during postprocessing. And it renders fast! Imagine how long would it take to render true volume refraction shader. Even if there was such an option I would not use that to simulate this effect…