Re: [osg-users] Slave Cameras projection matrices and aspect ratio

2008-07-25 Thread Robert Osfield
Hi Jose,

I tried the .cfg out and it works, but since osgviewer cow.osg -c
your.cfg doesn't contain your specific master projection matrix nor
have your profiling code I can't really test what your are seeing at
your end.

Given I'm busy working getting a 2.6 rc1 out the door, and am away
from tomorrow there is little time I have to further chase this up.

As a general note, the slave projection matrices are update on each
frame by multiplying the master camera's projection  matrix by the
slave projection offset matrix.  This means updates to the slaves
projection matrix will be overwritten, which is why you aren't seeing
these changes.

As to why you are seeing different values, I'm afraid I can't give a
specific reason for this, one would have to look at your specific code
against osgProducer and against osgViewer, and these both cases so you
can see it first hand and profile the values.

Robert.

On Thu, Jul 24, 2008 at 10:57 PM, Joseanibal Colon Ramos
[EMAIL PROTECTED] wrote:
 Thanks Robert,

 Here is the Producer config file I am using:

 ***
 Camera Camera-1
 {
RenderSurface Window-1
{
 Visual  { SetSimple }
 Screen 0;
 WindowRect 0 30 426 341;
 Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
   Rotate 42.4 0 1 0;
}
 }

 Camera Camera-2
 {
RenderSurface Window-2
{
Visual  { SetSimple }
Screen 0;
WindowRect 426 30 426 341;
Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
Rotate 0.0 0 1 0;
}
 }


 Camera Camera-3
 {
RenderSurface Window-3
{
Visual  { SetSimple }
Screen 0;
WindowRect 852 30 426 341;
Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
Rotate -42.4 0 1 0;
}
 }


 InputArea
 {
RenderSurface Window-1 ;
RenderSurface Window-2 ;
RenderSurface Window-3 ;
 }
 ***

 I have tested and compared it with OSG 2.4 and OSG 1.2 with (very)
 slightly different results. I need the results to be exactly the same as
 in OSG 1.2.

 My understanding is that the InputArea is no longer required, but is is
 still there for backwards compatibility with OSG 1.2 . For each
 RenderSurface block I used to have a Lens configuration block like this
 one:
  Lens {
Perspective 42.4 45.0 1.0 100.0;
}
 but I no longer use it because I set the parameters in my code as:

 vwr.getCamera()-setProjectionMatrixAsPerspective(VerticalFOV, AspectRatio,
 NearClip, FarClip);  //for the master cam.

 I've tried doing it for each of the Slave cams as well:
 vwr.getSlave(int i)._camera-setProjectionMat. (same thing) . but it
 doesn't change anything.

 In this example:
 AspectRatio = 1.33
 VerticalFOV = 42.4/AspectRatio
 NearClip = doesn't matter right now
 FarClip = doesn't matter right now




 Whe I run my program (version OSG 2.4) I get the following runtime values:

 Master cam: (fov, aspect, near, far)31.807951987997, 1.333, 0.02, 199.

 Slave cam # 0 (fov, aspect, near, far): 31.8079530956935,
 1.31249230769231, 305.702400933255, 70223.0343790709

 Slave cam # 1 (fov, aspect, near, far): 31.8079530956935,
 1.31249230769231, 443.807876894962, 43394.6435810508

 Slave cam # 2 (fov, aspect, near, far): 31.8079530956935,
 1.31249230769231, 292.024441391996, 54427.4475917436

 You may ignore the Near/Far values. You can notice how the slave cams
 manipulated the aspect ratio slightly. The VerticalFOV seems right.





 When I run OSG 1.2 I get this:
 (no master cam concept)

 camera 0 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

 camera 1 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

 camera 2 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

 I don't know how the aspect ration became that value either, because the
 aspect ratio should have been forced to 1.33. Anyways this works fine.

 I'd like to get the OSG 1.2 results, although none of these numbers quite
 make sense to me, and the corresponding values of each version are very
 close. I'll also provide the projection matrices which are a bit off as
 well:

 OSG2.4:
 Slave cam 0:
 projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.00874468153415 -1
