Lighting and rendering

From TOI-Pedia

Theory

Rendering

Courtesy of Mental Images, www.mentalimages.com

Rendering is the process of transferring a view on a 3D scene to a 2D image of that scene, according to the position of the viewer. Typically one would use a camera in a 3D computer model to determine the view. The computer can then calculate the 2D image: rendering.

The picture shows a rendering technique used centuries ago to get the perspective right in 2D sketches. It uses a raster (grid) to get the positions right when transferring the view to the 2D image. You could compare this to the grid of pixels that is used by modern computer renderings. The 'needle' makes sure they eye is always in the same position (moving it, would change the view and thus the image). You could compare it to the camera when rendering a 3D computer model.

From light source to rendered image

Rendering source to camera.jpg

In the real world, light travels from lights to the objects we see. It 'bounces' of the surfaces until it finally reaches our eye.

Rendering works in a similar way, but not quite in the same way. First of all, basic rendering doesn't calculate all possible reflections (bounces) of light from all surfaces (which would be a nearly infinite number of light bounces). You'll need advanced render techniques to mimic this light behavior. This is covered in more detail in the Lighting section.

Furthermore light isn't traced into the camera, but the render engine determines which objects (surfaces) are 'in sight' by looking through the camera. The renderer then determines the amount of light that is received by that patch of the surface. This would typically be the direct light received by that surface.

You may see why a renderer works this way: it may take many light paths to be considered to get from the light source, via an object, to the exact position of the camera. Instead it's more efficient to go from the camera to the object and then query the amount of light that gets to that specific patch on the object.


When an image is rendered, this is done in a few basic steps. These are:

Courtesy of Mental Images, www.mentalimages.com

1. look through the camera and determine which points in the scene correspond to the pixels in the image that is being rendered;


Courtesy of Mental Images, www.mentalimages.com

2. direct light distribution: emit light from all lights and calculate the accumulated intensity for every point in the scene;


Rendering Direct Illumination

3. for each point that needs to be rendered, the shader (material) of the surface is executed to determine the color. This is based on the amount of light this point receives (calculated in the first step) and the properties of the shader.



These basic steps can be expanded with steps for more advanced rendering techniques (such as: reflections, refractions, global- or indirect illumination, caustics, etc).


The model used in Maya for lighting is analogue to the 'real world' physical model, but not identical. There are some fundamental differences. The main reason for most differences is optimization: light can be very complex to calculate. Shortcuts are needed to keep render times as low as possible.


Direct and Indirect Illumination

Direct Illumination
Indirect Illumination

Light is split into two main parts:

  • Direct illumination
  • Indirect illumination


Every render engine handles the calculation of these two types of illumination differently. Some have very extensive options for realistic effects, others are more basic.


Direct illumination is the light from an active light source to the surface of an object. You can choose whether shadows should be calculated for the direct light.


Indirect illumination is the light that bounces of surfaces towards other surfaces. Some render engines are unable to calculate this indirect light.


Shadows

No shadows

When light hits an object, it also casts a shadow behind this object. By default, this behavior is not calculated, unless you enable a method that allows shadows to be calculated. In Maya there are two options:

  • Ray Tracing
  • Depth Map


Notice the absence of diffuse reflections in the images at the right. This is covered in depth in the section Lighting.

Ray Tracing is the most commonly used method. It tends to be slower than Depth maps, but it's more accurate. Furthermore it allows other effects besides shadows to be calculated as well, such as reflections and refractions.


Ray Tracing

Ray Trace shadows

Ray tracing is a method to calculate the path light travels. It can give very accurate results and produce realistic images. The downside is the performance: these calculations are costly.

As the name already predicts, it traces a ray from its source in a certain direction until it reaches it's destination (or better: a destination), thereby determining the path of light from a light source to an object to the camera. Actually, the calculation is done in exactly the opposite way: from the camera to the object to the light.

