Make the Depth-Map

Stereograms consist of two parts: The depth-map and the tiled image. The tiled image is what you see at first. The depth-map is the hidden 3D image. This tutorial will show you how to create the depth-map with POV-Ray.

Create the scene

Create the scene Place your camera somewhere at the -z axis, and make it look at the origin or at a point in the +z direction. You can make it orthographic if you want.

Now create and place all the objects you want to be in the scene. You can use all the light_sources and textures you want while modeling.

Apply gradient Z

Apply gradient Z Union all the objects you have created and placed together in one big union. Delete all textures and light_sources so all you have left the camera and the big untextured union.

Now apply a texture with a gradient z pigment to the union and "finish {ambient 1 diffuse 0}". The texture must be applied after all tranformations, that is, it must be the last thing before the last "}" in the union.

Tweak the gradient

Tweak the gradient Now scale and translate the gradient z pigment so that it fits to the objects. The nearest object must be the most light one and the object farest away must be the darkest. You don't need to use a color_map in the pigment as gradient z goes from black to white already. Almost there…

Make a background

Make a background Unless you want a flat and boring background or your objects cover the whole screen, it is a good idea to add a background to the scene. Create a plane behind all your objects. Give it a pigment with a nice pattern and finish {ambient 0.1 diffuse 0}. Make it very dark, it must be darker than all the objects. You don't need to use a color_map, you can just adjust the brightness with the ambient keyword in the finish and you can control the appearence of the pattern with frequency, phase, the wavetype and so on.


Fine-tuning Test the depth-map. Run it through your stereogram generator and look at the output. Maybe the stereogram has too much depth. In that case you can just make it a little more flat by tuning down the ambient a little. If you want to change the ambient of the objects and the background-pattern with the same amount you can just change the ambient_light in the global_settings.

Keep changing the depth-map and test it until the stereogram looks as you wish.


256 shades of grey is usually fine for depth-maps. If you absolutely have to reduce the colors to less than that make sure that you don't use dithering or diffusion of any kind. That will make the sterograms appear very uneven because although the human eye blends the different colored pixels to a color in between, the stereogram generator doesn't.

Don't use antialiasing!!! It can have strange consequences on the final stereogram. Objects may seem to blend together in the edges. So will use of resizing with resampling. Don't use any filters either or any postprocessing at all except for change of the brightness if you want.

Remember to let me know if you make some stereograms of your own! I would also like to know what you think of this tutorial. Please give me some feedback!