texmap - Texture map a surface
Surface "texmap" "Ka" n "Ks" n "Kd" n "roughness" n "specularcolor" c "texname" s "maporigin" p "xaxis" p "yaxis" p "zaxis" p "maptype" n "s1" n "t1" n "s2" n "t2" n "s3" n "t3" n "s4" n "t4" n
float Ka=1.0, Ks=0, Kd=1.0, roughness=0.25, specularcolor=[1 1 1] string texname="" point maporigin=[0 0 0] point xaxis=[1 0 0] yaxis=[0 1 0] zaxis=[0 0 1] float maptype=3 float s1=0 t1=0 s2=1 t2=0 s3=0 t3=1 s4=1 t4=1
This shader uses the projection functions in maps.sl to texture-map a surface. The name of the texture file is passed in texname. The parameters maporigin, xaxis, yaxis, zaxis, maptype, s1-4 and t1-4 are passed directly to the decalmap function defined in maps(3sh). Note that the mapping uses standard texture coordinates s and t.
Note that because the t component of a texure map is displayed on a monitor as increasing downward (as described in txmake(1)), textures mapped onto surfaces can easily appear to be upside-down. You should be careful to orient you coordinate system correctly when using projections for texture-mapping. For example, if you are using planar projection you may want to have the y axis of the projection plane pointing down.
The surface is texture-mapped as if it were painted with the image in the file. Normal shading techniques are then used to render the surface, as specified in the normal way. The parameters Ka,Ks and Kd have the usual meanings of ambient, specular and diffuse reflective intensities, respectively. roughness and specularcolor control the sharpness and color of the specular highlight.
Pixar Animation Studios
|