Article View: comp.graphics.algorithms
Article #65Re: Unusual texturing problem.. or is it?
From: David Matiskella
Date: Tue, 10 Sep 1996 00:00
Date: Tue, 10 Sep 1996 00:00
53 lines
4002 bytes
4002 bytes
On Tue, 10 Sep 1996, Lord Shaman wrote: > I'm not. I'm writing a polygon drawing engine > for TRIANGLES only, which can have any orientation in space and each > vertex has a seperate texture space co-ordinate (u,v) in the texture > pixmap. This allows stretched, distorted and scaled textures without > hassles. A scanline renderer would be prefferable, but is not necessary. > (Constant Z lines mean a lot of buffer changes in SVGA unless I use > double buffering) Also, linear interpolation will NOT do, it is far too > inaccurate to give satisfactory results. This game will be realease (if > ever) at a time P6s/K6s will be popular and therefore will have a tad > more power than your avarage computer today. Double precision floating > point is used everywhere so far, so no fixed point rubbish please. > (A lot of FAQs assume you're writing for a 386sx, which is NOT true.) > Quake's monsters use the method I just described. And no, John Carmack > doesn't want to tell me how he did it. > If you have ANY information, wether it is just some maths you saw once, > a URL, or a FAQ that is more practical than the comp.graphics.algorithms > FAQ, or a tutorial that has more than how to do a DOOM engine, please > email me. A book title is totally useless. > > thanx in advance . . . the Lord > Shaman. > > ---------------------------------------------------------------------- > "My aim is life is to become immortal, or die trying." > http://www.nlc.net.au/~shaman or mailto:shaman@nlc.net.au Well if you are planning that far ahead you might want to consider direct 3d. But to answer your question. Heckbert's web page has a complete mathematical explanation of how to do it. YOu might also want to look at chris Heckers texture mapper from Game Developer magazine. He has the best explanations of correct rasterization I have every seen. YOu will need to add Z buffer support but that shouldn't take more than a couple hours. Lastly is my simplifed expanation. 1) divide your texture coordinates by Z which makes them linear in screen space 2) interpolate the linearized texture coordinates and 1/z across the polygon 3) At each pixel divide u/z and v/z by 1/z to get the u and v's. There are loads of ways to speed this up focusing mainly on the fact that gradients can be quickly calculated for triangles and ways of avoiding the divide per pixel. The common ways of avoiding the divides every pixel are span line subdivision, triangle subdivision where you break the triangle into smaller parts, lines of constant Z, and quadratic interpolation rather than linear. These have all been hashed out in detail in this forum over the past year. Lastly, I wouldn't be suprised to learn that Quakes monsters are linearly interpolated. Over the relatively small delta Z of a monster the effects of perspective are not that noticeable especially since the average triangle size is pretty small. David Matiskella matiskel@aa.washington.edu
Technical Details
Message-ID:
<Pine.OSF.3.91.960910035753.28579A-100000@curtis.aa.washington.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3235299D.489D@nlc.net.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f6aa,73fb089eb6a7dfd X-Google-Attributes: gid10f6aa,public X-Google-Thread: 109d8a,73fb089eb6a7dfd X-Google-Attributes: gid109d8a,public X-Google-Thread: fdc2a,73fb089eb6a7dfd X-Google-Attributes: gidfdc2a,public X-Google-Thread: 10d67e,73fb089eb6a7dfd X-Google-Attributes: gid10d67e,public X-Google-Thread: f9e32,73fb089eb6a7dfd X-Google-Attributes: gidf9e32,public From: David Matiskella <matiskel@aa.washington.edu> Subject: Re: Unusual texturing problem.. or is it? Date: 1996/09/10 Message-ID: <Pine.OSF.3.91.960910035753.28579A-100000@curtis.aa.washington.edu> X-Deja-AN: 179682404 references: <3235299D.489D@nlc.net.au> content-type: TEXT/PLAIN; charset=US-ASCII organization: University of Washington mime-version: 1.0 newsgroups: comp.graphics.algorithms,comp.msdos.programmer,comp.os.msdos.programmer,aus.mathematics,sci.math