As technology advances, games and CGI movies become more and more realistic. What is the math behind those graphics? This article looks into popular rendering techniques such as rasterization, ray tracing, and path tracing.
The basic goal of 3D rendering is to produce a realistic 2-dimensional image of an illuminated 3D scene. There are many techniques that can solve that problem partially or completely. They are used in real-time games, movies, and some of the most powerful ones are still restricted to still images. Here are some of those techniques.
1. Rasterization
Time to render a frame: milliseconds
Rasterization, or projection as it’s sometimes known is by far the fastest and least realistic rendering technology. In its simplest form, it involves mathematically projecting 3D polygons onto a camera plane and assigning a distance value to each pixel – a pixel will be overwritten by another polygon’s color only if it is closer to the camera than the previous value. This is considered to be a pretty simple rendering algorithm. However, in modern games, the technique isn’t simple at all – this algorithm has been extended by game producers to produce extremely realistic images. Despite being based on the same basic methodology that was used ten years ago, modern game engines are huge, complex programs that can fake effects such as transparency, reflection, and shadows that used to be limited to raytracing.
Own Work. Time to render: <1 second
2. Ray Tracing
Time to render a frame: minutes
Advantages: True reflection and refraction with unbounded depth. Pixel-correct direct illumination. True shadows.
Ray tracing is a much more realistic method of rendering that is currently the choice of most 3D artists and CGI studios. It traces rays of light from the camera to light sources to find the color of each pixel. For each pixel on the screen, a ray is sent out from the camera plane to find the closest point of intersection with an object. Once the point is found, a ray is sent out to all light sources to determine if light is obscured, and, if not, how far and how strong the light source is. All of this is combined with the reflectivity, the shininess and color of the material, and the angle to the light source to find the resultant color. Additional rays can also be traced from the point of intersection if the object is reflective or transparent – to determine what the point will reflect or refract and then add it to the main color.
These computations are usually very time-intensive, especially the task of checking all objects in the scene for intersection with the ray, when the objects might number in the thousands in a complex scene. Real time ray-tracing is just starting to become practical, and there are many debates over whether using it for games will ever be worth the performance hit.
Own Work. Time to render: 22 seconds
2.5. Photon Mapping
Time to render a frame: minutes to hours
Advantages: Approximated indirect illumination and caustics.
Photon mapping is an extension of ray tracing with an added step before the rendering: “photons” are sent from light sources in all directions. When one hits a surface, it adds light to that point on the surface and may be reflected or refracted. Once “enough” photons have been fired, the scene is raytraced. Photon mapping is often used by 3D artists to create high-quality images.
3. Path Tracing
Time to render a frame: hours to days
Advantages: Total realism, more efficient then photon mapping in some cases.
Path tracing, when done correctly for a long enough time, can produce an image of a scene that is indistinguishable from a photo of an equivalent scene – algorithms with this property are called “unbiased”. The length of time required to produce a realistic scene has prevented it from being used widely, but as processor speeds increase, it is becoming popular amongst 3D artists – and even architects who want to see exactly how light will illuminate a house.
Path tracing consists of picking a random pixel and finding its color value in the same way as one would do in normal ray tracing. Then, another ray is traced in a random direction from the intersection point, and its color value is found and added to the original based on the angle and the light intensity. This process is repeated again for the next point of intersection, again and again until the ray doesn’t intersect anything or the path is terminated by a random probability. This constructs a path which transports light from a light source to the camera plane, bouncing between several objects and absorbing their color on the way. This process is then repeated, picking a different pixel and a different sequence of rays.
Unlike all the other listed algorithms, there is never a definitive “end” to path tracing. The quality of the image slowly increases as more and more samples are taken, but it’s up to the user when to stop it. While a recognizable (but static-filled) image can form in several minutes, it can take up to a few days to reduce the static to a tolerable level.
Performance of path tracing can be sped up using an algorithm known as Metropolis Light Transport. Instead of being picked randomly, new paths are created by slightly modifying previous paths that performed well (transported a lot of light). This can often improve performance by several times, especially if a lot of the lighting is indirect (bouncing off objects several times before hitting a light source).
Own Work. Time to render: 1 hour 54 minutes
Time to render a frame: days to months
Advantages: Physically accurate energy transport.
Photon tracing is a conceptual method of rendering/simulation that has only been done once as an experiment, producing several images using the distributed efforts of hundreds of computers. Instead of tracing paths from the camera, photons of various wavelengths are fired from the light sources and bounced off objects, leaving a point on the screen if they hit the camera plane – just like it happens in real life. It offers no advantage over path tracing in image quality (both algorithms will produce a perfectly realistic image in time), but may have an appplication in physical simulations.
Other articles by me: How to Make HDR Photos, Five Strangest Programming Languages















8 Responses
popurls.com // popular today…
story has entered the popular today section on popurls.com…
What software did you use to render these?
Blender, and Luxrender for the final picture. All free and open source software.
Blender is one of my favorite open source apps. I’m no artist, but it really demonstrates how good free and open source software can get.
Eventhough I could not understand the technical terms used in the article correctly, still the article is interesting.Is there any possibility to make the article even more simple and intelligible?Thank you
very interesting….
very interesting article. i’ve dabbled in blender but haven’t done anything too serious.
That is sweet