2008-03-20

Why don't my caustics in mental ray render?

There are just a few settings to get caustics to render properly in mental ray. But if they aren’t on, you’ll never get caustics. So how do you get caustics to work in mr?


Think about caustics in reality:

•You have to have a object that reflects

•You can’t get reflections without a light source, so you need a light in your scene




So with these in mind let’s look at the settings:

•Put a light in your scene.

•If you’re using the A&D material, be sure to make it reflective. If it doesn’t reflect it won’t create your caustics.

•To create the actual caustics effect, in the render settings, under caustics and GI, be sure Enable under caustics and GI is checked. It’s not enough to have Enable under caustics. Mental Ray actually uses photons to fake the caustics, that’s why caustics render so quickly in mr.

•Ok, so you’ve got your light source, your shiny object, and caustics are on, but when you render still no caustics effect.




•Right click on your object that you want to cast caustics, and select Object Properties. Go to the mental ray tab. Notice that Generate Caustics is not checked. Turn it on. By default mr has this turned off for all objects, because it is assuming that they aren’t creating caustics. If this was on for every object and you had caustics on in your render settings, it would be very costly, so this is done as a precaution. That’s it!


Note: if you are using transparent materials to generate caustics, check the advanced options in you’re A&D shader and use Refract light and generate Caustics effect.

2008-03-15

Frosted images on glass

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!

2008-03-08

Chromatic Aberration

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.

2008-03-05

Tiles and Bricks

A lot of people have a hard time understanding how to use Tiles as a procedural map for bricks, getting them to course properly and fit the model. Firstly, model your building to course! If you know you’re using modular brick be sure your windows and masonry units course at 4” increments. If you’re using king-size brick be sure your model courses at 3”. The following is my attempt to explain how to create accurate bricks to scale, that work every time.


First thing to note is that my geometry in 3DS Max always has a UVW map modifier applied to the mesh with the following settings:




I use box so that no matter what direction the object is or what plane the map is, it will always be the same scale. I also use Real-World Map Size for all of my scenes. There are exceptions to using Real-World Map Size, such as certain objects with displacement, grass, water, things that don’t constitute as a building. The Real-World Map Size will ensure that all of my tiles will be accurate to size, whether they’re bricks, acoustic ceiling panels, floor tiles etc.







For the settings in the material editor for the Tiles node:



Be sure Use Real-World Scale is checked. This will change your Size units to a physical scale (inches, feet, mm, or meters…depends on your Max unit settings). For this example, I created modular brick at 4”x12” (HxW).

Under Pattern Setup, I use regular Running Bond…straight forward. Under Advanced Controls here is where it gets confusing. Adjust both Tiles Horiz. and Vert. to 100. Here’s why: the higher the number under the Horiz. and Vert. Count, the more random your color pattern will be when you increase the Color Variance. By default Max has it set at 4. This only allows a Color Variance among a 4x4 grid, hence the repeated patterning that a lot of people see. Not very helpful for brick. Making it 100x100, allows a greater range of Color Variance. This is as high as it can go, and gives you the best optimized variance!

Changing your Horiz. and Vert. Count affects your Width and Height values under Size. With 100x100 under my tiles count, now my 12” width is really 0.12”. To change the width back to actual, real size 12”, multiply the original width by the Horiz. Count, in this case 100. This applies to the height of course too.

Here’s a simple equation to always get your right brick size:

Intended width X Horiz. Count = Width

Intended height X Vert. Count = Height

Now because we changed the Horiz. and Vert. Count, we also have to lower the Grout Horizontal and Vertical Gap. A good rule of thumb is to use 0.02.

Note: making these changes to your shader will make it look pixelated in your open gl scene, but when you render they will look fine.

2008-03-03

V-Ray Grass

If you are using v-ray and don't use the VRayDisplacmentMod, then you should switch to mental ray! I use both, but v-ray is very powerful at performing geometric displacement, and is superb at creating organic objects; even grass looks good with displacement. Mental ray is good at displacing small polygons of geometry, where V-ray is good at displacing detail over large polygons. For this reason v-ray 1.50 sp1 is much more successful at creating grass for very large sites; a big plus!

A torus-knot with VRayDisplacmentMod modifier (light cache & irradiance map with 2 vray area lights)


The shader is simply just a VRayMat, with a grass map in the diffuse slot. Then I applied the VRayDisplacementMod modifier to the object. I instanced the image map from the shader into the displacement modifier.


VRayDisplacementMod settings:

• For something like grass it’s very important to use 2D mapping rather 3D mapping.

• I instanced the image map from the shader into the Texmap.

• I changed the amount to 4” to have taller grass blades.

• I increased the resolution to 2048 for better quality.





Voila, beautiful grass!

(notice the render times)

2008-03-01

Bokeh Effect

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.