Page 1 of 1

Camera shaking on large position values

Posted: Wed Sep 20, 2006 3:20 pm
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

Posted: Wed Sep 20, 2006 3:40 pm
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

Posted: Wed Sep 20, 2006 9:18 pm
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

Posted: Thu Sep 21, 2006 1:35 am
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.

Posted: Thu Sep 21, 2006 8:19 am
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.