Pixel perfect texture mapping problem. Nvidia vs ATI?

Started by
6 comments, last by Daan 14 years, 1 month ago
Recently I've been trying to solve a problem I have with mapping a texture on screen with pixel perfect precision. It seems to work just fine on my PC and in OSX however there is some distortion on other PC's. The main difference I can think off that's causing this problem is the graphics card. I'm using an ATI graphics card myself and the other PC has an nVidia card. Before I'll go any further I'll show you what it looks like (with 300% zoom): http://img521.imageshack.us/img521/6827/texturemappingproblem.png I'm using perspective projection however the camera is moved at a distance where objects rendered at the center of the z-axis have the same size as their texture. I experimented with texture settings a bit but it didn't seem to make any difference. I've read about texture coordinates being in the center of pixels, which meant you had to translate them half a texel to overlap pixels and texels correctly. However I'm not sure if this applies to openGL as well. Has anyone seen this problem before or maybe any guesses what it could be? Any help is welcome ^^
Advertisement
NVidia drivers provide performance options, and AFAIK some of them tweak the texture rendering fidelity. Take a look at the NVidia Control Panel (or so) there should be an "advanced 3D settings" tab or something like that.
As far as I know the half-pixel problem of DX is not present in OpenGL.

ATi/AMD also has a set of hacks in the control center called "Catalyst AI" which replaces certain functions with faster approximations and might also be responsible for the difference in rendering.

Your problem might be elsewhere, because the difference you have is way too large. It could be some sort of a texture filtering problem (again in the gpu driver control center).
Quote:Original post by vincoof
NVidia drivers provide performance options, and AFAIK some of them tweak the texture rendering fidelity. Take a look at the NVidia Control Panel (or so) there should be an "advanced 3D settings" tab or something like that.


Hmmm, I've tried all the settings that could possibly help but it didn't have any effect.

Does the problem occur with exactly the same compiled executable, run on two different computers, or is the program re-compiled when it shows the different behavior?

It will be easier to guess at the problem if you create a minimal example showing the behavior, and post the complete code here, so that people can compile and run it themselves.

Quote:I'm using perspective projection however the camera is moved at a distance where objects rendered at the center of the z-axis have the same size as their texture.


If you don't do this, but actually specify the screen-space pixel coordinates, is the problem still there?

Also, does every frame show the problem?
In your image the sprite seems to be in a completely different position in the lower image. My guess is that the problem is transform related, and has nothing to do with the texture, but hard to say.
Quote:Does the problem occur with exactly the same compiled executable, run on two different computers, or is the program re-compiled when it shows the different behavior?

It will be easier to guess at the problem if you create a minimal example showing the behavior, and post the complete code here, so that people can compile and run it themselves.

If you don't do this, but actually specify the screen-space pixel coordinates, is the problem still there?

Also, does every frame show the problem?
In your image the sprite seems to be in a completely different position in the lower image. My guess is that the problem is transform related, and has nothing to do with the texture, but hard to say.


Thanks Erik! I found a solution! I switched to orthographic projection and it appears to have fixed the problem. But now I'm really curious why this happens. Why does perspective projection cause these problems on certain PC's?
The perspective projection depends on the actual width and height in pixels (and the aspect ration) of the windows... are they the same on all the systems?

How are you setting up the matrix?
Quote:Original post by mark ds
The perspective projection depends on the actual width and height in pixels (and the aspect ration) of the windows... are they the same on all the systems?

How are you setting up the matrix?


I use gluLookAt to create the perspective matrix.
Then I calculate the z value of the camera like this:
position.z = (screenHeight * 0.5f) / tan(fov * 0.5f);

This topic is closed to new replies.

Advertisement