Large coordinates

This means that three.js cannot carry large-scale scene space

This is not the case - this is just the nature of floating point value precision and the fact that GPUs use 32bit numbers in calculations.

You have a jitter problem caused by insufficient accuracy

This question should not be in the same category as mine

The source of the problem is fundamentally the same. You’re using very large values in calculations where there is insufficient precision.

You can see the same type of issue if you set an instanced mesh matrix to use a large translation, as well (see here). You’ll have to be aware of which matrices are uploaded in which form to the GPU in order to address this generally and ensure that as much of the large value matrix multiplication is happening in Javascript where 64bit precision is used. Both bone world matrices and instance matrices are uploaded to the GPU for calculation so you’ll want to adjust your scene to make sure those values are closer to 0 if you’re seeing this kind of jitter.

4 Likes

one detail, not the bone model, does not have this issue

one detail, not the bone model, does not have this issue

As I’ve explained - this will only occur when matrices of large values are used in calculations on the GPU. The mesh world matrices model-view matrices are computed in Javascript where 64 bit floats are used so this will not as easily occur with regular mesh objects.

If you have further problems you’ll have to make an effort to share a working example of the issue you’re having. You’re leaving a lot of guessing to people who are trying to help you.

1 Like

Why doesn’t this issue appear in the official three.js editor? I adjusted the coordinates of this sphere to (0, 5000000000000.000, 5000000000000.000), then double-clicked on the sphere, and the camera automatically focused on the sphere, but I did not see any incorrect model.

Blockquote
Edit fiddle - JSFiddle - Code Playground

I would guess that because as @gkjohnson explained… the modelView matrix is computed on the CPU with 64bit floats… so by the time it gets into the shader, the matrices are now back in the usable range of 32 or 16 bit float. modelView matrix is the matrix of the model relative to the camera, so it won’t be 5bajillion units away… it will only be camera position - object position units away.

2 Likes

You are right

---- Replied Message ----

From | Michael Schlachter via three.js forumnotifications@threejs.discoursemail.com |

  • | - |
    Date | 04/03/2024 17:03 |
    To | firstgis@163.com |
    Cc | |
    Subject | [three.js forum] [Questions] Large coordinates |

| manthrax
April 3 |

  • | - |

I would guess that because as @gkjohnson explained… the modelView matrix is computed on the CPU with 64bit floats… so by the time it gets into the shader, the matrices are now back in the usable range of 32 or 16 bit float. modelView matrix is the matrix of the model relative to the camera, so it won’t be 5bajillion units away… it will only be camera position - object position units away.