|
Texture Mapping
Channel Selection
Using the renderman shading language the red channel of a texture
map was selected and made transparent.
Texture Map
 |
Render
|
Select the red channel:
red = comp(surfcolor,0)
Subtract the red values from the opacity:
Oi = color(1-red,green,blue);
The red values are subtracted from the texture map leaving areas that
were red transparent, and areas that were white with only the blue
and green channels visible.
Composited Image in Photoshop

(Background painting by Dutch artist Pieter
Claesz, 1624.)
Maya Scene
Shader Settings in Maya

This set of sliders in Slim be used to effect the redness, blueness
and greenness of a texture map, as well as, move the texture in
the s and t direction.
Code
/* basic texture mapper */
surface
texture_mapper( float Kd = 1,
s_offset = .3, /*Offset of texture in s direction*/
t_offset = .3, /*Offset of texture in t direction*/
redness = 1, /*amount of redness in texture*/
greenness = 1, /*amount of greenness in texture*/
blueness = 1, /*amount of blueness in texture*/
switch = 0; /*turning red transparency on or off*/
string texname = "") /*texture to apply to object*/
{
color surfcolor = color(1, 1, 1);
normal n = normalize(N);
normal nf = faceforward(n, I);
Oi = Os;
/* Use the texture function if user spe cifies a texture file*/
if(texname != "") {
surfcolor = texture(texname, s + s_offset, t + t_offset);
/*pull the colors out*/
float red = comp(surfcolor,0);
float green = comp(surfcolor,1);
float blue = comp(surfcolor,2);
surfcolor = color(red*redness,green *greenness,blue*blueness);
/*Make the red values transparent*/
Oi = color(1-red,green,blue);
}
color diffusecolor = Kd * diffuse(nf);
Ci = Oi * Cs * surfcolor * diffusecolor;
|