calculate size of frustum as a function of z distance to camera
See original GitHub issuehi,
i want to create a rectangle which fills the screen exactly, example:
camera.position.z = 500;
...
var cube = new THREE.CubeGeometry( 1, 1, 1);
...
cubeMesh.position.x = 0; cubeMesh.position.y = 0; cubeMesh.position.z = 0;
cubeMesh.scale.x = ???;
cubeMesh.scale.y = ???;
so here is the distance from the camera to the object 500. is there a easy way to calculate ???
Issue Analytics
- State:
- Created 12 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
The Size of the Frustum at a Given Distance from the Camera
It is sometimes useful to calculate the size of this rectangle at a given distance, or find the distance where the rectangle is...
Read more >The Size of the Frustum at a Given Distance from the Camera ...
First, get the corners of the frustum at the distance you choose, then subtract the elements of the array returned to determine the...
Read more >[SOLVED] How to get the size of the frustum at a distance from ...
I have an camera at an determined position, looking at 0,0,0. The idea is to get the fustrum size on z=0 to be...
Read more >How to compute the size of the rectangle that is visible to the ...
You know FOV and distance from camera to a circle, so you can calculate upper and lower points (y-axis). You know FOV, aspect...
Read more >Frustum Culling - LearnOpenGL
Camera frustum represents the zone of vision of a camera. ... transform) const final { //Get global scale is computed by doing the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Usually for having screen-filling rectangle we use
OrthographicCameraand then just create window-pixel sizedPlaneGeometry.See for example here:
https://github.com/mrdoob/three.js/blob/master/examples/webgl_postprocessing_dof.html#L240
https://github.com/mrdoob/three.js/blob/master/examples/webgl_postprocessing_dof.html#L264
(for things like HUD the easiest is to have a separate scene just used for sticking things to the screen)
If you need a distance from object to camera, it can be computed using world matrices:
@bbnnt Your best bet for help is now stackoverflow.
http://stackoverflow.com/questions/15331358/three-js-get-object-size-with-respect-to-camera-and-object-position-on-screen/15331885#15331885