Next, add a Transparency Shaderlab shader. Again, bring up its interface and pick MarbleVein from
the Enhance:TS - Noise section. As with the displacement shader set Veins to 1.0, Vein Scale
to 1.0 and Sharpness to 0.02. Now, in order to control the transparency with our MarbleVein
shader we need to set up an Alpha Map. To do this set Blend1 to 0.0 and Blend2 to 1.0 and
Alpha1 to 1.0 and Alpha2 to 0.0. By doing this we are creating and Alpha Map that goes
from 0.0 to 1.0 based on the texture function, in this case MarbleVein. Finally, to use
the Alpha Map to control the transparency set Transparency to 1.0.
The Transparency parameter
works like this: With a negative value the transparency is applied all over the object irrespective
of the Alpha Map. So, a value of -1.0 means the object is totally transparent while a value of
0.0 means the object is totally opaque. Now, with positive values the transparency is controlled
in conjunction with the Alpha Map. The basic formula is for any given point is that the transparency
setting is the current Alpha Map value times the Transparency parameter.
Take our MarbleVein
case. In between the veins the texture function is 0.0 which means based on the blends the
alpha value will be 1.0 and subsequently the transparency 1.0 (i.e. 1.0 x 1.0 = 1.0). The gaps
between the value will therefore be transparent. When we get to the veins the texture function
returns 1.0 and the alpha value, again based on the blends, will be 0.0. The transparency
will then be 0.0 (i.e. 1.0 x 0.0 = 1.0). This makes the veins opaque.
|