# Amount of pixel along the FOV

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/06/2008 at 03:50, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.5
Platform:
Language(s) :     C++  ;

---------
Hey folks,

Is it possible to gain (read out a value, calculation, a.s.o) the amount of pixel along the fov ?

Background is this formula (http://www.pascucci.org/pdf-papers/IEEE-TVG-2002.pdf, page 9, bottom left) :

lambda = (w/2*tan(fov/2)) with w=the amount of pixel along the field of view.

Lambda is used for visibility check of a vertexpoint (seen by camera or not). I found out that w is very dependent on the distance between vertex and camera (at a distance ~18k to vertex w is ~27k) position. Has there anyone an idea how to calculate w?

Cheers
Sascha

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/06/2008 at 05:40, xxxxxxxx wrote:

I have a device placing a plane in front of view keeping the plane covering
the view (FOV) regardless of distance. Using that fov calc of yours,
the targetdistance (camera to plane) is equal to fov width in pixels.
Hight is then calculated from render settings.

Knowing the centerpixel, any other pixelposition should be pretty easy
to get.

So, from the rendersettings, set the plane at the distance equal to pixelwidth and you get a one to one correspondence.

Cheers
Lennart

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/06/2008 at 01:49, xxxxxxxx wrote:

Hmm, that sounds nice. How do you determine the size of fov's covering plane and why is the height calculated from render settings ? Can't you just grab it from there ?

Cheers,
Sascha

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/06/2008 at 18:53, xxxxxxxx wrote:

You "just" want to see if a particular point in space is within sight,right?
I'm using COFFEE, and maybe some else have a better solution but here's a
expression that works. Put it in a COFFEE Tag.
Here the op has its visibility dots toggled.
For you needs, replace the op with iterated vertexes and set your option(s).

Cheers
Lennart

> ` \> /\* \> OutOfSight by tcastudios©2008 \> Object (op) outside of active view, things happen \> \*/ \> \> \> main(doc,op) \> { \> //Get the active view and its FOV \> var cam     = doc->GetRenderBaseDraw()#BASEDRAW_DATA_camera; \> var camm    = cam->GetMg(); \> var campos = camm->GetV0(); \> var camrot = camm->GetHPB(); \> var fov = cam#CAMERAOBJECT_FOV/2; \> \> //Get render ratio \> var render = GetActiveDocument()->GetFirstRenderData(); \> var bc = render->GetContainer(); \> var xres = bc->GetFloat(RDATA_XRES); \> var yres = bc->GetFloat(RDATA_YRES); \> var yfov = fov \* ((1.0/xres)\*yres); \> \> //Get the position and angle at where the op is relative to view \> var oppos = op->GetMg()->GetV0(); \> var angle = VectorToHPB(oppos-campos); \> var dangle = angle-camrot; \> camm->Invert(); \> var locpos   = camm->GetMulP(oppos); \> \> //If op is outside or behind of view, as an example visibilty is toggled \> if(locpos.z <= 0 || dangle.x >= fov || dangle.x <= -fov || dangle.y >= yfov || dangle.y <= -yfov) \> { \> op#ID_BASEOBJECT_VISIBILITY_RENDER=1; \> op#ID_BASEOBJECT_VISIBILITY_EDITOR=1; \> return; \> } \> if(locpos.z > 0 && (dangle.x <= fov || dangle.x >= -fov || dangle.y <= yfov || dangle.y >= -yfov)) \> op#ID_BASEOBJECT_VISIBILITY_RENDER=2; \> op#ID_BASEOBJECT_VISIBILITY_EDITOR=2; \> \> } \> `

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/06/2008 at 19:08, xxxxxxxx wrote:

Darn, there is something wrong....
I'll have to look into it again....

Later
Lennart

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/06/2008 at 02:57, xxxxxxxx wrote:

Hallo Sascha,

Are you trying to figure out the pixel width of an object?

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/06/2008 at 03:15, xxxxxxxx wrote:

Yes i have to check if a vertexpoint of the polygonobject xyz is seen by the camera or if it is hidden by other vertices...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/06/2008 at 03:28, xxxxxxxx wrote:

So you want to know if a vertex is within the camera cone? If so what has is to do with pixel? Checking for camera visibilty is resolution independent.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/06/2008 at 06:53, xxxxxxxx wrote: