2010-01-08

Transparent Alpha Channel

 I noticed a tutorial of this for vray, and thought surely this can be done in mental ray....well it can.  Often times I create a rendering with transparent objects, and want to use an alpha channel to add a background while keeping the transparency in the foreground objects.  I'll show you how to do this with mental ray.






Now this is the image straight out of the render buffer, that I want to add an image into its background.  The reflection is from an image that I plugged into an environment switcher shader.  That way object inherit the images reflections, and the grey background that you see is just the environment background.





Max creates an alpha channel when a rendering is created.  However, only certain file formats keep the alpha channel information (.png, .tga).  I would recommend targa formats because it keeps the background, and has the alpha channel added in the same file...you can also save it as a 32 bit image which is a plus.







This is the background image that I added behind the snow globe.  This can be done in any software.  For this example I used Photoshop.






Now this is the image out of Photoshop with the snow globe and the background image using the default alpha channel.  This is the problem we get with transparent objects such as glass...notice how the background is the grey from the origianl rendering and not the lights from the background image.





The trick to getting transparency in mental ray is found in the A&D shader of the transparent objects.  Scroll down to the Advanced section and check Transparency propogates Alpha channel.  That's it!





Now when you render, and check the alpha channel you will see that it is transparent for the materials with the new setting checked.  Note: this doesn't work if materials have a map in the environment slot.








Now when you use the new alpha channel for your render, it will maintain transparency for your foreground to view the background image!








Here is the max file: 04-transAlpha_max2010.zip

2009-12-22

Parti Volume File

Ask and you shall receive...I've had several people ask me for the parti volume file from my volumetric lighting post.  I could not find the original file, so I only have it as a max 2010 version:




03-partiVolume_max2010.zip

enjoy!

2009-12-02

Water-Wall

I had someone ask me "How do I do a water wall in 3D?", and it got me thinking. There is no "right way" in 3D, and there is always more than one way to skin a rendering. It's all smoke and mirrors anyway. The two water walls in the rendering below were achieved with two different techniques.



The wall on the left has a plane "draped" over the wall with a combination of a wave and bend modifier. The wave modifier creates the ripples in the water going down the wall. The bend modifier bends the plane to follow the curve of the walls. Be sure the plane has enough segments in both directions for the modifiers to work correctly. For this example my plane was segmented at 100x100.


For the wall on the right I created material (using the A&D shader) that mimics flowing water going down the wall. This is achieved with a noise map in the bump slot. The trick is to increase the tiling of the noise map in either the X, Y, or Z direction. In this example, I cranked Y up to 40. This will create the effect of water running down the wall. Also be sure that the material is highly reflective to look wet.

My preference is to create the water through a material and apply it to the object. I find it much easier to control. If you want to check the file out here it is: 02-waterWall_max2010.zip

2009-10-07

Never under estimate the powers of SketchUp!

This isn't a tip or trick, but I had to post on this one. I know that I always talk about modeling in SketchUp and rendering in Max. Well Jacques from Cape Town, South Africa has proved that SketchUp can compete as a high-end 3D modeling contender. His stunning care for detail has been shown in his latest model of the HMCS Snowberry. The slideshow is also a good documentation of just how he managed to model organics in an XYZ world.




The images were modeled in SketchUp and rendered with Vray.

He has also been gracious enough to provide his models here for SU enthusiasts.

2009-10-02

Attaching & Detaching Meshes

I just wanted to point out some very useful buttons. These may be two of the most useful tools in the mesh modifier rollouts. The attach button is used for attaching several meshes into one mesh. The detach button is used for detaching a selected portion of a mesh into a new mesh. I’ve found these useful for managing large scenes so I don’t have to group objects. You will notice that you see Attach and Attach List, but if you click Polygon or Element, Attach List will switch to Detach.



In this first example you will see that there is just one object in the scene. I chose select by Element, which will select all connected faces. So when I select a face on the tire, the whole tire is selected.






When you click on Detach it will give you several options. If Detach to Element is checked then the faces will stay in the same mesh. If Detach to Element is unchecked then you can name the mesh that it will convert it to.




