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 

zooming is disabling rain and clouds in silverlining


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
drout
Newbie


Joined: 13 Aug 2013
Posts: 6

PostPosted: Mon Jun 23, 2014 3:49 am    Post subject:
zooming is disabling rain and clouds in silverlining
Reply with quote

Hi,

I`m using osg with silverlining, and when i try to zoom in (using makescale or setscale) it just hides the clouds in silverlining (and if enabled, the rain also disappears). Did any of you already experience it, and found a solution that could help me? Thanks!

Cheers,
lawrence
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 788

PostPosted: Mon Jun 23, 2014 6:19 pm    Post subject:
zooming is disabling rain and clouds in silverlining
Reply with quote

Hi Lawrence,

Where do you apply the scale? To the view matrix? Why don't you change the projection regarding the FoV? Since Silverlining is using some kind of skybox, scaling the view might result in strange results

Cheers
Sebastian
--



lawrence wong <> (
Only registered users can see emails on this board!
Get registred or enter the forums!
) schrieb:
Quote:
Hi,

I`m using osg with silverlining, and when i try to zoom in (using makescale or setscale) it just hides the clouds in silverlining (and if enabled, the rain also disappears). Did any of you already experience it, and found a solution that could help me? Thanks!

Cheers,
lawrence

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=59850#59850





_______________________________________________
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
View user's profile Send private message
drout
Newbie


Joined: 13 Aug 2013
Posts: 6

PostPosted: Mon Jun 23, 2014 9:45 pm    Post subject:
zooming is disabling rain and clouds in silverlining
Reply with quote

Hi Sebastian, thanks for the quick reply!

i`m pasting here below, the part of the code that deals with the camera matrix:

Code:


osg::Matrixd cameraMatrix;
osg::Matrixd cameraRotation;
osg::Matrixd cameraTrans;
osg::Matrixd cameraZoom;


cameraRotation.makeRotate( roll, vec3(0,1,0), pitch, vec3(1,0,0), heading, vec3(0,0,1) );

osg::Vec3f pos = nodeTrackerManip->getMatrix().getTrans();
cameraTrans.makeTranslate( pos.x(), pos.y(), pos.z() );

cameraMatrix = cameraRotation * cameraTrans;

cameraMatrix.invert(cameraMatrix);

// from OpenGL (Y up) to OSG (Z up)
osg::Matrixd rotationToYUp;
rotationToYUp.makeRotate( -osg::PI / 2.0, osg::Vec3(1.0, 0.0, 0.0) );

//===========================================
// ---------> here is the problem. If zoom is > 1 then the clouds won`t be visible anymore...
cameraZoom.makeScale( zoom, zoom, 1 );
//===========================================

cameraMatrix = cameraMatrix * rotationToYUp * cameraZoom;



Thank you!

Cheers,
lawrence
Back to top
View user's profile Send private message
drout
Newbie


Joined: 13 Aug 2013
Posts: 6

PostPosted: Mon Jun 23, 2014 9:52 pm    Post subject:
zooming is disabling rain and clouds in silverlining
Reply with quote

and thanks for the hint!! i will try the following line tomorrow morning when i get back to the pcs running the simulator Smile

Code:

_viewer.getCamera()->setProjectionMatrixAsPerspective( zoom, 16./9., ZNearMain, 110000. );



I will let you know if this works. Thanks again!
...


Cheers,
lawrence
Back to top
View user's profile Send private message
Sundog
Newbie


Joined: 27 Nov 2011
Posts: 17

PostPosted: Tue Jun 24, 2014 11:10 am    Post subject:
Reply with quote

Hi,

Keep in mind zoom and field of view (FOV) aren't quite the same thing... that first parameter should probably be more like fov / zoom, where typical fov's are around 45 degrees.

I'm pretty sure Sebastian's advice will get you going; lots of people are using SilverLining with OSG and lots of different FOV's without trouble. But feel free to contact us here at Sundog Software ( http://sundog-soft.com/sds/about/ ) if you need further assistance. Ideally if you could modify the OSG sample application that comes with SilverLining to reproduce your problem, we can look into it more easily.

Thank you!

Cheers,
Frank
Back to top
View user's profile Send private message
drout
Newbie


Joined: 13 Aug 2013
Posts: 6

PostPosted: Tue Jun 24, 2014 1:16 pm    Post subject:
zooming is disabling rain and clouds in silverlining
Reply with quote

Hi Frank and Sebastian,

So i just tested "setProjectionMatrixAsPerspective" it really worked as alternate to makeScale, zooming the scene as expected (but not quite...)

Zooming now does not hide Silverlining's rain and clouds. That's Ok. On the other hand, now that i'm altering FOV, it reaches a point when zooming in, where the screen flashes due to each raindrop passing in front of the scene. As far as i could figure out by observing it, the rain is implemented as thin semi-transparent rectangles (raindrop) in a plane so this behavior is kind of expected.

I just did a quick test trying to simulate rain using osg::ImageSequence with a couple of .png's resulting in animated droplets and i attached the imageSequence to a new osg::Camera and when i zoomed in the scene using FOV it solved the problem - the raindrops stayed the original size. I think i could use this process to render a windshield wiper swinging side to side now.

There may be a better way to solve this issue with zooming the scene while preserving the original rain, i'd gladly implement such a solution! Smile

...

Thank you!

Cheers,
lawrence
Back to top
View user's profile Send private message
Sundog
Newbie


Joined: 27 Nov 2011
Posts: 17

PostPosted: Tue Jun 24, 2014 9:33 pm    Post subject:
Re: zooming is disabling rain and clouds in silverlining
Reply with quote

drout wrote:
now that i'm altering FOV, it reaches a point when zooming in, where the screen flashes due to each raindrop passing in front of the scene. As far as i could figure out by observing it, the rain is implemented as thin semi-transparent rectangles (raindrop) in a plane so this behavior is kind of expected.


Well yes, if you zoom in that far the raindrops near the camera will also get bigger. If you open up the resources/silverlining.config file, you might try increasing the value of rain-near-clip a bit in order to reduce that effect. Or you could substitute your own image-based effect like you're doing.

This is sort of getting more into SilverLining support and less about OSG at this point though. Again feel free to just contact us directly if you need further assistance.

Thanks,
Frank
Back to top
View user's profile Send private message
drout
Newbie


Joined: 13 Aug 2013
Posts: 6

PostPosted: Tue Jun 24, 2014 10:17 pm    Post subject:
zooming is disabling rain and clouds in silverlining
Reply with quote

You're right, i'm going off-topic, sry :-s I will try to modify that config file - that was a very interesting hint, Thank you again!


...

Thank you!

Cheers,
lawrence Wink
Back to top
View user's profile Send private message
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 Disabling plugins via CMake sam General 4 Tue Nov 08, 2016 1:05 am View latest post
No new posts Lazy Disabling without VertexFuncsAva... Fabian Wiesel General 0 Wed Sep 21, 2016 11:46 am View latest post
No new posts Disabling plugins via CMake sam General 1 Tue Apr 19, 2016 5:48 pm View latest post
No new posts Is OSG a viable platform for renderin... shane_maclaughlin General 0 Fri Jan 08, 2016 12:54 pm 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