Re: NEED HELP ON TEXTURE MAPPING!

New Message Reply Date view Thread view Subject view Author view

Alejandro Saez (cano++at++krusty.engr.sgi.com)
Mon, 2 Mar 1998 13:06:15 -0500


On Jul 3, 2:27pm, Andreas.Ekstrand++at++saab.se wrote:
> Subject: NEED HELP ON TEXTURE MAPPING!
> Hello!
>
> I have a problem trying to map satellite textures on an ASD
> terrain mesh. I have also observed this problem when mapping
> textures on an "ordinary" static terrain mesh. The polygons
> match perfectly so the texture mapping must be the problem.
> The texture images themselves also match perfectly when I
> watch them unmapped. But as soon as Performer maps them on
> to the polygons there is disturbance between these texture
> pieces.
>
> My satellite textures are 2048x2048 each and between these
> pieces you can observe an annoying miscolored line when they
> are mapped. I figure this is due to Performer's method of
> interpolating, or blurring, the texture pixels to texels so
> they cover the whole surface. I have come the the conclusion
> (right or wrong?) that Performer filters the texture with some
> kind of average kernel, and that in the outer borders of the
> texture the pixels are blurred with the pixels on the opposite
> side of the image. This way unwanted lines with different colors
> appear between the texture pieces and in the outer borders of the
> terrain.
>
> Is there anyone who knows how this phenomenon can be avoided?
> I guess one either would want to totally eliminate the average
> filtering between the different texture pieces, or perhaps it
> would be even better if one could just avoid filtering the pixels
> with the ones on the opposite side.
>
> I know that some parts of my explanation of the problem might
> sound a bit confused or mixed up...if so, please ask me to try to
> describe these parts better. I sure hope somebody recognizes this
> problem and has a solution.
>
> Sincerely,
> Andreas Ekstrand, SAAB Simulation Centre, Sweden
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-- End of excerpt from Andreas.Ekstrand++at++saab.se

Andreas,

        What you seem to describing, is part of the reason of what you are
experiencing (if I got the problem right) but not all of it. What's really
happening is that the textures are being clamped. When textures are repeated,
then at the edge of the texture, the same texture is aligned "side by side",
and thus repeated, then there really isn't any edges. The problem is when you
have a clamped (no tiling) textures. There, when the texture reaches it's final
coordinate space (either 0 or 1 on u,v) and if there still is "polygon left"
the texels that get mapped into the polygon past the texture's edge are the
"edge texels" extended to the rest of the polygon. To see this in a more
evident way map a clamped texture to a small center area of a polygon and you
will see the edge texels repeated. At the edge, the interpolation kernel is
probably using this "extended" edges to do the interpolation. I can think of
the following solutions, some of them, I don't know how to implement :
        a) Don't map the corner and edges of the texture to the corners and
edges of the geometry, give yourself 1 to 3 texels (this will depend on the
kernel). For example, map texel 3,3 to coordinate 0,0 of your geomtery and so
on. Not very elegant but should eliminate the annoying line, but probably gives
you a matching problem among the tiles. Then again each tile could have 1-3
texels in common with the next coincident tile.
        b) Select a repeat (tiling) mapping. At the edges the opposite edge of
the texture will be repeated, depending on the texture you might get away with
it.
        c) I've seen some texture mapping techniques that mirror the texture to
do the kernel convolution at the edges. This is like putting a mirror at the
edge of the geometry, so the last edge of the texture gets mapped as the first
edge past the end of the geometry. The second before last edge maps to the
second past the end and so on. This is known as the "images" method for solving
boundary conditions in finite differences computations. This solves a potential
problem with solution b) which is: What happens if the first edge of the
texture(the one that is aligned with the last edge when tiling) is quite
different from the last edge? Well at the edge you will able to tell the
texture is being tiled because both edges are so different that a boundary can
be seen (it isn't a seamless tile). When doing mirroring, you avoid this
problem, because the same texels are used to do the convolution. The problem
is, I don't know if OpenGL can do this or gives you the means to implement it.

        d) Tell OpenGL/Performer to use the next tile to interpolate at the
edges. The problem is... ditto. I don't know if you can do this or a way to
trick it.

        Hope this helps,

-- 
------------------------------------------------------------------------
Alejandro Saez
Software Engineer
Silicon Chile S.A.
                                        Avda. Santa Maria 2560
E-mail: asaez++at++silicon.cl              	Providencia
Phone:  +56 (2) 203 3371 		        Santiago
Fax:    +56 (2) 203 3370                Chile
------------------------------------------------------------------------
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:40 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.