When you click ok, now you will see two meshes in your scene. The original mesh (AudiTT) and the new mesh (tire01). The new meshes that are created from an existing mesh will always share the same material.



In this next example you can see that there are 9 different meshes for this model. To attach them together you must have one of them selected. I chose the mesh BMW5_FLWHEEL. Now you can either click on Attach or Attach List. When Attach is selected, anytime you click on another mesh it will attach it to your current mesh.



When you click on Attach List, it will pull up the scene selector, and allow you to select other meshes by list. This is useful if you have too many objects to select in the 3D viewport.




If the new mesh you are attaching to the old mesh has a different material, this dialogue pops up. It is giving you several options for what to do with merging meshes with different materials. I usually just leave it as is, and hit ok. These settings will create a new Multi/Sub Object Material (MSOM) with instances of the existing materials. When the meshes are attached their faces will have corresponding IDs to their material ID.



Now you will see that there is just one mesh in the scene, and that the only root material is an MSOM for the car. You will also notice that the name of the mesh is based on the first mesh you select to attach other meshes to.

2009-08-17

3ds Max 2010 can now import SketchUp!

Yes folks. If you have a subscription to max, the new update has a feature called the Connection Extension for Max 2010. Along with other interop features, Max can now import *.skp files.


I was fortunate enough to be able to put my two cents into this particular feature of Max, and have to say that it is a very powerful feature for SketchUp/Max users. It is also very strategic for Autodesk because now if you have Max 2010, you don't even need to purchase SketchUp Pro to export the 3D model to a universal file format. Max can import the plain .skp file.

To see a video walkthrough of the importer check out this video

2009-07-10

Alt+W woes


If you use the Alt+W (Maximize Viewport toggle) as much as I do, you'll know that it's the greatest keyboard shortcut for Max. You'll also find that it's very frustrating when you have an Editable Mesh selected. This scenario happens often because I like to select my mesh in one view, then toggle viewports and hit Z so I don't have to "find" the mesh again in the new view. This was bugging me for a long time, and took me a while to figure out what the deal was. Alt+W always works unless you have an Editable Mesh selected and you have the Modify tab selected (which is the tab that I have selected most of the time when working in max). If you have any other tab selected (Create, Hierarchy, Motion, Display, Utilities) it works fine. So if you are wanting to quickly toggle your viewport with a Mesh selected, just remember to select a different tab before you Alt+W.




As someone pointed out, the Keyboard Override button will toggle between using the same shortcuts for Max global commands and using them for objects as Meshes, Track View, NURBS and some other shortcuts. Alt+W just happens to be a very important global shortcut that is also used for weld target mode for Edit/Editable Mesh.

2009-06-11

Multi/Sub-Object instancing trick

This really isn't a trick. It's just understanding how materials in max work, but it can sometimes still feel like a trick. This "trick" may resolve some of your Multi/Sub-Object (MSOM) woes. There is often the scenario that you import a .3ds file into max, and it contains several meshes each with a MSOM but with instanced sub-Standard materials. The next thing you want to do is to change them from Standard to A&D or V-ray materials, once without having to do any copy then paste (instance).






Having too many MSOM's in the Material Editor, especially with sub instanced materials can make max sluggish and perform slowly. I will show you an efficient way to do this that doesn't slow max down, and makes it a quick and easy job.

On the right is a similar scenario where I imported a .3ds file, to find that it created 3 meshes each with 3 MSOM's. I wanted to change all of the materials from Standard to A&D without going through the list of the MSOM's and seeing which one had (Standard) and which one had (Arch & Design(mi)) next to them.

Firstly in the material editor, click on the Get Material button on the left or go to Rendering->Material/Map Browser.









On the left in the Browse From section, if you click on Scene, it will potentially show you all of the materials and maps you have in your scene. So just because your material editor is empty, doesn't mean you don't have materials in your scene.

You will also notice that on the right side of the material, it will have a list of geometry that the material is actually applied to. If the material is a MSOM, I find it helpful to name material after the mesh its applied to...just to keep things straight in my head.

