Camera shaking on large position values

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
matiae
Posts: 16
Joined: Wed May 31, 2006 8:06 am
Location: Chile

Camera shaking on large position values

Post by matiae »

Hi, I've just noticed this effect in the camera movements when position has large values.. I suppose due to matrix calculation methods with large floats :? and I wanna know what should be the proper solution for this if I must implement a huge scene?? :o
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

How large are the values we are talking about?

One way to do it would be to periodically shift the world origin so that it is always near the camera position. This would require ofsetting the world origin for every scene node periodically. If you are making a huge world, you are probably going to implement some sort of tiling system for paging objectes into and out of memory. If you are doing this, or find that you need to, you should be able to adjust the origin when the paging work is done.

Another solution would be to modify the Irrlicht source and use a different number type for position. You could use a f64 or a composite type that used a f32 and a s32.

Travis
matiae
Posts: 16
Joined: Wed May 31, 2006 8:06 am
Location: Chile

Post by matiae »

Over 1M in any axis :shock:
I tested this in an AMD 64 and the shakes become smoother than in my 32 pc ..
Certainly the tiling system would be the best solution, thanks for the advice!! :)
Haa, and if someone is interested, in a quick search I found this articles about tiling games
http://www.gamedev.net/reference/list.asp?categoryid=44
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

A regular f32 [24 bits of precision] is only accurate out to about 6 decimal places. So at 1,000,000 units away from the origin, the camera is going to be jumping about 1 unit just for rounding error.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Not to mention the many code fragments that completely ignore precise calculations in favor of speed. So a vector transformed by a matrix will have even larger accumulated rounding errors in every component.
Post Reply