Video: Using occlusion as a foundation for dirt

One of the biggest uses for Ambient Occlusion in a game aside from gloom and spreading darkness is as a foundation for dirt. In this video, I'll show how to take a simple wall module and bake out a lower size occlusion, or rather an occlusion that doesn't spread as much. This will be a foundation for dirt in places like window openings. As we can see in this example, the window openings tend to be dark and grungy with occasional grunge below on the sill and on the wall around. I'll paint a diffuse texture and then lay the occlusion over it.

Follow a practical guide to building 3D cityscapes for games. IAuthor Adam Crespi constructs a city block in 3ds Max utilizing low-polygon modeling and advanced texturing techniques. The course shows how to model common city elements such as buildings, intersections, curbs, and roofs and explains how to expand a city quickly and easily by reusing existing geometry in a modular way. The course also sheds light on simulating real-world detail with baking, lighting, and ambient occlusion techniques and offers a series of best practices for exporting to the Unity gaming engine.

Using occlusion as a foundation for dirt

One of the biggest uses for Ambient Occlusion in a game aside from gloom andspreading darkness is as a foundation for dirt.In this video, I'll show how to take a simple wall module and bake out a lowersize occlusion, or rather an occlusion that doesn't spread as much.This will be a foundation for dirt in places like window openings.As we can see in this example, the window openings tend to be dark and grungywith occasional grunge below on the sill and on the wall around.I'll paint a diffuse texture and then lay the occlusion over it.

Here in 3ds Max I have a basic wall section.It's got a large window opening that's recess by 8 inches and at least the startof a diffuse map unwrapped and placed on.The windows will later go in this large gray polygon. Now I'm ready to bake the occlusion.Just to make sure the occlusion goes smoothly, sometimes I'll put just a straightstandard gray material on.Now I'm ready to bake.I'll press 0 and pull up the Render To Texture dialog.With my objects selected, it shows up here in the first field.I'll scroll down, making sure to Use the Existing Channel 1 for unwrapping, and inthe Output I'll Add an Occlusion element.

So I can find it later I'll name this element wall section001dirt.This will be a temporary working file, so I want to make sure I can find it,grab it, use it, and later delete it.I'll make this occlusion 1024 square to match the size of my texture.When you're baking occlusion for dirt the big deal aside from getting theSamples nice and high, say 128, is to make sure that the Max Distance is lowerthan you'd use for an overall cinematic mood.I'm going to try an occlusion distance of 16.I'll also pull the Spread back a little bit reducing it down to 0.7 so thedarkness clusters more in the corners.

If you'd like you can tune the Dark color to be more reflective of your dirt, oryou can leave it black and adjust it later in Photoshop.Finally, in the Baked Material rollout I'll make sure I check Render to Files Only.I don't need this to go into a shell material; I'm going to use it in my diffusetexture after I put in Photoshop.I'll hit Render and pull up that file.With my occlusion baked I'll show the image, so we can see what it's doing clearly.The occlusion with that Max Distance being low leaves my sill and my header aswell as the side of the windows dark in the corners but light at the edge whereit's on the face of the wall.

Additionally on the window I've got a good spreading dirt in here.This maybe less spread than I might want in a more moody or darker rendering.A higher occlusion setting would gray all the way across the windows. I reallywant the corner darkest most of all.I'll pull into Photoshop and layer it over my diffuse texture.In Photoshop, I've opened up that dirt image. I'll select all by pressingCtrl+A, Ctrl+C for Copy.Then I've got my PSD which has my diffuse texture and I'll paste that image in.

I'm going to drop mine in the Color group by dragging it onto it. Then I'll open up the group.I'll make sure that the occlusion or the dirt image is up above thebrick diffuse texture.Finally, I'll switch the blending mode of the occlusion to Multiply.I get dirt across my texture, in the windows, on the sill, and generally grunging the wall.As a possibility you can erase pieces of this to make it less uniform.Sometimes I'll use my eraser and set the eraser to a large sponge brush.I'll click on the Eraser button and then right-click to choose a brush.

I'll pick one of the sponges and use the square bracket keys to upsizeand downsize the brush.With my Brush Opacity fairly low, 28, I can start to take out pieces, dottingout pieces, making sure I don't leave too many streaks and making it spotted and, well, messy.That's okay. We can even erase parts of it completely.In this case, I'm taking out some of the top, but leaving occlusion andgrunge and general wear and tear down in the lower corners, especially here onthe bottom by the sill.

I might remove some of the top parts entirely.This may have a chance of staying the cleanest.I'll also do this on the sill and the header, just taking out little bits.I don't mind if these are fairly dirty.I remember that I've put the bottom vertices of the side elements on the leftand on the left side of my header and sill, the vertices correspond to theleft side of the image.I'll take out some of the dirt there as well.You can have some fun with this and brush as you need it. Maybe trying it acouple of times and experiment.Finally, I'll save this image out and load it back in 3ds Max.

Here in 3ds Max, I've put my new diffuse image with the dirt into a blendmaterial. It's called wall sectionC.This image once I've saved it out has my occlusion and the dirt and the brick together.I haven't added a dirt layer to the brick, it's still fairly clean, but I want to do that later.I'll put this material on my model and we can see in this in no light, or ratherjust the default lights in the scene, without occlusion on in the Realisticshading, checking under Lighting and Shadows, that my scene is grounded.

I've got dirt and splash stuff around the windows.It's ready for more painting, diffuse texture on the window, dirt on the brickwall, and my wall looks, well, grungy and old.Ambient occlusion is a great foundation for things like dirt and rust.A lot of times I'll model a high-res piece, bake an occlusion on it, andthrow it on a low-res.That will help me get detail on the windows, which I'll show in the next video.It's also a great way to gently ground things and add in a realism that wouldbe difficult to paint.

There are currently no FAQs about Creating Urban Game Environments in 3ds Max.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Already a member ?

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships.
Learn more

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.