Now if you have Root Only checked, you will only see the MSOM and not the other materials inside the MSOM. If you un-check Root Only, then you will see all of the other materials show up. This is very handy, because you can go one more step and tweak the individual material.











So for example, the image on the left: I clicked on an empty slot (bottom-left) in the material editor, then went to the Material/Map Browser and I double clicked on FrontCol (Standard). This places it in the empty slot in the Material Editor. Because I have FrontCol in all 3 MSOM, and it's instanced it doesn't matter which MSOM I grabbed it from.

Now because it's standing by itself I can do whatever I want to it, and it will change it in all 3 MSOM's! So I clicked on Standard and changed it to A&D, and you'll notice that it changed the FrontCol in all 3 MSOM's to (Arch & Design (mi)) in the Material/Map Browser.

Voila, the easy way to change materials in MSOM's!

2009-04-26

Understanding Cameras for Renderings

Last week I gave a presentation on photography for architecture, and thought this information would also be useful for exposure settings in 3D for renderings. With mental ray, the values are almost identical to a real cameras settings. Understanding these settings can make it much easier to get the rendering quality that you want...and can also help you take better pictures with your camera!

I believe there are only 4 criteria to know when it comes to cameras / exposure settings:

•Shutter Speed (exposure)
•Aperture (f-stop)
•Film speed (ISO)
•Whitepoint (color temperature)

In 3dsMax they all do the same thing (except whitepoint), make your image brighter or darker. But they all react a little different to each other and have some interesting characteristics.


Shutter Speed

The shutter speed value determines how long the shutter is open in a camera. The longer it's open, the brighter the image. Acceptable values are 500, 250, 30. The important thing to remember is these numbers are fractions of a second. So when you see 500, it's really 1/500th's of a second. So the smaller the number, the longer the exposure only up until you get to full second values. So it's important to know your camera. If you see 30 it could be 1/30 of a second or it could be 30 seconds. Just play with the setting to see where you are. I've found that speeds slower than 1/30th of a second on my camera tend to cause blurring if I'm not using a tripod. The shutter speed is also what determines blurry people. If you want a crisp photo with blurry moving objects, use a tripod and leave your exposure open for 1 full second.
Common values: ISO (100), f-stop(4), whitepoint (6500K)

Aperture (f-stop)

The aperture is how wide the lens is open. This value is called f-stop, and the lower the value, the wider the aperture, the brighter the image. In reality the f-stop is a factor of the focal length. For example if you are using a zoom lens at 17mm, you could get your f-stop to be as low as 3.4...but with the same lens if you are zoomed in at 100mm, your f-stop value can only go so far to maybe 4.0. Depth-of-field (DOF) is also a factor of the f-stop number. Typically the lower the f-stop number, the more of a DOF effect you can get.

Because we deal with exposure in 3D there is no limitation to the f-stop value. In mental ray, f-stop doesn't affect DOF, whereas in v-ray, if you are using a v-ray camera, DOF is affected by f-stop.
Common values: shutter speed (1/32), ISO (100), whitepoint (6500K)


ISO / Film Speed

Traditionally before digital cameras, you had to choose what film to put in your camera and it had a fixed film speed (ISO) value. Higher values are more sensitive to light, but noisier; whereas lower speeds of film are less sensitive to light, but are sharper. Because a digital camera doesn't use film, this value is purely fictitious and simply imitates what ISO used to be. The advantage to a digital camera, and renderings is that on the fly we can change the ISO value without having to change film. The difference between your digital camera and rendering though is that when you increase your ISO values in 3D, the rendering does not become more noisy.
Common values: shutter speed (1/32), f-stop (16), whitepoint (6500K)


Whitepoint
/ Color Temperature

Whitepoint is a way to determine the color temperature of lighting in a room. Every light emits different color values measured in Kelvin. Just some examples:

Incandescent light bulb (2700–3300 K)
Candle flame (1850 K)
Studio lamps, photofloods, (3400 K)

