View Full Version : No perspective correction when clipping?
11-06-2000, 12:30 AM
There seems to be a texturing problem in my terrain engine. It looks as if there's no perspective correction for the triangles that get clipped at the edges of the screen. I have no idea what could be causing this, because it only happens in one particular test app that I wrote.
The scene consists of a terrain mesh, which is built out of triangle fans. Sometimes the texture visually "jitters" even when you're standing still. I tested on a TNT2 and a GeForce2 - the problem occurs on both. Explicitly setting perspective correction with glHint() doesn't help either.
Does anyone have a clue about what could be causing this?
11-06-2000, 06:49 AM
A screenshot would help...
I have a hard time imagining how we could cause that to happen. Maybe if your app was sending strange w or q coordinates, or something... but clipping and perspective correction are pretty much independent, and we just ignore the hint (both TNT and GeForce pretty much always perspective correct, both textures and interpolated colors).
If you could provide the test app, that would help us track down the problem as well.
What driver version are you using?
11-07-2000, 12:28 AM
The problem is kind of hard to spot on stills, but I posted two shots and drew an arrow to the offending bits:
The idea of Z-buffer fighting has also crossed my mind (zoom in on the top area of the first screenshot to see why), but I don't see how that could be it, because it's rendered in a single pass. It also doesn't explain why the textures move around.
If you're still without ideas, I can upload the demo as well...
Thanks for the help,
11-07-2000, 12:28 PM
I just faced the same effect on my tnt2 (det ver .31). I have a terrain built up from 256x256 vertices. I create a big vertex array and fill it with one big strip, display it with glDrawElements (everything is totally static) and I got the same effect.
Are you using texgen to compute the texture coordinates, or are you specifying those directly? Also, if you can make the demo downloadable, that'd be great.
11-08-2000, 12:32 AM
I sent the sources for you (cass and matt). If anyone interested too just drop me a mail.
11-08-2000, 09:28 AM
I've uploaded my test app to http://www.gamedeveloper.org/delphi3d/misc/terrainbug.zip
You'll need to use the numeric keypad arrows to move around. Click and drag the mouse to turn. If you move real close to a surface, you'll notice that the texture starts to 'move' in a way that suggests a problem with clipping. The texcoords are specified manually. I will try texgen to see if it helps.
Mandroka, I couldn't immediately see the same problem in your demo. The only problem I see is that horizontal line that moves out in front of the camera at the point where it switches mipmap levels?
Thanks for your help,
11-08-2000, 11:46 AM
What is the range of your uv coordinates? I've seen this problem before and it's always been because the range of the uv was too big. Try scaling your uv up/down and see what happens. The way the texture is applied shouldn't change, but it might fix your problem.
11-08-2000, 01:01 PM
Hmmm. I tried my app at home and I could not see the bug. BTW I have a geforce2 (elsa) with detonator 6.031.
Both machines I use have win2k.
11-08-2000, 01:34 PM
Well I'll be damned. Indeed, scaling down my UV coordinates reduces the problem, whereas scaling them up makes it significantly worse. I was originally using UVs in the range of [0, 200], but the problem was still sometimes visible after reducing them to [0, 10].
I guess I'll just have to look for ways to keep my UVs between 0 and 1. Thanks for helping me track this down!
Hmm, I didn't notice any problems on my GeForce DDR. I looked, but I couldn't find the problems in the screen shots.
11-08-2000, 11:15 PM
Intriguing. I tried to run it on the GeForce2 at work again, and what do you know: the problem is gone. Nothing changed since last time, except for the fact that I upgraded from Detonator 6.18 to 6.47. I'm still running 6.18 on my TNT2 at home, where it does exhibit the problem. Was all this just a driver bug, then? We'll know tonight, after I install 6.47 at home http://www.opengl.org/discussion_boards/ubb/frown.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.