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:
chrome-capture (9)

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 :wink:

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:
Screen Recording 2021-08-06 at 07.51.22

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

Thank you so much for all your recommends and your time, :pray: :pray: :pray:

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