Four years ago, I wrote a simple ray tracer in Java to render a scene hard-coded in the source code. After writing this ray tracer, I came to know about sophisticated ray tracing engines available for free on the internet. POV-Ray seemed to be one of the most popular engines and I decided to learn to use it. However, I never managed to devote time to learning it in the last four years. Finally, in May 2013, I decided to teach myself to do ray tracing with POV-Ray. This activity consisted of learning the concepts required to write scene descriptions for POV-Ray, and writing a new scene each day for 25 days in the month of May 2013.
-
This scene consists of three spheres and three boxes. The scene is illuminated by three point light sources.
One light source is shining from the top right corner of the scene. This light source is behind the camera. This casts the shadow of the green box on the blue ball and that of the blue ball on the yellow one.
Another one is shining from the left side of the scene. This light source is also behind the camera. This casts the smaller shadow of the red box on the blue ball, that of the green box on the orange ball and that of the blue ball on the pale pink box.
There is a third light source at the bottom right corner of the scene. This light source is present slightly in front of the camera. This casts the longer shadow of the red box on the blue ball.
-
The white box is centred at the origin. The camera is placed 10 units behind the origin. One light source is placed 10 units behind the origin, i.e. at the same place where the camera is. There is another light source shining from the top left corner of the scene.
All boxes except the three boxes in the bottom-right quadrant of this image have the same dimensions as that of the white box.
The red box is translated to <2, 2, 2>, i.e. 2 units left from the origin, 2 units above the origin and 2 units further away from the origin in the direction perpendicular to the image.
The green box is translated to <5, 5, 2>, i.e. it has been shifted further way towards the top right corner. As a result we can see more of its left and bottom faces.
The blue box is translated to <5, 5, 5>, i.e. it is placed 3 units behind the green box. As a result it appears smaller than the green box.
The yellow box is first rotated around z axis by 45° and then shifted left by 5 units
The cyan box is first shifted left by 5 units and then the box is rotated around z axis by 45°. In the rendered image, it can be seen that the whole box as a whole orbits around the z axis due to the rotation and occupies a new place 45° away from the yellow box in this orbit.
The length of the brown box is first doubled along x axis, then it is rotated 45° around y axis. As a result, the elongated face is rotated towards left. Then it is translated to a new position below the origin, a little further away towards the right.
The pink box is first rotated 45° around y axis. Then it is scaled by a factor of 2 along x axis. As a result, the diagonal of the box running along x axis seems to be elongated. Finally, this box is translated and placed right below the brown box.
The maroon box is first rotated along y axis by 45°. Then it is translated to a new position right below the pink box. Finally, it is scaled by a factor of 2 along the x axis. As a result, the box appears to have moved further along the x axis. Also, its diagonal along the x axis appears to be stretched.
-
There are two light sources in this scene: one where the camera is situated, and another on the left side of the scene.
The sphere and the torus appear to be specular due to Phong highlighting. As a result, two bright shiny spots can be seen on the sphere as well. One spot is closer to the camera while the other one is on the left side of the sphere. These spots are due to the two light sources. Similar but fainter shiny spots can be seen on the torus as well. The specular highlights on the torus appear fainter because a less saturation value was used for the Phong highlighting was used for the torus.
In addition to making the sphere specular, it has also been made slightly reflective. As a result, a faint reflection of the torus can be seen in the bottom hemisphere of the sphere.
-
There are two light sources in this scene: one at the centre of the ceiling and another at the top of the wall opposite to the camera. The walls are glossy, and thus reflect the scene slightly.
There is a mirror on the wall opposite to the camera. The mirror has a wooden frame. The reflection of a door in the wall behind the camera can be seen in the wall opposite to the camera.
There is a crystal ball placed on a wooden block. There are two other coloured balls lying on the floor.
-
The room in this scene is similar to the room in the previous scene. However, in this scene the floor is reflective instead of the walls. The balls are missing from this scene and there are two prisms instead on the wooden block. The reflection of the door behind the camera can be seen in the mirror on the wall opposite to the camera.
-
This scene contains a rubber tube floating on water. There are ripples on the surface of water. The ripples have been made slightly turbulent in order to make it look a little natural.
-
This scene contains a wooden block and spheres with various textures placed on the floor of a room. The block is made of pine wood. There is a ruby glass sphere placed on the block. There is a pink granite sphere placed between the mirror and the wooden block. The leftmost sphere is made of white marble. The one to its right is made of brown agate. The next sphere that looks dark is made of blue agate. The reflective sphere on the floor is made of aluminium. The rightmost sphere is made of red marble. The mirror at the back shows a reflection of the scene.
-
This scene shows light entering a room through a window. Isotropic scattering makes the light beam coming through the window visible.
-
This scene contains water and sky. The sky contains clouds and the water contains irregular ripples. The water reflects the sky.
-
This scene contains a few marble balls and metal rods placed on a wooden plank. The scene is illuminated by three area light sources. The area light sources cast soft shadows. The light sources fade away with distance. As a result, the scene at the top left corner of the image appears to be darker than the rest of the scene. The soft shadows and the fading light sources make this image seem quite photorealistic.
-
This scene contains six coloured balls lying on a tiled floor. The camera is focussed on the white ball at the centre. The shallow depth of field causes other balls to blurred.
-
This scene contains a white pawn and a black pawn placed on a chessboard. There are two light sources shining on the chessboard: one from the left side and one behind the chessboard.
-
This scene contains glass pawns placed on a glass chessboard.
-
This scene contains a globe placed on a glossy surface. The globe was created by wrapping a map of the earth around a sphere. The map used to create this globe can be found in the maps directory.
-
This scene is an attempt to model Saturn along with its five prominent rings. The planet and the rings are drawn to scale.
The innermost ring is the D ring. The next ring that appears to be translucent is the C ring. The next opaque ring is called the B ring. Then there is a gap called the Cassini Division. After this division, lies the A ring. The A ring contains a thin gap called the Encke Gap. The outermost thin ring is the F ring. The region between the A ring and the F ring is called the Roche Division.
The shadow of the gas giant on the rings can be seen in the right side of this image.
-
This scene represents the models of the eight planets of our solar system. The sizes of the planets are to scale in this scene. Names of the planets from left to right: Jupiter, Saturn, Uranus, Neptune, Earth, Venus, Mars and Mercury.
-
This scene contains a waxing half moon. This scene was created by wrapping a map of the moon around a sphere and rotating the sphere in order to show the side of the moon that is visible from the Earth.
-
This scene contains a white canoe floating on water. The hull of the canoe has been modelled using ellipsoids. The hollow section of the hull has been modelled by removing smaller ellipsoids from a large ellipsoid that forms the outer surface of the hull of the canoe. The canoe contains three wooden seats. The water is slightly reflective. The water reflects the sky, and thus appears blue in colour. A distorted reflection of the canoe can be seen in the water.
-
This scene contains half a dozen eggs lying on a tiled surface. Each egg is modelled by combining halves of a prolate ellipsoid and a sphere. The ellipsoid is cut into two halves at the equator. One half is used to model the little end of each egg. The big end of each egg is formed using a hemisphere cut off from the sphere. The length of the semi-major axis of the prolate ellipsoid is 1.6 times that of its semi-minor axis. The tiled surface on which the eggs are kept are slightly glossy and reflective. Two fading area light sources have been used to illuminate the scene. One light source shines from the left side of the scene. The other light source shines from the camera.
-
This scene contains a glass of water. There is only one point light source in this scene shining from the left side. The water has been modelled as a material with refractive index of 1.33. The reflection of light by the water has been modelled using Fresnel reflection.
-
This scene contains a grid made of glass nodes and edges. Each node in the grid is spherical. Each edge is cylindrical. The edges connect adjacent nodes.
-
This scene shows the earth and sky meeting at the horizon. A faint fog can be seen near the horizon. The shadows of the clouds can be seen on the ground. A viewing angle of 90° has been used to model the camera.
-
This scene contains two glasses kept in a kitchen corner. The kitchen has tiled walls. A faint reflection of the window in the kitchen can be seen on the wall behind the wine glass. Light entering from this window illuminates the kitchen. There is another yellow light source attached to the top of the wall behind the glasses.
-
This scene shows the inside view of a kaleidoscope. The kaleidoscope is constructed using three rectangular mirrors placed at 60° angle to one another so that they form an equilateral triangle shaped empty space between them. The triangular empty space between the mirrors can be spotted by looking for the orange disc at the centre of this image. The pink, green and purple discs around this orange disc are placed at three corners of this triangle.
There are a few more objects, such as coloured grains, little pyramids and pearls placed in this empty space. Multiple reflections of these objects can be seen in the three mirrors surrounding the empty space. The reflection of the empty space can be seen as faint dark triangles throughout this scene.
-
This scene contains three glass dice placed on a wooden surface. The scene is illuminated by three fading area light sources.
The scenes above were rendered using POV-Ray 3.6 on a Debian system. The steps below describe how POV-Ray 3.6 was installed.
-
Download POV-Ray 3.6 for Linux from https://www.povray.org/ftp/pub/povray/Official/Linux/povlinux-3.6.tgz. In case, the above URL becomes unavailable in future, a copy of the tarball can be obtained from tgz/povlinux-3.6.tgz.
-
Enter the following commands to begin installation.
tar -xvzf povlinux-3.6.tgz cd povray-3.6 bash install -no-arch-check
-
Enter
U
to make a user level installation at a custom location. -
Enter
~/povray
as the custom location to install POV-Ray. -
Enter the following commands to view the version and help message of povray and its man page.
~/povray/bin/povray man -M ~/povray/man/ povray
-
Add the following line to ~/.bashrc.
export PATH=$PATH:~/povray/bin
Now povray can be executed and its man page can be seen from any directory simply by entering the following commands.
povray man povray
The following errors were faced during installation:
-
On trying to install by executing
./install
, the following error was displayed:This machine does not seem to be a Linux PC.
This error occurred because the script looks for
i?86*
orathlon*
in the output ofuname -m
, but the output on my system was:x86_64
. -
On executing
./install -no-arch-check
, the following error was displayed:./install: 1094: read: Illegal option -n
This error occurred because the script is executed by /bin/sh by default. This was resolved by executing the script with bash.
The following is a list of commands that were executed to render various scenes.
povray -W960 -H720 scene01.pov
povray -W960 -H720 scene02.pov
povray -W960 -H720 scene03.pov
povray -W960 -H720 +A0.0 scene04.pov
povray -W960 -H720 +Q9 +A0.0 +AM2 +R5 -J scene05.pov
povray -W960 -H720 +A0.0 +AM2 scene06.pov
povray -W960 -H720 +A0.0 +AM2 scene07.pov
povray -W960 -H720 +A0.0 scene08.pov
povray -W960 -H720 +A0.0 +AM2 scene09.pov
povray -W960 -H720 +A0.0 scene10.pov
povray -W960 -H720 scene11.pov
povray -W960 -H720 +A0.0 +AM2 scene12.pov
povray -W960 -H720 +A0.0 scene13.pov
povray -W960 -H720 +A0.0 +AM2 scene14.pov
povray -W960 -H720 +A0.0 +AM2 scene15.pov
povray -W960 -H720 +A0.0 +AM2 scene16.pov
povray -W960 -H720 +A0.0 +AM2 scene17.pov
povray -W960 -H720 +A0.0 +AM2 scene18.pov
povray -W960 -H720 +A0.0 scene19.pov
povray -W960 -H720 +A0.0 +AM2 +R5 -J scene20.pov
povray -W960 -H720 +A0.0 +AM2 -J scene21.pov
povray -W960 -H720 +A0.0 +AM2 scene22.pov
povray -W960 -H720 +A0.0 +AM2 -J scene23.pov
povray -W960 -H720 +A0.0 +AM2 scene24.pov
povray -W960 -H720 +A0.1 +AM2 scene25.pov
The following is a list of tutorials and articles I studied to teach myself some elementary ray tracing with POV-Ray.
- The Online POV-Ray Tutorial: Introduction to POV-Ray and Ray-tracing
- The Online POV-Ray Tutorial: POV-Ray Basics
- The Online POV-Ray Tutorial: Creating Simple Scenes
- The Online POV-Ray Tutorial: Advanced POV-Ray Features
- 4 tips to improve a simple POV-Ray scene
- Slope map tutorial
- How to Render Planets
Some prior knowledge of coordinate geometry was helpful in describing some of the scenes. I found the POV-Ray scene description language pretty simple and easy to learn. In these 25 days, I managed to learn a number of useful features and concepts from online tutorials, articles, available source code of POV-Ray scenes described by other POV-Ray users, and managed to describe and render many simple scenes. However, there were a lot of options, features, language directives, effects, etc. that I could not find time for in these 25 days. These things can be learnt in future by studying the official POV-Ray documentation.
This is free and open source software. You can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of it, under the terms of the MIT License. See LICENSE.md for details.
This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or implied. See LICENSE.md for details.