Re: [osg-users] Light Position Behavior

2008-12-18 Thread Robert Osfield
HI Ryan,

It's the CameraManipulator that will be setting the view matrix per
frame, and it is what is using the bounding volume of the scene graph
to set it's initial position.  If you have a camera manipulator
attached to the viewer on end of each update traversal the view matrix
from the camera manipulator will be copied to the camera's view matrix
overwritting what you are setting manually, unless you do it after the
updateTraversal() (note frame() encompasses advance();
eventTraversal();updateTraversal();renderinTraversals());

If you want to use Camera::setViewerMatrix*() methods then you to need
to create your viewer without attached a CameraManipulator, and by
default this is what the viewer does unless you call viewer.run() as
viewer.run() has a fallback of attaching a TrackballManipulator is
nothing else is setting the camera viewer matrix.  If you call
viewer.realize() and run the frame loop yourself then you won't get
this auto added camera manipulator.

My guess is that you still might be happy using the CameraManipulator
if only it didn't use the whole bounding sphere.   For this you can
just use:

  viewer.getCameraManipualtor()->setHomePosition(eye, look, up);

But you'll need to call this after the setSceneData() as this it'll be
the setSceneData() that is prompting the camera manipulator to do it's
stuff.

You follow up email about setUpViewerAsEmbeded() is just a
distraction, it's not related to the problem in hand.

Robert.

On Thu, Dec 18, 2008 at 1:01 AM, Ryan Morris  wrote:
> I understand that positioning the camera SHOULD fix my problem, but it
> isn't. I have the light positioned at (0,0,100,1) and even after i set my
> camera with setViewMatrixAsLookAt it is still trying to view the entire
> bounding box of the scene. This is the fix i was looking for when i started
> the post =) Looking forward to some guidance! Thanks!
>
> ___
> 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] Light Position Behavior

2008-12-17 Thread Ryan Morris
it seems that by using setUpViewerAsEmbeddedInwindow() it does not
reposition based on the world's bounding sphere. interesting for those who
didn't already know that. Anyway hope this helps someone else!
-Rusty

On Wed, Dec 17, 2008 at 5:01 PM, Ryan Morris wrote:

> I understand that positioning the camera SHOULD fix my problem, but it
> isn't. I have the light positioned at (0,0,100,1) and even after i set my
> camera with setViewMatrixAsLookAt it is still trying to view the entire
> bounding box of the scene. This is the fix i was looking for when i started
> the post =) Looking forward to some guidance! Thanks!
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Light Position Behavior

2008-12-17 Thread Ryan Morris
I understand that positioning the camera SHOULD fix my problem, but it
isn't. I have the light positioned at (0,0,100,1) and even after i set my
camera with setViewMatrixAsLookAt it is still trying to view the entire
bounding box of the scene. This is the fix i was looking for when i started
the post =) Looking forward to some guidance! Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Light Position Behavior

2008-12-16 Thread Robert Osfield
HI Ryan,

This problem will be down to the camera manipulators setting their
default mode position based on the total bounding sphere that encloses
your whole scene including lights.

Setting the home position of the camera manipulators directly would be
one way of tackling this problem.

Robert.

On Tue, Dec 16, 2008 at 3:08 AM, Ryan Morris  wrote:
> OSG Community,
> I'm experiencing a strange behavior when I do a setPosition on my
> osg::Light. For one, I'm trying to create a sun like light and it doesn't
> seem to work. but the real problem I'm having is that my viewer zooms way
> out when I give my light a position like (0.0,0.0,100.0,1.0). Just an
> example, but if any of the coordinates are larger than 50 or so the viewer
> adjusts itself, even though i'm manually setting the camera. Any help would
> be great!
> -Rusty
>
> ___
> 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] Light Position Behavior

2008-12-15 Thread Ümit Uzun
Hi Ryan,

If you want to create lighting model like sun, that's not important how far
away your sun model. I think you are creating a sphere for representing sun
model and you use same coordinate position for sun model and light source
position.

You can prefer allocate light source position far away from your scene and
allocate sun model closer for your scene. That's not change your sun models
lightening operation if you want to see sun model when you look above the
sky :)

Or with simple changing on manipulator home position setting, you can set
your asked viewing frustum.

HTH.Best Regards.

2008/12/16 Ryan Morris 

> OSG Community,
> I'm experiencing a strange behavior when I do a setPosition on my
> osg::Light. For one, I'm trying to create a sun like light and it doesn't
> seem to work. but the real problem I'm having is that my viewer zooms way
> out when I give my light a position like (0.0,0.0,100.0,1.0). Just an
> example, but if any of the coordinates are larger than 50 or so the viewer
> adjusts itself, even though i'm manually setting the camera. Any help would
> be great!
> -Rusty
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


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


[osg-users] Light Position Behavior

2008-12-15 Thread Ryan Morris
OSG Community,
I'm experiencing a strange behavior when I do a setPosition on my
osg::Light. For one, I'm trying to create a sun like light and it doesn't
seem to work. but the real problem I'm having is that my viewer zooms way
out when I give my light a position like (0.0,0.0,100.0,1.0). Just an
example, but if any of the coordinates are larger than 50 or so the viewer
adjusts itself, even though i'm manually setting the camera. Any help would
be great!
-Rusty
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org