Is there ANY way to have the three.js camera lookat being rendered off-center?

前端 未结 2 507
情话喂你
情话喂你 2021-01-22 06:34

Is there a way to setup the Three.js renderer in such a way that the lookat point of the camera is not in the center of the rendered image?

To clarify: image a scene wit

2条回答
  •  有刺的猬
    2021-01-22 07:15

    If you want your perspective camera to have an off-center view, the pattern you need to use is:

    camera = new THREE.PerspectiveCamera( for, aspect, near, far );
    camera.setViewOffset( fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight );
    

    See the docs: https://threejs.org/docs/#api/cameras/PerspectiveCamera

    You can find examples of this usage in this example and this example.

    three.js r.73

提交回复
热议问题