Controlling the Object's Transparency


Basic Scene Setup
Add a simple plane and a sphere. For the sphere change its properties so that the polygons are double sided. This is done by selecting the "Render Options" for the object. Next, add a single light. Ensure that the light casts shadows and that these are filtered shadows. Finally, position the camera appropriately.

Setting Up The Bumps
Select the Material Editor and add a Displacement ShaderLab shader. Bring up its interface and pick MarbleVein from the Enhance:TS - Noise section. For this shader set the Bump Height to 0.3, Veins to 1.0, Vein Scale to 1.0 and Sharpness to 0.02. All other parameters remain at their default value.

Setting Up The Filter
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.

Experimentation
Now you have seen a basic set up for an Alpha Map and Transparency control try a little experimentation. First off, try change the Transparency parameter to different value to see the effect, try both positive and negative. Also, change the alpha values, Alpha1 and Alpha2. Finally, how about make an Alpha Map with three values ?


Home Order About Pricing Mail Previous Next Back