CompuServe Messages

#Texture Mapping

    28-Sep-94 17:35:56
Sb: #Texture Mapping
Fm: Marion K. Marks 70700,2777
To: Chris Doner 76702,776
Did you ever watch one of those old cartoons (the one I'm thinking of is a Popeye cartoon) wherein someone paints checkerboard tiles onto a floor by using checkered paint? <grin> Well, texture mapping is much like that magical checkered paint that exists only in cartoons and the imagination. It basically applies a bitmapped picture onto the surface of a 3D object. The object itself doesn't have to have additional detail, just as the floor in the cartoons didn't have to have real tiles thanks to the magical checkered paint. But like the checkered paint, it's an illusion. The floor had no real tiles, just squares of black and white color that were flat on the floor. There are two main methods of applying textures in 3DS: bitmaps and .SXPs. Bitmaps are just ordinary bitmapped pictures such as would come out of PhotoShop, PhotoStyler, Fractal Designs Painter, Corel Photo-Paint, a typical scanner, a digital camera, or even Windows Paintbrush. 3DS needs "mapping coordinates" to know how to take this rectangular image and apply it to a 3D surface. These coordinates can be applied manually (Planar, Cylinderical, or Spherical), during Lofting (Mapping ON in the 3D Lofter), through Face or Box Mapping, or by a .PXP or .AXP (the latter needs arbitrary mapping coordinates applied first, but then it replaces them with its own — SKIN.AXP, for instance, permits mapping coordinates on the skinned object, while most particle systems [Fireworks, etc.] use the texture maps for other purposes such as changing the colors of the particles over time). Since these ARE bitmaps we're talking about, zooming in on them past their resolution will result in the pixels becoming clearly visible, which is usually not the desired effect. .SXPs on the other hand compute the color of each pixel procedurally in 3D space. As such, they need no mapping coordinates, and will faithfully follow the shapes of even the most wildly intricate surfaces. They can be zoomed in on without limit. But in general they aren't quite as realistic as scanned bitmaps can be, particularly for organic materials such as wood and fur (Schrieber's Texture Factory .SXPs do a fantastic job of simulating marbles and granites and the like). The term "TEXTURE mapping" should actually be called "COLOR mapping." It simply applies the color of the bitmap pixels onto the surface. At full strength (Texture slider at 100), the underlying Ambient and Diffuse colors of the object simply don't matter, as the Texture bitmap provides ALL of the Ambient and Diffuse color. (Specular color still has an effect, but even that can be overridden with Specular Mapping in Release 3 and later!) There are other types of mapping, though. Bump Mapping is often confused with Texture Mapping due to the unfortunate choice of the term "texture mapping" to refer to color mapping. Bump mapping uses the luminance of the pixels in the bitmap (or .SXP) to distort the normals of the surface, causing the renderer to shade them as if they were elevated or inset from their normal position. Do note that the surface isn't REALLY elevated or inset — it is only SHADED as if it WERE! This is very important. If, for instance, you used a repeating gradient from black to white and mapped that onto a rectangle to give the effect of a flag in the wind, it would look fine when viewed face-on assuming there was light coming from proper angles to provide the necessary shading. But if you viewed it edge-on, the flag would be revealed to still be an absolutely flat rectangle. Yost IPAS Boutique #6 provides a Displace .PXP (a demo version of which is in the Library) which DOES REALLY elevate or inset vertices of an object according to the intensity of a bitmap image, thus providing for real what Bump Mapping can only fake through shading. Displace needs LOTS of vertices, though, and so is much slower in rendering and can make for Really Big .3DS and .PRJ files. Other types of mapping include Opacity (specifying which parts of an object are transparent and opaque, and by how much, on a per-pixel basis), Reflection (faking reflections by mapping an image in special ways that don't require mapping coordinates), Shininess (determining the strength of the specular highlights on a per-pixel basis), Specular (determining the color of the specular highlights on a per-pixel basis — this works great for faking soap bubbles and the like), and Self-Illumination (for having parts of objects appear to glow — handy for faking LED indicators on a control panel and the like). The bitmaps themselves can be individual bitmaps or frames of an animation. The latter allow some truly wonderful effects. Many .SXPs can also be animated — check out WATER.SXP from the IPAS Boutique #3 for a dramatic example.