Am Do, den 16.12.2004 schrieb Brian Paul um 16:45:
Felix Kühling wrote:
Hi,
I noticed some strange rendering artifacts with the Savage that are caused by very large texture coordinates on GL_REPEAT'ed textures. Very large means that it gets noticeable with texture coordinates >255 or <-256. A real world example that exhibits this problem is Torcs with the "Spring" track. Right at the start the effect can be seen very nicely. The track before the start line shows artifacts, directly after the start line everything looks fine.
My question is, should I consider such problems an application bug or would it be wise to implement a workaround? I was thinking of implementing a TNL pipeline stage that normalizes texture coordinates.
That could be tricky. If you're thinking of doing something like t' = t MOD maxValue, that'll often cause incorrect interpolation.
The trick is that you have to change (add or subtract) all texture coordinates in one primitive (e.g. triangle) in the same way, that is, the relative differences between texcoords must not be changed.
That's exactly what I had in mind.
I've already hacked up something and the result looks good. It computes the max and min coordinates per direction and then subtracts floor((max+min)/2 + 0.5) from all texture coordinates in the vertex buffer. This is done only for texture coordinates for which the wrapping mode is GL_REPEAT. I havn't measured the performance, but I didn't notice a major difference. I guess the Savage has other bottle-necks. ;-)
A patch is attached for anyone who wants to see the gory details.
Looks like you've got a good understanding of the problem.
I was also wondering if other hardware has similar problems. I'm
attaching a small test program that demonstrates the effect and a
screenshot of what I get on my ProSavageDDR. With software rendering the
output is almost correct. Compile with
cc -lGL -lGLU -lglut teximage.c -o teximage
If the hardware implements texcoord interpolation with fixed point you can imagine how the bits are used.
If the largest texture dimension is 2048, you'd need at least 11 bits to address all texels.
Then you need some sub-texel bits for accurate interpolation and for computing the weighting for linear sampling. You probably need 10 bits there.
Allocate another bit for the sign.
Finally, whatever bits are left in the interpolator will limit the maximum coordinate range. If the interpolator is 32 bits, then 32 - 11 - 10 - 1 = 10. So the max coordinate would be 2^10 or 1024.
Maybe the savage hardware has a narrow interpolator, or allocates the bits differently.
When you increase the texture coordinate offset you can see the artifacts get worse with every power of two. So you can literally take away bits available for the interpolation on the Savage by making texture coordinates bigger. :)
I believe one of the differences between "pro" and "consumer" cards is the accuracy and range of interpolators.
Or maybe more expensive hardware does the normalization per hardware-primitive before it starts interpolating.
It might. An engineer with one of the major IHVs once told me a few things about the differences between the pro and consumer cards.
-Brian
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ -- _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel