Re: [osg-users] Consistent lighting across different cameras
Julian Looser wrote: Hi Ulrich, (The model and lightsource are a shared graph, right?) Yes, that's right. With regards to the different lighting, how is your model tessellated? If it's coarsely tessellated and/or you're using face normals then the lighting calculation might only be done on the corner vertices and interpolated from there. The model is a simple box with no further tessellation, and just face normals. However, the effect is the same with more complicated and higher-tessellated models. I think the detail of the model shouldn't effect the lighting in this case... all the cameras are looking at the same lit scene from the same point, just with slight offsets in the projection and view matrices. Other than possibly subtle differences in specular highlights, I wouldn't think the scene should be lit any differently in each of the views. I realise the lighting won't look great on a low-tessellated model, but I think it should be consistent. I figure it's like taking multiple photos and stitching them together into a panorama... the world doesn't get lit completely differently just because you turn left and right a bit. :-( FYI, you probably got a good suggestion from Terry Welsh (try enabling GL_LIGHT_MODEL_LOCAL_VIEWER), but his reply doesn't seem to have been added to this thread... Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Consistent lighting across different cameras
Just a quick guess, but are you putting rotation into your left right projection matrices? If so that's what's mucking up your lighting: http://sjbaker.org/steve/omniv/projection_abuse.html 2009/7/6 Julian Looser li...@roarmot.co.nz: Hi, I am using OSG in a multi-wall stereo rendering environment. We have three walls, and we render both a left and right eye view for each wall. To do this, in my application I create six osg::Cameras and update their projection and view matrices each frame based on head-tracking. I add the same subgraph under each camera, and I get a seamless 3D scene across the three walls. So far so good. My problem is with lighting. Although the 3D geometry is rendered in the right place, it isn't lit correctly. For example, sometimes the left view might be much brighter than the center view, which in turn is brighter than the right view. This has me confused because all six cameras are rendering the exact same scene, and the light is part of the scene (rather than a head-light of the viewer for example). My scene graph is set up basically like this (just showing three rather than six cameras). The cameras all share the same child subgraph, and just render to viewports next to each other across a window. root -- camera (mv proj for left wall) --- model --- lightsource -- camera (mv proj for center wall) --- model --- lightsource -- camera (mv proj for right wall) --- model --- lightsource I've attached a picture of the effect I'm getting. What I expected would be that the object (just a long red box) would be smoothly lit along its length. However, when it spans across my three views, you can see it's darker or lighter in each view, suggesting that the lightsource isn't in the same place within each rendering. Am I putting my lightsource in the wrong place in the scene graph? I thought it should be a sibling to what you want lit? Even though the projection and view matrices are different for each camera, the lighting should be consistent, right? I'm using a composite viewer, and each view I create I've set the lighting mode to NO_LIGHT, so I don't think it's a default light causing any trouble. The only light should be the one in my scene. If you have any ideas why this is happening I would really appreciate hearing them! :-) Thanks, Julian. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.ssTk.co.uk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Consistent lighting across different cameras
Hi Julian, On 6/7/09 6:28 AM, Julian Looser wrote: root -- camera (mv proj for left wall) --- model --- lightsource -- camera (mv proj for center wall) --- model --- lightsource -- camera (mv proj for right wall) --- model --- lightsource Am I putting my lightsource in the wrong place in the scene graph? I thought it should be a sibling to what you want lit? Even though the projection and view matrices are different for each camera, the lighting should be consistent, right? (The model and lightsource are a shared graph, right?) You can place the osg::LightSource anywhere you like in the scene graph, OSG has no concept of limiting light to a certain sub-graph. With regards to the different lighting, how is your model tessellated? If it's coarsely tessellated and/or you're using face normals then the lighting calculation might only be done on the corner vertices and interpolated from there. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Consistent lighting across different cameras
Hi Simon, Thanks for the promising link, but I don't think I'm misusing the projection matrix. I calculate the left, right, top and bottom values and set the projection matrix via osg::Camera's setProjectionMatrixAsFrustum. The view matrix is set with setViewMatrixAsLookAt using the head-tracked position and the direction towards the screen. I'm pretty sure this is the correct way to set up head-tracked stereo. The 3D effect works, just the lighting is wrong. :-( Cheers, Julian. Simon Hammett wrote: Just a quick guess, but are you putting rotation into your left right projection matrices? If so that's what's mucking up your lighting: http://sjbaker.org/steve/omniv/projection_abuse.html 2009/7/6 Julian Looser li...@roarmot.co.nz: Hi, I am using OSG in a multi-wall stereo rendering environment. We have three walls, and we render both a left and right eye view for each wall. To do this, in my application I create six osg::Cameras and update their projection and view matrices each frame based on head-tracking. I add the same subgraph under each camera, and I get a seamless 3D scene across the three walls. So far so good. My problem is with lighting. Although the 3D geometry is rendered in the right place, it isn't lit correctly. For example, sometimes the left view might be much brighter than the center view, which in turn is brighter than the right view. This has me confused because all six cameras are rendering the exact same scene, and the light is part of the scene (rather than a head-light of the viewer for example). My scene graph is set up basically like this (just showing three rather than six cameras). The cameras all share the same child subgraph, and just render to viewports next to each other across a window. root -- camera (mv proj for left wall) --- model --- lightsource -- camera (mv proj for center wall) --- model --- lightsource -- camera (mv proj for right wall) --- model --- lightsource I've attached a picture of the effect I'm getting. What I expected would be that the object (just a long red box) would be smoothly lit along its length. However, when it spans across my three views, you can see it's darker or lighter in each view, suggesting that the lightsource isn't in the same place within each rendering. Am I putting my lightsource in the wrong place in the scene graph? I thought it should be a sibling to what you want lit? Even though the projection and view matrices are different for each camera, the lighting should be consistent, right? I'm using a composite viewer, and each view I create I've set the lighting mode to NO_LIGHT, so I don't think it's a default light causing any trouble. The only light should be the one in my scene. If you have any ideas why this is happening I would really appreciate hearing them! :-) Thanks, Julian. ___ 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] Consistent lighting across different cameras
Julian Looser wrote: Hi, I am using OSG in a multi-wall stereo rendering environment. We have three walls, and we render both a left and right eye view for each wall. To do this, in my application I create six osg::Cameras and update their projection and view matrices each frame based on head-tracking. I add the same subgraph under each camera, and I get a seamless 3D scene across the three walls. So far so good. My problem is with lighting. Although the 3D geometry is rendered in the right place, it isn't lit correctly. For example, sometimes the left view might be much brighter than the center view, which in turn is brighter than the right view. This has me confused because all six cameras are rendering the exact same scene, and the light is part of the scene (rather than a head-light of the viewer for example). Can you give more detail on the sometimes? Does that mean that the lighting varies over different runs of your software, or that the lighting is incosistent during a single run for some head positions? If the latter, it sounds like the head transformation isn't applied consistently to the light position. And is there some position for which the lighting does seem to be correct? Bye, Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Consistent lighting across different cameras
Hi Julian, Have you tried using osg::LightModel to turn on GL_LIGHT_MODEL_LOCAL_VIEWER? It's often necessary in multi-wall setups -- Terry Welsh / mogumbo 'at' gmail.com www.reallyslick.com / www.mogumbo.com Message: 3 Date: Mon, 06 Jul 2009 16:28:10 +1200 From: Julian Looser li...@roarmot.co.nz Subject: [osg-users] Consistent lighting across different cameras To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Message-ID: 4a517d5a.5060...@roarmot.co.nz Content-Type: text/plain; charset=iso-8859-1; Format=flowed Hi, I am using OSG in a multi-wall stereo rendering environment. We have three walls, and we render both a left and right eye view for each wall. To do this, in my application I create six osg::Cameras and update their projection and view matrices each frame based on head-tracking. I add the same subgraph under each camera, and I get a seamless 3D scene across the three walls. So far so good. My problem is with lighting. Although the 3D geometry is rendered in the right place, it isn't lit correctly. For example, sometimes the left view might be much brighter than the center view, which in turn is brighter than the right view. This has me confused because all six cameras are rendering the exact same scene, and the light is part of the scene (rather than a head-light of the viewer for example). My scene graph is set up basically like this (just showing three rather than six cameras). The cameras all share the same child subgraph, and just render to viewports next to each other across a window. root -- camera (mv proj for left wall) --- model --- lightsource -- camera (mv proj for center wall) --- model --- lightsource -- camera (mv proj for right wall) --- model --- lightsource I've attached a picture of the effect I'm getting. What I expected would be that the object (just a long red box) would be smoothly lit along its length. However, when it spans across my three views, you can see it's darker or lighter in each view, suggesting that the lightsource isn't in the same place within each rendering. Am I putting my lightsource in the wrong place in the scene graph? I thought it should be a sibling to what you want lit? Even though the projection and view matrices are different for each camera, the lighting should be consistent, right? I'm using a composite viewer, and each view I create I've set the lighting mode to NO_LIGHT, so I don't think it's a default light causing any trouble. The only light should be the one in my scene. If you have any ideas why this is happening I would really appreciate hearing them! :-) Thanks, Julian. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Consistent lighting across different cameras
Hi Ulrich, (The model and lightsource are a shared graph, right?) Yes, that's right. With regards to the different lighting, how is your model tessellated? If it's coarsely tessellated and/or you're using face normals then the lighting calculation might only be done on the corner vertices and interpolated from there. The model is a simple box with no further tessellation, and just face normals. However, the effect is the same with more complicated and higher-tessellated models. I think the detail of the model shouldn't effect the lighting in this case... all the cameras are looking at the same lit scene from the same point, just with slight offsets in the projection and view matrices. Other than possibly subtle differences in specular highlights, I wouldn't think the scene should be lit any differently in each of the views. I realise the lighting won't look great on a low-tessellated model, but I think it should be consistent. I figure it's like taking multiple photos and stitching them together into a panorama... the world doesn't get lit completely differently just because you turn left and right a bit. :-( Cheers, Julian. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Consistent lighting across different cameras
Hi, I am using OSG in a multi-wall stereo rendering environment. We have three walls, and we render both a left and right eye view for each wall. To do this, in my application I create six osg::Cameras and update their projection and view matrices each frame based on head-tracking. I add the same subgraph under each camera, and I get a seamless 3D scene across the three walls. So far so good. My problem is with lighting. Although the 3D geometry is rendered in the right place, it isn't lit correctly. For example, sometimes the left view might be much brighter than the center view, which in turn is brighter than the right view. This has me confused because all six cameras are rendering the exact same scene, and the light is part of the scene (rather than a head-light of the viewer for example). My scene graph is set up basically like this (just showing three rather than six cameras). The cameras all share the same child subgraph, and just render to viewports next to each other across a window. root -- camera (mv proj for left wall) --- model --- lightsource -- camera (mv proj for center wall) --- model --- lightsource -- camera (mv proj for right wall) --- model --- lightsource I've attached a picture of the effect I'm getting. What I expected would be that the object (just a long red box) would be smoothly lit along its length. However, when it spans across my three views, you can see it's darker or lighter in each view, suggesting that the lightsource isn't in the same place within each rendering. Am I putting my lightsource in the wrong place in the scene graph? I thought it should be a sibling to what you want lit? Even though the projection and view matrices are different for each camera, the lighting should be consistent, right? I'm using a composite viewer, and each view I create I've set the lighting mode to NO_LIGHT, so I don't think it's a default light causing any trouble. The only light should be the one in my scene. If you have any ideas why this is happening I would really appreciate hearing them! :-) Thanks, Julian. inline: lighting.jpg___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org