I'd like to use Pov-Ray to generate pictures that can be used in a website on any background color. The pictures need to have a transparent background, but with reflection and shadows cast on a transparent plane surface.
In Pov-Ray (3.7), you can set the background transparent by setting Output_Alpha=True
in the povray.ini
file and outputting as a png
file.
You can even get transparent reflective surfaces by using the color Clear
on a plane (or any other object). But if you set the color of an object to Clear
, no shadows are cast on it.
Is it possible to cast shadows on transparent objects?
The technique suggested by m13r produces very nice renderings, but it requires 3 rendering passes and a lot of changes to the scene for each. This takes time and requires quite a bit of setup.
A simpler and honestly for some cases better result can be obtained with just two passes. Set both your background and ground plane to white, render, set them to black, render again. Lets say you toggle the setting here and generate two files,
white.png
andblack.png
using one or the other of those light definitions.Now the two images and extract the difference using the two background technique documented here.
The disadvantage of this method is that you have less flexibility over scene lighting and cannot pretend to reflect anything off the ground plane. If your objects are matte enough not to be seriously affected by scene background colors then this method might be for you. It my case it saved one time consuming rendering pass and a lot of scene object manipulation.