Understanding IFW2_Stencil

Introduction
IFW2_Stencil is an important shader to understand as it allows an image map to control the application of other IFW2 shaders. This means that it can use the image to act like a stencil in much the same way as the material maps work. In fact, IFW2_Stencil can be used to create a material map based on the brightness of the color currently applied to the object.

Step One
The first thing to do is apply an image to the object. So load up an object and use BarsSmall.jpg from the "Images/VideoFX" directory. Click on Automatic Scaling so that the image covers the whole object. The image on the left shows the mapped object.
Step Two
Next apply the IFW2_SpecialFX shader and select Stencil. Select Black as Color1 and White as Color2 (The blends are already set 0% to 100%). Basically, Stencil takes the brightness of the color currently on the object (the BarsSmall image) and turns them into a texture function which is in turn mapped Black to White. The is shown by the picture on the left.
Step Three

Two controls are available that allow the conversion of the image map to be controlled. The first, Parameter 1, controls the brightness. By default this is 50%. If the value is decreased the brightness decreases. Conversely, increasing the value increases the brightness. The image to the left shows Parameter 1 at 25% while the image on the right shows is at 75%.

Step Four

The second control, Parameter 2, controls the contrast. By default this is 50%. If the value is decreased the contrast decreases. Conversely, increasing the value increases the contrast. The image to the left shows Parameter 2 at 25% while the image on the right shows is at 75%.
Step Five
Now that you can see how IFW2_Stencil works you may be sat there thinking "So What?" Well, because the image has been converted to a fully controllable texture function this texture function can control an alpha map which can then be used as a material map or a scale map. So, in the Stencil shader set Alpha 2 to 100% creating an alpha map matching the current color map. Also set both Color 1 and Color 2 to white as we want a consistent base color. Next, add a new shader like IFW2_Skins and select DinoSkin. Finally, to make this shader use the alpha map from the image as a material map go to the Bump Tab and check the DinoSkin's Material Map check box. The images below shows the result with different brightness and contrast settings.

Brightness = 25%
Contrast = 50%
Brightness = 75%
Contrast = 50%
Brightness = 50%
Contrast = 50%
Brightness = 50%
Contrast = 25%
Brightness = 50%
Contrast = 75%

Step Six

You can also add a second texture to the material map so add IFW2_Organic. Select Cellular and enable its Material Map check box. The blank areas are then filled in with the Organic textures just like an normal material map. This is shown on the image to the left. Similarly, the image can be used to create a scale map as shown on the right.


Home Order About Pricing Mail Home Home Back