With raytrace rendering, rays are typically cast from the camera, one for each pixel. When a ray hits the first object it meets, the ray stops. From there several possibilities may be evaluated. A ray may be shot towards a light source to determine if the spot is lit or in shadow. Other options are rays to determine reflections (reflecting objects) or refractions (transparent objects). Most render engines allow tweaking these different parameters, to optimize render speeds: if you're not interested in reflections, there's no need to spend costly calculations on them.

Depth map shadow

Depth Map shadows, low quality
Depth Map shadows, high quality

Shadow Mapping, called Depth Map shadows in Maya, is a method where an image is created of what a light source would 'see' if it would be a camera. This image is then used during the render process to asses whether a part of an object is obscured by another object, i.e: if there is an object in the path between the light and the patch of the surface that is being rendered.



Reflections

By default most render engines won't consider reflections of light. It's important to know there are three main types of reflections:

  • diffuse reflections
  • specular reflections
  • glossy reflections

Reflection diffuse.jpgReflection specular.jpgReflection glossy.jpg


Diffuse reflections are reflections of diffuse surfaces (diffuse shader, such as Lambert). Specular reflections are reflections of shiny surfaces (specular shader, such as Blinn or Phong). Glossy reflections are only available in a few render engines such as Mental Ray.

Diffuse reflections won't be calculated by default and some render engines are unable to render them all together. Specular Reflections will only be calculated when you enable them. This requires Ray Tracing to see where the reflections go. How to enable them is covered in the pages on each render engine.

Overview of render engines

Rendering is one of the final stages of the 3D computer graphics design process. In this stage you will transform the three dimensional model into a 2D image or movie. The specific settings and render engine you use have great influence on the final result and your way to get there. There are numerous render engines that can all give you a different look and feel and have all their own limitations, which makes it important to choose the right one. By default Maya comes with four different render engines:


Information on common render settings can be found in Rendering.


Software render

Software Engine (time: 9 sec)

This engine is mostly called Maya's default render engine. In general this is a very basic engine, which makes is easy to understand and setup (compared to Mental Ray).


For more information: Software rendering

Hardware render

Hardware Engine (time: 1 sec)

The Maya Hardware renderer is different from most engines covered. Where most engines use the computers processor to calculate, the hardware render uses the computers graphics card. It basically works with a "what you see is what you get" principle. If the computers graphics card cannot reproduce it, you won't be able to render it. On the other hand can the hardware render give you a great improvement in speed, and the possibility to render particles.


For more information: Hardware rendering

Vector render

Vector Engine (time: 3 sec)

The vector render is a 3rd party plugin which is integrated by default. The vector render creates cartoon-style images with fill and edges (both selectable) and a limited set of lighting abilities.


For more information: Vector rendering


Tutorial : Vector rendering tutorial

Mental Ray render

Mental Ray Engine (time: 7 sec)

Mental Ray for Maya offers all the features traditionally expected of photo realistic rendering and includes functionality not found in most rendering software. It is a 3rd party plugin developed by Mental Images and integrated in Maya. The engine has a high level of flexibility which makes rendering in various styles (from photo realistic to cartoon style) possible. This is not only limited to rendering the final product, it incorporates also materials, lights, camera's and even geometry.


For more information: Mental ray rendering


Mental Ray Tutorials

Other 3rd party engines (plugins)

There are various other 3rd party render engines available for Maya.

Comparison

render enginediffuse reflections
Maya Softwareno
Maya Hardwareno
Vector Renderno
Mental Rayno
Mental Ray with Final Gatheryes [1]
Mental Ray with Irradiance Particlesyes
Mental Ray with Global Illuminationyes

Lighting

Lighting covers:

Rendering

Rendering covers:

Tutorials

Notes

  1. Default settings calculate 1 diffuse reflection. Setting up Secondary Diffuse bounces can enable more reflections (depth)



Overview of Maya topics

Maya main index

Personal tools
Actions
Navigation
Tools