So when a photo is taken at these different values, the images can turn out to be red or blue depending on the lights in the space. Whitepoint actually counter-acts the colors of the lights to even out the color in the image/rendering. So lower values of K will result in a bluer image while higher values result in more red images.
Common values: shutter speed (1/32), ISO (100), f-stop (6)

This should help you begin to understand the art of light, and help you to start seeing things in terms of these values. They each affect the other. So play with them and know how one will make the other value work. When you master this, it should definitely give you a leg up when you are working on lighting those renderings.

Happy testing!

2009-03-10

Parti Volume Shader

Volumetric lighting can be a mysterious thing in mental ray. I'm going to go through the Parti Volume Shader, and hopefully you will be able to know how to use it after understanding it.


Firstly, how do you apply it? Go to your render settings, and click on the Renderer tab. Scroll down until you see the Camera Shaders section. Click on the button that says None to the right of the Volume option. Here you will see a list of various volume shaders, choose Parti Volume. Now you have it applied, but like alot of shaders in max, to access click on the Parti Volume button and drag an instance of it to the material editor.






The default settings:

Right away if you were to render your scene, assuming it has lights, you will a very slow rendering that looks blown out with too much volume. After I discuss each setting, hopefully you can tweak it to optimize your rendering and speeds.

Mode:
there are really two settings for this. 0 and 1. Anything else will give you strange results. Mode 0 is usually what you want. when Mode is set to 1 creates ground fog, and activates the Height function.

Scatter:
This color swatch is what gives the power behind your volume light. The lighter it is, the more volume effect you will get. The darker it is the less effect you will get. By default the value is set to 50% white, which is way too strong. I would suggest to keep gray-scale values for the best effect. Of course you can color the volume, but this is unnatural. Usually the closer you can get to black the better.

Extinction:
This controls how quickly light is absorbed by the particulate. The higher the value, the more volume you get. But it will choke your light. I try to keep this value as low as possible.

r, g2, and g2:
These values tend to act strange if you don't know what they're doing. Basically the three of them control scattering of the volume. The values g1 and g2 control the distance of the scattering between each other. The r value controls the favoring between g1 and g2. r=0 will favor g2 and r=1 will favor g1. Rule of thumb: r value should only be between 0 and 1, and g1 and g2 should only be between -1 and 1. You will get strange artifacts with other values. Keeping these at the default aren't a bad idea. But if you want to control the spreading, you can change these values.

Non Uniform:
this creates a non-uniform volume, and adds noise to the effect. I usually leave this at 0.

Height:
Only works when Mode=1. It controls the height of the volume from the ground for fog effects.

Minimum, Maximum Step Length:
Simply put these control the sampling for the volume light. The larger the values the less samples are taken, and the faster the render. For quick and dirty test renders you can set these to min=4' and max=4'. Work your way down, trying to keep the min value smaller than the max value so that the solution is adaptive. Eventually something like min=1" and max=2' should give you more than enough sampling. For the render above I used min=2' and max=3'.

Light Distance:
This is a control for a falloff of sampling quality. It defines high sampling to take place within the specified distance.

No GI where direct:
If checked, when GI is calculated it ignores the volumetric light. Produces much faster GI solution of course.

Lights:
This is a very important option and should not be ignored if you have more than 1 light in your scene. It is off by default, meaning every light in the scene will emmit volume, which can cause very very slow render times; especially if you have like 40+ lights in your scene. When checked, it will only cast volume from the lights added to its list.

That's it for the Parti Volume Shader!

Other notes of weirdness for this shader...it only works with geometry behind the rays. So if your light which should be casting volume is against empty space, you will not see the volume. Solutions to this:

-put glass in your windows for interior scenes

-add an invisible sphere around your scene for volume passing over open air

On left: plane behind volume light. On right: invisible sphere around scene

This is achieved by creating a sphere that encompasses your entire scene, cameras and lights. Then apply an A&D material with Transparency=1.0 and an IOR=1.0 to the sphere. Then go to object properties, and uncheck Visible to Reflections/Refraction, Receive Shadows, and Cast Shadows. Also under the mentar ray tab, turn off Receive Illumination from Final Gather and check Exclude from Caustics and Exclude from GI.)