Capítulo 804 de 859
A deeper look at PerspectiveCamera's frustum (near, far, fov, aspect), how to visualize it with a second camera and CameraHelper, and the depth-precision trade-offs of choosing near/far values.
PerspectiveCamera renders, defined by near, far, fov and aspect.near / far: clipping planes — objects closer than near or farther than far aren't rendered.fov / aspect: vertical field of view (degrees) and width-to-height ratio, together sizing the frustum's front and back.CameraHelper: draws a visual wireframe of another camera's frustum, handy for debugging.renderer.setScissorTest plus per-viewport scissor rects let you draw two cameras' views side by side in one canvas.logarithmicDepthBuffer: a WebGLRenderer option that can reduce z-fighting on supported GPUs, at some performance cost.renderer.setScissorTest(true);
{
const aspect = setScissorForElement(view1Elem);
camera.aspect = aspect;
camera.updateProjectionMatrix();
cameraHelper.visible = false;
renderer.render(scene, camera);
}
{
const aspect = setScissorForElement(view2Elem);
camera2.aspect = aspect;
camera2.updateProjectionMatrix();
cameraHelper.visible = true;
renderer.render(scene, camera2);
}
CameraHelper for the other.PerspectiveCamera's frustum is fully defined by near, far, fov and aspect.logarithmicDepthBuffer can help with z-fighting but isn't universally supported and has a performance cost.logarithmicDepthBuffer option.