Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong model culling rendering issues #164

Open
mchao123 opened this issue May 2, 2024 · 0 comments
Open

Wrong model culling rendering issues #164

mchao123 opened this issue May 2, 2024 · 0 comments

Comments

@mchao123
Copy link

mchao123 commented May 2, 2024

With version 1.2.1, after zooming the camera several times with "OrbitControls", there is a problem with model culling, it looks like the model is moving away from the camera. There is no good solution at the moment and by the way there is no manual for version 1.2.3, maybe the documentation should be updated. Thanks for your help.

Additional note: The main problem is when moving the viewpoint after zooming in, then restoring the viewpoint and repeating the operation about four times. I restored the viewpoint using the following code

let lastPerspectiveStop: () => void;
export const setPerspective = ([cameraP, controlsP] = Config['perspective'], animate = 500) => {
    lastPerspectiveStop && lastPerspectiveStop();
    const lastCamera = [...camera.position.toArray()];
    const lastControls = [...controls.target.toArray()];
    if (animate) {
        lastPerspectiveStop = tween(animate, (i) => {
            camera.position.fromArray(lastCamera.map((c, k) => c + (cameraP[k] - c) * i));
            controls.target.fromArray(lastControls.map((c, k) => c + (controlsP[k] - c) * i));
            camera.updateMatrix();
            controls.update();
            renderContenxt(i === 1);
        }, Tween.easeInOut);
    }
    else {
        camera.position.fromArray(cameraP);
        controls.target.fromArray(controlsP);
        camera.updateMatrix();
        controls.update();
        renderContenxt();
    }
    return [lastCamera, lastControls] as [[number, number, number], [number, number, number]];
};

Could this be the cause?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant