1

I would like to get control point of the rendering volume of a camera in three.js

it can be accessed by using a camera helper like in the camera example with attribute pointMap

console.log(cameraOrthoHelper.pointMap);

return :

c, cf1, cf2, cf3,cf4, cn1, cn2, cn3, cn4, f1, f2, f3, f4, n1, n2, n3, n4, p, t, u1, u2, u3

Threejs camera helper

My interest are in n1...n4 and f1...f4 (orange cube)

But the value seems to be wrong. what do i have to do to exploit thoses values in real world coordinates ?

1
  • Any luck solving this with my last comment? Commented Feb 25, 2016 at 16:28

1 Answer 1

2

Those points are set using the properties of the camera.

new THREE.OrthographicCamera( left, right, top, bottom, near, far );

So if you want to change the "orange box" you should just change the camera and your helper will also change...

UPDATE

You can get the camera helper matrix and apply it to the vertices that you are interested in. If you want the orange box this means you need the four near and four far points:

Near points:

cameraHelper.pointMap[n1][0]
cameraHelper.pointMap[n2][0]
cameraHelper.pointMap[n3][0]
cameraHelper.pointMap[n4][0]

Far points:

cameraHelper.pointMap[f1][0]
cameraHelper.pointMap[f2][0]
cameraHelper.pointMap[f3][0]
cameraHelper.pointMap[f4][0]

Apply the camera helper matrix to the points and you have them in world space. Before you do that you have to also update the worldMatrix of the orthographic camera, it seems the cameraHelper matrix depends on it:

camera.updateMatrixWorld();
point.applyMatrix4( cameraHelper.matrix );

Check a fiddle here that demonstrates that the code above works.

Sign up to request clarification or add additional context in comments.

1 Comment

i dont want to change it, i want to get the position value in real world coordinate after transformation of the camera matrix.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.