Archive for the ‘mental ray’ Category

Today’s write-up is simple. Just glass. MR makes it very easy to create realistic glass with the A&D shader. I start with a fresh A&D shader, and all I change is the reflection to 1.0 and the refraction to 1.0….that’s it! Here’s what it looks like:

Color in the refraction is a light green

Note that to get glass to work like the image above, the glass must be a solid (there’s a thickness to the glass). If you were to render the same glass above onto a thin plane this is what it would look like:

Notice that the refraction color gets lost

Obviously this image is incorrect and defies much of physics. The question is how do you create glass with a plane? You have to change the Advanced Transparency Options from “Solid” to “Thin-walled”. Now when the thin plane renders it looks like this:

This is a great solution for thin planes, but the only way to achieve truly realistic glass is by giving it a thickness (think about the shell modifier).

If you haven’t played with Max 2009’s new lighting analysis tool, it’s definitely worth checking out. For this blog I will briefly explain how to use it.

Before I jump into lighting analysis, I have a disclaimer for lighting studies/software. When it comes to lighting analysis, the results are just estimates on how much lighting a space is receiving. There are too many physical factors to be accurate. Materials have to act exactly as they do in reality to bounce light properly. This includes physical characteristics as index of refraction/reflection, caustics etc. Max does a pretty darn good job at simulating these though, so good infact that it is recognized by LEED as program for obtaining lighting analysis credits.

With that said, here is a quick look at how we set a scene up. Firstly, be sure the space you are modeling, is as accurate as possible. The windows need to be the right size, and there cannot be any openings in the space other than the windows. Secondly be sure that the materials you are using are either all ProMaterials or A&D materials, and they act as the material would in real life (tile being reflective, gyp being non-reflective, etc). One of the most important materials is the glass, because it will determine how and how much light will enter the space. The way the glass is modeled is important as well. Be sure your glass has a thickness. Usually the A&D material or ProMaterial Glazing will attenuate light properly for each polygon that is traversed, without refracting it. Thirdly, the lighting must be accurate and represent true-life physical amounts. Creating a Daylight system is the best way to achieve physical properties for your sun, just don’t mess with the multiplier amounts. If you also want to include light fixtures the best type of light for this are photometric lights. Typically only FG should be used, and can be used in conjunction with the light portals. For accurate fc or lux amounts it is important to increase the number of FG bounces. 4-8 bounces is acceptable.

Once you have your scene set up, in the menu under”Lighting Analysis” use the “Lighting Analysis Assistant.” Basically this box checks your scene to make sure that you don’t have any un-natural materials or lights. If you do, it will tell you how many materials and lights need to be tweaked. The “Analysis Output” tab is where you can create a light meter. The Light Meter is just a plane that record light data in the scene and spits out numbers of light intensities (measured in foot candles fc or lux). In the US everyting is measured in foot candles, so I use fc. The modifier settings for the light meter controls the amount of segments, orientation arrows, type of illuminance, and it can export the numbers to an excel csv file.

For the lighting analysis, you will only get figures for where the planes are. So if you need all four walls of room, you will need 4 light meters, one for each wall. Note: the lighting analysis is no gauge on how the scene will render. Much like a camera, you can make a very dark room appear light with the right exposure settings. The exposure settings also don’t have any effect on the lighting analysis since these numbers are fixed amounts of energy.

For much more detailed information you can check out the Autodesk whitepapers posted by Pierre-Felix Breton.

Earilier I wrote about vray dmc glossy samples, so I figured I would do one with mental ray glossy samples as well.

This chart for mental ray takes the combination of samples per pixel vs. A&D material glossy samples.

You decide which one is best for the amount of rendering time. I also found it interesting to compare with the v-ray test and see what overall gave the best performance results.

Check out the pdf, and decide for yourself what are the best settings.

Here’s the max file (max 2008, mental ray) if you’re interested in the rest of the settings. I was using an hdr map, so you will notice a broken link to that map.

It seems like alot of folks on the forums are asking this question. Often when using low GI and Final Gather settings, an animation will flicker because the solution is not refined enough. To have a smooth animation you have to crank up your settings high enough to have similar results for each frame. Problem is you will have extremely long render times. This is my attempt at explaining how to create smooth animations with low indirect illumination settings in Max 2008.

common problem with low GI and Final Gather settings

Here’s a quick step-by-step, but if you read further I have exhausted each of these steps in detail.

•Turn on Photon Map, use Read/Write File, then render
•Turn on Final Gather, use Read/Write File
•Lower samples to 1/64 – 1/64
•Render active time segment at every 10 frames
•Turn on final gather Read Only (FG Freeze)
•Increase samples to 1 – 16
•Turn on Save File for Render Output
•Render active time segment at every 1 frame

First we calculate the photon map (PM). When calculating the PM it’s a good practice to have final gather (FG) off to see the pure PM results. To save your PM click on the […] button, and if you are rendering on a renderfarm, be sure to save your PM in a location that the farm has access to (your network). Also be sure “Read/Write File” is checked.

Now go ahead and render a single frame. Mental ray will calculate the PM first, save it to the location you specified, then renders your scene. Very important to note: now the second time you render, mental ray will not re-calculate the PM, but rather read the already calculated PM from the file location you specified because you have “Read/Write File” checked. The PM is scene based rather than view/camera based. This means that when the PM is calculated it is calculating the entire scene (much like radiosity). The great thing about the PM, is that once it is calculated, a rendering can be done from any view using that same PM…wonderful for animations!

Now that we have our PM calculated, we’re now going to move onto FG. Unlike the PM, FG is view/camera based. This means that when a FG map is calculated the information in the map is only of that viewing angle. So if you wanted to see both sides of an object, you would need at least 2 FG maps. This is very bad news for animations. Because every frame in an animation is different, you would need a new FG map for that frame. But we have a work around for this that I will get to.

