Tip:
Highlight text to annotate it
X
Along with alpha masks, another commonly required compositing element is the depth or Z-Depth
pass. This element can be utilized to create a number of depth-based effects inside a compositing
application. A very common one is to add a fake depth-of-field or lens effect to our
final shot. We're actually going to be adding a little bit of haze to our scene interior
by of course creating a depth pass render for it. Now once again we may need to perform
a little bit of scene setup if we want our depth pass render to work in a specific way--that
is, if we want it to take into account our exterior environment. This will mean we need
to once again hide our sky portal and glass layers. Now you may wonder, with the glass
objects having transparent material applied to them, why is this so? Because in our Beauty
render we can clearly see through to the outside environment. But when creating a depth render,
Twilight doesn't look at the material definitions assigned to a piece of geometry; it will just
see the geometry in the scene and so terminate the depth render at that point. So let's do
that. Let's open up our Layers dialog. Again we just need to make Layer0 the default so
that we can turn off our Sky Portals layer, our Patio Glass layer, and of course our Skylight
Glass layer. Now we can actually go and set up Twilight for a depth render. So let's open
up the Render dialog, and again in the Presets we're going to skip past the Easy options
and work instead inside the Advanced group. Here, as you can see, we have a Depth Render
option. Using this preset, Twilight can now output a render that really measures depth
in the scene. So points closes to our camera will be represented by a black color; points
farthest away from the camera in the environment will be represented by a pure white color;
and anything in between will receive a grayscale gradient that essentially represents the changing
distance. To see this in action, let's go and take a render for ourselves. If we just
come into our Render window and right-click and fit the image to screen, you can see what
we have actually doesn't look every interesting. In fact, we don't appear to have much variation
in terms of depth in our scene. This is because, if we just come over to our Camera tab, we
will see that the Twilight's Tone Mapping filters do affect how our depth pass render
works. So if we just switch over from Simple to None, you can see we get a much better
representation of depth in our scene. In fact, if we want to control how our depth render
is working inside of Twilight, we can use the Tone Mapping filters to do just that.
Now generally speaking, the None filter type would be my preferred option. From here I
would save out to a floating-point image, so that would be a HDR or EXR file from Twilight.
And then I could use tools in my image editing application to affect how the depth render
is working. In this instance though, just to demonstrate how it does work, we're going
to switch over to the Simple option and we're going to make some changes in here. We're
going to set our Exposure Level to a value of 1, and we're going to set our Gamma Adjustment
level all the way down to .1. This will really crunch the grayscale gradient of our depth
render and mean that really, we're just pushing all of our depth information down to the far
end of our room. This means that when we add our Haze effect inside of Photoshop, everything
close up to the camera will appear a bit clear, but everything further away will receive our
Haze effect. Now of course I do need to save this out, so I'm going to click on the Save
current render icon, and I'm just going to overwrite our existing HDR file. Using a floating-point
file format means that I will still have lots of control over my depth render once I start
to work with it inside of my image editing application. So in a very short space of time,
we have created a very useful depth pass compositing element. Not that we finished just yet with
Twilight's compositing presets. In the next video, we'll show you how we can use the Diffuse
Texture Pass preset in Twilight's Tech options to essentially create a three-in-one mask
render for ourselves.