On Wed, 24 Mar 1999, Brian Paul wrote:

> Marc Jauvin wrote:
> > 
> > Hi,
> > 
> > I have some work to do with respect to MIP mapping and I would like to know
> > where I can find information on how the texture selection works and where
> > exactly in the code it can be found.
> 
> The OpenGL spec is a good place to learn how it works.
> 
> In Mesa, look in src/triangle.c for any function with the name "lambda"
> in it.  Lambda comes from the definition in the spec.
> 
> To be honest though, Mesa's mipmap computation isn't 100% correct.
> The mipmap demo from the Red book comes out with curved mipmap level
> transitions instead of straight lines.  Compare Mesa's output to
> the book's color plate.  I've been stumped by this for over a year.
 
Since the choice of MIPmap level is determined by the size of the
pixel when projected into texture space, I wouldn't expect those
transitions to be straight. (Although the OpenGL specification allows
considerable leeway in picking MIPmap levels - and it possible that
some algorithm choices would produce straight line - although that
would be mathematically 'wrong' I think).

Here is why I think you are getting (correctly) curved map transitions:

At the top and bottom edge of that long polygon, the texels are sheared
(in screen space) but down the centerline, they are almost square. Hence
when you project the screen pixel into texel space, you'll get (more or less)
rectangular pixels in the center of the polygon and sheared parallellograms
at the edges of the polygon.

That makes the S (or is it T) dimension of the pixel different at the top
and bottom of the polygon compared to the center - which in turn will lead
to a curved transition line. If you didn't do that, the texture would
(potentially) alias.

So, why are the lines in the RedBook image (Plate 20) straight?

Well, I don't believe that picture in the book was really rendered by OpenGL.

Some of the pictures in the first revision of RedBook were done in IrisGL
and some by SGI's Performer library - which hadn't (AFAIK) been ported to
OpenGL by the time the RedBook was printed.

In IrisGL, the MIPmaps (if implemented) were computed inside the IrisGL API,
(unlike OpenGL where you can build your own MIPmaps) so it would be
impossible to do the trick of colouring each level of map differently
if you were rendering that image in IrisGL.

So, I strongly suspect that the picture in plate 20 is faked by a set of
differently coloured rectangles rather than as a single textured polygon.

I can't prove that though.

Anyway - I think Mesa does it right - so don't sweat it.

Steve Baker                (817)619-2657 (Vox/Vox-Mail)
Raytheon Systems Inc.      (817)619-2466 (Fax)
Work: [EMAIL PROTECTED]      http://www.hti.com
Home: [EMAIL PROTECTED] http://web2.airmail.net/sjbaker1

Reply via email to