OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Rotating Slave Camera Views


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Jim Perkins
Guest





PostPosted: Tue Sep 26, 2017 7:57 pm    Post subject:
Rotating Slave Camera Views
Reply with quote

Hi everyone,


I am fairly new to OSG and am trying to use slave cameras to view a scene from slightly different angles, of which will overlap slightly.  I am starting with the OSG 3.0 Cookbook example from chapter 4, #2 (source code at https://github.com/xarray/osgRecipes).
Instead of the full 9 cameras, I am working with just two cameras that I am aligning side by side, with no rotation as my first test, using the following approximate code.  In this example, I am attempting to show half of a 3D model on each slave camera.


Slave1:
osg::Matrix projOffset = osg::Matrix::translate(1,0,0);
viewer.addSlave(camera, projOffset, osg::Matrix(), true);
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px} span.s1 {font-family: 'Helvetica'; font-weight: normal; font-style: normal; font-size: 12.00pt}


Slave2:osg::Matrix projOffset = osg::Matrix::translate(-1,0,0);



viewer.addSlave(camera, projOffset, osg::Matrix(), true);





This seems to work fine, with half the 3D model on the left screen, half on the right.  


When i add in a rotation term, for example, on slave 2:


osg::Matrix projOffset = osg::Matrix::rotate(osg::DegreesToRadians(15), osg::Vec3D(0,1,0)) * osg::Matrix::translate(-.8,0,0);
viewer.addSlave(camera, projOffset, osg::Matrix(), true);


all I see is a tiny sliver of the model.  I have tried rotating on different axis (placing the 1 in a different spot in the vector), different translations, etc.  The Z axis seems to work fine, but the X and Y axis are not working properly.  I am thinking it may be due to an improperly setup frustrum, but am having trouble setting it.


I would appreciate any kind of information as to what I may be doing wrong or should be looking at.  


Thank you!


Jim








p.p1 {margin: 0.0px 0.0px 0.0px 0.0px} span.s1 {font-family: 'Helvetica'; font-weight: normal; font-style: normal; font-size: 12.00pt}

------------------
Post generated by Mail2Forum
Back to top
Voerman, L.
Guest





PostPosted: Wed Sep 27, 2017 7:18 am    Post subject:
Rotating Slave Camera Views
Reply with quote

Hi Jim,you are using "projectionOffset" while I think you want a viewOffset. Attached is a small example (a mix of osgViewer and the osgSidebySide example creating 3 views with 52 degrees rotation offset.
Regards, Laurens.


On Tue, Sep 26, 2017 at 9:56 PM, Jim Perkins < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi everyone,


I am fairly new to OSG and am trying to use slave cameras to view a scene from slightly different angles, of which will overlap slightly.  I am starting with the OSG 3.0 Cookbook example from chapter 4, #2 (source code at https://github.com/xarray/osgRecipes).
Instead of the full 9 cameras, I am working with just two cameras that I am aligning side by side, with no rotation as my first test, using the following approximate code.  In this example, I am attempting to show half of a 3D model on each slave camera.


Slave1:
osg::Matrix projOffset = osg::Matrix::translate(1,0,0);
viewer.addSlave(camera, projOffset, osg::Matrix(), true);



Slave2:osg::Matrix projOffset = osg::Matrix::translate(-1,0,0);



viewer.addSlave(camera, projOffset, osg::Matrix(), true);





This seems to work fine, with half the 3D model on the left screen, half on the right.  


When i add in a rotation term, for example, on slave 2:


osg::Matrix projOffset = osg::Matrix::rotate(osg::DegreesToRadians(15), osg::Vec3D(0,1,0)) * osg::Matrix::translate(-.8,0,0);
viewer.addSlave(camera, projOffset, osg::Matrix(), true);


all I see is a tiny sliver of the model.  I have tried rotating on different axis (placing the 1 in a different spot in the vector), different translations, etc.  The Z axis seems to work fine, but the X and Y axis are not working properly.  I am thinking it may be due to an improperly setup frustrum, but am having trouble setting it.


I would appreciate any kind of information as to what I may be doing wrong or should be looking at.  


Thank you!


Jim









_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Different views hide/show different n... icf80 General 13 Wed Apr 17, 2019 9:56 am View latest post
No new posts AddSlave & removeSlave camera see... bclay General 2 Wed Apr 10, 2019 6:52 pm View latest post
No new posts FPS camera Ligvest General 0 Mon Apr 01, 2019 1:03 pm View latest post
No new posts First Person Camera disable inertial ... Ligvest General 3 Thu Mar 28, 2019 1:01 pm View latest post
No new posts Make an object linked to camera moove... GiacomoB General 0 Wed Mar 20, 2019 9:45 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP