PDA

View Full Version : problem with perspective view



steve_j
04-21-2005, 08:10 AM
Hi!

I am working on a simple visualization of terrain for use with flight simulator. There, terrain and runways are rendered. I have the following problem:
When rolling on the runway the runway and all of its components are not steady displayed, they are very jumpy. When I hold still they are displayed steady. The same applies for the wireframe model of the terrain. To better understand here is pic (the red arrow indicates the motion):
http://www.sbox.tugraz.at/home/s/s_josel/rwy_prob2.jpg
Has anyone a hint?
Thanks,
Steve

dorbie
04-21-2005, 09:41 AM
The numbers you use in the modelview and terrain transformations are too large and you are seeing vertex jitter due to floating point precision issues.

There is a fix, you need to perform your flight sim calculations in double precision float (64 bit), then take the eye position in double precision and subtract a large constant number from the translation component, then you can cast to 32 bit float and use the values for your viewing matrix (viewing will be (-x, -y, -z)).

You then take the same large value and subtract it from a double precision matrix translation above your terrain segments before placing the resulting translation into a single precision model matrix (model will be (-x, -y, -z)). Note that terrain section vertices should be relative to a local origin.

Now that large constant that you subtracted earlier will need to vary over time depending on where the eye is. You typically want some modulo effect where the number never exceeds an nice high precision single point falue.

If you have a space sim you'd subtract x,y,z but in the case of a flight sim you probably only need to subtract in x and y axes I think.

dorbie
04-21-2005, 09:42 AM
p.s. moving this question to the advanced forum.

knackered
04-21-2005, 10:20 AM
Wow....perdy picture...in thread...how?...err...how preddy picture...how?

steve_j
04-21-2005, 11:08 AM
Hi!

Thanks for you hint!

That was my assumption. I have had already such problems with the z-buffer resulting from large coordinates. I subtracted a large constant number from the coordinates and it worked there.

regards,
Steve

kon
04-21-2005, 03:07 PM
Revolution! Post your advanced question with picture in the beginners forum, and we get some coloured visuals here!

knackered
04-21-2005, 11:33 PM
why doesn't this work:-
http://www.gamasutra.com/features/20050420/magemasters.jpg

dorbie
04-22-2005, 12:32 AM
Edit, I have no idea how to embed images, I get different results with mangled characters from the editor.

UBBCode images seem to be explicitly prohibited on these forums.

The encoding of the attachment here looks html like rather than UUB.

P.S.

OK, Kon got it right, Images are enabled in the beginner's forum UUB and not in the advanced forum UUB. Because I moved this topic it allowed an image to migrate over to this forum with some funky html like coding that you still can't use because UUB reencodes some chars like greater than & less than.

knackered
04-22-2005, 03:51 AM
Anything you can do to allow images in this forum, dorbie? Have a word with "them upstairs" or something?
It would certainly save a lot of hassle with people trying to explain things in words.

steve_j
04-22-2005, 01:40 PM
Hi!

Ok, I did the changes to my code but first with no better result. I figured out that my coordinates are too large especially in y-directions, so the important information in sub meter level was lost due to the precision of GLfloat. When I tested along a direction parallel to the y-axis I have no jitters now.

regards,
Steve

dorbie
04-22-2005, 02:19 PM
Originally posted by knackered:
Anything you can do to allow images in this forum, dorbie? Have a word with "them upstairs" or something?
It would certainly save a lot of hassle with people trying to explain things in words.I already asked the webmaster as anyone's free to do, I have no real clout, I'm just a moderator.