0 0 -614.078072006898 0
 }
 Slave cam 1:
 projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.02066585525608 -1
0 0 -896.787423135345 0
 }
 Slave cam2:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.01078866385069 -1
0 0 -587.199436318357 0
 }

 What they should be: (OSG 1.2):
 Cam 0:
 2.57815,0,0,0
 0,3.5096,0,0
 0,0,-1,-1
 0,0,-20,0

 Cam 1:
 2.57815,0,0,0
 0,3.5096,0,0
 0,0,-1,-1
 0,0,-20,0

 Cam2:
 2.57815,0,0,0
 

Re: [osg-users] Slave Cameras projection matrices and aspect ratio

2008-07-24 Thread Robert Osfield
Hi Joseanibal,

Could you provide a Producer .cfg that you are having problem with.
Could you also please specify which versions of the OSG you've tried.

Robert.

On Thu, Jul 24, 2008 at 3:43 AM, Joseanibal Colon Ramos
[EMAIL PROTECTED] wrote:
 Hi Anyone,

 I need to fix this ASAP. I am using OSG 2.4+ with old Producer Config
 files. OSG creates slave cameras for my multiple window configuration (one
 for each). The resulting settings are not quite like specified in my
 configuration file. Field of Views are mostly OK, but it is altering the
 aspect ratios of the slave cams and providing me with an image slightly
 off from how it should be. I've tried setting the Slave cams' projection
 matrix, (setProjectionMatrixAsPerspective) with particular aspect ratios
 etc, but the aspect ratio value is being overriden somewhere and adjusted
 a little bit. However, the Master cam's aspect ratio is correct. How do I
 correctly set the Slave cam's aspect ratios?? and Why are the Producer
 Configuration files not doing what they used to in OSG 1.2  ?? Anyone
 please let me know soon, THANKS!

 -JCOLON


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Slave Cameras projection matrices and aspect ratio

2008-07-24 Thread Joseanibal Colon Ramos
Thanks Robert,

Here is the Producer config file I am using:

***
Camera Camera-1
{
RenderSurface Window-1
{
 Visual  { SetSimple }
 Screen 0;
 WindowRect 0 30 426 341;
 Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
   Rotate 42.4 0 1 0;
}
}

Camera Camera-2
{
RenderSurface Window-2
{
Visual  { SetSimple }
Screen 0;
WindowRect 426 30 426 341;
Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
Rotate 0.0 0 1 0;
}
}


Camera Camera-3
{
RenderSurface Window-3
{
Visual  { SetSimple }
Screen 0;
WindowRect 852 30 426 341;
Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
Rotate -42.4 0 1 0;
}
}


InputArea
{
RenderSurface Window-1 ;
RenderSurface Window-2 ;
RenderSurface Window-3 ;
}
***

I have tested and compared it with OSG 2.4 and OSG 1.2 with (very)
slightly different results. I need the results to be exactly the same as
in OSG 1.2.

My understanding is that the InputArea is no longer required, but is is
still there for backwards compatibility with OSG 1.2 . For each
RenderSurface block I used to have a Lens configuration block like this
one:
 Lens {
Perspective 42.4 45.0 1.0 100.0;
}
but I no longer use it because I set the parameters in my code as:

vwr.getCamera()-setProjectionMatrixAsPerspective(VerticalFOV, AspectRatio,
NearClip, FarClip);  //for the master cam.

I've tried doing it for each of the Slave cams as well:
vwr.getSlave(int i)._camera-setProjectionMat. (same thing) . but it
doesn't change anything.

In this example:
AspectRatio = 1.33
VerticalFOV = 42.4/AspectRatio
NearClip = doesn't matter right now
FarClip = doesn't matter right now




