Terrain LOD update bug while zooming

Started by
6 comments, last by masha2 13 years, 1 month ago
Hi

I implemented terrain LOD algorithm and while moving camera around I can see the triangle size changing correctly for each chunk.
It works while rotating right, left, up, down, forward, backward ,but LOD is not updated while zooming in/out.
Actually I know the reason, but I dont know how to fix it.
Reason is that I'm zooming with gluPerspective(..) help - I'm decreasing and increasing the view angle respectively.
So unlike other rotating function in this function camera eye and "look at" points are not updated.

Any ideas how to fix it?

TIA
Advertisement
Did you make your terrain LOD using a quadtree? If so, I would guess you are doing LOD based on which quadtree the camera is actually inside. Quadtrees represent the terrain in a 2D format and do not take into account the y axis (height/altitude). Octrees take into account the 3rd axis but that is overkill for a terrain. You can probably get away with adding some sort of distance calculation and LOD from there when the camera is beyond a certain height. Check for height from the patch and use LOD1, LOD2, etc...
Can you add a routine in your LOD algorithm to account for the ratio of the current FOV to some "base" FOV? I.e., if your normal FOV is PI/4.0f, perhaps calculate fovScale = currentFOV/( PI/4.0f ) and factor that into your LOD algorithm. By using a ratio like that, fovScale will equal 1.0f if you're not zooming and won't otherwise affect your LOD calc.

EDIT: The effect it appears you want to get will require increasing the LOD over a greater distance from the viewpoint, since nearer objects are still in view. Be sure to balance the increase in the number of "chunks" at high LOD by culling chunks no longer in view due to the reduced FOV.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.


Can you add a routine in your LOD algorithm to account for the ratio of the current FOV to some "base" FOV? I.e., if your normal FOV is PI/4.0f, perhaps calculate fovScale = currentFOV/( PI/4.0f ) and factor that into your LOD algorithm. By using a ratio like that, fovScale will equal 1.0f if you're not zooming and won't otherwise affect your LOD calc.


Thanks! This solves the problem. I'm still playing with right parametrs for a scale factor, but it's minor.

And matt3d - I use quadtrees, my problem was that zooming with changing only FOV angle it was disconnected from the camera functions. I think that it's possible calculate exact camera position relatively to changed FOV. It should be something like this:

instead of gluPerspective(newFOV,.......)

UpdateMyCameraPosition()
{
calculate camera position according to new FOV
//go backwards or forwards
}

I'm working on UpdateMyCameraPosition() math now.
I think that it's possible calculate exact camera position relatively to changed FOV[/quote]

Changing the FOV doesn't change the camera position. It just changes the view volume as seen from the same position.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.


I think that it's possible calculate exact camera position relatively to changed FOV


Changing the FOV doesn't change the camera position. It just changes the view volume as seen from the same position.
[/quote]


So then I'm a little confused - zooming should do nothing with camera eye and "look at" points?
Then LOD update should be done by 2 criterions :
1) distance from camera to a chunk center
and
2) FOV (or zoom) factor ?

Thanks

[quote name='Buckeye' timestamp='1299427463' post='4782442']
I think that it's possible calculate exact camera position relatively to changed FOV


Changing the FOV doesn't change the camera position. It just changes the view volume as seen from the same position.
[/quote]


So then I'm a little confused - zooming should do nothing with camera eye and "look at" points?[/quote]
I don't know if you want to change the eye and lookat points, but changing only the FOV is as described above.

Then LOD update should be done by 2 criterions :
1) distance from camera to a chunk center
and
2) FOV (or zoom) factor ?

Thanks
[/quote]
If that's what you want to do. What do you want the effect of zooming to be? Maybe that's the problem. Normally, zooming is used to simulate (for instance) the use of binoculars or a telescope. It doesn't change anything but the FOV. You stay in the same position.

EDIT: just to clarify: if you want a "magnification" effect by changing the FOV, you shouldn't change the camera position or lookat points just because the FOV has changed. You can certainly move/rotate the camera as desired, but not because the FOV has changed.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Thanks a lot for clearing it up.

This topic is closed to new replies.

Advertisement