DMMultimedia

3D Graphics, Tutorials and Tips
Using 3DS Studio Max and Mental Ray

DMMultimedia

3D Studio Max MENTAL RAY Tutorials - Using the Production Shaders - 360 HDRI environment

The Mental Ray Production Shaders in 3DS Max enables a whole set of features and shaders to help with compositing 3D models into images/environments. An example of these shaders in action (created by Zap Andersson) can be found on YouTube here.

BMW used in 3ds max scene with Production Shaders - Tutorial

In this free tutorial we will use the Environment/Background Switcher, Environment/Background Camera Map, Environment HDRI and Matte/Shadow/Reflection shaders. This tutorial is constructed in Max 2009 Design - but it is possible to use some of these shaders (The shaders use slightly different names and gui layouts) in Max 2008.

In Max 2008 some of the shaders are "hidden" by default. To unhide them you will need to open the .mi files in a text editor and remove the ", hidden" from each declaration. Please see the previous tutorial for detailed setup of shaders required.

Tutorial 1 : Production Shaders

In this simple scene we will use the following shaders:

  • Environment/Background Camera Map, Shader to take the background image. In this example this is the image of the table. With this shader it is also seen to reflections, and also as a background to the Matte shader below.

  • Environment/Probe Chrome Ball, Shader to take a Chrome Ball or Probe image to use as the environment for reflections and lighting. It will unwrap the spherical image and use it as an environment map.

  • Environment/Background Switcher, This shader is used in the global environment slot. It switches between the Background Camera Map (for reflections coming from the rear of the image) to the Probe Chrome Ball for all reflections coming from behind the camera.

  • Matte/Shadow/Reflection, This shader is a Matte plane that will show the background camera map but also allow the catching of direct illumination shadows and/or Ambient Occlusion shadows.
  • Support File : The NEW background image for the grad en : Garden_sunny_2.jpg

  • Support File : The HDRI background for the grad en : sunny_garden_Panorama_hdr.hdr

  • Support File : The above files in a ZIP archive : backgrounds_360HDRI.zip 25 MB

Initial Setting up

We will use the scene we setup in Part 1 and 2. Please follow the setup instructions outlined in Part 1 and 2 for setting up units, exposure and materials (especially the matte/shadow/reflection, Camera Map and Environment/Background switcher).

Setting up our Material Editor Slots

We will use our previous scene and add a simple bitmap (360 degree HDRI) material to slot 5. First replace the Camera Map image with the new Garden_sunny_2.jpg image, and adjust your viewport to match the table top - see the image titled Perspective Viewport adjusted for new background image below for this setup.

For the new 360 HDRI, select the fifth material slot and click on the Get Material icon.

Get Material 3ds Max Material editor
Get Material for the fifth material slot

Select a bitmap shader :

Select a bitmap shader for the fifth slot
Select a Bitmap shader for the fifth material slot

With the Bitmap shader selected you will be asked to load an image. Choose the house_panorama_hdr.hdr file which is included in the files to download (see here). Change the name to 360 HDRI. In the coordinates panel change to Environ and Spherical Environment as shown below. Another important value to change is Tiling. This is important because by default 3ds Max wraps the bitmap around the OUTSIDE of an object. In this case we will be looking from the INSIDE of the environmental sphere. So to mirror image the Environmental Bitmap change the U: Tiling value to -1 as shown below.

Setup for HDRI bitmap used for environment
Adjust the parameters for the Bitmap shader

We will now replace the Chrome Ball shader with our HDRI. Select the first material slot called Environment. Open the maps tab. Then select the new Bitmap map we just created (360 HDRI) and drag it to the Environment/Reflection slot as shown below. Make this an instance - this will be useful later when changing bitmaps (explained in next section).

Move HDRI to Environment switcher
Move HDRI Bitmap to Environment switcher

The HDRI you loaded is a 360 degree image taken of the real environment. The panorama viewer below shows this HDRI as a tone-mapped JPEG.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Setting up the viewports and HDRI position

See Part 1 of this tutorial to see how to add a bitmap to a viewport background. We will add a new image to our perspective background. Load in Garden_sunny.jpg and adjust the viewport position to match the table top. It will now look as shown below. We will used the same light setup as previously - a skylight with the environment shader and a single mr spot light.

Add new background to perspective view
Perspective Viewport adjusted for new background image

We need to adjust the orientation of our 360 HDRI Bitmap to match our viewport. The 360 HDRI Bitmap was centred on the lawn in front of the table so it will not be a perfect match, but it will be fine for matching the position of the sky, sun and house.

From the main menu select Views - Viewport Background - Viewport Background and select "Use Environment Background". The images below show the setup for the earlier versions of Max, and for Max 2013.

Select viewport background
Select perspective viewport background (older versions of Max)
Select viewport background
Select perspective viewport background (Newer versions of Max)

As stated in Part 1, this will now make the viewport window show a black background (the environment background switcher). We can now quickly add the 360 HDRI image to the Environment Map slot as shown below - to replace the existing Environment/Background Switcher material. Drag the 360 HDRI material across and tick instance.

Select the 360 HDRI for the background
Click and drag the 360 HDRI material to the Environment Map slot - select instance

With the HDRI now being displayed in the main viewport we can rotate the HDRI to match the backplate. When loaded in with a U offset of 0.0 you should see the image below:

Adjust the U offset for the 360 HDRI background
The main viewport showing the 360 HDRI material with default U value of 0.0

Because we captured the HDRI a little bit to the side of the table, it will not be possible to completely match the backplate. But the important point to try and match is the direction of the sun. I used the U offset of 0.38 to match the alignment of the backplate.

Adjust the U offset for the 360 HDRI background
The main viewport showing the 360 HDRI material with U value changed to 0.38

We now need to switch back the Environment Map to the previous Environment/Background Switcher material, again select "instance". The Viewport background will be black.

Set the Environment Map back to the Environment/Background Switcher material
Set the Environment Map back to the Environment/Background Switcher material

Set the Environment Map back to the Environment/Background Switcher material through the main menu select Views - Viewport Background - Viewport Background and select "Custom Image File". You should now see the following :

Set the Environment Map back to the Environment/Background Switcher material
The main viewport with the Environment Map set back to the Environment/Background Switcher material, and viewport background set to Custom Image.

This will give you this final render :

Final render using the 3ds Max Production Shaders and a 360 HDRI
Final render using the 3ds Max Production Shaders and a 360 HDRI