Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!sdd.hp.com!wuarchive!udel!rochester!kodak!uupsi!sunic!liuida!isy!lysator.liu.se!zap From: zap@lysator.liu.se (Zap Andersson) Newsgroups: comp.graphics Subject: Re: Texture mapping onto 3-D objects Message-ID: <457@lysator.liu.se> Date: 21 Dec 90 11:47:03 GMT References: <1737@winnie.fit.edu> <2674@gould.doc.ic.ac.uk> Sender: news@isy.liu.se (Lord of the News) Organization: Lysator Computer Club, Linkoping University, Sweden Lines: 92 ra2@doc.ic.ac.uk (Roger Attrill) writes: >In article <1737@winnie.fit.edu> rao@sun9.cs.fit.edu (Rao Ranjan /ADVISOR-Shoaff) writes: >>Hi netters, >> >>Could anybody provide me some information about texture >>mapping. I would like to know, if there is any >>algorithms for mapping 2-D polygonal textures ( random ) on to 3-D objects Well, not 2d POLYGONAL surfaces, but 2d BITMAPPED surfaces! But on the other hand, you may use the same approach... more below... >Yes. I've written a machine code version of RayShade V3.00. (Yes I'm crazy!). >I've incorporated this feature (along with others) into the program, and it >works a treat. There is a problem in that seeing as the 2D texture (a logo >for instance) *is* 2D, then the person creating the scenefile has to do most >of the positioning work, - scaling,rotating etc. I've initiated 2D textures >to have unit size in +x and +z directions with bottom left of the picture >at the origin. The normal points in the -y direction. The texture is then >mapped *through* an object - not *around* an object. This means it is best >suited to mapping to flat surfaced objects. However, nice effects are achieved >when mapping a face onto a distorted sphere. Aha, this is 'projective' texture mapping. Another approach of this is different TYPES of projection, i.e. 'BALL' and 'CYLINDER' projections are most common, i.e. for 'cylinder' you might use the ANGLE in the x/y or any other (perhaps arbitrary) plane as ONE 'texture map coordinate' and the DISTANCE from that plane as the other. 'BALL' type is really polar coordinates from a central point (perhaps in relation to an arbitrary plane, if you like) > If anyone has a method of wrapping an image *around* an object, I'd be >most interested. I'd imagine this would imply some intensive computation Well, it's really VERY simple: See to ut that your routine that intersects a ray with an object also returns the 'local surface coordinates' for that primitive! For a sphere, it's the 'latitude' and 'longditude', for a superquadric it is the parameters (quite simple B->) andfor other surfaces you may use different tecniques depending on primitive. But in some cases, projective mapping is more appropriate, and in some, 'wrapping' is more appropriate, i.e. Wood patterns look best projected, but a picture of a girl should be WRAPPED onto a folded polygonal mesh, to make it look like a folded/wrinkeled/whatever photo of the very same girl! >and would not be globally useful. Would different algorithms be needed for >each primitive type. eg for cones *and* superquadrics!!! God forbid! What >about mapping pictures of farms and cows onto fractal landscapes. Not a real problem, unless you REALLY want them to 'stand out' of the surface. THen you are beyond even simple 'bump mapping' and into 'displacement mapping' i.e. the surface is ACTUALLY DISPLACED by the map, no tricks. This, however, is 'slightly' easier (very large understatement B->) to do in polygon based (Z buffer and the like) renderers than in raytracing. Imagine the intersection calculation for a sphere, whose surface is displaced with a fractal noise function, PLUS a wavy pattern of concentric waves? Nah, then I stick to bump-mapping, a 'slight' bit easier (same understatement) What you need to do THEN, is that you intersection routine must not ONLY return the local coordinates, but also two vectors that show the directions in wich these coordinates increase. Then your mapping should get a hold of the delta in color on your 2d image (both delta in X and delta in Y) and then twiddle ye normal vector the 'delta' amount along the vector you just got. Needless to say, my raytracer (commercial product) does all this. > Maybe >even some people skiing down snowy mountaintops. Shadows might be hard >though!! I'll try to render such an image. Would be fun ;-) >Time to abort! Yeah, rite, system halted and all that.. > Merry Xmas Merry to all netters! > Rog. >=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- >| Roger C. Attrill | I don't always think therefore I'm not necessarily. | >| ra2@doc.ic.ac.uk | I couldn't have done better unless I did it myself. | >| Imperial College | and other variations on a theme. | >=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > -- * * * * * * * * * * * * * * * * * * My signature is smaller than * * yours! - zap@lysator.liu.se * * * * * * * * * * * * * * * * * *