Remove this ad

avatar

Rantam

Posts: 9,592

Site Admin

Lead

Aug 20 08 10:22 AM

Tags : :

This tutorial explains how to add shadows to textures using 3D Max to generate them automatically. This is very handy because usually textures are plain and doesn't have any 3D effect unless you paint them manually.

This "fake 3D effect" on the texture will allow your model to look much more realistic once it's ingame.

This "2D shadowing" or "shadow map" should be generated to every object of the car, and not only to the exterior but to the interior also (cockpit buttons, gauges, seats, etc). Many mods out there don't do it and that's probably the main reason why their textures look so plain and unrealistic.

If you have worked with templates, I'm sure you have seen that there's a layer which contains (usually) the "shadow map" of the exterior of the car. This allow the painter to create a new skin easily, just painting plain colours, as the 3D effect will be added by that shadow map layer.

Before creating the shadow map for a texture we’ll need to have the car mesh correctly done, as well as the UV mapping.

It's also necessary to add a big plane under the car, just in the place where the floor should be, so the light will impact there and will be reflected, as occurs in real life, to create more realistic lights/shadows on the car (do it even if you're generating the shadows for the interior).

We'll use the Ferrari Daytona exterior we included in the HGT&TC mod as example.

First of all, go to the material's window, and create a standard 3D Max material if there isn't any. Once you have a standard material apply it to the object/objects you're going to bake (in this case the body of the Ferrari).

Let's go with the next step now: go to “Rendering” menu and select “Render”. Go to the bottom of “Common” tab and select “Mental ray renderer” as production renderer under “Assign renderer section”.

image

Now let’s go to modify a bit the environment light. Close the render window, go back to “Rendering” menu and click the option "Environment".

image

In the section “Global lightning” click in the “Tint” box, as we’re going to do that white colour a bit less bright.

To do that simply change the value of the global light tint from 255 to 240 (or 244 as you see in the screenie)

image

Some people will add an environmental light on this step also, and others won't. Personally I prefer to add a "skylight" light (which can be placed anywhere on the scene without affecting the direction of the light) or an "omni" light over the car (which allows to be moved to change the source of the light).

This light can be added using the buttons available on the tool stack, "Create tab", then pressing the button "lights". The Skylight light is inside the Starndard lights.

image

Now select the object/s which you want to create the shadow map for. The hiding/deleting options might be useful in some cases, to avoid the projection of shadows of these other elements in the want we're creating the shadow map for. But I usually don't hide/delete them, as these shadows will make the map shadow of our object more realistic.

image

Now go to “Rendering” menu and select the option “Render to texture”.

If you get some error when loading that option it would mean that you didn't applied the 3DS standard material to all the objects you've selected to be baked. Re-check that step in such case to solve the issue.

Select the output path of the texture on the section "General settings".

Set the padding = 2 under the section “Objects to bake”

image

In the projection mapping be sure to select “Use existing channel” in the mapping coordinates section. Otherwise 3DMax will unwrap the mesh and you don’t get the texture you want. The channel to be used on object's mapping coordinates is usually "1".

image

Expand “output” section and click the “Add” button. Select the “Ambient Occlusion (MR) and press the “Add elements” button.

image

Now be sure to select “Diffuse color” in the target map slot list.

You can keep the map size as “256” for the moment, as that will minimize the time needed to render the texture.

Let’s reduce the bright a bit, so the sections of the skin with more light won’t appear as 100% white. To do that just click in the white box of the “Bright” parameter under “Selected element unique settings” and select a value of 244 instead 255.

It will be good in most cases to reduce the "dark" value also. Otherwise some shadows will be totally black (which might not be realistic). I usually use a value of 50.

image

Leave the “Spread”, “Max.dist” and “fall off” as they are by default and click the render button to see if you get what you want.

Once you get the desired parameters for your texture, change the size of the texture to 1024 (or to the size you want to have for your final texture), and increase the value of "sample" field (which specifies the level of detail of the shadow) from 16 to 256 (or 128 in the case of less detailed objects).

It's better to do this in the last step because the rendering time will increase a lot if you increase these two values.

Set the rest of the options as you see in the image, and all should work fine.

At the end of the process you should get a .dds file, which you can edit on photoshop or other image editing program to add shadows to your texture.

image

I usually will add this shadow to the texture as a new layer, setting the blending as "multiply" with a 75% in "opacity", but sometimes as "overlay", with a value of 100% in "opacity". Just play with the blending modes until you get the result you want.

To edit it manually to add a bit more contrast or shadows/lights detail will help to make it look better usually. Here's the final result of our example, which can be used as base to create the template of the car:

image

(Last version Sept. 13th 2010)
Quote    Reply   
Remove this ad
Remove this ad

#3 [url]

Jan 20 11 5:41 PM

Hi Rantam,
it's been a while since you wrote this tutorial, but I want to thank you anyway. I've used the technique in three different models and the results are astonishing

Keep on with this great work!

Saludos

Quote    Reply   
Add Reply

Quick Reply

bbcode help