Mask Shaders |
|||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||||||
![]() |
|||||||||
The title image, rendered using Mask Distance Ramp. This could be used to add depth cue / fog, or depth of field, in post-process, for example (and was used for to produce the images here and here) |
|||||||||
What They Do These shaders simplify the process of producing images for use as masks or alpha channels in post process compositing. Although it’s possible to create such renders already using trueSpace, these shaders are designed to simplify and speed up the process by removing irrelevant processing and leaving only the bare bones! For some general discussion on how these shaders might be applied (that is, if you’re not familiar with the ideas and uses of alpha channel masks etc), see the pages, Introduction to Post-Process Compositing, and Some Post-Process Compositing Ideas. The shader titles below will take you to their parameter section if you click on them, |
|||||||||
![]() |
|||||||||
The Shaders |
|||||||||
Distance Based : |
|||||||||
A basic “z-buffer information” shader. Creates a greyscale render, with the greyscale intensity controlled by the magnitude of the I vector (that is, the distance travelled from the camera to the surface). |
|||||||||
Another basic “z-buffer information” shader. Creates a greyscale render, with the greyscale intensity controlled by the magnitude of the I vector, but this time a Ramp controls the final value, allowing for control over how the greyscale intensity varies with distance. |
|||||||||
Another “z-buffer information” shader, but rather than use the I vector, a point in space is set, and the distance from that point to the surface point is used to work out the greyscale intensity. Generally, you will want to set the point used to match the co-ordinates of the camera (which means it is really only useful for still images rather than animations, unless you keyframe the relevant camera positions into the shader). Using a different point, rather than the camera location, may still be useful for some effects (eg a fog effect, that grows more dense based on a point other than the camera location). Primary intended use is to allow Transparency shaders to render and take the distance of the object seen through them - this allows depth of field effects on scenes with transparency shaders (eg, if you have a tree painted on a plane with an alpha mask). |
|||||||||
Another “z-buffer information” shader, again using the length of the I vector, however, this time the shader includes the capability to generate a reflection (note that to work properly as an alpha mask, the whole scene should use Mask Distance shaders - the reflection in this instance should return a greyscale value representing how far the reflected ray travelled, and not an actual reflection of a rendered object!). This means the reflection of a distance object on a nearby object will give rise to a “distant” point being written to the z-buffer image (the native tS z-buffer would only store the distance to the immediate surface, not to the reflected surface). Can be used for blurring reflections. |
|||||||||
Mask Distance Ramp Transmission Another “z-buffer information” shader, again using the length of the I vector, however, this time the shader includes the capability to generate a reflection (note that to work properly as an alpha mask, the whole scene should use Mask Distance shaders - the reflection in this instance should return a greyscale value representing how far the reflected ray travelled, and not an actual reflection of a rendered object!). This means the reflection of a distance object on a nearby object will give rise to a “distant” point being written to the z-buffer image (the native tS z-buffer would only store the distance to the immediate surface, not to the reflected surface). Can be used for blurring reflections. |
|||||||||
View Angle Based : |
|||||||||
This shader renders to greyscale, with the greyscale intensity controlled by the angle between the surface and the I vector. Allows for alpha masking of such things as reflection or transmission, which vary in strength with angle. |
|||||||||
As Mask ViewAngle, only a Ramp controls the final intensity. |
|||||||||
General : |
|||||||||
This reflectance shader is designed for use as a layered shader, to allow you to toggle a solid mask render vs an ordinary render, through the use of an external control image, entirely without making any changes to the scene. Note that unlike the other shaders, which produce greyscale images, this creates a solid white render (for use as a “cut out” mask). The layer that the shader is in should be set to 0.99 transparency (ie, as close to completely transparent as possible, without actually being completely transparent). This leaves the shader having no noticeable effect on the render when it is inactive. When the control image is set to make the shader render as a mask, it “swamps” the colours from the otehr layered reflectance shaders by setting its own colour to an extreme value (about 1000 times greater than white!). This means, despite the transparency, it forces the object to render as solid white. It can be layered with any other materials, in effect giving you a global switch outside of the scene to control when you do an ordinary render pass, and a masking pass, without the need to edit or change the scene or its materials. |
|||||||||
![]() |
|||||||||
Mask Shaders Intro |
|||||||||
![]() |
|||||||||