light into water

Hi guys,

thought I would share this solution to a problem that I had. I was trying to make a shaft of light into water, with a volumetric visible shaft under the water.

I made a box with two windows, one under the water and one above, and lit both from outside. Only the lower one showed a shaft of light. Making the water surface totally transparent worked, but then there was no reflection or refraction.

After a lot of messing about, the solution seems to be this:

Take the water surface and make a copy. Extend this into a volume if it isn’t already, ( say if you made from a plane with an ‘ocean’ modifier like in this image.) Now apply a totally transparent surface, and the volumetric shader to the volume input of the object. This makes the shafts of light.

The other copy is moved upwards very slightly, and then apply a shader as follows: add a mix shader. To the upper shader input put a transparent shader. to the lower input put a glass shader. To the factor input take an input from a Light path node, specifically the ‘is camera ray’ output.

This seems to merge the inputs and gives reflection, refraction and volumetric at the same time. You can see both shafts of light, and both the pools of light where they hit the bottom of the tank.


Hope this helps someone. Note this works on 2.72 experimental GPU rendering.

Note there is not a lot of detail in the water as I threw this together as a demo.

Matt