| ||
Depth | Dust | P Position |
Rollover images
This tutorial shows how to create Z Depth, dust and Object Position masks that can be used in a compositing package to layer shading effects such as depth of field, dirt, dust or snow. They use a combination of Arnold shaders such as utility, range and state_float. Thanks to Slava Sych for the assistance with this tutorial.
A scene file can be found here. |
---|
Depth Mask
- Create a state_float shader. Set the variable parameter to ray_length (Rl).
- Create a range shader and connect the state_float shader output to the input of the range shader. Change the following parameters of the range shader:
- input_min: 0.6 (this value depends on the distance from the camera your object is).
- output_max: 1.5 (this value depends on the distance from the camera your object is).
- smoothstep: Enabled
Note that this mask directly depends on the distance from the camera.
Object Position (n) Dust Mask
- Create a utility shader. Set the following parameters for the utility shader:
- color_mode: normal (n)
- shade_mode: flat
- Create a range shader and connect the utility shaders Output.G to the input of the range shader. Enable smoothstep and control the mask position with the input_min/max parameters.
If you cannot connect a single out color (Out G) to an Input in your DCC, use a rgba_to_float (mode G) shader to convert it.
Object Position (P) Mask
- Create a utility shader. Set the following parameters for the utility shader:
- color_mode: shading point (P)
- shade_mode: Flat
- Create a range shader and connect the utility shaders Output.G to the Input of the Range shader. Enable smoothstep and control the mask position with the input_min/max parameters.
If you cannot connect a single out color (Out G) to an Input in your DCC, use a rgba_to_float (mode G) shader to convert it.