Home
What's New...
Plugins
Presets Manager
Maxwell Render
Render Farm
Render Queue

Rendering with Layers in LightWave 3D
copyright © 2006 Andrew G. Morgan

OK, the finish line is in sight - we're now going to take what you've learnt in the last two guides
and kick it up a notch - I'm going to explain the principles of rendering in layers and combine this
with our new-found knowledge of render passes - the end result being near complete control of
all the elements of your scene in comp - excited? You should be!

So what exactly is a Layer?

People often confuse the meaning of passes and layers and use them interchangeably - as we've
already seen, a pass is a specific effect (such as specular or diffuse) that in combination with other
passes allows you to reconstruct your render with a greater degree of control over how these effects
combine to create your final output. A Layer on the other hand is a specific element in your scene
(background, character, building etc.) that has been rendered separately of all the other elements
so that you can manipulate it more easily. You can render passes without layers and layers without
passes but you only get the highest degree of flexibility if you do both.

The most common type of layer is a background layer - you separate the foreground elements
from the background allowing you to easily reposition the foreground elements, introduce new
elements in-between the foreground and background, independently adjust colour and lighting
values etc. Taking this a step further, you can render your foreground elements in separate layers
too allowing you to manipulate those individualy as well. Let's take a look at a simple example:

Background Layer
Background Layer
Cube Layer
Cube Layer
Ball Layer
Ball Layer
Cylinder Layer
Cylinder Layer

Combined Layers
Combined Layers

In the example above, I've simply made the various objects in the LightWave scene 'unseen by camera'
and rendered them out individualy with an alpha channel - combining them all together creates our
final image. Having these elements separated like this allows us to easily image process a specific element
or reposition it as necessary. Pretty useful in of itself but once you combine this with render passes things
get a lot more interesting as you can see below (download the PSD here):

Layers - Advanced

OK - to keep things simple (kinda) I've grouped the passes for specific elements - Cube, BG etc.
I've also colour-coded the passes so you can see at-a-glance which group they belong to - organisation
is very important when you're dealing with a large number of passes. What we basically have is all the
elements in the scene rendered separately with all their relevent passes. This allows us to easily work with
any given element and the passes that it's assembled from. In previous (passes) examples, we've had the
flexibility to tweak (for example) specular shading across the whole image - when we break our render
down further into layers, we can tweak any of those passes on an object by object basis - very powerful.

Of course, with a scene this simple, there's little need to break it down into as many passes as the
example above but it should give you a good feel for the level of control you (or your compositor)
can have over your render in post. If you've been keeping up with these guides you should realise
that there aren't in fact any layers in the above comp - it's all passes - a typical workflow might involve
you rendering the background as a layer and a foreground element (say a key character for example)
in passes in order to fine-tune the lighting and shading.


A word about alpha channels

When rendering layers, it's important to render your isolated elements against a black background.
Why? Well, part of the flexibility of rendering in layers is that you can reposition elements and insert
additional layers between them if needed. When LightWave renders an object it will anti-alias the edges
in order for that object to blend properly into the surrounding environment.

LightWave creates what's known as 'premultiplied' alpha channels for these layers -  when you
render, it will create anti-aliased pixels that are a combination of the background colours and
the shading properties of the object being drawn. Say for instance, you render your foreground layer
with a nice, cloudy sky in the background and then your client changes their mind and asks you to
replace it with a cloudless blue sky - because the edge pixels have been rendered against the clouds,
when you replace the background you'll often get a 'halo' around your layer - this can be tricky to
remove and in worst cases can require re-rendering the layer.

If you render your layers against black, most compositing software will automatically 'unmultiply'
the black background colour from the anti-aliased edges when you load up the layer - even if they don't
they'll have tools to do so - this ensures that whatever elements you place behind your layers, they'll
always blend together perfectly.

Photoshop is a special case as it internally deals with non-premultiplied alphas. Consequently, bringing
rendered layers into Photoshop can create some nasty halos when you're trying to put things together.
Let's take a look at an example:

Premultiplied Alpha
Black background premultiplied into the anti-aliasing

In the above example, the background and the cylinder were rendered as separate layers - the cylinder was
rendered against black and saved as a 32-bit TGA out of LightWave. Bringing this layer into Photoshop and
using its alpha channel as a layer mask reveals a nasty dark outline of pixels surrounding the layer - not great.

So how do we fix this? Luckily, Photoshop has a built-in tool for removing the multiplied black pixels from an
alpha channel - to use it you'll have to 'apply' your layer mask first which will clip all the black pixels from your
layer and leave them transparent. Next, go to the 'Layer' menu and select 'Matting->Remove Black Matte' -
this will unmultiply the black background colour from your layer and result in a nice, clean transparent edge:

After removing 'Black Matte'
Fixed after using 'Remove Black Matte'


That's it! Congratulations - you now know pretty much everything you need to know about passes,
layers, how to create them and what they're good for - now go put it into practice!


Home