Skip to content

Wrong model culling rendering issues #164

Description

@mchao123

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions