Simulate Real-world Detail with Baking and Lighting
In a game, dynamic lighting is difficult. Dynamic lighting is the act of having real geometry cast real shadows, occasionally in motion and on static objects. We try to reserve this for things that are important, like the player or moving cars. In our city there is going to be lots of stuff that needs to look like it's shadowing. That can be fairly static, hence we can bake our shadows. Additionally, we may want to model high detailed stuff, like these windows you can see on screen, and bake complex shadows from them to put into our texture.
On the left side with the brick wall I have an ambient occlusion bake, plus a diffused map adding what looks like great depth in that window. When I had the shadow detail in, those will really pop. By doing this then I can put one large light in my game that has dynamic shadows only on select objects and impersonates my sun. Everything else will look like it's lit by it, as long as the angle matches. To start, I'll take my high detail windows, which I have already unwrapped, and press 0 to go to the Render to Texture dialog.
Windows are selected up here in the top field. I'll scroll down to the output and add elements. I'll add in a ShadowsMap. We can also add other maps in, depending on what we need. As an example, we could bake about a NormalsMap, differentiating the height in the windows. This could be handy. We can output a LightingMap, where are things bright and dark. We can output SpecularMaps, where are things shiny or dull. And finally, we can output a CompleteMap. A CompleteMap has everything altogether.
Essentially the whole look of the game is baked into one texture. I'll light in the ShadowsMap for now. In this element, I'll run it at 1024. Later I'll size it down to match over my windows, in my diffuse texture in Photoshop. I'll make sure in my source that Rendered to Files Only is checked. When I hit Render, this will take a sec, render out a diffuse map, as well as the shadows. My shadows are baked. I can see on screen in the diffuse map what look like good shadows.
However, this isn't the true map. This is a true shadow. In a shadow map, things that are not shadowed are white. That way when I lay this over an image in Photoshop, switching the blending mode to Multiply, white is invisible, essentially multiplying by 1. I'll bring that image into Photoshop and lay it over my existing diffused map. Here in Photoshop, I've opened up my shadows map, as well as my diffuse texture. I'll select the shadow map. In this case I'll use the Magic Wand to select the black around my actual object, then invert the selection by pressing Ctrl+Shift+I. Finally, I'll copy and paste over to my PSD.
I'll press Ctrl+C and now I can close this image. In this diffuse texture then, I'll paste that into a new layer. I need to downsize this to match my windows. I'll press Ctrl+T to access the Transform tool. Hold Shift and scale from one corner. This will be a combination of moving and scaling, to see if this really works. However, I do have my occlusion render already in to size to. I'll scale it in as well as possible, and then see if I need to widen it just a little bit to match. Looks like it snaps right on.
I'll make sure that this snaps on all the sides. Finally, I'll hit Enter to accept the transformation. The shadows look pretty good. I'll change this layer's blending mode to Multiply. My shadows lay over my windows. I may want to think about the order of the shadows in the occlusion in here. In this case I have my occlusion over my shadows, giving me really nice darkness up here at the top of the window and the window looks like it's lit. I'll zoom in and check and make sure that my shadows are lined up correctly. Looks like I'm in pretty good.
I may use the Nudge tool just a couple of pixels to get that right on. That looks pretty good there. The neat part with crafting that high- detailed geometry is that it shadows onto the windows and the windows self shadow, and they really look like they have some depth. When I combine this with a normal map, I'll get tremendous depth in the windows on a single polygon all done with texture. I'll save this out, bring it back into 3ds Max, and show how it looks. Back here in 3ds Max, I've saved this ShadowMap out as a separate image. I'll press M for my Material Editor and in the Diffuse Color of the material applied to that wall, I'll choose the new one.
Once that updates, I can see my shadows. We can see that my free direct light is casting shadows on my object. Additionally, the windows have shadows. It looks like I forgot to turn these over. That's a quick fix in Photoshop. I'll go back and do this and then import it again. The important thing to remember here as well, as you can see, is that it doesn't work the first time, and that's really okay. It's perfectly fine to try something, say it didn't work, come back, and try it again. Even 3, 4, 5 times, until you get it right.
I need to flip my shadows around, both horizontally and vertically, to get them in the right place. As my window polygon is upside down. I'll choose Edit > Transform > Flip Horizontal. Then I'll choose Edit > Transform > Flip Vertical, and now they are in the right direction. Alternately we can make sure that everything in this UVW map is facing the right way. I'll save this image out, bring back into 3ds Max, and see how it looks. Here in 3ds Max, we can see that fix in action. My shadows are in the right direction and using the realistic shading, really simulates how it will look in game.
I have some minor inconsistency, where the real shadow from the polygon laps over the windows. But in general, the windows look like they have a tremendous amount of detail and depth, all done with texture. It's important to consider the Render to Texture dialog and baking parts of the texture in your arsenal of tools for texturing in games. We shouldn't just have to hand-paint everything. There is a lot we can do with rendering elements and using them, including adding dirt, shadow, and high detail pieces into our renders, getting the best of both worlds, high detail, high resolution renderings, and texture painting, to add realism in our game.
Creating Simulations in MassFX and 3ds Max65,487 Views
Cloth Simulation in 3ds Max27,274 Views
Mastering UVW Mapping in 3ds Max49,012 Views
Textures and Materials in 3ds Max247,044 Views
Animating for Unity 3D in 3ds Max39,133 Views
3ds Max 2015 Essential Training514,818 Views
3ds Max 2016 Essential Training436,608 Views
After Effects CC Essential Training2,630,123 Views
Deke's Techniques1,565,488 Views
Foundations of Programming: Fundamentals7,748,469 Views