Introduction to Post-Process Compositing

A set of images being combined in post-process, based on angle of view.

The first image is a tS render, the second altered in an art package; these two were blended using a render from Mask ViewAngle Ramp, to give the result (seen full size here ).

What This Section Is For

Several shaders in this collection generate greyscale images, called Masks, and this section explains just why there are shaders to do that!

Alpha Masks
An alpha mask is a greyscale image which controls the transparency of an image in an art package (or in tS, if you use an alpha mask in the transparency shader settings). For art packages, black is transparent, and white is opaque, with greyscale values having a partial transparency.

These shaders are designed to let you produce images which can then be used as Alpha Masks to alter a rendered image (they do not produce final rendered images on their own).

Why Use Alpha Masks and Post-Process Compositing?

Quite often, it can be nice to do everything automatically from within trueSpace, so you can just click the render button, and know that everything you need will happen all at once.

In truth, though, this is quite a limited approach. For instance, if you change an effect, you have to re-render the entire image in order to get a final copy with that effect in place. Also, there may be some issues with the way a certain type of processing is done within tS, which you simply won’t be able to get around.

It may seem a little awkward to have to do some work outside of trueSpace, but much professional work often takes this approach, both for reasons of finer control and reduced need to re-render, and the Mask shaders in this collection are intended to make that ability available for trueSpace.

In general, the sort of things that are handled in this way may include :

Dividing up the different material channels, such as specularity, diffuse, reflection, etc, and rendering these separately, to add them back together again later. Some of the advantages of this approach are :

  • i) Allows the strength of reflection (or transmission, or specular brightness) to be adjusted, without ever needing to re-render
  • ii) Allows an alpha mask to be used to control the amount of reflection present, so that reflection could change with angle of view (or with distance, or randomly by introducing noise into the alpha mask, etc)
  • iii) Allows alpha masks to control all these channels independently (so you could introduce diffuse that varies with distance, or with angle of view, etc)
  • iv) Allows you to combine the channels in different ways - most shaders work on an “additive” principle when combining these different channels (not all, some TG shaders take a different approach ;-)  ), but if you combine them in an art package you can mix using alpha masks or transparency, take the conventional additive approach, multiply the channels together, use “if darker” or “if lighter”, and any other method that your art packages support for combining layers and images, including painting onto the alpha masks directly
  • v) Allows effects to be applied to only certain channels - eg adding blur to reflection only, or adding blur to the specular channel, to produce a bloom (where the highlight gets blurred “off” from the edge of the object).


Even without dividing up the material channels, there are a great many uses for alpha masks. For instance, creating alpha masks based on distance - in effect, creating a z-buffer in the form of an image - lets you add z-buffer based effects, such as depth of field, fog, or an object materialising as it grows nearer / farther away.

The advantage of doing these things post process is that you can adjust the effect without ever needing to re-render (as well as get more creative in how you approach it, or indeed come up with truly bizarre and unusual ways of mixing images!).

There are also some issues with depth of field as generated within trueSpace - for example, if you have a distant object seen through a nearby pane of glass, then the distant object remains steadfastly unblurred (because the tS z-buffer only “sees” the point on the surface of the glass, which is nearby and so not blurred much by the depth of field). A similar situation occurs with transparency, for the same reason. Using the right Distance Mask shader can overcome these limitations.

Isn’t This Possible Already in tS?

Many of these effects are possible with the native shaders in trueSpace, yes. For instance, you could paint all objects a Constant colour, and render using Depth Cue, in order to generate a z-buffer image, or you could use one of the Fog shaders to achieve the same result (but perhaps only on one object). For dividing up materials, you could go through and set all the other channels to zero and render, then do the same for the other channels, rendering them out one at a time.

The idea of these shaders is to simplify the approach, both to make it easier and more instinctive to approach this sort of work, and to remove redundant processing for optimal render speeds.

That said, these shaders also offer greater flexbility than other approaches - for example, the Distance Mask shaders have Ramp based versions, which allow control over how the mask varies with distance, offering all the advantages of a Ramp (you can’t control trueSpace’s native Depth Cue with a Ramp.....). This also means that if you generate Depth of Field effects in post-process, you can control the strength of that effect (the fade in and fade outs) via a Ramp when creating the alpha mask, and again this offers all the advantages that Ramps bring.

Finally, some of the shaders also let you get around some of the drawbacks of the way some things work in trueSpace, such as the previously noted limitation on Depth of Field with transmission or transparency (as an aside, this approach would let you use Fog, Depth of Field, etc, on images rendered using some TMG CG Art shaders which use a “photographic plate” approach to generate an image, such as the Object Camera shader in this collection).

Do I Need an Art Package to do the Compositing?

Preferably :-)

You will get much more control and many more options for how to carry out the compositing if you use an external art package. However, it is possible to use the alpha masks to composite within tS, using layered shaders to blend the different images - could well lead to some interesting and novel effects of course, when used with procedural shaders etc!

And why not try using a greyscale alpha mask, based on distance, as a bump map?

Introduction to Post-Process Compositing

Some Post-Process Compositing Ideas

TG Pack 3 Index