mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.02k stars 35.33k forks source link

When an OrthographicCamera is used, increasing the far value (> 3000000) will cause the perspective effect of the model. #29264

Closed Jenychen1996 closed 1 month ago

Jenychen1996 commented 1 month ago

Description

When an OrthographicCamera is used, increasing the far value (> 3000000) will cause the perspective effect of the model. example: webgl_loader_gltf_avif.html

Reproduction steps

1.Create an OrthographicCamera 2.modify the far value: >3000000 3.load model

Code

let SCREEN_WIDTH = window.innerWidth;
let SCREEN_HEIGHT = window.innerHeight;
let aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
const frustumSize = 600;
camera = new THREE.OrthographicCamera(0.5 * frustumSize * aspect / - 2, 0.5 * frustumSize * aspect / 2, frustumSize / 2, frustumSize / - 2, -100000, 1000000000);

Live example

none

Screenshots

No response

Version

162

Device

Desktop

Browser

Chrome

OS

Windows

mrdoob commented 1 month ago

Missing live example.

Jenychen1996 commented 1 month ago

Live example: https://threejs.org/examples/?q=av#webgl_loader_gltf_avif

Mugen87 commented 1 month ago

@Jenychen1996 A live example is a fiddle, not a link to one of the official examples.

In any event, a negative near value is not supported by the library. So do not use -100000 but at least 0.

Mugen87 commented 1 month ago

The artifacts you see are related to the lack of depth precision. In general, there should be no need for such large scaled view frustums so try to stick to a tighter one and scale the scene instead.