Shaders



texbomb - A texture bombing shader



The texbomb shader is used to apply multiple copies of a texture on a surface, with psuedorandom jitter and rotations. It can also make color variations in the texture.

For the example, here is a simple texture of a leaf, designed in Photoshop.


maple.pict

The texbomb shader applies the single leaf texture repeatedly with variations.


To prepare the model for the texbomb shader, follow these steps:

1. Create the texture image as a PICT file..

2. Create the transparency image. It is also a PICT file.. It should have exactly the same dimensions as the texture image. It should use grayscale to indicate the transparent areas. A black pixel indicates a transparent area. White pixels mean that the corresponding pixel in the texture image is opaque. For the leaf texture, here is the transparency image:


maple.pict.a

3. Create a Renderman RIB file to convert the PICT files to texture file format.

The RIB file used to create the leaf texture files contains two lines:

MakeTexture "maple.pict" "leaf.tex" "clamp" "clamp" "box" 2 2
MakeTexture "maple.pict.a" "leaf.texa" "clamp" "clamp" "box" 2 2

This RIB file tells MacRenderman to convert the PICT files called "maple.pict" and "maple.pict.a" to texture files called "leaf.tex" and "leaf.texa", respectively.

4. Process the RIB through MacRenderman. Start the RenderApp program, and select the "Render" command from the "xxx" menu. Select the RIB file, and it will run the conversion.

5. Move the leaf.tex and leaf.texa files to the "Shaders & Textures" folder, in the System folder.

6. Open the model in Presenter, and open the attributes window for the mesh object to apply the texture on. Open the Attributes window and select the Shaders view. Drag the texbomb shader icon to the attributes bin for the object.

7. Double click on the texbomb icon and enter the desired parameters.

Parameter

Data Type

Usage

Example

scale

Positive Integer

Specifies the dimensions of the bombing grid.

scale = 4 sets a 4-by-4 grid on the surface

frequency

float 0.0 to 1.0

Controls the number of textures applied.

frequency = 0.5 applies texture to half of the cells in the grid

layers

Positive Integer

Specifies the number of bombing passes

layers = 2 bombs the grid twice

noise_scale

float

Scales the sampling interval for the noise() function.

rot_min

float

The minimum rotation range for the object, in degrees

rot_min = 15 will rotate the texture at least 15 degrees

rot_max

float

The maimum rotation range for the object, in degrees

rot_min = 270 will rotate the texture no more than 270 degrees

texture_name

string

The name of the texture color map file

texture_name = "leaf.tex"

alpha_name

string

the name of the transparency map file

alpha_name = "leaf.texa"

vary_color

RGB color

maximum color variation for the red, blue and green color channels

vary_color = color(0.5, 0, 0) varies the red color channel in the texture map plus or minus 0.5 for each cell

shading_method

Integer 0, 1 or 2

Specifies the shading method:
0 = constant shading
1 = plastic shading
2 - matte shading

shading_method = 0 will use the plastic shading method

Ka

float 0.0 to 1.0

ambient lighting value

Kd

float 0.0 to 1.0

diffuse lighting value

Ks

float 0.0 to 1.0

specular lighting value

roughness

float

Used with the plastic shading method

specular_color

color

Used with the plastic shading method

Revision history -

5 January 1997 - The maximum jitter was reduced to prevent clipping of rotated textures.


View the texbomb.sl shader source

Download the texbomb package for Presenter 3D

 


HOME

NEW

LINKS

GALLERY

ARTICLES

PLUG-INS

RENDERMAN

Switch to Frame View




Copyright © 1997 by WebNation
All trademarks are the property of their respective holders