For now:
•under FG check “Enable Final Gather”
•for the Preset choose Draft
•under Final Gather Map click on the […] button, and choose a location to save the FG map.

Be sure “Read/Write File” is checked and “Read Only” is not checked.

Now to get back to our problem of needing different FG maps for every frame. Instead of creating a FG map for every frame, I create a FG map for a range of frames. For example, if my animation is 100 frames long, I will render every 10 frames creating a FG map for only those 10 frames. Then with that combined FG map, will go back and render every frame. Here’s how to do this:

Make sure FG Map is checked on. Then in the Renderer tab, lower your samples to 1/64 – 1/64. We are doing this, because we are not concerned with the actual rendering, but just the calculation of the FG map. In the Common tab, change your Time Output to Active Time Segment, and under Every Nth Frame change it to 10.

Now click Render. You will get a warning that pops up telling you that you are rendering a sequence without saving the images to a location. That’s ok, because we are just interested in FG at this point. So click Yes. Now the animation will render every 10th frame. Because we have “Read/Write File” checked and do not have “Read Only” checked, every time FG for a frame is calculated it is added to the previous FG map. After all 10 frames render, you now have a single FG map for your animation sequence.

Now go back to Indirect Illumination tab, and under Final Gather Map check “Read Only”. Now when you render, it will not add to your already created FG map, but just read the one that it’s locating to. Also increase your samples back up to something reasonable (1-16), and change your “Every Nth Frame” back to 1. Also be sure to set your Render Output to save to a file location.

That’s it. Click render and enjoy!

Animation using PM and FG from file

Now it will start the rendering right away without calculating any indirect illumination. Even though the solution for PM and FG are low, it’s not that noticeable. The noise will be even less noticeable when texture are added. Note: this technique doesn’t work well for secondary animation (animation with moving objects or characters).

I probably should have titled this Image Maps in 3D, but I’m demonstrating one particular example of frosted glass. Before I get into this example, I do want to explain image maps.

All images are the same in 3D. They have different intensity values in different locations across the image. It’s all about intensity. Once you understand this concept in any 3d software program, you can master materials. Essentially 3ds max reads black as being 0% and white being 100%. Everything grey is in between depending on how grey they are. This works for any slot in your material that allows a map to be read for it’s value. By default they have numerical values, but that will apply to the entire material. If there is a pattern that you want the values to follow…well that’s when you use an image map.

If this image were plugged into the opacity slot, then it would be an opacity map. All of the black areas would be 0% opaque, and all of the white areas would be 100% opaque. If it were plugged into the reflection slot then it would be a reflection map, and all of the black areas would be 0% reflective and all of the white areas would be….you get the idea.

In this example for frosted glass, I had to ask “what is it that makes the glass look frosted?” The major difference between frosted glass and regular glass is that you can’t see through frosted glass like you can regular. Why can’t you see through the frosted glass if it’s made out of the same material? That’s because light scatters differently. In the A&D material, refraction is what controls the transparency, and glossiness is what controls how refraction is scattered. So that’s where I plugged my map into.

Sometimes you can plug the map in straight. But in this case to get the most control of your colors, I used a Mix map, then plugged my image into the mix amount. This way I can make sure that the only intensity values used for glossiness will be white and black.

If you created your image map, and screwed up by reversing the black and whites, this is also a good way to switch the blacks with the whites.

So now my whites have a glossiness of 1.0 (pure refraction), and black has a glossiness of 0.0 (no refraction), and it gives me that frosted glass look!

I’ve been itching to finally say something about this one. If a 3D rendering looks life-like, most likely it has this phenomenon somewhere in the rendering. Chromatic Aberration (CA) occurs any time light refracts from a lens in such a way to disperse colors. This is most obvious in high contrast areas like the image below.

Photograph of Disney Concert Hall

You can simulate this effect in max 2008 with mental ray by using the mia_lens_bokeh shader, and an image map with red, green and blue. Plug the image map into the custom bokeh map. The downside to using an image map is that it really slows down the Arch / DOF Bokeh shader. You will also have to change the samples from 4 to at least 8. I typically use a minimum of 64 samples for my final renders. Note that DOF is what causes CA, so you have to have some blur to get this effect…even if it’s a very small amount.

These were some tests I did to compare a rendering with and without CA. The difference is very small, but it makes it that much closer to what a camera is really doing.

There are also ways to do this in Photoshop after rendering. Plug-ins like PTLens are great at creating or fixing CA.

This is a phenomenon familiar to photographers and is one that I have been obsessed with over the last couple of days. Just recently I have tried to emulate the bokeh effect in my renderings. Simply put, this occurs when an object is out of focus, and a point of light happens to be much brighter than the surrounding points.

There is a very easy way to do this using Max 2008. There is actually a mia_lens_bokeh shader that Autodesk has developed. It’s one of the hidden shaders in architectural_max.mi file, and is useful for creating this type of depth of field as well as other effects such as chromatic aberration. You can unhide the shader by opening architectural_max.mi in a text editor and where you see mia_lens_bokeh, put a # in front of where it says “hidden”. Next time you run Max you will see this shader when you click on Lens shader in your render settings. Remember to drag it into the material editor (instance) to control the properties.

The depth of field in this example was quite extreme, but I was trying to demonstrate the effect. It is important to note that this effect doesn’t work if Enable is checked under Multi-Pass Effect on your camera. In other words, let the shader on the lens do the DOF work not the camera. It will also render faster. If you have DOF on, in your camera settings, the bokeh lens shader just works on-top of this…blurring the image too much. To get the blades to show, I had to crank up my sampling to 64.