problem with perspective view

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):

Has anyone a hint?
Thanks,
Steve

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.

p.s. moving this question to the advanced forum.

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

Revolution! Post your advanced question with picture in the beginners forum, and we get some coloured visuals here!

why doesn’t this work:-

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.

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.

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

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.