Thursday, August 30, 2007

Tutorial: AO and Baked Light Maps - Part 4

... continued from part 3

Normally, baking out a light-map is relatively straightforward, but in this case, we have mapped light (the custom Occlusion texture in the grounds Extra Light slot), skylight exclusions and GI exclusions, which creates a much more complex environment to create our baked lights in.

The key part from the original assignment for this part of the tutorial is, "baking in the more processor-intensive lighting, without losing shadow detail...". We said we'd leave the key light out of the bake so that we could preserve the shadow's clarity.

  1. Open the Starting-Point File
    1. File|Open... field-guide_ao_bake_end_part_3.max
    2. Render.
      This is the point we left off from in part 3 of this tutorial. Since we're going to be changing the global light settings again, lets start by creating a new render preset to work with:
  2. Create a new render presets called "bake" by copying our "full render" preset.
    1. Open the Render Dialog and click the Render Tab
    2. Go to the "Brazil Bridge Renderer" rollout, and click "Manage..."
    3. Select "full render" from the list, and click "Clone"
    4. Rename the new preset ("Copy of full render") to "bake"
    5. Close the "Manage Brazil r/s Renderers" dialog box
    6. In the render panel, in the Brazil Bridge Renderer rollout, change the "Active Setup:" to "bake"
  3. turn off light-source direct illum for the bake pass
    1. In the Renderer Panel of the render dialog, open the "Brazil: Luma Server" rollout
    2. Turn off "Point Lights" and "Area Lights" in the Direct Illumination section
    3. Render. This will give us a render that's just our skylight, AO, and GI
  4. Convert the teapot's material to white plaster for capturing the illumination
    The goal of these next two sections is to convert the current materials to a material that will capture both the direct and indirect (bounce) light falling on the object. We don't want to capture the actual surface colors, specular highlights, etc., but we do want to capture the bounce light created by those surfaces. We do this using a Brazil2 Utiltiy material, using a simple white plaster material as the capturing material, with copies of our original materials used to generate all secondary illumination
    1. In the Material Editor, select the "teapot" material.
    2. drag and drop the "teapot" material swatch to an unused slot to make a copy of it.
    3. Working on the copy you just made, click the material's "Type Button", which says "Brazil2 Advanced" and select a Brazil2 Utility Material.
    4. Select "Keep old material as sub-material?" when prompted.
    5. Open the "Global Illumination Parameters" in the Brazil2 Utility material and drag/drop the "plane (Brazil2 Advanced)" material from the "Base" slot above into the "Material" slot of the Util mtl's GI params.
    6. Select "Copy" when prompted.
    7. Click the map button in the "Base" slot of the Utility Material
    8. Change this material to a white-plaster type:
      1. Set the Material's "Diffuse (Cs)" color to white (255,255,255)
      2. In the Material's "Highlight Shader" rollout, change the highlight shader from "Phong Highlight" to "None"
    9. Click the "Put to Scene" button
      to apply this material to the teapot.
    10. Render.
  5. Convert the plane's material to white plaster types for capturing the illumination
    1. drag and drop the "plane" mtl swatch to an unused slot to make a copy of it.
    2. Working on the copy you just made, click the material's "Type Button", which says "Brazil2 Utility Material" and select a new Brazil2 Utility Material.
    3. Select "Keep old material as sub-material" when prompted.
    4. Open the "Global Illumination Parameters" in the Brazil2 Utility material and drag/drop the "plane (Brazil2 Advanced)" material from the "Base" slot above into the "Material" slot of the Util mtl's GI params.
    5. Select "Copy" when prompted.
    6. Click the map button in the "Base" slot our top-level Utility Material
    7. Click the material "Type Button" and select a new Brazil2 Advanced Material
    8. Change this new material to a white-plaster type:
      1. Set the Material's "Diffuse (Cs)" color to white (255,255,255)
      2. In the Material's "Highlight Shader" rollout, change the highlight shader from "Phong Highlight" to "None"
    9. Click the "Put Material to Scene" button to apply this material to the plane object.
    10. Render.
      The plane comes out black... not what we want. Why? Because the plane is excluded from the scene's skylight illumination and GI -- Once again, we need to explicitly map the illumination onto the plane, using that same Occlusion map we created before.
    11. In the material editor, on the white-plaster material we just created, open the Brazil2 Advanced material "Basic Surfaces Properties" rollout, and click the button that says, "(None)" in the "Extra Light" channel.
    12. In the "Material/Map Browser" Click the "Browse From: Scene" radio button.
    13. Double Click one of the "Brazil2 Occlusion" textures that you see to assign the Ambient Occlusion texture to the Extra Light slot.
    14. Choose "Instance" when prompted for to choose "Instance or Copy".
    15. Render.
      Now the ground renders as white, with our modified skylight shadow.
  6. bake the light map using render to texture
    1. In your max scene, select all your objects (multi-select both the teapot and the plane)
    2. In the Menu, select Rendering | Render To Texture...
    3. In the "Render To Texture" dialog, Change the "Output" path to a location of your choice.
    4. In the "Output" rollout, click "Add" and choose "CompleteMap" from the "Add Texture Elements" list.
    5. Change the output size to 512x512
    6. In the "Baked Material" rollout, select "Render to Files Only" -- we will remap these into the scene by hand so that we have an understanding of how these are used.
    7. Click the "Render" button in the Render To Texture dialog. The baked light maps are rendered and saved.
