DMMultimedia

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

Latest Capri MK IV updates
Latest Cortina updates
Latest Escort MK1 updates

DMMultimedia | 3d tutorials | Production Shaders in Mental Ray | Using Production Shaders : A Car Scene - Sunny

mr Production Shaders
Quick Links 3D Tutorials
Latest RS500
Latest RS500
Latest BMW F32
Latest BMW F32
Latest Escort MKII
3D Studio Max MENTAL RAY Tutorials - Using the Production Shaders - Car Scene (Sunny)

This section will build on the previous sections, and add a 3D car to a backplate image. It will explain how to setup the scene for lighting, exposure settings and how to use the shaders. The Free background image and the HDRI to create the scene below are included so you can follow along.

Use this Tutorial, and the supplied FREE backplate and HDRI files to place your car into this 3D scene
Use this Tutorial, and the supplied FREE backplate and HDRI files to place your car into this 3D scene

In this free tutorial we will use the Environment/Background Switcher, Environment/Background Camera Map, Environment HDRI and Matte/Shadow/Reflection shaders to place a 3D car model into a photograph/backplate. This tutorial is constructed in Max 2013 Design - but it is possible to use some of these shaders (The shaders use slightly different names and gui layouts) in earlier versions of 3DS Max.

In this simple scene we will again 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.

  • Arch:Env Blur, This shader speeds up the rendering and quality of glossy materials, by pre blurring the background image used in reflections (it does not affect blurring between physical objects). It works very well in a Production Shader setup scene as we use an HDRI for most of our environment.
  • Support File : Background image for the Railway Yard : IMG_6649.tif

  • Support File : The 360 degree HDRI background for for the Railway Yard : otelrailway_big.hdr

  • Support File : The above files in a ZIP archive : Otelfingen_Railway.zip 75 MB

Initial Setting up

We will use the same basic scene setup as in Parts 1 to 3. 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 the same basic setup from the previous scene. We will use an Environment/Background Switcher, an Environment/Camera Map (this is our background image), an Arch:Environment Blur shader with an HDRI 360 degrees image (this is used for reflections) and a Matte/Shadow/Reflections material. The basic setup of these shaders is shown below.

These are the main shaders we will be using:

The set of 3ds Max Mental Ray Production Shaders we will be using for this car scene
The set of 3ds Max Mental Ray Production Shaders we will be using for this car scene

This is the setup of the Environment/Background Switcher. It uses an instance of the Camera Map shader and the Arch:Environment Blur shaders. When you have the Camera Map and Arch:Env shaders loaded (see below for details), simply drag them onto the Environment / Background Switcher slots, and chose instance

The Mental Ray Environment/Background Switcher shader showing the slots filled with Camera Map and ARch:Environment Blur shaders
The Mental Ray Environment/Background Switcher shader showing the slots filled with Camera Map and ARch:Environment Blur shaders

The Camera Map has the background image - in this case IMG_6649.tif. Again make sure your Reverse Gamma Correction is set to 2.2

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

The Arch:Environment Blur shader contains the 360 degree background HDRI. The Blur shader pre-blurs this reflection map for use with any of our Arch&Design materials that use glossy reflections - it makes them much smoother, without using a larger (and slower) amount of samples. For more background information on this shader see Zap's excellent Blog post here.

Setup of the Mental Ray Arch:Environment Blur shader
Setup of the Mental Ray Arch:Environment Blur shader

To the Arch:Environment Blur shader we add a standard Bitmap shader which is the 360 degree background HDRI (otelrailway_big.hdr). In this case we will set the offsets as shown with u = 0.02.

Setup of the Mental Ray Arch:Environment Blur shader
Setup of the Mental Ray Arch:Environment Blur shader

The Matte/Shadow/Reflection Material is used to display our cast shadows on the background image. Drag your Camera Map shader to the Camera Mapped Background slot (make it an instance). The settings of this shader will be discussed in more detail below.

Mental Ray Production Shaders - Matte/Shadow/Reflection Material setup
Mental Ray Production Shaders - Matte/Shadow/Reflection Material setup

The next step is setting the Exposure settings. The overall value of 8.1 was chosen. This was determined by setting the Exposure Value to 7.5 and rendering the scene (you can render the Scene using very low settings, it is only the light balance we are interested in) then adjusting the EV up or down so that the background image (Camera Map - IMG_6649.tif) has the correct exposure - it can match your original photo, but you can slightly over or under-expose it here to your tastes. To summarise, in this step we adjust the exposure value to make our background image have the correct exposure in the rendered image.

The image below also shows the Image Control settings I used, these adjust the contrast and highlight intensities.

3ds Max Production Shaders Car scene - exposure settings
3ds Max Production Shaders Car scene - exposure settings

Using the above Exposure Value (EV) of 8.1 and rendering with very low settings (no objects are required just yet) I get this rendered image. If you adjust the EV value this image will get darker, or lighter. This is the exposure value I wanted for my backplate.

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

The next step is setting up the lights. In this scene we will have a Skylight to give global fill light, and an mr Area Spotlight which will represent the direct light from the sun. If you look at the 360 HDRI you can see the sun is high up and to the right of the car. Place your mr Area Spotlight in a position which is close to the position of the sun in the HDRI. The Skylight can be positioned anywhere, but add an instance of the Arch:Environment Blur shader to the Environment slot, and tick the Map option. The settings I used are shown below. The car I am using is positioned at 0,0,0 and there is a simple plane beneath the car which is our ground and will use the Matte/Shadow/Reflection Material.