Whe I run my program (version OSG 2.4) I get the following runtime values:

Master cam: (fov, aspect, near, far)31.807951987997, 1.333, 0.02, 199.

Slave cam # 0 (fov, aspect, near, far): 31.8079530956935,
1.31249230769231, 305.702400933255, 70223.0343790709

Slave cam # 1 (fov, aspect, near, far): 31.8079530956935,
1.31249230769231, 443.807876894962, 43394.6435810508

Slave cam # 2 (fov, aspect, near, far): 31.8079530956935,
1.31249230769231, 292.024441391996, 54427.4475917436

You may ignore the Near/Far values. You can notice how the slave cams
manipulated the aspect ratio slightly. The VerticalFOV seems right.





When I run OSG 1.2 I get this:
(no master cam concept)

camera 0 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

camera 1 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

camera 2 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

I don't know how the aspect ration became that value either, because the
aspect ratio should have been forced to 1.33. Anyways this works fine.

I'd like to get the OSG 1.2 results, although none of these numbers quite
make sense to me, and the corresponding values of each version are very
close. I'll also provide the projection matrices which are a bit off as
well:

OSG2.4:
Slave cam 0:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.00874468153415 -1
0 0 -614.078072006898 0
}
Slave cam 1:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.02066585525608 -1
0 0 -896.787423135345 0
}
Slave cam2:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.01078866385069 -1
0 0 -587.199436318357 0
}

What they should be: (OSG 1.2):
Cam 0:
2.57815,0,0,0
0,3.5096,0,0
0,0,-1,-1
0,0,-20,0

Cam 1:
2.57815,0,0,0
0,3.5096,0,0
0,0,-1,-1
0,0,-20,0

Cam2:
2.57815,0,0,0
0,3.5096,0,0
0,0,-1,-1
0,0,-20,0

(all the same). In OSG 2.4, if I hard-code my Master cam's
projectionMatrix to be like the one printed out in OSG 1.2 I get the good
image result.

The big question is: What parameter is off? Why? and How do I fix it?
Any help with anything here mentioned will be VERY welcomed!!
Thanks,

-Jose








On Thu, July 24, 2008 3:12 am, Robert Osfield wrote:
 Hi Joseanibal,

 Could you provide a Producer .cfg that you are having problem with.
 Could you also please specify which versions of the OSG you've tried.

 Robert.

 On Thu, Jul 24, 2008 at 3:43 AM, Joseanibal Colon Ramos
 [EMAIL PROTECTED] wrote:
 Hi Anyone,

 I need to fix this ASAP. I am using OSG 2.4+ with old Producer Config
 files. OSG creates slave cameras for my multiple window configuration
 (one
 for each). The resulting settings are not quite like specified in my
 configuration file. Field of Views are mostly OK, but it is altering the
 aspect ratios of the slave cams and providing me with an image slightly
 off from how it should be. I've tried setting the Slave 

[osg-users] Slave Cameras projection matrices and aspect ratio

2008-07-23 Thread Joseanibal Colon Ramos
Hi Anyone,

I need to fix this ASAP. I am using OSG 2.4+ with old Producer Config
files. OSG creates slave cameras for my multiple window configuration (one
for each). The resulting settings are not quite like specified in my
configuration file. Field of Views are mostly OK, but it is altering the
aspect ratios of the slave cams and providing me with an image slightly
off from how it should be. I've tried setting the Slave cams' projection
matrix, (setProjectionMatrixAsPerspective) with particular aspect ratios
etc, but the aspect ratio value is being overriden somewhere and adjusted
a little bit. However, the Master cam's aspect ratio is correct. How do I
correctly set the Slave cam's aspect ratios?? and Why are the Producer
Configuration files not doing what they used to in OSG 1.2  ?? Anyone
please let me know soon, THANKS!

-JCOLON


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org