This last step has rendered out our light maps. In the next step of this tutorial, we will apply these light-maps to our objects using the Extra Light slots in their materials, and change our render settings to include only area and point lights.
Next: Part 5 -- finishing up

Friday, August 24, 2007

Friday Diversions

Uh oh. A whole week's gone by with no new posts. My apologies to those of you that have kept checking back -- Unexpected workloads and August vacation/holidays have us a bit short-handed on the field-guide. Nonetheless, here's this week's diversions and a preview of what I'd like to get posted next week.

First is a test from the work on displacements -- mapped procedural displacements w/ reflections and shadows:And this one... I have no idea what it was about, but it's pretty :)Here's what I'm going to try and get online next week:

A neon light example (object lights and the irradiance cache):A GI interior tutorial ( Global Photon mapping, Datascope, Regathering, Render Cache, Brazil2 Utility Material, Glossy Reflections, Area Shadows):
I'm going to add some more to the Ambient Occlusion and Light-Maps tutorial -- there may be 6 parts to that tutorial before it's completed. That tutorial has evolved and I think I'm going to throw in a bonus section that looks at a different approach.

We also have a new contributor converting one of his Brazil 1 tutorials for us.

Friday, August 17, 2007

Friday Diversions

I was hoping to do a quick "insiders look" at one of our cool internal dev tools (called smokey), but I don't have the time to write up the explanation... so here's a couple more fun dev pix:

Here's a quick test of some crazy toon shading with spherical lenses:... and I'm not even 100% sure what this is :) I think it's an early irradiance estimate analysis:


There's also tons of new pictures in the SplutterFish gallery -- check them out!

Tutorial: Your First Brazil Render!

This tutorial is designed to give you a quick overview of the basics of setting up your first Brazil render. I'm not going to go into too much of the fancy stuff. You'll need to become familiar with these basic steps in order to do ANY Brazil rendering so just stick to the tutorial and in the end you should understand the "basic" work-flow of Brazil.

I think once you understand the concepts you won't find Brazil hard to use at all. Of course everything has a learning curve and if you've just started using Brazil r/s you're in the right place.

First off we create a generic scene. It can be anything you like. You can even work with an existing scene that you've created before. However, keep in mind that for the sake of speed in this tutorial you may want to limit the amount of geometry and texture.


As you can see my scene is VERY simple. I just put in a few rough primitives since we'll be focusing mostly on getting that look that is probably what attracted you to Brazil as a render engine. The fancy lighting etc...


Well the first part was obvious; you need a scene to work with.

Next we click the "Render Scene Dialog" button. This will bring up the standard render dialog. Click the tab labeled "Common." This is where you choose what renderer you'd like to use. We're going to choose "Brazil r/s v2.0 [build xxxx] "xxxx" representing the build number but that's not too important since that build number changes all the time. The important thing is that you are using Brazil v2.


Click the three little dots "..." next to the "Production" render slot and you'll see the next dialog.

Once you've highlighted Brazil v2 click "OK."

Right after you select the Brazil Renderer un-tick the "lock" button. The lock button locks the material editor to whatever renderer you are using so you'll see the materials rendered using the renderer you chose. Now unfortunately with Brazil if you don't un-tick this "lock" button you'll see a material editor like the one below.

Obviously a bunch of black squares is not what we're looking for but by ticking the "lock" button to unlocked position we see the material editor below in all its glory.

Now I switch from the default Max material to the Brazil Advanced Material from the material editor. This isn't really needed for this example but I don't like the rainbow colored scene I have now. Also this will give us a good idea of how light is looking since everything is the same. I'd advise against trying to get into materials at this point. Just use a standard Brazil or Max material that is some gray or similar color so that we can really see what Brazil has to offer when we get to lighting.

Now that we have Brazil setup as our renderer and we have our material set to something fairly neutral we can simply click the Quick Render button and see what we have so far.

If you still have the renderer dialog open you can also hit the render button at the bottom. This is usually where you'll be clicking since you'll most likely make some tweaks as you go to get things just right. For now though you don't really have to worry about it. As you progress in skill though my guess is that you'll be back to this button frequently so if you want to get used to using it now then be my guest.

Well a few seconds later and we have what we see here. Gotta say... nothing too fancy but it is a Brazil render so you've made some progress. Now we just have to do a few simple steps and we can upgrade the look of this dramatically.

Obviously there are no real shadows other than the default light from Max which kinda sucks. We'd much rather use a Brazil Light right!? Of course! So click on the "light" button on your create panel.