mr Productions shaders car scene Skylight settings

mr Productions shaders car scene mr Area Spotlight settings
The setup of the Skylight and mr Area Spotlight for our car scene

To determine the values to use for the lights I used a material over-ride in the Render setup - Processing panel which makes every object render with a single material. The material I used was a simple Arch&Design material with grey colour and no reflections. This material is dragged to the slot as shown below.

Setting up a simple flat grey material override for testing light intensities
Setting up a simple flat grey material override for testing light intensities

Rendering with the light intensities (as shown above, mr Area Spot at 1.5 and Skylight at 0.6) we get this output. I have rendered the images below with high sampling settings, but when you test you can use low render settings as it only the light balance we are interested in. This stage can take some time. How the light balance is set, is up to personal preferences as well as being accurate. Even writing this tutorial I was adjusting these values. :-)

With the Skylight set to 0.6 - note the blue tint from the Bckground HDRI which is in the environment slot of the Skylight
With the Skylight only (set to 0.6) - note the blue tint from the Background HDRI which is in the environment slot of the Skylight. This is our "fill" light.

With the Spotlight only (set to 0.5) - no tint in the Spotlight
With the Spotlight only (set to 0.5) - no tint in the Spotlight. This is our main light source (representing the sun)

Combined Skylight and Spotlight, which complement each other
Combined Skylight and Spotlight, which complement each other.

Quick test with the actual textures - material override switched off
Quick test with the actual textures - material override switched off.

With the basic lighting and exposure setup finalised, the last stage will be adjusting the Matte/Shadow/Reflection Material to give us the cast shadow properties we would like.This is done by adjusting the and the. In every case I switch off the option. The model I am using was not originally created to scale, so some of the values for AO Max Distance in metres may be wrong for your own setup

The Matte/Shadow/Reflection Material values I used - mainly adjusting the Ambient / Shadow Intensity (affected by AO)
The Matte/Shadow/Reflection Material values I used - mainly adjusting the Ambient / Shadow Intensity (affected by AO).

The Matte/Shadow/Reflection Material values I used - switch OFF the "Receive Indirect Illumination" option.)
The Matte/Shadow/Reflection Material values I used - switch OFF the "Receive Indirect Illumination" option.

The following images show the effect of altering the Matte/Shadow/Reflection values. As these images show some subtle variation in shadow colours, you may have to view these on a good monitor if you don't see any differences.

The first image shows the shadow colour setting (colour values as shown above) with the AO values switched OFF. This is basically the settings for the shadow that will be seen out in the open.

Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.3 - No AO (switched off)
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.3 - No AO (switched off)

The strength of this shadow is altered by changing the Ambient / Shadow colour, but normally it shouldn't be too dark. This is the part of the shadow that is out in the open, so in real life this will be lit by the environment (indirect light).

In real life the shadow strength under the car will be much darker, as the car blocks the direct and indirect light. This is where the AO settings come in - tick the Use Ambient Occlusion (AO) box. The AO adds extra shadow colour (in our case set to black) to areas covered by the car. The important setting here is the AO Max Distance. We can set that to light how far the AO will bleed into our main shadow. I chose 4.5m as it got the results I want in my scene, but that distance will vary according to how your scene is setup. NOTE : As the AO will be set at a distance it helps if your car has a flat undertray - you will get a much more controllable result.

Final render using the 3ds Max Production Shaders and a 360 HDRI
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.3 - AO switched on with = AO Max Distance 4.5m, note darker area directly under the car

The strength of the AO shadow can be controlled by the Ambient / Shadow Intensity (affected by AO) value. The images below show how this is affected by increasing and decreasing this value (AO Max Distance is set to 4.5m for these images) . Lower values here give a shadow that is powerfully affected by the AO colour, higher values give a much less intensive adding of the AO colour.

Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.1
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.1
Note that almost all of the original shadow is now affected powerfully by the AO shadow colour
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.3
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.3
the standard setting - and a good starting point
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.8
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.8
Note that the main shadow is only very lightly affected by the AO shadow colour

The AO Max Distance sets how far the AO Shadow fills the main shadow. To show this here the AO Max Distance has been set to 2.0m. The Ambient / Shadow Intensity (affected by AO) has been set to 0.8 to make the effect easier to see. Note that when the Max distance is small only objects close to the car contribute to the AO shadow - in this case very close to the tyres (shown below). Increasing the AO Max Distance will push the AO Shadow out from the car. Too much and the effect is lost. It should be a subtle effect.

AO Max Distance - Note that the AO Shadow colour is only visible close to the tyres
Matte/Shadow/Reflection Material - Ambient / Shadow Intensity (affected by AO) = 0.8
Note that the AO Shadow colour is only really visible close to the tyres
Putting it altogether

With the scene setup using the Mental Ray Production shaders (using the HDRI and Backplate supplied), the Lights setup, the Exposure adjusted and the Matte/Shadow/Reflection Material configured we can now create a render. The Mental Ray sampling settings and Final Gather settings I use for the final render are shown below.

Mental Ray Render samples per pixel setup for the final car render
Mental Ray Render samples per pixel setup for the final car render
Mental Ray Render Final Gather setup for the final car render
Mental Ray Render Final Gather setup for the final car render

The final render - direct from 3DS Max. Move your mouse over this image to view a more detailed image. This render uses the Silver Metallic A&D paint setup.

The final result from using Studio 3ds Max with the Mental Ray Production shaders and the free HDRI and backplates