
|
Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
|
Hi,
I still got no answer about
how to calculate the camera Field of View using focus and zoom.
I did some research
and I find out how to calculate focalDistance, is it the same as the camera
focus?
Here is formula I
found how to convert diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number =
622;
var height:Number =
310;
var w:Number = width
;
var h:Number = height
;
var d:Number = Math.SQRT((w
* w) + (h * h)) ;
var focalDistance:Number
= d * Math.TAN(diagonalFOV / 2.0) ;
|
|
If focalDistance is
the same as the camera focus, it still doesn’t make sense how to
calculate the correct camera zoom for one selected FoV.
Does anyone have some clue to this puzzle?
|
|
Thanks,
Marcelo Muniz
|
|
|
|
|
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Hi someone posted a calculator or something (my suggestion). I will look tonight - literally out the door now. -Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
|
Hi,
I still got no answer about how to calculate the camera Field of View using focus and zoom.
I did some research and I find out how to calculate focalDistance, is it the same as the camera focus?
Here is formula I found how to convert diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; |
|
If focalDistance is the same as the camera focus, it still doesn't make sense how to calculate the correct camera zoom for one selected FoV.
Does anyone have some clue to this puzzle? |
|
Thanks,
Marcelo Muniz |
|
|
|
|
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Ok. I’ll be waiting for
you response.
Hi someone posted a calculator or something (my suggestion).
I will look tonight - literally out the door now.
-Pete
On 6/12/07, Marcelo
Caetano Martins Muniz <marcelo@...>
wrote:
|
Hi,
I still got no answer about how to
calculate the camera Field of View using focus and zoom.
I did some
research and I find out how to calculate focalDistance, is it the same as the
camera focus?
Here is formula I found how to convert
diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d *
Math.TAN(diagonalFOV / 2.0) ;
|
|
If focalDistance is the same as the
camera focus, it still doesn't make sense how to calculate the correct camera
zoom for one selected FoV.
Does anyone have some clue to this puzzle?
|
|
Thanks,
Marcelo Muniz
|
|
|
|
|
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Ok I am back - can you send me any code (hopefully flex as3 or cs3)? I will try to give you a good answer! -Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
Ok. I'll be waiting for you response.
Hi someone posted a calculator or something (my suggestion). I will look tonight - literally out the door now.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
|
Hi,
I still got no answer about how to calculate the camera Field of View using focus and zoom.
I did some research and I find out how to calculate focalDistance, is it the same as the camera focus?
Here is formula I found how to convert diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; |
|
If focalDistance is the same as the camera focus, it still doesn't make sense how to calculate the correct camera zoom for one selected FoV.
Does anyone have some clue to this puzzle? |
|
Thanks,
Marcelo Muniz |
|
|
|
|
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
I can’t give you a code
example but I’ll give you the scenario.
I have renderers implemented in
Directx and OpenGL that output renders (images) to me.
In these renderers I can set
any value as diagonal field of view to the camera.
What I wanna do is to use a low
poly version of my 3d models in papervision, so the user can set the camera
position in the scene, click on a button to render and I output an image of the
same scene rendered using high poly 3d models on my renderers.
The default diagonal FoV that I
use in the renderers is 25. The flash stage and the output image have the same
size 622x310. I could synchronize the papervision camera with my renderers
using the following formula to find the papervision camera focus:
var
diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width;
var h:Number = height;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
And I had to manually adjust
the papervision camera zoom until it matches the rendered images.
I have the following questions:
1) Does the papervision camera focus represent the focal distance that we find
in any standard 3D game library (DirectX/OpenGL) for camera settings?
2) How can I calculate automatically the papervision camera focus and zoom if I
give you as input my stage size and diagonal field of view?
Thank you,
Marcelo Muniz
Ok I am back - can you send me any code (hopefully flex as3 or cs3)?
I will try to give you a good answer!
-Pete
On 6/12/07, Marcelo
Caetano Martins Muniz <marcelo@...>
wrote:
Ok. I'll be waiting for you response.
Hi
someone posted a calculator or something (my suggestion). I will look
tonight - literally out the door now.
-Pete
On
6/12/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
|
Hi,
I still got no answer about how to
calculate the camera Field of View using focus and zoom.
I did some
research and I find out how to calculate focalDistance, is it the same as the
camera focus?
Here is formula I found how to convert
diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d *
Math.TAN(diagonalFOV / 2.0) ;
|
|
If focalDistance is the same as the
camera focus, it still doesn't make sense how to calculate the correct camera
zoom for one selected FoV.
Does anyone have some clue to this puzzle?
|
|
Thanks,
Marcelo Muniz
|
|
|
|
|
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Hi, I seriously DOUBT it because it is not truley 3d...however I am sure it comes very close. Also I realize you maybe have answered your own question! I don't think zoom will help you because I believe it in effect the same as moving the camera closer to the focal point, so it almost seems like zoom might not play a part in your scenario unless maybe you convert it to a Z position? Just an idea.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
I can't give you a code example but I'll give you the scenario.
I have renderers implemented in Directx and OpenGL that output renders (images) to me.
In these renderers I can set any value as diagonal field of view to the camera.
What I wanna do is to use a low poly version of my 3d models in papervision, so the user can set the camera position in the scene, click on a button to render and I output an image of the same scene rendered using high poly 3d models on my renderers.
The default diagonal FoV that I use in the renderers is 25. The flash stage and the output image have the same size 622x310. I could synchronize the papervision camera with my renderers using the following formula to find the papervision camera focus:
var diagonalFOV:Number = 25; var width:Number = 622; var height:Number = 310; var w:Number = width; var h:Number = height;
var d:Number = Math.SQRT((w * w) + (h * h)) ; var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
And I had to manually adjust the papervision camera zoom until it matches the rendered images.
I have the following questions:
1) Does the papervision camera focus represent the focal distance that we find in any standard 3D game library (DirectX/OpenGL) for camera settings?
2) How can I calculate automatically the papervision camera focus and zoom if I give you as input my stage size and diagonal field of view?
Thank you,
Marcelo Muniz
Ok I am back - can you send me any code (hopefully flex as3 or cs3)? I will try to give you a good answer! -Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
Ok. I'll be waiting for you response.
Hi someone posted a calculator or something (my suggestion). I will look tonight - literally out the door now.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
|
Hi,
I still got no answer about how to calculate the camera Field of View using focus and zoom.
I did some research and I find out how to calculate focalDistance, is it the same as the camera focus?
Here is formula I found how to convert diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; |
|
If focalDistance is the same as the camera focus, it still doesn't make sense how to calculate the correct camera zoom for one selected FoV.
Does anyone have some clue to this puzzle? |
|
Thanks,
Marcelo Muniz |
|
|
|
|
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
If you use DirectX for example,
the FoV has a big rule in the camera Zoom.
Generally people use 45 as diagonal FoV, but if you change from 45 to 25 the
object will look closer.
Check the attached images, both images the camera is at the same distance from
the object, the only difference is the Field of View.
When I use papervision, if I
just change the camera focus the objects won’t look any closer. I see the
projection difference but no zoom difference.
So, I think that if I want to
synchronize DirectX or OpenGL camera with Papervision3D I’ll have to
change both focus and zoom. And that’s why I’m after a formula that
gets as input the scene stage size and diagonal field of view and return the
papervision focus and zoom.
Does it make sense to you?
Thanks,
Marcelo Muniz
Hi, I seriously DOUBT it because it is not truley 3d...however I am
sure it comes very close.
Also I realize you maybe have answered your own question! I don't think zoom
will help you because I believe it in effect the same as moving the camera
closer to the focal point, so it almost seems like zoom might not play a part
in your scenario unless maybe you convert it to a Z position? Just an idea.
-Pete
On 6/12/07, Marcelo
Caetano Martins Muniz <marcelo@...>
wrote:
I can't give you a code example but I'll
give you the scenario.
I have renderers implemented in Directx
and OpenGL that output renders (images) to me.
In these renderers I can set any value as
diagonal field of view to the camera.
What I wanna do is to use a low poly
version of my 3d models in papervision, so the user can set the camera position
in the scene, click on a button to render and I output an image of the same
scene rendered using high poly 3d models on my renderers.
The default diagonal FoV that I use in the
renderers is 25. The flash stage and the output image have the same size
622x310. I could synchronize the papervision camera with my renderers using the
following formula to find the papervision camera focus:
var
diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width;
var h:Number = height;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
And I had to manually adjust the
papervision camera zoom until it matches the rendered images.
I have the following questions:
1) Does the papervision camera focus represent the focal distance that we find
in any standard 3D game library (DirectX/OpenGL) for camera settings?
2) How can I calculate automatically the papervision camera focus and zoom if I
give you as input my stage size and diagonal field of view?
Thank you,
Marcelo Muniz
Ok I am
back - can you send me any code (hopefully flex as3 or cs3)?
I will try to give you a good answer!
-Pete
On
6/12/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
Ok. I'll be waiting for you response.
Hi
someone posted a calculator or something (my suggestion). I will look
tonight - literally out the door now.
-Pete
On
6/12/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
|
Hi,
I still got no answer about how to
calculate the camera Field of View using focus and zoom.
I did some
research and I find out how to calculate focalDistance, is it the same as the
camera focus?
Here is formula I found how to convert
diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d *
Math.TAN(diagonalFOV / 2.0) ;
|
|
If focalDistance is the same as the
camera focus, it still doesn't make sense how to calculate the correct camera
zoom for one selected FoV.
Does anyone have some clue to this puzzle?
|
|
Thanks,
Marcelo Muniz
|
|
|
|
|
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Hi
I was saying to consider the fact since ZOOM basically moves the camera closer - perhaps you can look at what ZOOM does in the code, but my feeling is that it simply just moves the camera closer - and focus accounts for the "fish eye" etc.
If you figure out that ZOOM may just be the same as bringing the camera close - maybe that will help you figure it out?
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
If you use DirectX for example, the FoV has a big rule in the camera Zoom. Generally people use 45 as diagonal FoV, but if you change from 45 to 25 the object will look closer.
Check the attached images, both images the camera is at the same distance from the object, the only difference is the Field of View.
When I use papervision, if I just change the camera focus the objects won't look any closer. I see the projection difference but no zoom difference.
So, I think that if I want to synchronize DirectX or OpenGL camera with Papervision3D I'll have to change both focus and zoom. And that's why I'm after a formula that gets as input the scene stage size and diagonal field of view and return the papervision focus and zoom.
Does it make sense to you?
Thanks,
Marcelo Muniz
Hi, I seriously DOUBT it because it is not truley 3d...however I am sure it comes very close. Also I realize you maybe have answered your own question! I don't think zoom will help you because I believe it in effect the same as moving the camera closer to the focal point, so it almost seems like zoom might not play a part in your scenario unless maybe you convert it to a Z position? Just an idea.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
I can't give you a code example but I'll give you the scenario.
I have renderers implemented in Directx and OpenGL that output renders (images) to me.
In these renderers I can set any value as diagonal field of view to the camera.
What I wanna do is to use a low poly version of my 3d models in papervision, so the user can set the camera position in the scene, click on a button to render and I output an image of the same scene rendered using high poly 3d models on my renderers.
The default diagonal FoV that I use in the renderers is 25. The flash stage and the output image have the same size 622x310. I could synchronize the papervision camera with my renderers using the following formula to find the papervision camera focus:
var diagonalFOV:Number = 25; var width:Number = 622; var height:Number = 310; var w:Number = width; var h:Number = height;
var d:Number = Math.SQRT((w * w) + (h * h)) ; var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
And I had to manually adjust the papervision camera zoom until it matches the rendered images.
I have the following questions:
1) Does the papervision camera focus represent the focal distance that we find in any standard 3D game library (DirectX/OpenGL) for camera settings?
2) How can I calculate automatically the papervision camera focus and zoom if I give you as input my stage size and diagonal field of view?
Thank you,
Marcelo Muniz
Ok I am back - can you send me any code (hopefully flex as3 or cs3)? I will try to give you a good answer! -Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
Ok. I'll be waiting for you response.
Hi someone posted a calculator or something (my suggestion). I will look tonight - literally out the door now.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
|
Hi,
I still got no answer about how to calculate the camera Field of View using focus and zoom.
I did some research and I find out how to calculate focalDistance, is it the same as the camera focus?
Here is formula I found how to convert diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; |
|
If focalDistance is the same as the camera focus, it still doesn't make sense how to calculate the correct camera zoom for one selected FoV.
Does anyone have some clue to this puzzle? |
|
Thanks,
Marcelo Muniz |
|
|
|
|
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Ok well, I tried a test like this... nnn++; if(nnn%5){
//#1 camera.z=-1000; camera.zoom=2; }else{
//#2 camera.z=-15500; camera.zoom=20; } Just so I can see distortion, and indeed zoom does cause alot of distortion even if the get the object in the same place, another will be distorted. So I take back what I said about the ZOOM not doing much, it seems to be distorting stuff.
In scenario #1, the sphere in helloworld looks like a egg shape pointing at you, however in scenario #2, the Space background nearly match, but the sphere is a perfect sphere - because it is being viewed from afar.
There has to be a calculation then - I am almost certain of it - I was thinking of trying myself, but I don't have a project to work on that needs it, yet :) -Pete
On 6/12/07, Peter Kapelyan <flashnine@...> wrote:
Hi
I was saying to consider the fact since ZOOM basically moves the camera closer - perhaps you can look at what ZOOM does in the code, but my feeling is that it simply just moves the camera closer - and focus accounts for the "fish eye" etc.
If you figure out that ZOOM may just be the same as bringing the camera close - maybe that will help you figure it out?
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
If you use DirectX for example, the FoV has a big rule in the camera Zoom. Generally people use 45 as diagonal FoV, but if you change from 45 to 25 the object will look closer.
Check the attached images, both images the camera is at the same distance from the object, the only difference is the Field of View.
When I use papervision, if I just change the camera focus the objects won't look any closer. I see the projection difference but no zoom difference.
So, I think that if I want to synchronize DirectX or OpenGL camera with Papervision3D I'll have to change both focus and zoom. And that's why I'm after a formula that gets as input the scene stage size and diagonal field of view and return the papervision focus and zoom.
Does it make sense to you?
Thanks,
Marcelo Muniz
Hi, I seriously DOUBT it because it is not truley 3d...however I am sure it comes very close. Also I realize you maybe have answered your own question! I don't think zoom will help you because I believe it in effect the same as moving the camera closer to the focal point, so it almost seems like zoom might not play a part in your scenario unless maybe you convert it to a Z position? Just an idea.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
I can't give you a code example but I'll give you the scenario.
I have renderers implemented in Directx and OpenGL that output renders (images) to me.
In these renderers I can set any value as diagonal field of view to the camera.
What I wanna do is to use a low poly version of my 3d models in papervision, so the user can set the camera position in the scene, click on a button to render and I output an image of the same scene rendered using high poly 3d models on my renderers.
The default diagonal FoV that I use in the renderers is 25. The flash stage and the output image have the same size 622x310. I could synchronize the papervision camera with my renderers using the following formula to find the papervision camera focus:
var diagonalFOV:Number = 25; var width:Number = 622; var height:Number = 310; var w:Number = width; var h:Number = height;
var d:Number = Math.SQRT((w * w) + (h * h)) ; var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
And I had to manually adjust the papervision camera zoom until it matches the rendered images.
I have the following questions:
1) Does the papervision camera focus represent the focal distance that we find in any standard 3D game library (DirectX/OpenGL) for camera settings?
2) How can I calculate automatically the papervision camera focus and zoom if I give you as input my stage size and diagonal field of view?
Thank you,
Marcelo Muniz
Ok I am back - can you send me any code (hopefully flex as3 or cs3)? I will try to give you a good answer! -Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
Ok. I'll be waiting for you response.
Hi someone posted a calculator or something (my suggestion). I will look tonight - literally out the door now.
-Pete
On 6/12/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
|
Hi,
I still got no answer about how to calculate the camera Field of View using focus and zoom.
I did some research and I find out how to calculate focalDistance, is it the same as the camera focus?
Here is formula I found how to convert diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; |
|
If focalDistance is the same as the camera focus, it still doesn't make sense how to calculate the correct camera zoom for one selected FoV.
Does anyone have some clue to this puzzle? |
|
Thanks,
Marcelo Muniz |
|
|
|
|
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Now it makes sense. I’ll
take a look at the papervision API implementation and try to figure out how
they are implementing focus and zoom.
Ok well, I tried a test like this...
nnn++;
if(nnn%5){
//#1
camera.z=-1000;
camera.zoom=2;
}else{
//#2
camera.z=-15500;
camera.zoom=20;
}
Just so I can see distortion, and indeed zoom does cause alot of distortion
even if the get the object in the same place, another will be distorted.
So I take back what I said about the ZOOM not doing much, it seems to be
distorting stuff.
In scenario #1, the sphere in helloworld looks like a egg shape
pointing at you, however in scenario #2, the Space background nearly match, but
the sphere is a perfect sphere - because it is being viewed from afar.
There has to be a calculation then - I am almost certain of it - I was thinking
of trying myself, but I don't have a project to work on that needs it, yet :)
-Pete
On 6/12/07, Peter
Kapelyan <flashnine@...>
wrote:
I was saying to consider the fact since ZOOM basically moves the camera
closer - perhaps you can look at what ZOOM does in the code, but my feeling is
that it simply just moves the camera closer - and focus accounts for the
"fish eye" etc.
If you figure out that ZOOM may just be the same as bringing the camera
close - maybe that will help you figure it out?
-Pete
On 6/12/07, Marcelo
Caetano Martins Muniz <marcelo@...> wrote:
If you use DirectX for example, the FoV
has a big rule in the camera Zoom.
Generally people use 45 as diagonal FoV, but if you change from 45 to 25 the
object will look closer.
Check the attached images, both images the camera is at the same distance from
the object, the only difference is the Field of View.
When I use papervision, if I just change
the camera focus the objects won't look any closer. I see the projection
difference but no zoom difference.
So, I think that if I want to synchronize
DirectX or OpenGL camera with Papervision3D I'll have to change both focus and
zoom. And that's why I'm after a formula that gets as input the scene stage
size and diagonal field of view and return the papervision focus and zoom.
Does it make sense to you?
Thanks,
Marcelo Muniz
Hi, I
seriously DOUBT it because it is not truley 3d...however I am sure it comes
very close.
Also I realize you maybe have answered your own question! I don't think zoom
will help you because I believe it in effect the same as moving the camera
closer to the focal point, so it almost seems like zoom might not play a part
in your scenario unless maybe you convert it to a Z position? Just an idea.
-Pete
On
6/12/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
I can't give you a code example but I'll
give you the scenario.
I have renderers implemented in Directx
and OpenGL that output renders (images) to me.
In these renderers I can set any value as
diagonal field of view to the camera.
What I wanna do is to use a low poly
version of my 3d models in papervision, so the user can set the camera position
in the scene, click on a button to render and I output an image of the same
scene rendered using high poly 3d models on my renderers.
The default diagonal FoV that I use in the
renderers is 25. The flash stage and the output image have the same size
622x310. I could synchronize the papervision camera with my renderers using the
following formula to find the papervision camera focus:
var
diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width;
var h:Number = height;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
And I had to manually adjust the
papervision camera zoom until it matches the rendered images.
I have the following questions:
1) Does the papervision camera focus represent the focal distance that we find
in any standard 3D game library (DirectX/OpenGL) for camera settings?
2) How can I calculate automatically the papervision camera focus and zoom if I
give you as input my stage size and diagonal field of view?
Thank you,
Marcelo Muniz
Ok I am
back - can you send me any code (hopefully flex as3 or cs3)?
I will try to give you a good answer!
-Pete
On
6/12/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
Ok. I'll be waiting for you response.
Hi
someone posted a calculator or something (my suggestion). I will look
tonight - literally out the door now.
-Pete
On
6/12/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
|
Hi,
I still got no answer about how to
calculate the camera Field of View using focus and zoom.
I did some
research and I find out how to calculate focalDistance, is it the same as the
camera focus?
Here is formula I found how to convert
diagonalFOV to focalDistance.
var diagonalFOV:Number = 25;
var width:Number = 622;
var height:Number = 310;
var w:Number = width ;
var h:Number = height ;
var d:Number = Math.SQRT((w * w) + (h * h)) ;
var focalDistance:Number = d *
Math.TAN(diagonalFOV / 2.0) ;
|
|
If focalDistance is the same as the
camera focus, it still doesn't make sense how to calculate the correct camera
zoom for one selected FoV.
Does anyone have some clue to this puzzle?
|
|
Thanks,
Marcelo Muniz
|
|
|
|
|
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV
Hi Marcelo,
I've also been looking into this in order to sync a PV3D scene and a
pre-rendered 3D animation together over the past few days, and I
reckon you're on the right track.
Basically, Camera.focus applies the focal depth of the camera, which
is effectively the FOV. The problem, though, is that the PV3D camera
doesn't take into account the maximum diagonal width of the viewport
it is being rendered into (the frame size). This is the third,
critical variable. The only thing is that I haven't yet figured out
how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I’ll take a look at the papervision API
> implementation and try to figure out how they are implementing
> focus and zoom.
>
>
> From: Papervision3D-bounces@... [mailto:Papervision3D-
> bounces@...] On Behalf Of Peter Kapelyan
> Sent: quarta-feira, 13 de junho de 2007 00:34
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok well, I tried a test like this...
> nnn++;
> if(nnn%5){
>
> //#1
> camera.z=-1000;
> camera.zoom=2;
> }else{
>
> //#2
> camera.z=-15500;
> camera.zoom=20;
> }
> Just so I can see distortion, and indeed zoom does cause alot of
> distortion even if the get the object in the same place, another
> will be distorted.
> So I take back what I said about the ZOOM not doing much, it seems
> to be distorting stuff.
>
> In scenario #1, the sphere in helloworld looks like a egg shape
> pointing at you, however in scenario #2, the Space background
> nearly match, but the sphere is a perfect sphere - because it is
> being viewed from afar.
> There has to be a calculation then - I am almost certain of it - I
> was thinking of trying myself, but I don't have a project to work
> on that needs it, yet :)
> -Pete
>
>
> On 6/12/07, Peter Kapelyan < flashnine@...> wrote:
>
> Hi
>
>
> I was saying to consider the fact since ZOOM basically moves the
> camera closer - perhaps you can look at what ZOOM does in the code,
> but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc.
>
>
> If you figure out that ZOOM may just be the same as bringing the
> camera close - maybe that will help you figure it out?
>
> -Pete
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> If you use DirectX for example, the FoV has a big rule in the
> camera Zoom.
> Generally people use 45 as diagonal FoV, but if you change from 45
> to 25 the object will look closer.
>
> Check the attached images, both images the camera is at the same
> distance from the object, the only difference is the Field of View.
>
>
> When I use papervision, if I just change the camera focus the
> objects won't look any closer. I see the projection difference but
> no zoom difference.
>
>
> So, I think that if I want to synchronize DirectX or OpenGL camera
> with Papervision3D I'll have to change both focus and zoom. And
> that's why I'm after a formula that gets as input the scene stage
> size and diagonal field of view and return the papervision focus
> and zoom.
>
>
> Does it make sense to you?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
> From: Papervision3D-bounces@... [mailto: Papervision3D-
> bounces@...] On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 21:54
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi, I seriously DOUBT it because it is not truley 3d...however I am
> sure it comes very close.
> Also I realize you maybe have answered your own question! I don't
> think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems
> like zoom might not play a part in your scenario unless maybe you
> convert it to a Z position? Just an idea.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> I can't give you a code example but I'll give you the scenario.
>
>
> I have renderers implemented in Directx and OpenGL that output
> renders (images) to me.
>
> In these renderers I can set any value as diagonal field of view to
> the camera.
>
>
> What I wanna do is to use a low poly version of my 3d models in
> papervision, so the user can set the camera position in the scene,
> click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers.
>
>
> The default diagonal FoV that I use in the renderers is 25. The
> flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using
> the following formula to find the papervision camera focus:
>
> var diagonalFOV:Number = 25;
> var width:Number = 622;
> var height:Number = 310;
> var w:Number = width;
> var h:Number = height;
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
> And I had to manually adjust the papervision camera zoom until it
> matches the rendered images.
>
>
> I have the following questions:
>
> 1) Does the papervision camera focus represent the focal distance
> that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings?
> 2) How can I calculate automatically the papervision camera focus
> and zoom if I give you as input my stage size and diagonal field of
> view?
>
> Thank you,
>
> Marcelo Muniz
>
> From: Papervision3D-bounces@... [mailto: Papervision3D-
> bounces@...] On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 20:57
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok I am back - can you send me any code (hopefully flex as3 or cs3)?
> I will try to give you a good answer!
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Ok. I'll be waiting for you response.
>
>
> From: Papervision3D-bounces@... [mailto: Papervision3D-
> bounces@...] On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 15:30
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi someone posted a calculator or something (my suggestion). I will
> look tonight - literally out the door now.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Hi,
>
>
> I still got no answer about how to calculate the camera Field of
> View using focus and zoom.
>
>
> I did some research and I find out how to calculate focalDistance,
> is it the same as the camera focus?
>
> Here is formula I found how to convert diagonalFOV to focalDistance.
>
>
> var diagonalFOV:Number = 25;
>
> var width:Number = 622;
>
> var height:Number = 310;
>
> var w:Number = width ;
>
> var h:Number = height ;
>
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
>
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
>
> If focalDistance is the same as the camera focus, it still doesn't
> make sense how to calculate the correct camera zoom for one
> selected FoV.
>
> Does anyone have some clue to this puzzle?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org>
>
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV
Hi guys, Since there has been some many going around about FOV, let me clarify some issues I came up with this. Let me explain by just using 1 axis, to keep things simple. Field of View is expressed as an angle, starting from 0. So, a FOV of 90 would give you 90 degrees of view of an area from a specific point of view, centered by the viewing angle.
Let me clarify this; if the FOV is 90, everything to the left from the center of the screen is viewing angle - 45 degrees (stepwise), and everything to the right of the center of the screen is viewing angle + 45 degrees.
Now here the problem pops up; FOV relates to a fixed projection size. Something PV3D doesn't do right now. If my view is 90 degrees and the project screen is 320 pixels, this would work. Normally, when the screen would become wider (and higher, aspect ratio and such, I'll won't go deeper in that right now), let's say, going to 640, the 90 degrees could be still projected over that amount of pixels, the same it was over the amount of 320. Because we would know the screen has become wider; we would update the camera settings to match that FOV at that pixel width.
Since PV3D has none of this implemented, there is no real FOV -> projected plane. I guess we'll have it in there by the next version though. So, point taken, we'll have a better look at it. For now I can imagine coding workarounds which would work like a real FOV setting though.
Regards, Ralph. On 6/15/07, Aaron McCaffery <lists@...> wrote:
Hi Marcelo,
I've also been looking into this in order to sync a PV3D scene and a pre-rendered 3D animation together over the past few days, and I reckon you're on the right track.
Basically, Camera.focus
applies the focal depth of the camera, which is effectively the FOV. The problem, though, is that the PV3D camera doesn't take into account the maximum diagonal width of the viewport it is being rendered into (the frame size). This is the third,
critical variable. The only thing is that I haven't yet figured out how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I'll take a look at the papervision API > implementation and try to figure out how they are implementing > focus and zoom. > > > From: Papervision3D-bounces@... [mailto: ...> bounces@...] On Behalf Of Peter Kapelyan > Sent: quarta-feira, 13 de junho de 2007 00:34
> To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV > > > Ok well, I tried a test like this... > nnn++; > if(nnn%5){
> > //#1 > camera.z=-1000; > camera.zoom=2; > }else{ > > //#2 > camera.z=-15500; > camera.zoom=20; > } > Just so I can see distortion, and indeed zoom does cause alot of
> distortion even if the get the object in the same place, another > will be distorted. > So I take back what I said about the ZOOM not doing much, it seems > to be distorting stuff. > > In scenario #1, the sphere in helloworld looks like a egg shape
> pointing at you, however in scenario #2, the Space background > nearly match, but the sphere is a perfect sphere - because it is > being viewed from afar. > There has to be a calculation then - I am almost certain of it - I
> was thinking of trying myself, but I don't have a project to work > on that needs it, yet :) > -Pete > > > On 6/12/07, Peter Kapelyan < flashnine@...> wrote: > > Hi > > > I was saying to consider the fact since ZOOM basically moves the > camera closer - perhaps you can look at what ZOOM does in the code, > but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc. > > > If you figure out that ZOOM may just be the same as bringing the > camera close - maybe that will help you figure it out? >
> -Pete> > > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote: > > If you use DirectX for example, the FoV has a big rule in the
> camera Zoom. > Generally people use 45 as diagonal FoV, but if you change from 45 > to 25 the object will look closer. > > Check the attached images, both images the camera is at the same
> distance from the object, the only difference is the Field of View. > > > When I use papervision, if I just change the camera focus the > objects won't look any closer. I see the projection difference but
> no zoom difference. > > > So, I think that if I want to synchronize DirectX or OpenGL camera > with Papervision3D I'll have to change both focus and zoom. And > that's why I'm after a formula that gets as input the scene stage
> size and diagonal field of view and return the papervision focus > and zoom. > > > Does it make sense to you? > > > Thanks, > > Marcelo Muniz > >
> From: Papervision3D-bounces@... [mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 21:54 > > > To: Papervision3D@... > Subject: Re: [Papervision3D] Camera FoV > >
> Hi, I seriously DOUBT it because it is not truley 3d...however I am > sure it comes very close. > Also I realize you maybe have answered your own question! I don't > think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems > like zoom might not play a part in your scenario unless maybe you > convert it to a Z position? Just an idea. > -Pete >
>> > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote: > > I can't give you a code example but I'll give you the scenario.
> > > I have renderers implemented in Directx and OpenGL that output > renders (images) to me. > > In these renderers I can set any value as diagonal field of view to > the camera.
> > > What I wanna do is to use a low poly version of my 3d models in > papervision, so the user can set the camera position in the scene, > click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers. > > > The default diagonal FoV that I use in the renderers is 25. The > flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using> the following formula to find the papervision camera focus: > > var diagonalFOV:Number = 25; > var width:Number = 622; > var height:Number = 310;
> var w:Number = width; > var h:Number = height; > var d:Number = Math.SQRT((w * w) + (h * h)) ; > var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; > > And I had to manually adjust the papervision camera zoom until it
> matches the rendered images. > > > I have the following questions: > > 1) Does the papervision camera focus represent the focal distance > that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings? > 2) How can I calculate automatically the papervision camera focus > and zoom if I give you as input my stage size and diagonal field of > view? > > Thank you, >
> Marcelo Muniz > > From: Papervision3D-bounces@... [mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 20:57 > > > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV
> > > Ok I am back - can you send me any code (hopefully flex as3 or cs3)? > I will try to give you a good answer! > -Pete > > > > On 6/12/07, Marcelo Caetano Martins Muniz <
marcelo@...> > wrote: > > Ok. I'll be waiting for you response. > > > From: Papervision3D-bounces@... [mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 15:30 > To:
Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV > > > Hi someone posted a calculator or something (my suggestion). I will > look tonight - literally out the door now.
> -Pete > > > > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote: > > Hi, > > > I still got no answer about how to calculate the camera Field of
> View using focus and zoom. > > > I did some research and I find out how to calculate focalDistance, > is it the same as the camera focus? > > Here is formula I found how to convert diagonalFOV to focalDistance.
> > > var diagonalFOV:Number = 25; > > var width:Number = 622; > > var height:Number = 310; > > var w:Number = width ; > > var h:Number = height ; >
> var d:Number = Math.SQRT((w * w) + (h * h)) ; > > var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; > > > If focalDistance is the same as the camera focus, it still doesn't
> make sense how to calculate the correct camera zoom for one > selected FoV. > > Does anyone have some clue to this puzzle? > > > Thanks, > > Marcelo Muniz >
>
_______________________________________________ Papervision3D mailing list Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
-- Ralph Hauwert
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
I found how the projection is done. It is inside the class
Vertice3D. Here is part of the code:
while( vertex = vertices[--i] )
{
// Center position
var vx :Number = vertex.x;
var vy :Number = vertex.y;
var vz :Number = vertex.z;
var s_x :Number = vx * m11 + vy * m12 + vz * m13 + view.n14;
var s_y :Number = vx * m21 + vy * m22 + vz * m23 + view.n24;
var s_z :Number = vx * m31 + vy * m32 + vz * m33 + view.n34;
screen = projected[vertex] || (projected[vertex]
= new Vertex2D());
if( screen.visible = ( s_z > 0 ) )
{
persp = focus / (focus + s_z) * zoom;
screen.x = s_x * persp;
screen.y = s_y * persp;
screen.z = s_z;
}
}
They way papervision
implements the 3d projection in 2d, but if you take a look the persp is
relative to focus, and zoom.
The way 3D APIs
generally do is something like this:
a) Align the screen (0,0) with the world (0,0,0)
b) correct the y
directional error
then:
screen.x = s_x * horizontalFoV * (1/ s_z)+ XCenter; screen.y = -s_y * verticalFoV * (1/ s_z) + YCenter; screen.z = s_z;
But I still didn’t
figure out a direct way to convert zoom and focus to FoV.
Thanks,
Marcelo Muniz
Hi guys,
Since there has been some many going around about FOV, let me clarify some
issues I came up with this.
Let me explain by just using 1 axis, to keep things simple.
Field of View is expressed as an angle, starting from 0. So, a FOV of 90 would
give you 90 degrees of view of an area from a specific point of view, centered
by the viewing angle.
Let me clarify this; if the FOV is 90, everything to the left from the center
of the screen is viewing angle - 45 degrees (stepwise), and everything to the right
of the center of the screen is viewing angle + 45 degrees.
Now here the problem pops up; FOV relates to a fixed projection size. Something
PV3D doesn't do right now. If my view is 90 degrees and the project screen is
320 pixels, this would work. Normally, when the screen would become wider (and
higher, aspect ratio and such, I'll won't go deeper in that right now), let's
say, going to 640, the 90 degrees could be still projected over that amount of
pixels, the same it was over the amount of 320. Because we would know the
screen has become wider; we would update the camera settings to match that FOV
at that pixel width.
Since PV3D has none of this implemented, there is no real FOV -> projected
plane. I guess we'll have it in there by the next version though. So, point
taken, we'll have a better look at it. For now I can imagine coding workarounds
which would work like a real FOV setting though.
Regards,
Ralph.
On 6/15/07, Aaron
McCaffery <lists@...>
wrote:
Hi Marcelo,
I've also been looking into this in order to sync a PV3D scene and a
pre-rendered 3D animation together over the past few days, and I
reckon you're on the right track.
Basically, Camera.focus applies the focal depth of the camera, which
is effectively the FOV. The problem, though, is that the PV3D camera
doesn't take into account the maximum diagonal width of the viewport
it is being rendered into (the frame size). This is the third,
critical variable. The only thing is that I haven't yet figured out
how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I'll take a look at the papervision API
> implementation and try to figure out how they are implementing
> focus and zoom.
>
>
> From: Papervision3D-bounces@...
[mailto:...
> bounces@...] On Behalf Of
Peter Kapelyan
> Sent: quarta-feira, 13 de junho de 2007 00:34
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok well, I tried a test like this...
> nnn++;
> if(nnn%5){
>
> //#1
> camera.z=-1000;
> camera.zoom=2;
> }else{
>
> //#2
> camera.z=-15500;
> camera.zoom=20;
> }
> Just so I can see distortion, and indeed zoom does cause alot of
> distortion even if the get the object in the same place, another
> will be distorted.
> So I take back what I said about the ZOOM not doing much, it seems
> to be distorting stuff.
>
> In scenario #1, the sphere in helloworld looks like a egg shape
> pointing at you, however in scenario #2, the Space background
> nearly match, but the sphere is a perfect sphere - because it is
> being viewed from afar.
> There has to be a calculation then - I am almost certain of it - I
> was thinking of trying myself, but I don't have a project to work
> on that needs it, yet :)
> -Pete
>
>
> On 6/12/07, Peter Kapelyan <flashnine@...> wrote:
>
> Hi
>
>
> I was saying to consider the fact since ZOOM basically moves the
> camera closer - perhaps you can look at what ZOOM does in the code,
> but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc.
>
>
> If you figure out that ZOOM may just be the same as bringing the
> camera close - maybe that will help you figure it out?
>
> -Pete
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> If you use DirectX for example, the FoV has a big rule in the
> camera Zoom.
> Generally people use 45 as diagonal FoV, but if you change from 45
> to 25 the object will look closer.
>
> Check the attached images, both images the camera is at the same
> distance from the object, the only difference is the Field of View.
>
>
> When I use papervision, if I just change the camera focus the
> objects won't look any closer. I see the projection difference but
> no zoom difference.
>
>
> So, I think that if I want to synchronize DirectX or OpenGL camera
> with Papervision3D I'll have to change both focus and zoom. And
> that's why I'm after a formula that gets as input the scene stage
> size and diagonal field of view and return the papervision focus
> and zoom.
>
>
> Does it make sense to you?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...] On Behalf Of
Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 21:54
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi, I seriously DOUBT it because it is not truley 3d...however I am
> sure it comes very close.
> Also I realize you maybe have answered your own question! I don't
> think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems
> like zoom might not play a part in your scenario unless maybe you
> convert it to a Z position? Just an idea.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> I can't give you a code example but I'll give you the scenario.
>
>
> I have renderers implemented in Directx and OpenGL that output
> renders (images) to me.
>
> In these renderers I can set any value as diagonal field of view to
> the camera.
>
>
> What I wanna do is to use a low poly version of my 3d models in
> papervision, so the user can set the camera position in the scene,
> click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers.
>
>
> The default diagonal FoV that I use in the renderers is 25. The
> flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using
> the following formula to find the papervision camera focus:
>
> var diagonalFOV:Number = 25;
> var width:Number = 622;
> var height:Number = 310;
> var w:Number = width;
> var h:Number = height;
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
> And I had to manually adjust the papervision camera zoom until it
> matches the rendered images.
>
>
> I have the following questions:
>
> 1) Does the papervision camera focus represent the focal distance
> that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings?
> 2) How can I calculate automatically the papervision camera focus
> and zoom if I give you as input my stage size and diagonal field of
> view?
>
> Thank you,
>
> Marcelo Muniz
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...] On Behalf
Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 20:57
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok I am back - can you send me any code (hopefully flex as3 or cs3)?
> I will try to give you a good answer!
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Ok. I'll be waiting for you response.
>
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...] On Behalf Of
Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 15:30
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi someone posted a calculator or something (my suggestion). I will
> look tonight - literally out the door now.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Hi,
>
>
> I still got no answer about how to calculate the camera Field of
> View using focus and zoom.
>
>
> I did some research and I find out how to calculate focalDistance,
> is it the same as the camera focus?
>
> Here is formula I found how to convert diagonalFOV to focalDistance.
>
>
> var diagonalFOV:Number = 25;
>
> var width:Number = 622;
>
> var height:Number = 310;
>
> var w:Number = width ;
>
> var h:Number = height ;
>
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
>
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
>
> If focalDistance is the same as the camera focus, it still doesn't
> make sense how to calculate the correct camera zoom for one
> selected FoV.
>
> Does anyone have some clue to this puzzle?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
--
Ralph Hauwert
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Why not write your own code to override that?
If the math is wrong - and some numbers seem "unneded" for you... Why not cut them out and make it work the way you want? There seems like there is a possible compromise between the two :)
I would almost go as far as far as saying "I think i can figure that out" :)
know you want to use it - so why not use it? :)
Sorry to give you or anyone more work... but you basically pasted your own answer - it is kind of interesting to me :)
Almost make me want to figure it out - seems like you did 95% of the work - :)
On 6/15/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
I found how the projection is done. It is inside the class Vertice3D. Here is part of the code:
while
( vertex = vertices[--i] )
{
// Center position
var vx :Number = vertex.x;
var vy :Number = vertex.y;
var vz :Number = vertex.z;
var s_x :Number = vx * m11 + vy * m12 + vz * m13 + view.n14;
var s_y :Number = vx * m21 + vy * m22 + vz * m23 + view.n24;
var s_z :Number = vx * m31 + vy * m32 + vz * m33 + view.n34;
screen = projected[vertex] || (projected[vertex] =
new Vertex2D());
if( screen.visible = ( s_z > 0 ) )
{
persp = focus / (focus + s_z) * zoom;
screen.x = s_x * persp;
screen.y = s_y * persp;
screen.z = s_z;
}
}
They way papervision implements the 3d projection in 2d, but if you take a look the persp is relative to focus, and zoom.
The way 3D APIs generally do is something like this:
a) Align the screen (0,0) with the world (0,0,0)
b) correct the y directional error
then:
screen.x =
s_x * horizontalFoV * (1/ s_z
)+ XCenter; screen.y
= -s_y * verticalFoV * (1/
s_z) + YCenter; screen.z
= s_z;
But I still didn't figure out a direct way to convert zoom and focus to FoV.
Thanks,
Marcelo Muniz
Hi guys,
Since there has been some many going around about FOV, let me clarify some issues I came up with this.
Let me explain by just using 1 axis, to keep things simple. Field of View is expressed as an angle, starting from 0. So, a FOV of 90 would give you 90 degrees of view of an area from a specific point of view, centered by the viewing angle.
Let me clarify this; if the FOV is 90, everything to the left from the center of the screen is viewing angle - 45 degrees (stepwise), and everything to the right of the center of the screen is viewing angle + 45 degrees.
Now here the problem pops up; FOV relates to a fixed projection size. Something PV3D doesn't do right now. If my view is 90 degrees and the project screen is 320 pixels, this would work. Normally, when the screen would become wider (and higher, aspect ratio and such, I'll won't go deeper in that right now), let's say, going to 640, the 90 degrees could be still projected over that amount of pixels, the same it was over the amount of 320. Because we would know the screen has become wider; we would update the camera settings to match that FOV at that pixel width.
Since PV3D has none of this implemented, there is no real FOV -> projected plane. I guess we'll have it in there by the next version though. So, point taken, we'll have a better look at it. For now I can imagine coding workarounds which would work like a real FOV setting though.
Regards, Ralph.
On 6/15/07, Aaron McCaffery <lists@...> wrote:
Hi Marcelo,
I've also been looking into this in order to sync a PV3D scene and a pre-rendered 3D animation together over the past few days, and I
reckon you're on the right track.
Basically, Camera.focus applies the focal depth of the camera, which is effectively the FOV. The problem, though, is that the PV3D camera doesn't take into account the maximum diagonal width of the viewport
it is being rendered into (the frame size). This is the third, critical variable. The only thing is that I haven't yet figured out how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I'll take a look at the papervision API > implementation and try to figure out how they are implementing
> focus and zoom. > > > From: Papervision3D-bounces@... [mailto:
...> bounces@...] On Behalf Of Peter Kapelyan > Sent: quarta-feira, 13 de junho de 2007 00:34 > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV > > > Ok well, I tried a test like this... > nnn++; > if(nnn%5){ > > //#1 > camera.z=-1000
; > camera.zoom=2; > }else{ > > //#2 > camera.z=-15500; > camera.zoom=20; > } > Just so I can see distortion, and indeed zoom does cause alot of > distortion even if the get the object in the same place, another
> will be distorted. > So I take back what I said about the ZOOM not doing much, it seems > to be distorting stuff. > > In scenario #1, the sphere in helloworld looks like a egg shape > pointing at you, however in scenario #2, the Space background
> nearly match, but the sphere is a perfect sphere - because it is > being viewed from afar. > There has to be a calculation then - I am almost certain of it - I > was thinking of trying myself, but I don't have a project to work
> on that needs it, yet :) > -Pete > > > On 6/12/07, Peter Kapelyan < flashnine@...> wrote: > > Hi > > > I was saying to consider the fact since ZOOM basically moves the > camera closer - perhaps you can look at what ZOOM does in the code, > but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc. > > > If you figure out that ZOOM may just be the same as bringing the > camera close - maybe that will help you figure it out? >
> -Pete> > > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote: > > If you use DirectX for example, the FoV has a big rule in the > camera Zoom. > Generally people use 45 as diagonal FoV, but if you change from 45 > to 25 the object will look closer.
> > Check the attached images, both images the camera is at the same > distance from the object, the only difference is the Field of View. > > > When I use papervision, if I just change the camera focus the
> objects won't look any closer. I see the projection difference but > no zoom difference. > > > So, I think that if I want to synchronize DirectX or OpenGL camera > with Papervision3D I'll have to change both focus and zoom. And
> that's why I'm after a formula that gets as input the scene stage > size and diagonal field of view and return the papervision focus > and zoom. > > > Does it make sense to you?
> > > Thanks, > > Marcelo Muniz > > > From: Papervision3D-bounces@... [mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 21:54
> > > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV
> > > Hi, I seriously DOUBT it because it is not truley 3d...however I am > sure it comes very close. > Also I realize you maybe have answered your own question! I don't > think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems > like zoom might not play a part in your scenario unless maybe you > convert it to a Z position? Just an idea. > -Pete >
>> > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote:
> > I can't give you a code example but I'll give you the scenario. > > > I have renderers implemented in Directx and OpenGL that output > renders (images) to me. > > In these renderers I can set any value as diagonal field of view to
> the camera. > > > What I wanna do is to use a low poly version of my 3d models in > papervision, so the user can set the camera position in the scene, > click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers. > > > The default diagonal FoV that I use in the renderers is 25. The > flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using> the following formula to find the papervision camera focus: > > var diagonalFOV:Number = 25; > var width:Number = 622; > var height:Number = 310;
> var w:Number = width; > var h:Number = height; > var d:Number = Math.SQRT((w * w) + (h * h)) ; > var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; > > And I had to manually adjust the papervision camera zoom until it
> matches the rendered images. > > > I have the following questions: > > 1) Does the papervision camera focus represent the focal distance > that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings? > 2) How can I calculate automatically the papervision camera focus > and zoom if I give you as input my stage size and diagonal field of > view? > > Thank you, >
> Marcelo Muniz > > From: Papervision3D-bounces@... [mailto: Papervision3D-
> bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 20:57
> > > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV
> > > Ok I am back - can you send me any code (hopefully flex as3 or cs3)? > I will try to give you a good answer! > -Pete > > > > On 6/12/07, Marcelo Caetano Martins Muniz <
marcelo@...> > wrote: > > Ok. I'll be waiting for you response. >
> > From: Papervision3D-bounces@... [mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 15:30 > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV > > > Hi someone posted a calculator or something (my suggestion). I will > look tonight - literally out the door now.
> -Pete > > > > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote: > > Hi, > > > I still got no answer about how to calculate the camera Field of > View using focus and zoom. > > > I did some research and I find out how to calculate focalDistance,
> is it the same as the camera focus? > > Here is formula I found how to convert diagonalFOV to focalDistance. > > > var diagonalFOV:Number = 25; > > var width:Number = 622;
> > var height:Number = 310; > > var w:Number = width ; > > var h:Number = height ; > > var d:Number = Math.SQRT((w * w) + (h * h)) ; > > var focalDistance:Number = d *
Math.TAN(diagonalFOV / 2.0) ; > > > If focalDistance is the same as the camera focus, it still doesn't > make sense how to calculate the correct camera zoom for one > selected FoV. >
> Does anyone have some clue to this puzzle? > > > Thanks, > > Marcelo Muniz > > > > > > _______________________________________________ > Papervision3D mailing list
> Papervision3D@...>
http://osflash.org/mailman/listinfo/papervision3d_osflash.org> > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > > > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
-- Ralph Hauwert
_______________________________________________ Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Hi,
Part of this puzzle was
solved!!
I found a way to convert
FoV to focus and camera. But don’t look at me with this smile on your
face!
I was researching about how to convert FoV to focal length and I got the following formula:
x = 43.266615300557;
focus = (x / (2 * Math.tan(Math.PI * fov / 360))) /1.5;
I got this from http://www.bdimitrov.de/kmp/technology/fov.html
and actually it is the formula for Rectilinear Lenses on DSLR with 1.5
Crop-Factor.
After lots of empirical
tests I found that if you pick one focus value, you can find the zoom value
and if you don’t change the camera z position the above formula will work
to any the field of view (remember that the formula takes in account the
diagonal field of view) to any FoV value.
On my tests I synchronized the camera with a rendered
image. So I used the above formula to get the FoV I was using in the rendered
image than I changed the Zoom until it matched the image. The interesting thing
is that after doing this I pick another FoV value (changed the focus based on
the above formula) but kept the same zoom and it worked fine to any field one
view.
Although I found a little issue, if the camera distance
from the target vary too much, for example, I positioned the camera 1300 units
on the Z axis far from the target to find the correct zoom, but after setting
the zoom, if the camera gets too close or too far from 1300 there will the an
small error on the FoV synchronism.
As I limit the camera movements that is not a really
issue to me. Note that I used the 1.5 Crop-Factor formula. I tried the formula
without the crop factor but the error when you move the camera too close or far
to the target gets more accented.
That’s what I found so far. I hope it can be
helpful for someone else.
Thanks,
Marcelo Muniz
From:
Papervision3D-bounces@... [mailto:Papervision3D-bounces@...] On Behalf Of Peter Kapelyan
Sent: domingo, 17 de junho de 2007
05:13
To: Papervision3D@...
Subject: Re: [Papervision3D]
Camera FoV
Why not write your own code to override that?
If the math is wrong - and some numbers seem "unneded" for
you...
Why not cut them out and make it work the way you want? There seems like there
is a possible compromise between the two :)
I would almost go as far as far as saying "I think i can figure that
out" :)
know you want to use it - so why not use it? :)
Sorry to give you or anyone more work... but you basically pasted your own
answer - it is kind of interesting to me :)
Almost make me want to figure it out - seems like you did 95% of the
work - :)
On 6/15/07, Marcelo
Caetano Martins Muniz <marcelo@...>
wrote:
I found how the projection is done. It is inside
the class Vertice3D. Here is part of the code:
while ( vertex = vertices[--i] )
{
// Center position
var vx :Number = vertex.x;
var vy :Number = vertex.y;
var vz :Number = vertex.z;
var s_x :Number = vx * m11 + vy * m12 + vz * m13 + view.n14;
var s_y :Number = vx * m21 + vy * m22 + vz * m23 + view.n24;
var s_z :Number = vx * m31 + vy * m32 + vz * m33 + view.n34;
screen = projected[vertex] || (projected[vertex] = new Vertex2D());
if( screen.visible = ( s_z > 0 ) )
{
persp = focus / (focus + s_z) * zoom;
screen.x = s_x *
persp;
screen.y = s_y * persp;
screen.z = s_z;
}
}
They way papervision implements the 3d projection
in 2d, but if you take a look the persp is relative to focus, and zoom.
The way 3D APIs generally do is something like
this:
a) Align the screen (0,0) with the world (0,0,0)
b) correct the y directional error
then:
screen.x = s_x * horizontalFoV * (1/ s_z )+ XCenter; screen.y = -s_y * verticalFoV * (1/ s_z) + YCenter; screen.z = s_z;
But I still didn't figure out a direct way to
convert zoom and focus to FoV.
Thanks,
Marcelo Muniz
Hi guys,
Since there has been some many going around about FOV, let me clarify some
issues I came up with this.
Let me explain by just using 1 axis, to keep things simple.
Field of View is expressed as an angle, starting from 0. So, a FOV of 90 would
give you 90 degrees of view of an area from a specific point of view, centered
by the viewing angle.
Let me clarify this; if the FOV is 90, everything to the left from the center
of the screen is viewing angle - 45 degrees (stepwise), and everything to the
right of the center of the screen is viewing angle + 45 degrees.
Now here the problem pops up; FOV relates to a fixed projection size. Something
PV3D doesn't do right now. If my view is 90 degrees and the project screen is
320 pixels, this would work. Normally, when the screen would become wider (and
higher, aspect ratio and such, I'll won't go deeper in that right now), let's
say, going to 640, the 90 degrees could be still projected over that amount of
pixels, the same it was over the amount of 320. Because we would know the
screen has become wider; we would update the camera settings to match that FOV
at that pixel width.
Since PV3D has none of this implemented, there is no real FOV -> projected
plane. I guess we'll have it in there by the next version though. So, point
taken, we'll have a better look at it. For now I can imagine coding workarounds
which would work like a real FOV setting though.
Regards,
Ralph.
On
6/15/07, Aaron McCaffery <lists@...> wrote:
Hi
Marcelo,
I've also been looking into this in order to sync a PV3D scene and a
pre-rendered 3D animation together over the past few days, and I
reckon you're on the right track.
Basically, Camera.focus applies the focal depth of the camera, which
is effectively the FOV. The problem, though, is that the PV3D camera
doesn't take into account the maximum diagonal width of the viewport
it is being rendered into (the frame size). This is the third,
critical variable. The only thing is that I haven't yet figured out
how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I'll take a look at the papervision API
> implementation and try to figure out how they are implementing
> focus and zoom.
>
>
> From: Papervision3D-bounces@...
[mailto: ...
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: quarta-feira, 13 de junho de 2007 00:34
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok well, I tried a test like this...
> nnn++;
> if(nnn%5){
>
> //#1
> camera.z=-1000 ;
> camera.zoom=2;
> }else{
>
> //#2
> camera.z=-15500;
> camera.zoom=20;
> }
> Just so I can see distortion, and indeed zoom does cause alot of
> distortion even if the get the object in the same place, another
> will be distorted.
> So I take back what I said about the ZOOM not doing much, it seems
> to be distorting stuff.
>
> In scenario #1, the sphere in helloworld looks like a egg shape
> pointing at you, however in scenario #2, the Space background
> nearly match, but the sphere is a perfect sphere - because it is
> being viewed from afar.
> There has to be a calculation then - I am almost certain of it - I
> was thinking of trying myself, but I don't have a project to work
> on that needs it, yet :)
> -Pete
>
>
> On 6/12/07, Peter Kapelyan <flashnine@...> wrote:
>
> Hi
>
>
> I was saying to consider the fact since ZOOM basically moves the
> camera closer - perhaps you can look at what ZOOM does in the code,
> but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc.
>
>
> If you figure out that ZOOM may just be the same as bringing the
> camera close - maybe that will help you figure it out?
>
> -Pete
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> If you use DirectX for example, the FoV has a big rule in the
> camera Zoom.
> Generally people use 45 as diagonal FoV, but if you change from 45
> to 25 the object will look closer.
>
> Check the attached images, both images the camera is at the same
> distance from the object, the only difference is the Field of View.
>
>
> When I use papervision, if I just change the camera focus the
> objects won't look any closer. I see the projection difference but
> no zoom difference.
>
>
> So, I think that if I want to synchronize DirectX or OpenGL camera
> with Papervision3D I'll have to change both focus and zoom. And
> that's why I'm after a formula that gets as input the scene stage
> size and diagonal field of view and return the papervision focus
> and zoom.
>
>
> Does it make sense to you?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
> From: Papervision3D-bounces@...[mailto: Papervision3D-
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 21:54
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi, I seriously DOUBT it because it is not truley 3d...however I am
> sure it comes very close.
> Also I realize you maybe have answered your own question! I don't
> think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems
> like zoom might not play a part in your scenario unless maybe you
> convert it to a Z position? Just an idea.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> I can't give you a code example but I'll give you the scenario.
>
>
> I have renderers implemented in Directx and OpenGL that output
> renders (images) to me.
>
> In these renderers I can set any value as diagonal field of view to
> the camera.
>
>
> What I wanna do is to use a low poly version of my 3d models in
> papervision, so the user can set the camera position in the scene,
> click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers.
>
>
> The default diagonal FoV that I use in the renderers is 25. The
> flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using
> the following formula to find the papervision camera focus:
>
> var diagonalFOV:Number = 25;
> var width:Number = 622;
> var height:Number = 310;
> var w:Number = width;
> var h:Number = height;
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
> And I had to manually adjust the papervision camera zoom until it
> matches the rendered images.
>
>
> I have the following questions:
>
> 1) Does the papervision camera focus represent the focal distance
> that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings?
> 2) How can I calculate automatically the papervision camera focus
> and zoom if I give you as input my stage size and diagonal field of
> view?
>
> Thank you,
>
> Marcelo Muniz
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 20:57
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok I am back - can you send me any code (hopefully flex as3 or cs3)?
> I will try to give you a good answer!
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Ok. I'll be waiting for you response.
>
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 15:30
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi someone posted a calculator or something (my suggestion). I will
> look tonight - literally out the door now.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Hi,
>
>
> I still got no answer about how to calculate the camera Field of
> View using focus and zoom.
>
>
> I did some research and I find out how to calculate focalDistance,
> is it the same as the camera focus?
>
> Here is formula I found how to convert diagonalFOV to focalDistance.
>
>
> var diagonalFOV:Number = 25;
>
> var width:Number = 622;
>
> var height:Number = 310;
>
> var w:Number = width ;
>
> var h:Number = height ;
>
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
>
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
>
> If focalDistance is the same as the camera focus, it still doesn't
> make sense how to calculate the correct camera zoom for one
> selected FoV.
>
> Does anyone have some clue to this puzzle?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
--
Ralph Hauwert
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Wow!
Congratulations that is awesome...! amazing work. SO basically you have to be 1300 away - or it is not true to FOV? Sound really intersting, thank you!
On 6/18/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
Hi,
Part of this puzzle was solved!!
I found a way to convert FoV to focus and camera. But don't look at me with this smile on your face!
I was researching about how to convert FoV to focal length and I got the following formula:
x = 43.266615300557;
focus = (x / (2 * Math.tan(Math.PI * fov / 360))) /1.5;
I got this from
http://www.bdimitrov.de/kmp/technology/fov.html and actually it is the formula for Rectilinear Lenses on DSLR with 1.5 Crop-Factor.
After lots of empirical tests I found that if you pick one focus value, you can find the zoom value and if you don't change the camera z position the above formula will work to any the field of view (remember that the formula takes in account the diagonal field of view) to any FoV value.
On my tests I synchronized the camera with a rendered image. So I used the above formula to get the FoV I was using in the rendered image than I changed the Zoom until it matched the image. The interesting thing is that after doing this I pick another FoV value (changed the focus based on the above formula) but kept the same zoom and it worked fine to any field one view.
Although I found a little issue, if the camera distance from the target vary too much, for example, I positioned the camera 1300 units on the Z axis far from the target to find the correct zoom, but after setting the zoom, if the camera gets too close or too far from 1300 there will the an small error on the FoV synchronism.
As I limit the camera movements that is not a really issue to me. Note that I used the 1.5 Crop-Factor formula. I tried the formula without the crop factor but the error when you move the camera too close or far to the target gets more accented.
That's what I found so far. I hope it can be helpful for someone else.
Thanks,
Marcelo Muniz
From:
Papervision3D-bounces@... [mailto:Papervision3D-bounces@...] On Behalf Of Peter Kapelyan Sent: domingo, 17 de junho de 2007 05:13
Why not write your own code to override that?
If the math is wrong - and some numbers seem "unneded" for you... Why not cut them out and make it work the way you want? There seems like there is a possible compromise between the two :)
I would almost go as far as far as saying "I think i can figure that out" :) know you want to use it - so why not use it? :)
Sorry to give you or anyone more work... but you basically pasted your own answer - it is kind of interesting to me :)
Almost make me want to figure it out - seems like you did 95% of the work - :)
On 6/15/07, Marcelo Caetano Martins Muniz <marcelo@...> wrote:
I found how the projection is done. It is inside the class Vertice3D. Here is part of the code:
while
( vertex = vertices[--i] )
{
// Center position
var vx :Number = vertex.x;
var vy :Number = vertex.y;
var vz :Number = vertex.z;
var s_x :Number = vx * m11 + vy * m12 + vz * m13 + view.n14;
var s_y :Number = vx * m21 + vy * m22 + vz * m23 + view.n24;
var s_z :Number = vx * m31 + vy * m32 + vz * m33 + view.n34;
screen = projected[vertex] || (projected[vertex] =
new Vertex2D());
if( screen.visible = ( s_z > 0 ) )
{
persp = focus / (focus + s_z) * zoom;
screen.x = s_x * persp;
screen.y = s_y * persp;
screen.z = s_z;
}
}
They way papervision implements the 3d projection in 2d, but if you take a look the persp is relative to focus, and zoom.
The way 3D APIs generally do is something like this:
a) Align the screen (0,0) with the world (0,0,0)
b) correct the y directional error
then:
screen.x =
s_x
* horizontalFoV * (1/ s_z
)+ XCenter;
screen.y = -
s_y * verticalFoV * (1/
s_z) + YCenter;
screen.z
= s_z;
But I still didn't figure out a direct way to convert zoom and focus to FoV.
Thanks,
Marcelo Muniz
Hi guys,
Since there has been some many going around about FOV, let me clarify some issues I came up with this.
Let me explain by just using 1 axis, to keep things simple. Field of View is expressed as an angle, starting from 0. So, a FOV of 90 would give you 90 degrees of view of an area from a specific point of view, centered by the viewing angle.
Let me clarify this; if the FOV is 90, everything to the left from the center of the screen is viewing angle - 45 degrees (stepwise), and everything to the right of the center of the screen is viewing angle + 45 degrees.
Now here the problem pops up; FOV relates to a fixed projection size. Something PV3D doesn't do right now. If my view is 90 degrees and the project screen is 320 pixels, this would work. Normally, when the screen would become wider (and higher, aspect ratio and such, I'll won't go deeper in that right now), let's say, going to 640, the 90 degrees could be still projected over that amount of pixels, the same it was over the amount of 320. Because we would know the screen has become wider; we would update the camera settings to match that FOV at that pixel width.
Since PV3D has none of this implemented, there is no real FOV -> projected plane. I guess we'll have it in there by the next version though. So, point taken, we'll have a better look at it. For now I can imagine coding workarounds which would work like a real FOV setting though.
Regards, Ralph.
On 6/15/07, Aaron McCaffery <lists@...> wrote:
Hi Marcelo,
I've also been looking into this in order to sync a PV3D scene and a pre-rendered 3D animation together over the past few days, and I
reckon you're on the right track.
Basically, Camera.focus applies the focal depth of the camera, which is effectively the FOV. The problem, though, is that the PV3D camera doesn't take into account the maximum diagonal width of the viewport
it is being rendered into (the frame size). This is the third, critical variable. The only thing is that I haven't yet figured out how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I'll take a look at the papervision API > implementation and try to figure out how they are implementing
> focus and zoom. > > > From: Papervision3D-bounces@... [mailto:
...> bounces@...] On Behalf Of Peter Kapelyan > Sent: quarta-feira, 13 de junho de 2007 00:34 > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV > > > Ok well, I tried a test like this... > nnn++; > if(nnn%5){ > > //#1 > camera.z=-1000
; > camera.zoom=2; > }else{ > > //#2 > camera.z=-15500; > camera.zoom=20; > } > Just so I can see distortion, and indeed zoom does cause alot of > distortion even if the get the object in the same place, another
> will be distorted. > So I take back what I said about the ZOOM not doing much, it seems > to be distorting stuff. > > In scenario #1, the sphere in helloworld looks like a egg shape > pointing at you, however in scenario #2, the Space background
> nearly match, but the sphere is a perfect sphere - because it is > being viewed from afar. > There has to be a calculation then - I am almost certain of it - I > was thinking of trying myself, but I don't have a project to work
> on that needs it, yet :) > -Pete > > > On 6/12/07, Peter Kapelyan < flashnine@...> wrote: > > Hi > > > I was saying to consider the fact since ZOOM basically moves the > camera closer - perhaps you can look at what ZOOM does in the code, > but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc. > > > If you figure out that ZOOM may just be the same as bringing the > camera close - maybe that will help you figure it out? >
> -Pete> > > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote: > > If you use DirectX for example, the FoV has a big rule in the > camera Zoom. > Generally people use 45 as diagonal FoV, but if you change from 45 > to 25 the object will look closer.
> > Check the attached images, both images the camera is at the same > distance from the object, the only difference is the Field of View. > > > When I use papervision, if I just change the camera focus the
> objects won't look any closer. I see the projection difference but > no zoom difference. > > > So, I think that if I want to synchronize DirectX or OpenGL camera > with Papervision3D I'll have to change both focus and zoom. And
> that's why I'm after a formula that gets as input the scene stage > size and diagonal field of view and return the papervision focus > and zoom. > > > Does it make sense to you?
> > > Thanks, > > Marcelo Muniz > > > From: Papervision3D-bounces@...[mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 21:54
> > > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV
> > > Hi, I seriously DOUBT it because it is not truley 3d...however I am > sure it comes very close. > Also I realize you maybe have answered your own question! I don't > think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems > like zoom might not play a part in your scenario unless maybe you > convert it to a Z position? Just an idea. > -Pete >
>> > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote:
> > I can't give you a code example but I'll give you the scenario. > > > I have renderers implemented in Directx and OpenGL that output > renders (images) to me. > > In these renderers I can set any value as diagonal field of view to
> the camera. > > > What I wanna do is to use a low poly version of my 3d models in > papervision, so the user can set the camera position in the scene, > click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers. > > > The default diagonal FoV that I use in the renderers is 25. The > flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using> the following formula to find the papervision camera focus: > > var diagonalFOV:Number = 25; > var width:Number = 622; > var height:Number = 310;
> var w:Number = width; > var h:Number = height; > var d:Number = Math.SQRT((w * w) + (h * h)) ; > var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ; > > And I had to manually adjust the papervision camera zoom until it
> matches the rendered images. > > > I have the following questions: > > 1) Does the papervision camera focus represent the focal distance > that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings? > 2) How can I calculate automatically the papervision camera focus > and zoom if I give you as input my stage size and diagonal field of > view? > > Thank you, >
> Marcelo Muniz > > From: Papervision3D-bounces@... [mailto: Papervision3D-
> bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 20:57
> > > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV
> > > Ok I am back - can you send me any code (hopefully flex as3 or cs3)? > I will try to give you a good answer! > -Pete > > > > On 6/12/07, Marcelo Caetano Martins Muniz <
marcelo@...> > wrote: > > Ok. I'll be waiting for you response. >
> > From: Papervision3D-bounces@... [mailto: Papervision3D- > bounces@...] On Behalf Of Peter Kapelyan > Sent: terça-feira, 12 de junho de 2007 15:30 > To: Papervision3D@...> Subject: Re: [Papervision3D] Camera FoV > > > Hi someone posted a calculator or something (my suggestion). I will > look tonight - literally out the door now.
> -Pete > > > > On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...> > wrote: > > Hi, > > > I still got no answer about how to calculate the camera Field of > View using focus and zoom. > > > I did some research and I find out how to calculate focalDistance,
> is it the same as the camera focus? > > Here is formula I found how to convert diagonalFOV to focalDistance. > > > var diagonalFOV:Number = 25; > > var width:Number = 622;
> > var height:Number = 310; > > var w:Number = width ; > > var h:Number = height ; > > var d:Number = Math.SQRT((w * w) + (h * h)) ; > > var focalDistance:Number = d *
Math.TAN(diagonalFOV / 2.0) ; > > > If focalDistance is the same as the camera focus, it still doesn't > make sense how to calculate the correct camera zoom for one > selected FoV. >
> Does anyone have some clue to this puzzle? > > > Thanks, > > Marcelo Muniz > > > > > > _______________________________________________ > Papervision3D mailing list
> Papervision3D@...>
http://osflash.org/mailman/listinfo/papervision3d_osflash.org> > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > > > > > _______________________________________________ > Papervision3D mailing list > Papervision3D@...> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
-- Ralph Hauwert
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV

Some parts of this message have been removed.
Learn more about Nabble's security policy.
Actually you can
synchronize the zoom at any camera position. But if you move the camera to a
position far from that you used the synchronize it, you will see some
distortion and the FoV won’t match exactly how it show.
So the steps to use the
FoV are the following:
1. Get the focus value from the formula I sent (or use that site, there is a
javascript that automatically converts from FoV to focal length (same as
focus).
2. Synchronize the zoom
with a reference image.
Once you synchronized
the zoom you can use the any FoV (just change the focus value using the
formula).
3. Have fun!
I still want to find a
formula that given a FoV and a camera position I can calculate automatically the
zoom. I think it’s possible, not sure how.
Thanks,
Marcelo Muniz
Congratulations that is awesome...!
amazing work.
SO basically you have to be 1300 away - or it is not true to FOV?
Sound really intersting, thank you!
On 6/18/07, Marcelo
Caetano Martins Muniz <marcelo@...>
wrote:
Hi,
Part of this puzzle was solved!!
I found a way to convert FoV to focus and
camera. But don't look at me with this smile on your face!
I was researching about how to convert FoV to focal length and I got the following formula:
x = 43.266615300557;
focus = (x / (2 * Math.tan(Math.PI * fov / 360))) /1.5;
I got this from http://www.bdimitrov.de/kmp/technology/fov.html
and actually it is the formula for Rectilinear Lenses on DSLR with 1.5
Crop-Factor.
After lots of empirical tests I found that if you
pick one focus value, you can find the zoom value and if you don't change
the camera z position the above formula will work to any the field of view
(remember that the formula takes in account the diagonal field of view) to any
FoV value.
On my tests I synchronized the camera with a rendered image. So I used
the above formula to get the FoV I was using in the rendered image than I
changed the Zoom until it matched the image. The interesting thing is that
after doing this I pick another FoV value (changed the focus based on the above
formula) but kept the same zoom and it worked fine to any field one view.
Although I found a little issue, if the camera distance from the target
vary too much, for example, I positioned the camera 1300 units on the Z axis
far from the target to find the correct zoom, but after setting the zoom, if
the camera gets too close or too far from 1300 there will the an small error on
the FoV synchronism.
As I limit the camera movements that is not a really issue to me. Note
that I used the 1.5 Crop-Factor formula. I tried the formula without the crop
factor but the error when you move the camera too close or far to the target
gets more accented.
That's what I found so far. I hope it can be helpful for someone else.
Thanks,
Marcelo Muniz
From: Papervision3D-bounces@...
[mailto:Papervision3D-bounces@...] On
Behalf Of Peter Kapelyan
Sent: domingo, 17 de junho de 2007
05:13
Why not
write your own code to override that?
If the
math is wrong - and some numbers seem "unneded" for you...
Why not cut them out and make it work the way you want? There seems like there
is a possible compromise between the two :)
I would almost go as far as far as saying "I think i can figure that
out" :)
know you want to use it - so why not use it? :)
Sorry to give you or anyone more work... but you basically pasted your own
answer - it is kind of interesting to me :)
Almost
make me want to figure it out - seems like you did 95% of the work - :)
On
6/15/07, Marcelo Caetano Martins Muniz
<marcelo@...> wrote:
I found how the projection is done. It is inside
the class Vertice3D. Here is part of the code:
while ( vertex = vertices[--i] )
{
// Center position
var vx :Number = vertex.x;
var vy :Number = vertex.y;
var vz :Number = vertex.z;
var s_x :Number = vx * m11 + vy * m12 + vz * m13 + view.n14;
var s_y :Number = vx * m21 + vy * m22 + vz * m23 + view.n24;
var s_z :Number = vx * m31 + vy * m32 + vz * m33 + view.n34;
screen = projected[vertex] || (projected[vertex] = new Vertex2D());
if( screen.visible = ( s_z > 0 ) )
{
persp = focus / (focus + s_z) * zoom;
screen.x = s_x *
persp;
screen.y = s_y * persp;
screen.z = s_z;
}
}
They way papervision implements the 3d
projection in 2d, but if you take a look the persp is relative to focus, and
zoom.
The way 3D APIs generally do is something like
this:
a) Align the screen (0,0) with the world (0,0,0)
b) correct the y directional error
then:
screen.x = s_x * horizontalFoV * (1/ s_z )+ XCenter; screen.y = - s_y * verticalFoV * (1/ s_z) + YCenter; screen.z = s_z;
But I still didn't figure out a direct way to
convert zoom and focus to FoV.
Thanks,
Marcelo Muniz
Hi guys,
Since there has been some many going around about FOV, let me clarify some
issues I came up with this.
Let me explain by just using 1 axis, to keep things simple.
Field of View is expressed as an angle, starting from 0. So, a FOV of 90 would
give you 90 degrees of view of an area from a specific point of view, centered
by the viewing angle.
Let me clarify this; if the FOV is 90, everything to the left from the center
of the screen is viewing angle - 45 degrees (stepwise), and everything to the
right of the center of the screen is viewing angle + 45 degrees.
Now here the problem pops up; FOV relates to a fixed projection size. Something
PV3D doesn't do right now. If my view is 90 degrees and the project screen is
320 pixels, this would work. Normally, when the screen would become wider (and
higher, aspect ratio and such, I'll won't go deeper in that right now), let's
say, going to 640, the 90 degrees could be still projected over that amount of
pixels, the same it was over the amount of 320. Because we would know the
screen has become wider; we would update the camera settings to match that FOV
at that pixel width.
Since PV3D has none of this implemented, there is no real FOV -> projected
plane. I guess we'll have it in there by the next version though. So, point
taken, we'll have a better look at it. For now I can imagine coding workarounds
which would work like a real FOV setting though.
Regards,
Ralph.
On
6/15/07, Aaron McCaffery <lists@...> wrote:
Hi
Marcelo,
I've also been looking into this in order to sync a PV3D scene and a
pre-rendered 3D animation together over the past few days, and I
reckon you're on the right track.
Basically, Camera.focus applies the focal depth of the camera, which
is effectively the FOV. The problem, though, is that the PV3D camera
doesn't take into account the maximum diagonal width of the viewport
it is being rendered into (the frame size). This is the third,
critical variable. The only thing is that I haven't yet figured out
how Camera.focus, Camera.zoom and the frame size relate to one another.
Maybe we can collaborate on this?
- Aaron
On 13/06/2007, at 1:14 PM, Marcelo Caetano Martins Muniz wrote:
> Now it makes sense. I'll take a look at the papervision API
> implementation and try to figure out how they are implementing
> focus and zoom.
>
>
> From: Papervision3D-bounces@...
[mailto: ...
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: quarta-feira, 13 de junho de 2007 00:34
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok well, I tried a test like this...
> nnn++;
> if(nnn%5){
>
> //#1
> camera.z=-1000 ;
> camera.zoom=2;
> }else{
>
> //#2
> camera.z=-15500;
> camera.zoom=20;
> }
> Just so I can see distortion, and indeed zoom does cause alot of
> distortion even if the get the object in the same place, another
> will be distorted.
> So I take back what I said about the ZOOM not doing much, it seems
> to be distorting stuff.
>
> In scenario #1, the sphere in helloworld looks like a egg shape
> pointing at you, however in scenario #2, the Space background
> nearly match, but the sphere is a perfect sphere - because it is
> being viewed from afar.
> There has to be a calculation then - I am almost certain of it - I
> was thinking of trying myself, but I don't have a project to work
> on that needs it, yet :)
> -Pete
>
>
> On 6/12/07, Peter Kapelyan <flashnine@...> wrote:
>
> Hi
>
>
> I was saying to consider the fact since ZOOM basically moves the
> camera closer - perhaps you can look at what ZOOM does in the code,
> but my feeling is that it simply just moves the camera closer - and
> focus accounts for the "fish eye" etc.
>
>
> If you figure out that ZOOM may just be the same as bringing the
> camera close - maybe that will help you figure it out?
>
> -Pete
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> If you use DirectX for example, the FoV has a big rule in the
> camera Zoom.
> Generally people use 45 as diagonal FoV, but if you change from 45
> to 25 the object will look closer.
>
> Check the attached images, both images the camera is at the same
> distance from the object, the only difference is the Field of View.
>
>
> When I use papervision, if I just change the camera focus the
> objects won't look any closer. I see the projection difference but
> no zoom difference.
>
>
> So, I think that if I want to synchronize DirectX or OpenGL camera
> with Papervision3D I'll have to change both focus and zoom. And
> that's why I'm after a formula that gets as input the scene stage
> size and diagonal field of view and return the papervision focus
> and zoom.
>
>
> Does it make sense to you?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
> From: Papervision3D-bounces@...[mailto: Papervision3D-
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 21:54
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi, I seriously DOUBT it because it is not truley 3d...however I am
> sure it comes very close.
> Also I realize you maybe have answered your own question! I don't
> think zoom will help you because I believe it in effect the same as
> moving the camera closer to the focal point, so it almost seems
> like zoom might not play a part in your scenario unless maybe you
> convert it to a Z position? Just an idea.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> I can't give you a code example but I'll give you the scenario.
>
>
> I have renderers implemented in Directx and OpenGL that output
> renders (images) to me.
>
> In these renderers I can set any value as diagonal field of view to
> the camera.
>
>
> What I wanna do is to use a low poly version of my 3d models in
> papervision, so the user can set the camera position in the scene,
> click on a button to render and I output an image of the same scene
> rendered using high poly 3d models on my renderers.
>
>
> The default diagonal FoV that I use in the renderers is 25. The
> flash stage and the output image have the same size 622x310. I
> could synchronize the papervision camera with my renderers using
> the following formula to find the papervision camera focus:
>
> var diagonalFOV:Number = 25;
> var width:Number = 622;
> var height:Number = 310;
> var w:Number = width;
> var h:Number = height;
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
> And I had to manually adjust the papervision camera zoom until it
> matches the rendered images.
>
>
> I have the following questions:
>
> 1) Does the papervision camera focus represent the focal distance
> that we find in any standard 3D game library (DirectX/OpenGL) for
> camera settings?
> 2) How can I calculate automatically the papervision camera focus
> and zoom if I give you as input my stage size and diagonal field of
> view?
>
> Thank you,
>
> Marcelo Muniz
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 20:57
>
>
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Ok I am back - can you send me any code (hopefully flex as3 or cs3)?
> I will try to give you a good answer!
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Ok. I'll be waiting for you response.
>
>
> From: Papervision3D-bounces@...
[mailto: Papervision3D-
> bounces@...]
On Behalf Of Peter Kapelyan
> Sent: terça-feira, 12 de junho de 2007 15:30
> To: Papervision3D@...
> Subject: Re: [Papervision3D] Camera FoV
>
>
> Hi someone posted a calculator or something (my suggestion). I will
> look tonight - literally out the door now.
> -Pete
>
>
>
> On 6/12/07, Marcelo Caetano Martins Muniz < marcelo@...>
> wrote:
>
> Hi,
>
>
> I still got no answer about how to calculate the camera Field of
> View using focus and zoom.
>
>
> I did some research and I find out how to calculate focalDistance,
> is it the same as the camera focus?
>
> Here is formula I found how to convert diagonalFOV to focalDistance.
>
>
> var diagonalFOV:Number = 25;
>
> var width:Number = 622;
>
> var height:Number = 310;
>
> var w:Number = width ;
>
> var h:Number = height ;
>
> var d:Number = Math.SQRT((w * w) + (h * h)) ;
>
> var focalDistance:Number = d * Math.TAN(diagonalFOV / 2.0) ;
>
>
> If focalDistance is the same as the camera focus, it still doesn't
> make sense how to calculate the correct camera zoom for one
> selected FoV.
>
> Does anyone have some clue to this puzzle?
>
>
> Thanks,
>
> Marcelo Muniz
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
--
Ralph Hauwert
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV
On 19/06/2007, at 11:09 AM, Marcelo Caetano Martins Muniz wrote:
> I still want to find a formula that given a FoV and a camera
> position I can calculate automatically the zoom. I think it’s
> possible, not sure how.
This has been going on for a while now, hasn't it! I think you'll
never get the answer you want, because the projection in Papervision/
OpenGL is not compatible with cameras.
Cameras have incoming light that go through a nodal point, which then
goes to a CCD sensor. Computer graphics use a rectangular frustum
with no nodal point. The position of the camera defines a single
spot, and the distance defines the clipping plane of the near-side
frustum - which has no correlation with cameras.
You can get the FOV from the edges of the frustum, but the zoom is
sectioned out from that overall FOV. This is different from cameras
setting the FOV from focal length, as cameras handle FOV and zoom
with the same mechanism. Rectangular frustums have separate values,
which you can best see by setting zoom to 1, and modifying the
clipping planes.
You're just not really going to get what you want.
--
steve@...
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV
Is this still true now that we have the FrustumCamera3D?
Has anyone worked out the formulas yet?
stephen white-4 wrote:
On 19/06/2007, at 11:09 AM, Marcelo Caetano Martins Muniz wrote:
> I still want to find a formula that given a FoV and a camera
> position I can calculate automatically the zoom. I think it’s
> possible, not sure how.
This has been going on for a while now, hasn't it! I think you'll
never get the answer you want, because the projection in Papervision/
OpenGL is not compatible with cameras.
Cameras have incoming light that go through a nodal point, which then
goes to a CCD sensor. Computer graphics use a rectangular frustum
with no nodal point. The position of the camera defines a single
spot, and the distance defines the clipping plane of the near-side
frustum - which has no correlation with cameras.
You can get the FOV from the edges of the frustum, but the zoom is
sectioned out from that overall FOV. This is different from cameras
setting the FOV from focal length, as cameras handle FOV and zoom
with the same mechanism. Rectangular frustums have separate values,
which you can best see by setting zoom to 1, and modifying the
clipping planes.
You're just not really going to get what you want.
--
steve@adam.com.au
_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|

