Jump to content
  • Advertisement
Sign in to follow this  
masha2

Terrain LOD update bug while zooming

This topic is 2756 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

[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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!