Baking GI Shadows into a Single Texture

Hello and welcome to this exercise about how to bake Global Illumination into just one texture. This is used mainly to import models to real-time 3D engines where objects have to be rendered at least 60 times per second.

Shadows in videogame engines are a very expensive process; however, if we bake the Global Illumination of an object in a texture then we can help out the engine and we can show better quality graphics!

I will use a 3 segmented teapot as a model; it's a low polygon model for videogames, so we'll stick to that rule for this tutorial (Fig.01).

Fig. 01

Fig. 01

The way of working the scene first is the same as if we are about to start work on any new scene; I downloaded 2 images from cgtextures.com, which is an excellent site for finding textures. I applied a brick material to the plane and a metal material to the teapot (Fig. 02)

Fig. 02

Fig. 02

This part of the tutorial depends on what result you're looking for, because this step is about giving illumination to the model. In my case I used V-Ray, and activated illumination global in the Renderer options, along with the GI environment option (skylight) (Fig.03).

Fig. 03

Fig. 03

The next step was to put an Omni light with "Vray shadows", activating the "area Shadow" option.

Before baking the illumination into a texture we must make renders, because the final render appearance will be the same as it will be when baking the textures (Fig.04a - c).

Fig. 04a

Fig. 04b

Fig. 04c

Okay, so I am pleased with the result - now comes the hard part!

Before starting, 3ds Max uses channels at the time to make UV Maps; default textures are always set in Channel 1.

What we need to do now is to join both elements into a single object, without losing their materials. So, right-click on the teapot, Convert and Convert to edit poly (Fig.05).

Fig. 05

Click on Attach and select the plane to join both objects. Select the "Match Material IDs to Material" option and this will make our object have 2 different materials in a single mesh (Fig.06).

Fig. 06

Now, our object is only one, so the next thing to do is to apply a "UVW unwrap" modifier. Let's go to the Channels option and change the values to Channel 2.  Then we click on Edit to open up the dialogue, Edit UVWs (Fig.07).

Fig. 07



Inside the UVWs dialogue, we click on the face selection mode to activate the option: "Mapping > Flatten Mapping"

Inside the dialogue we put the following values (it is very important to remember all settings used!) (Fig.08a).

Fig. 08a

We should now have this result (Fig.08b).

Fig. 08b

The next step is to open the Render to Texture window, found in Rendering; in the tab "Mapping Coordinates" we'll change the Object option to Use existing channel, and we'll select Channel 2 to make the texture rendering be distributed in the same way as our map. In Channel 2, where all faces have one part in the texture, we click the Add button and select CompleteMap. Last but not least, we choose the size of our texture, and in this case 512x512 is enough for us (Fig.09a - b).

Fig. 09a

Fig. 09b

This is the final result: remember to save the picture in a known place; the format can be .jpg, .tga or .png, depending on the engine you're using.

The next thing to do is to go back to the UVW unwrap options, change to Channel 1 and apply 'Flatten Mapping' again, with the same settings as for the first time. This way we'll have the same map but now on Channel 1, which is colour (Fig.09c).

Fig. 09c



Next we'll create a material with a bitmap of the image we've just rendered, in diffuse color with a value of 100 in self illumination. Apply the material to our model and "Presto!" we have a texture with global illumination in it (Fig.10).

Fig. 10

I hope that this tutorial has been useful to you. I'm making a webpage where I will soon upload my best works, so if you liked the tutorial please visit my webpage, too: The Kitten Factory - http://www.thekittenfactory.com

Fetching comments...

Post a comment