Skip to content

Commit

Permalink
demo: Take camera field of view into account for LOD target
Browse files Browse the repository at this point in the history
The field of view is fixed at 45 degrees right now but this makes the
computation more future proof.
  • Loading branch information
zeux committed Sep 9, 2024
1 parent f1f677b commit 7a43719
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion demo/simplify.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
var center = new THREE.Vector3();
var radius = 1;
var distance = Math.max(camera.position.distanceTo(center) - radius, 0);
var loderrortarget = 1e-3; // ~1 pixel at 1k x 1k
var loderrortarget = 1e-3 * Math.tan(camera.fov * 0.5 * (Math.PI / 180)); // ~1 pixel at 1k x 1k

// note: we are currently cutting corners wrt handling the actual mesh scale
// since we rescale the entire scene to fit a unit box, we can directly feed the threshold
Expand Down

0 comments on commit 7a43719

Please sign in to comment.