# When I am panning the camera the model loss the precision, how can I increase the precision?

Hello everyone

I have a simple tube and when I want to rotate the camera around the model , the model start to loss the precision.
as can be seen in the following clip:

how can I solve this problem?
here is my PG: https://www.babylonjs-playground.com/#CPA4SL#1

Iâ€™m no expert on this but my understanding is what youâ€™re seeing is a hardware floating point precision limit. The range of floats youâ€™re using there is huge.

Often if I receive georeferenced CAD or BIM files from a client Iâ€™ll see numbers like this and my first step is to scale everything to my target platformâ€™s units, reposition to world origin and then apply/reset all transforms before exporting. This usually resolves any floating point issues.

Actually it looks like you asked a similar question a while back.

The problem is the same and the suggested solutions in that post are similar to mine above.

Hi @inteja, in the previews question the problem solved with scaling and I didnâ€™t find better solution, but I need another solution now.

I donâ€™t think there is another solution. Itâ€™s a hardware limit. Use smaller numbers, relative to world origin. Everything is relative to the observer (camera) - you donâ€™t need absolute coordinates so itâ€™s easy to avoid such floating point precision issues.

Sorry I didnâ€™t understand why I donâ€™t need to the absolute coordinates?

I am trying to build a GIS app, and all this coordinates are on the height map, because of that the coordinates its very important

Everything is relative to the camera. Say youâ€™re wanting to represent our huge solar system. If you use absolute coordinates for everything thereâ€™s no consumer hardware that can handle that. If you scale everything down to manageable units and have a floating origin that tracks the camera, you can visualise the entire solar system.

Iâ€™m not sure I explained that very well.

Everything has limits - even the universe has floating point precision limits in the Planck length

See the concept of floating origin https://floatingorigin.com/

2 Likes

so I should scale the height map and the all models coordinates together?

Thereâ€™s probably a few ways to achieve it but say youâ€™re developing something like Google Earth, you wouldnâ€™t just have a single huge range of absolute coordinates. Youâ€™d break the world down into level of detail tiles and display a particular level of detail tile depending on the camera position and distance. But each tile is still using a sane and manageable range of relative floating point coordinates.

its somehow like google earth but there are some models under the ground and I cannot use level of details tile.
here is you can see my scene:

The principle is exactly the same.

so should I scaling all the models and the height map together?

Yes, scale and recenter everything to the origin (0, 0, 0) then, depending on your software, make sure you reset/apply those transformations (in 3ds max it is/was â€śReset Xformâ€ť and in Blender itâ€™s â€śApply > All Transformsâ€ť).

But it depends on your use case. If you need the user to get really close, like walking around on the surface, then you will need some kind of level of detail, terrain tiling system.

2 Likes

1 Like

Thanks for sharing @inteja , I actually would like to convert Continuous Floating Origin to WebGL.

Actually, if you use the centering properly, everything can be done in full scale. I did a full scale Solar system wide demo using my techniques, all single precision, not one double floating point variable!
See: my trip to Pluto

@cosmochristo would you be interested in porting the technique to Babylon ?

sebavan Jedi council
September 26

@cosmochristo would you be interested in porting the technique to Babylon ?

I would like to look at that, yes. Iâ€™m planning porting to Unreal but a WBGL port makes sense too.

cheers,

Dr Chris Thorne

1 Like