CompuServe Thread

#Texture Mapping

7 messages in this thread
#126080From: Marion K. MarksSep 28, 1994 5:35 PM
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.
#126344From: Chris DonerSep 29, 1994 11:10 PM
Wow. Thanks for taking the time to give me such a complete answer. This gives me food for thought.
#126912From: Marion K. MarksOct 3, 1994 3:07 PM
More on mapping coordinates: Imagine someone mails you a picture of a logo, a model of, say, a chair, and a letter asking you to paint the logo onto the chair model. That's all the letter says. But you don't know how big the logo should be, or where on the chair it should be, or in what orientation, or whether it should be painted only once or in a repeating pattern. 3DS has the same problem if you just give it a shape and a material with maps. It has no way of knowing HOW to apply the maps to the object. This is what mapping coordinates are for. As I said before, there are seven types: the three manual types (Rectangular, Cylinderical, and Spherical), the more-automated Lofted, Box and Face mappings, plus IPAS .PXP/.AXP-modified mapping. Starting with the manual types: Rectangular mapping works as if one took an insubstantial rectangular picture that was magically enchanted so that anything it passed through would take on the colors of the picture, and you then passed the rectangle over an object. Each pixel of the picture that intersects the surface of the object causes that tiny spot of the object to take on that color (or opacity or bump deformation or whatever). Another way of looking at it is to imagine a rectangular picture wherein each pixel casts a ray of light in both directions from it, exactly perpendicular to the rectangle itself, and extending to infinity in both directions. Where any of these rays intercept the mapped object(s) or element(s), they paint the surface with their individual pixel colors. Cylinderical mapping imagines a picture rolled up into a cylinder. This time, think of it as rays of light being emitted from the surface of the cylinder both inwards towards the center and outwards towards infinity, but always perpendicular to a plane tangent to the cylinder at the point the pixel in question. Again, any object so mapped which intersects these rays gets painted on accordingly. Usually, a cylinderical map is positioned so that its center and axis match up with the center and an axis of the object(s) or element(s) to be mapped, but this need not always be the case. Interesting mapping effects can be done by having the cylinder off-center or even completely outside the object. For spherical mapping, imagine the picture wrapped around a globe and projecting its rays of colorization inwards towards the center and outwards to infinity, with each ray being precisely perpendicular to a plane tangent to the sphere at the pixel. Again, the center of mapping need not, but usually does, coincide with the center of the mapped object. You can "tile" any of the manual types, causing the picture to repeat horizontally and/or vertically. Note that, for rectangular, the aspect ratio of the mapping icon should be as close as possible to the aspect ration of the picture it contains, or else the picture will appear distorted (compressed or expanded). Lofted mapping basically follows the loft path in the 3D Lofter and applies coordinates to the resulting object so that the pictures appear wrapped perfectly around the object. You can set tiling options here as well. Box mapping is like rectangular mapping but works semi-automatically. You simply specify a material for the Front, Back, Left, Right, Top, and Bottom of the object (as seen from its local coordinates — to verify those, do an Object Pivot on it from the Keyframer), and those are applied with mapping coordinates that act as if the rectangles for each of the three dimensions were exactly sized to precisely enclose the object, but no larger than that. Face mapping applies mapping coordinates to each individual face or group of coplanar faces. This is set on the material layer and overrides all other mapping coordinates. It results in mapped patterns that completely cover the surface, mapped to each face. The results aren't easily predictable but can be quite beautiful. Check out the sample FACEMAP.3DS file, and apply the sample FACEMAP METAL BUMP material to the polyhedron. Finally, certain .PXPs and .AXPs can apply their own more sophisticated mapping at modeling (.PXP) or rendering (.AXP) time. In the case of .AXPs, you must first apply any arbitrary mapping coordinates (default rectangular will work fine) to the .AXP stand-in object so that the Renderer doesn't abort with an "Object needs mapping coordinates" error before the .AXP even gets a chance to run. Those arbitrary coordinates will usually be completely replaced by the IPAS-generated coordinates, though, but it may use them as a basis. For example, DISINTEGRATE chooses the color of each particle by the dominant color of the original mapping of the object at that point. FIREWORKS, on the other hand, completely ignores the original coordinates and instead uses the applied map as a time/distance color chart to control the color of each of the fireworks particles and their tails over time.
#127060From: John EllisOct 4, 1994 9:40 AM
That was a helluva explanation! <g> Was that a stream of consciouness or do you have a helmet plugged into your cortex? I'm not razzing just rather amazed. 🙂 John
#127080From: Brian Rudolph [Adesk]Oct 4, 1994 11:30 AM
Excellent work. Are there more comming? I would like to put them all together in a thread for people to download. So far, I count two messages of this nature, did I miss one? -Brian
#127911From: Marion K. MarksOct 8, 1994 8:59 PM
Thanks, folks. I'm told I have a knack for explaining things. That was all stream of consciousness. Brian, if you really think they're worthy, feel free to collect any of my posts into a file.
#126442From: Nik Grant [adesk]Sep 30, 1994 10:37 AM
Hey, thanks for taking the time to illustrate this!