Zoom and scaling issue, mesh flickers on movement

Hello, i have create this simply PG

i have some issues when i zoom into mesh and move with ArcRotateCamera! (freecamera looks better)

click on “boombox” and move camera near to see the issue!

mesh is parent of cube and has set with normalizeToUnitCube as I need the smallest values that i can get, then scaled with scaleInPlace..

Seems like this not the right way to do!!

Any idea how to solve this issue???

scaleInPlace will not trigger a setter. Some functionality in Babylon depends on code within a setter.

Try setting the scale property to itself so the setter is triggered.

I’m not sure mesh.scale has a setter, but if it does, this may help.

Looks like you’ve exceeded the floating point numeric precision limit.

Your camera.maxZ is 20,000,000.

2 Likes

@inteja has identified the issue.

Try using the new floating origin mode to eliminate the precision problem (see line 133):

However, the camera continues to shake after clicking the “Boombox” button. cc @georgie regarding this issue.

2 Likes

Without FloatingOrigin mode:

With floatingOrigin mode:

i’m not seeing the shaking, can you give me repro steps? maybe it has to do with order in which you animate?

I do see that as you move thorugh the cube and animate towards the boombox it flickers due to passing through the sides of the cube, but i’m not seeing the boombox itself flickering

Here’s what I see when I simply rotate the camera around the boombox:

1 Like

ah yes I can see that too, and I can repro on a simple playground with large scale / rotation of camera. I will investigate :slight_smile:

3 Likes

Creating the engine with high precision matrix fixes the problem:

working on a fix within floatingOriginMode!

@Petros_Pap FYI I have an incoming change that moves FloatingOriginMode to engine instead of scene creation options, and sets high precision matrix usage on engine.

To enable it, pass { useFloatingOriginMode: true } when creating engine.

And to enable in playground, override the createEngine function like this Babylon.js Playground

I will make an announcement post as well once the PR is checked in

FloatingOriginMode moved to engine; Fix matrix precision setter by georginahalpern · Pull Request #17334 · BabylonJS/Babylon.js

2 Likes

@georgie A big, BIG THANK YOU!!
In beginning i see the PG’s and kind disappointed as still have this ugly flickering on movement.. :slight_smile:
After i pass your commit to AbstractEngine and scene, AND everything run super smooth!!!
Again thank you!!! :waving_hand:

2 Likes

Awesome glad it is useful! Please note I have slightly updated the parameter names (see the post above that I tagged you in) – now you can enable both highprecisionmatrices and floatingoriginoffsets using the engine creation option ‘useLargeWorldRendering’ :slight_smile:

I will check for sure those new options!! :slight_smile: