How to set an ortographic camera to project like described?
-
27-04-2021 - |
Question
I would like the projection to be like this:
That is, (x,y,z) -> (x-y/sqrt(2),y/sqrt(2)-z)
How to find the projection matrix?
La solution
I got this by using a simple camera:
var camera = new THREE.Camera();
Setting it's far and near views to big values:
camera.far=2000;
camera.near=-2000;
And setting a projection matrix like this:
camera.projectionMatrix = camera.projectionMatrix = new THREE.Matrix4(
1,0,0.5,0,
0,-1,-0.5,0,
0,1,0,0,
0,0,0,2000);
I'm not sure 0.5 is the right value (guess it should be 1/sqrt(2)) but it worked. Also, realizing how a projection matrix works was a fun insight. http://en.wikipedia.org/wiki/Projection_%28linear_algebra%29
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow