Documentation
Tutorials
This tutorial shows how to use RenderElements created by RichDirt in Photoshop. It uses the basics of compositing with Photoshop and mental ray.
The tutorial shows how to solve 4 major hurdles in the workflow, 2 in 3ds Max (Background, Exposure) and 2 in Photoshop (Invert, Masks from Alpha). Note that an identical tutorial exists for V-Ray, with a very similar approach, the hurdles and solutions are different.
You split a rendering in several elements and then re-add these elements in Photoshop. The advantage is that you can easily control color and intensity of layers. Adding images in Photoshop is real time, you don´t need to re-render for 1 hour to get a change in your images. This can be up to 1000 times faster than simple re-rendering ! And it offers much more artistic freedom.
The tutorial is organized in 2 sections:
An image of our example scene - without dirt : It uses 3 concrete cubes on a floor. The size of the cubes is around 200 cm (80 inch). There is 1 mirror sphere to cover reflections. The background uses a procedural sky. Note that this image is shown with a gamma of 1.0.
They are found in the rendering dialog, in the ´render elements´ tab. Non-English versions of 3ds Max might have different translations, but the position of the tab is the same.
We need to seperate lighting (illumination) from textures. Why ? We want to change the diffuse texture later !
Diffuse
Lighting - this includes direct and indirect lighting
Background (for the sky)
Reflections
When using a mental ray physical sun and sky you will get color values above 1.0. For standard rendering this is handled by exposure control. Render Elements do not use exposure control, they -should- write the raw unclamped color. However 3ds Max with mental ray writes all Render Elements -clipped-, so all values above 1.0 are lost, even when you write to file formats like hdr or exr. To solve this we need to switch off the exposure control, and adjust brightness of sun and sky. Typical multipliers for the sun and sky are 0.02. Note that mental ray -can- write raw unclamped colors when the framebuffer is set to 32 bit float. (Renderer->Sampling Quality-> Frame Buffer Type: floating point (32 bit per channel). However the main image (beauty pass) would still run through exposure control - this would create a difference when compositing Render Elements. Also Photoshop doesn´t support certain operations on 32 bit buffers. So for learning it is better to switch off the exposure control.
You need to export images using gamma 1.0.
Use RGB (do -not- use RGBA)
Use 16 bit tif files everywhere.
Why 16 bit and not 8 bit or 32 bit ?
8 bit does not have sufficient precision.
Photoshop can not -invert- 32 buffers, and we will need the invert operation.
The 4 Render Elements :
Switch off the RGB, Red, Green, Blue channels. Switch on the ´Layer Mask´ channel.
Now you should see a nice mask. If this didn´t work - load Diffuse.tif again, Photoshop sometimes
stores intermediate results. Also make sure you only have the alpha layer selected in the channels tab when you press control a and control c
Control a + control c to copy this to the 'Background' image.
In the 'Background' image change the mode to multiply.
Inside the background image select the new mask layer and invert it ( we need the geometry to be black).
Invert can be done with 'control + i', Then change the mode to 'multiply'. Black is 0, so multiplying with black
removes the geometry.
So far the background looks great, but we also have to copy it to the 'main image'.
To do so we need to first collapse (= merge layers) the layer stack.
Now we have a nice background that can be directly added to the main image ('All together').
Result - we get the exact same image as inside 3ds Max. So the compositing worked ! If you get a different image, check again that you exported the images from 3ds Max using a gamma of 1.0 and used 16 bit in Photoshop.
Now let us start with the second section of this tutorial - how to add dirt. This is the fun part - no ´Background mask business to do ´!
a) Create the first mr Shader Element RenderElement
b) Add a RichDirt texture to it.
Drag the texture into the material editor to edit it.
Use the 'Rich Building preset'.
If this is too fast (not enough details in the tutorial - see the
video tutorial how to
create a single dirt Render Element. The video has more details.
c) Create a second and third mr Shader Element RenderElement
d) Add RichDirt with preset 'Splashes (variations)' and 'Building edge streaks'.
Render - you now should get the following 3 images:
This creates combined dirt. RichDirt uses black and white colors by default so multiplying layers is easy.
Let us have a quick look at the delicious dirt:
Dirt is added to -all- the geometry, including the ground plane. (Note that one can use RichDirt also as a texture, then each material can have different dirt. Per-material-textures can also write to a RenderElement, see the Reuse/Store tab of RichDirt´) When we later mix this with the diffuse texture we do -not- want dirt on the ground plane. So we need to mask it.
In your renderings you might not have a ground plane. So why is this covered so much in this tutorial ? The ground plane is an example for all geometry that you want to keep free from dirt. When you have a large model 1000s of objects might need dirt and other 1000s of objects may not want dirt. The approach described here solves this for you.
While handling the Background buffer is much easier in V-Ray creating a mask for the selected objects is easier with mental ray. mental ray supports the ´render only selected objects´. We use this to create a mask for the selected objects. - Add a second 'Diffuse' Render Element. - Name this ´myMask´, and set it to 16bit tif with rgba. We will need the alpha mask. - Switch off all other render elements so they are not touched. - Select the 3 cubes. - Hit Render with the 'green cube + teapot' toggle on.
To convert this into a mask do steps that are similar to the alpha mask for the background image. In Photoshop in the 'Layers' dialog select the 'Channels' tab. Switch off rgb, red,green,blue, and switch on 'alpha'.
Now you have an image that can be used as mask.
a) Paste it into ´All together´ on -top- of the 3 dirt layers.
b) Invert it using ´control I´.
c) Set the mode to ´Lighter Color´.
Why ´Lighter color´ ? The inverted mask is white for all objects that should not get dirt.
Name this group ´Dirt Effects´. ´myMask´ must be inside the group, so it is only applied
to the dirt.
The huge advantage of using a group is that we can control weights (opacity) of
streaks, splashes and more effects directly.
This is essential to get the big speed-up compared to re-rendering.
The fun part is to adjust the weights of streaks and splashes to get the exact amount of
dirt you like.
To make sure you see the full setup here is a snapshot of the layers in Photoshop.
Check this when you think you missed a step somewhere in the tutorial.
Also check if your layers are still in 16 bit. When converting a single layer to 8 bit
Photoshop sometimes converts all layers to 16 bit.
Compositing in Photoshop is very fast, so why doesn´t everybody use it -all- the time ? At edges of objects (masks) one can easily get aliasing. To minimize this be sure
The compositing set up above uses multiplication, which makes things -darker-. This is often perfect. But sometimes you want dirt that has a different color, like greenish moot, or brown rust. To achieve this do the following steps in Photoshop
The dirt group with a green tint
Moot on concrete - gamma is set to 2.2 after compositing.