Skip to content

Instantly share code, notes, and snippets.

@AlainBarrios
Created June 20, 2020 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlainBarrios/d2bc85d90427ce02ad54426df49c6d15 to your computer and use it in GitHub Desktop.
Save AlainBarrios/d2bc85d90427ce02ad54426df49c6d15 to your computer and use it in GitHub Desktop.
Get the viewport size to give the plane full size
const getViewSize = () => {
const fov = THREE.Math.degToRad(camera.fov);
const dist = camera.position.z - plane.position.z;
const height = 2 * Math.tan(fov / 2) * dist;
const width = height * camera.aspect;
return [width, height];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment