TG PACK 3, ABOUT RAMPS, GRADIENTS and POST-PROCESSING
Many of the shaders in TG Pack 3 use Ramps and Gradients to control their processing, and this section gives a bit of an insight into what they are, and what advantages they bring. Purchasers will find this information in the help files too. First, some definitions, as used within TG Pack 3 - I take no responsibility for these definitions matching exactly their use in other packages or contexts! Ramps A Ramp is a grayscale image, which controls the value of a variable within the shader. The value is read in from the grayscale image - the position along the Ramp will be controlled by factors such as distance from camera or angle of view. The grayscale value at that point in the image is then used to set a variable, such as fog intensity, or reflection strength, and so on. Using a ramp takes the place of having a range of values set in the shader itself. Gradients A Gradient is a color image, which controls the color value of something within the shader (diffuse color, specular color, etc). The color value is read in from the Gradient, with the position along the Gradient being controlled by factors like the distance from camera or angle of view (often those may be modified through accessing a Ramp). This is in place of having color values set in the shader itself. The Advantages of Using Ramps & Gradients Ok, so why would we bother with Ramps or Gradients? Here are some advantages! 1) Using a Ramp or Gradient to read in a value often cuts down on the processing that a shader needs to do. For instance, it has no need to calculate the blend between two colors, as that is "hard coded" into the Gradient. 2) When the shader itself controls a parameter, you are limited in what you can create. You can only have as much variation as there are variables in the shader - for example, the TG Slope Bands shader only allows the blending of 3 colors, since that’s the number of color parameters provided in the shader interface. By using a Gradient, you can then move the blend between as many (or as few) colors as you wish, allowing for much finer control over the result. Can you imagine trying to control 10, or 20, or more color values in a shader?! Using a Ramp to control a variable brings a similar benefit - for instance, the TG Glow Transparency shader only allows for 3 angles at which the transparency changes. With a Ramp, though, you can have as many transparency changes with angle as you wish! Not only that, but you can vary the value in a non-linear way, or with sudden breaks and changes, with as many repeats as you like, or with randomization in the Ramp too - all things that would be difficult to define mathematically via a few shader controls. Disadvantages The world is never perfect, so there remains a disadvantage to using Ramps and Gradients, that being that you need to create the Ramp or Gradient image separately, and if you want to tweak an effect, then you need to generate a new Ramp or Gradient to do so - and that means work in a separate piece of software. For instance, if you want a fade in color from orange to blue, you’ll need to have a Gradient that fades from orange to blue - you can’t just adjust the color within the shader. Of course, over time, you can build up a library of Ramps and Gradients, which will always be to hand. Where do I find Ramps & Gradients? There are sample Ramps and Gradients provided along with the shaders, in the following folders (these assume you are using trueSpace 5, and that you installed it to the default directories - if not, simply look in your trueSpace 5 folder and follow the path from there!) : C:\trueSpace5\ShaderLab2\Shaders\TG Pack 3 SL2\Ramps\C:\trueSpace5\ShaderLab2\Shaders\TG Pack 3 SL2\Gradients\ You can store your own Ramps and Gradients wherever you like, but you might like to keep them in these folders for ease of use in future!
Two of the 65 ramps provided with TG Pack 3. The ramps control transition points between values
Two of the 23 gradients provided with TG Pack 3. The gradients replace color parameters
Several shaders in this collection generate grayscale images, called Masks, and this section explains what they are used for.
An alpha mask is a grayscale image which controls the transparency of an image or layer in an art package or in tS itself. For art packages, black is transparent, and white is opaque, with grays having partial transparency. These shaders let you create images for use as Alpha Masks to alter a rendered image (they do not produce final rendered images on their own).
It can seem like a good idea to try to do everything in one render pass. In truth, though, this is quite a limited approach! For instance, if you change an effect such as depth of field or fog, you have to re-render in order to get a final image or animation with that effect in place. Also, there may be some issues with the way a certain type of processing is done within trueSpace which you can't get around. So although it may seem awkward at first to do some steps outside of your modeling / rendering software, it is the approach most professional work follows for reasons of finer control and reduced need to re-render. The Mask shaders in TG Pack 3 are intended to make that option available for trueSpace. Here are some examples, just to uncover the benefits this approach brings : 1. Dividing up the different material channels, such as specularity, diffuse, reflection, etc, and rendering these separately, to add them back together again later, so you can :
2. Creating alpha masks based on distance is like creating a z-buffer in the form of an image, and lets you add effects such as depth of field, fog, etc. 3. There are issues with depth of field in trueSpace - eg, a distant object seen through a nearby pane of glass remains unblurred (because the tS z-buffer only sees the nearby point on the surface of the glass). A similar situation occurs with transparency, for the same reason. Using the right Distance Mask shader can overcome these limitations.
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 grayscale alpha mask, based on distance, as a bump map?
Don’t worry, the help file for TG Pack 3 comes with a page of ideas on how to use alpha channel masks and post-processing, including guides on how to get depth of field, depth cue, Fresnel effects, etc! Of course, these are just ideas to start you off, as there are many potential uses for post-processing.
TG Pack 3 costs $10, and is available for purchase and immediate download - click now!
TG PACK 3 SHADER LISTING, PAGE 1 |