In the drop-down menu pick Brazil r/s v2 light.
Next pick B2 Main light which gives you the option of an area light or a point light. The differences will be obvious if you play with them both or you can refer to the Brazil Reference PDF for detailed information on light configurations. For now lets just stick with something simple. In your scene drag out a light to light your scene and place it how you'd like. Depending on how you drag you'll either get an area light or a point light. A quick click and then a drag gives you point lights while a held click gives you an area light. But you can change this in a rolldown on the modifier panel at any time.

Here I select an area light in the dropdown menu.

Features: While there are a ton of "features" for lighting I'm only going to do the most basic one that pretty much everyone will want to use and that is "shadow" so under "features" click shadow.

If you'd like you can click "Focus" and see a visual indicator of where the light is going to fall upon your scene. This makes it very easy to move your lights around to get them in just the right position.

Now lets pop off another render.

OK it looks a little better... we have shadows now but probably still not exactly what you were expecting. So lets go back to the "Render Scene Dialog."

From here we're going to up the sample rate in order to get rid of the little jaggies on the edges of our objects. This is called "anti-aliasing" or AA. Without going into too much detail about sampling I'm just going to say that for getting a scene setup just leave it at 0,0 and when you want to pop off more final examples up it a bit. Most of my high res images never go above 1,3. They usually look pretty good and serve most of my purposes.

Now our scene looks a little more crisp but it lacks that nice ambient look. We've all heard about Photons and Global Illumination. It's basically the ambient light that cascades around a scene from light bouncing around just a bit here and there. But it adds a great sense of realism to the scene.

In your render dialog go into the "Direct Illumination" area and tick "Sky Light." This only really works if you're not working inside of geometry. That is there is no "ceiling" etc. So if you've done what I've done and just made a few objects on a plane this should work fine. If you've build a whole room with no windows you're not going to notice much. But hopefully you're the smart type and saved time and just put a teapot on a plane.
One neat tip when you get to working in the render dialog a lot is that you can drag the most frequently used rollouts in any order. I'm dragging the dialogs around to change the order here. The blue line indicates where the rollout will be when I'm done. Kinda a nifty feature so I thought I'd mention it.

Oh I almost distracted you with the cool tip. HIT RENDER QUICK! Oh wow look at that you have skylight in your scene now. Doesn't that look a ton better?

Well since not all light is bright white the smart guys at Splutterfish have designed the skylight so you can make actual sky colors. As you can see below I'm changing the color of the skylight in the luma server rollout to something more realistic.

OK it might be realistic if everything was radioactive but you get the point. I'm just having fun and so should you. Playing with these basic settings is how most of the experts here learned how to make you green with envy at their skills. (intentional lame pun alert!)

Anyway, it doesn't have to be green you can make it a sky color or even use an image to make the light... that's more Hollywood style goodies for later. Remember you're just getting the basics down so don't fiddle around too much with these little teasers I'm throwing out or you'll over look all the really important stuff.

Well the image looks OK (for a green room) but I want this thing to be a lot bigger so lets go back to the "common" tab on the "Render Dialog Screen" and set up a larger image. There are preset standard sizes that are often used in video, web, etc and you can also make custom sizes here.

Then again, click the render button... see I told you the more you tweak the more you'll use the render button inside the "Render Dialog"

This is what it might look like if you have multiple processors or dual or quad core processors. This is called "Bucket Rendering" each little square is a processor churning away trying to process all the hard stuff you've been telling it to do. So as you up your samples, geometry, and lighting situation these renders will take longer and longer. You've probaly already noticed that just by rendering the first few tests. There are ways to speed things up but we'll have a tutorial on speed later. First we've got to get you rendering some images and saving them out to show to your friends and co-workers what cool stuff you can do.

So the more complex the render the longer it'll take this little line to get across the screen. It's not much fun to watch so if you have to pee and you're on a slow machine do it now.

Finally we have something that looks more normal than a radioactive tea and doughnut party so lets save it! Look for the red arrow on this screen cap which shows the little icon that looks like a floppy disk. This is how you save from the VFB or (Virtual Frame Buffer). See now you even know some lingo... :)

From there you'll have a multitude of choices to pick from. Jpg is good for the web while tga is good for games and tif is good for print. But don't let me be the one to tell you which is best. Cause that is about like saying "what makes good art?" Everyone has their own opinion. Use your own :)

Alternatively if you don't feel like waiting around because you know you've setup a huge scene with lots of polygons and lights and fancy materials you can opt to save an output file in any of those formats and just walk away. When you come back your file will be saved where you told it to go. Sometimes the urge to watch a render is akin to crack addiction but please try to avoid the urge to watch a 45 minute render... do it this way. Life is too precious to lose so many to render hypnosis.
So you're done with this tutorial but this is just the very beginning. I'm sure there are a million questions on your mind if you've made it through this and luckily there is an awesome group of people working on more tutorials for you as well as a great forum where you can ask questions. It's your questions that dictate the tutorials we make so please don't hesitate to ask them.
Congratulations and welcome to the Fish!