understanding perspective()
in
Programming Questions
•
2 years ago
Hi,
I'm trying to understand the parameters of the perspective() method.
The explanation in the documentation is pretty vague about them.
In particular, given the values for fov, aspect, zNear and zFar (or even assuming aspect=width/height), I want to compute the value of Z at which I have to draw a rectangle so that it's drawn at it's exact x,y,width and height on the window.
That is:
Or even better, what is in detail the meaning of each of the prespective parameters so that I can understand by myself how to compute z?
Thanks
m.
I'm trying to understand the parameters of the perspective() method.
The explanation in the documentation is pretty vague about them.
In particular, given the values for fov, aspect, zNear and zFar (or even assuming aspect=width/height), I want to compute the value of Z at which I have to draw a rectangle so that it's drawn at it's exact x,y,width and height on the window.
That is:
- size(800,600,P3D);
- float fov=90; //any arbitrary value
- float zNear=10; //any arbitrary value
- float zFar=10000; //any arbitrary value
- float rectanglez= //??? How do I compute this given fov, zNear and zFar?
- perspective(fov,width/height,zNear,zFar);
- translate(0,0,rectanglez); // I want rectanglez such that the following rectangle fills exactly the screen
- rectangle(0,0,width,height);
Or even better, what is in detail the meaning of each of the prespective parameters so that I can understand by myself how to compute z?
Thanks
m.
1