|
Re: Camera FoV
Hi,
This one is good solution by just getting a reference of plane and copying plane position to actual object position.
Good thinking.
With Regards,
Ritesh Jariwala
-----Original Message-----
From: papervision3d-bounces@... [mailto: papervision3d-bounces@...] On Behalf Of timbon
Sent: Monday, February 18, 2008 9:26 AM
To: papervision3D@...
Subject: Re: [Papervision3D] Camera FoV
Is this still true now that we have the FrustumCamera3D?
Has anyone worked out the formulas yet?
stephen white-4 wrote:
>
> On 19/06/2007, at 11:09 AM, Marcelo Caetano Martins Muniz wrote:
>> I still want to find a formula that given a FoV and a camera
>> position I can calculate automatically the zoom. I think it’s
>> possible, not sure how.
>
> This has been going on for a while now, hasn't it! I think you'll
> never get the answer you want, because the projection in Papervision/
> OpenGL is not compatible with cameras.
>
> Cameras have incoming light that go through a nodal point, which then
> goes to a CCD sensor. Computer graphics use a rectangular frustum
> with no nodal point. The position of the camera defines a single
> spot, and the distance defines the clipping plane of the near-side
> frustum - which has no correlation with cameras.
>
> You can get the FOV from the edges of the frustum, but the zoom is
> sectioned out from that overall FOV. This is different from cameras
> setting the FOV from focal length, as cameras handle FOV and zoom
> with the same mechanism. Rectangular frustums have separate values,
> which you can best see by setting zoom to 1, and modifying the
> clipping planes.
>
> You're just not really going to get what you want.
>
> --
> steve@...
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org>
>
--
View this message in context: http://www.nabble.com/Camera-FoV-tp11084062p15538587.htmlSent from the Papervision3D mailing list archive at Nabble.com.
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
|