ART 488 - Pre-Lighting or Converting a Shader to a File Texture
This page is designed as a supplement to lectures. It is not intended to be a stand alone tutorial.
Pre-lighting a scene is a requirement for video games and can dramatically speed up a render for a traditional animation. This Maya-centric demonstration introduces the concepts behind Pre-lighting. Basically in Pre-lighting, lights, shadows and shader effects on a surface are "baked" into a file texture that can then be simply displayed on the object. The original lights, shadows, bump maps, and other texture information can then be deleted or turned off for that object. This can be done in a number of ways.
NOTE. This technique can only be performed with the Maya Render. It will not work with Mental Ray Renderer.
A scene in Maya for the rear wall of dark hip interior space.
The wall has been textured with a brick image that includes a bump and specular map. 3 spot lights are raking the wall.
In the final scene a neon light will be on the shelf. Currently a purple Point Light is positioned to mimic light emitted from the neon light. 2 additional Point Lights are in the center of the room to add a slight fill to the whole wall that tapers to darkness at the corners.
Since this wall will only be rendered once, computational heavy effects can be added. The spotlights on the wall are set to be more realistic.
The purple Point Light is also set for accurate fall-off. This again increases render times.
To get accurate shadows on the wall for the shelf, Depth Map Shadow setting were also increased.
This is a test render of the wall. There are good looking lighting effects and the shadow under the shelf appears accurate.
On a dual processor 2.8 GHz computer it took almost 2 minutes to render just this wall.
Imagine if you wanted to render a 20 second shot in this scene. That's 600 frames x 2 minutes or 20 hours just to render the wall!
Convert to File Texture (only available in Maya with the Maya Renderer) can take all this rendered information and bake it into a single color file texture map that can then be remapped back onto the surface.
You must select the geometry that you want to bake, then shift-click in the HyperShade to select the Shader for the wall. Both have to be selected.
In the Hypershade select Edit>Convert to Maya Texture. Open the options and set the following settings so as to bake in the lights and shadows.
Note that you need to select how large you want to render out the final image. Note the we are using "Powers of Two" sizes.
Select a file format that you can easily open in Photoshop to make changes.
This is the rendered file of the wall that was created.
NOTE. As part of the Convert Process, Maya deletes the original shader's connection to the geometry, creates a Surface Shader with the new file texture and attaches it to the geometry. I prefer to delete this shader and make my own.
It also gives the file a long Maya-esque name that makes little sense. I change the name to something I understand.
Open the image in Photoshop and you can continue to add in information. In this case, other than the graffiti, the wall corners and edges were darkened further and the overall image was increased in contrast. The model view with the new texture.
You could repeat this process for the ceiling, floor, and other walls if they will be prominent in the scene.
The purple Point light could definitely be deleted at this point. The 3 spot lights could also be deleted, unless you need them to light a character or other surfaces. They could also be set so they do not illuminate the wall.
Shadows for the shelf could also be turned off.
Rendering this now takes less than 10 seconds! Huge savings..