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 

A Dynamic Pipeline


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgPPU [osgPPU]
View previous topic :: View next topic  
Author Message
allensaucier
Appreciator


Joined: 10 Apr 2009
Posts: 126

PostPosted: Thu May 06, 2010 2:24 pm    Post subject:
A Dynamic Pipeline
Reply with quote

Hi All,

does anyone know if it is possible to build a dynamic pipeline? I need to be able to build a pipeline after my scene is already up and running and the first frame loop has already occured.

Thanks!

Cheers,
Allen
Back to top
View user's profile Send private message
art (Art Tevs)
Site Admin


Joined: 20 Dec 2008
Posts: 414
Location: Saarbr├╝cken, Germany

PostPosted: Thu May 06, 2010 2:34 pm    Post subject:
Re: A Dynamic Pipeline
Reply with quote

allensaucier wrote:
Hi All,

does anyone know if it is possible to build a dynamic pipeline? I need to be able to build a pipeline after my scene is already up and running and the first frame loop has already occured.

Thanks!

Cheers,
Allen


Hi Allen,

it shouldn't make any difference if you put your pipleine (or any kind of subgraph) into the scene graph during the running time. Processor, which initializes the pipeline, will be initialized as soon as it visited first time by an osg visitor. The only one problem might appear, is that you would not get the results directly on the first frame, but on the second one, after you enable the pipeline.

cheers,
art
Back to top
View user's profile Send private message Visit poster's website
allensaucier
Appreciator


Joined: 10 Apr 2009
Posts: 126

PostPosted: Thu May 06, 2010 7:45 pm    Post subject:
Reply with quote

Hi Art,

hum, ok. Here is the problem I am having:
1. In my application, I build my scene & display it.
2. In building my scene, I build my pipeline and associate it with my scene. My blur effect is working at the start of my application.
3. My initial view camera is looking down at my terrain.
4. Later, I move the camera programmatcially - not with the mouse - to a new location within my scene. That location is still on top of the terrain and not below my terrain.
5. After moving the view's camera, I no longer see anything in the scene I once saw. It appears that no updates within the scene are displayed any further within my view

If I remove the osgPPU pipleine altogether, my application works as usual. My goal is to "turn-on" my blurring effect "after" my camera has been moved to a particular spot within my scene and not before then.

It is as if the "final" scene displayed in my view is the scene just before my camera is moved and no further updates are recognised after my camera is moved. The final image I see in my view is the scene just before the camera was moved.

below is the code that actually moves my camera programmatically.
ui_viewNumber is equal to g_uiPRIMARY_VIEW_NUMBER because p_sViewName
is related to g_uiPRIMARY_VIEW_NUMBER
Code:

  void CCompositeViewerGtkmmExt::vMoveCameraToPosition(osg::Matrixd &p_mtxdM,
    std::string p_sGWName, std::string p_sViewName)
  {
    unsigned ui_viewNumber=uiReturnViewNumberGivenName(p_sViewName);
    if (ui_viewNumber == g_uiPRIMARY_VIEW_NUMBER)
    {
      CSceneMatrixManipulator *manip =
        dynamic_cast<CSceneMatrixManipulator *>(m_osvPrimaryView->getCameraManipulator());       
      manip->setByMatrix(p_mtxdM);     
    } // if prim view
  } // vMoveCameraToPosition


do you have any idea what might cause the camera's attached texture to cease being sent into the pipeline?

here's how I setup my camera for my main view
Code:

  void CCompositeViewerGtkmmExt::vCameraSetup(osg::Camera *p_pocmCamera,
    int p_iTexWidth, int p_iTexHeight)
  {
    osg::ref_ptr<osg::Texture> tex = otxConstructTexture(p_iTexWidth,
      p_iTexHeight);

    p_pocmCamera->setViewport(new osg::Viewport(0,0,p_iTexWidth,p_iTexHeight));
    p_pocmCamera->attach(osg::Camera::COLOR_BUFFER0, tex);

    // must write the cam output to a frame buffer object, else, nothing will
    //  appear on screen.
    p_pocmCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
  } // vCameraSetup



Thanks Art!

Cheers,
Allen
Back to top
View user's profile Send private message
art (Art Tevs)
Site Admin


Joined: 20 Dec 2008
Posts: 414
Location: Saarbr├╝cken, Germany

PostPosted: Thu May 06, 2010 7:56 pm    Post subject:
Reply with quote

Hi Allen,

So, I assume you are using the same mechanism to turn blur effect on/off as in the example you posted previously. You remember, the example which I have included into the osgppu repository. In that example everything worked fine, camera's texture is updated.

Could it be that you are using slave camera, or just not the main camera for the pipeline. So that just wrong camera is updated. If you not sure, if everything is right, then just put a simple pipeline, without any shaders in it, i.e. UnitCameraBypass->UnitOut. This will just put the output of the camera on the screen. Check then if your camera is updated correctly.

The glow example in the osgppu repository shows an effect using two cameras. So maybe this might help you to debug your camera's setup.


Cheers,
Art
Back to top
View user's profile Send private message Visit poster's website
allensaucier
Appreciator


Joined: 10 Apr 2009
Posts: 126

PostPosted: Fri May 07, 2010 3:32 pm    Post subject:
Reply with quote

Hi Art

I am doing more experimentation today. And, yes, you are correct: the movement of the camera has nothing to do with my problem. I had not thought about the wrong camera being used. I will check my code on this for sure.

O and I am definitely using the same methodology to blur my scene as the example of mine that you have included in your project now. Smile

Today, i put in a simple pipeline - the one you suggested - and a curious thing happened.
1. I am definitely able to move my camera either programmatcially or with the mouse, no problem
2. when I try to "flip" my terrain using the mouse to attempt to see the bottom of it, my terrain becomes horizontal and then the system stops rotating the terrain. I keep trying to rotate the terrain and eventually the image rotates and I can see the underside of my terrain.
3. when I turn off all pipelines and do not allocate any: I can rotate my terrain and see the bottom side very quickly and easily with the mouse
4. with any pipeline in effect, rotating the terrain works smoothly until I try to flip it to see the bottom side. Only then does my image "freeze" when it becomes horizontal. I keep trying to rotate my terrain to see the bottom side and eventually - about 3 ~ 5 seconds later - my 3d image begins to rotate again and I can see the bottom side of my terrain.

I am attempting to place my camera close to the terrain and then look up from the terrain at a 10 degree angle at the sky. This feature is part of my project. I am thinking that getting too close to the terrain is causing my pipeline a tremendous amount of processing. But that is only a guess. and I think a bad one.

I understand the glow example very well now. I am also going to implement that effect. with my current issue, I am only using one camera - the main camera. I only use the slave camera when I setup my glow pipeline.

Thank you, Art. I'll keep plugging away but if you can think of anything, I would appreciate your thoughts.

Cheers,
Allen
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgPPU [osgPPU] 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 How to use frame buffer object in exi... saedrna1 General 2 Sat Feb 18, 2017 3:54 am View latest post
No new posts Dynamic linking of fbx plugin and fbx... Vladimir Chebaev Submission 5 Mon Nov 14, 2016 1:20 pm View latest post
No new posts Moved to BUILD FORUM - Best Pipeline ... dsargrad General 3 Sun Jun 05, 2016 5:03 pm View latest post
No new posts Creator/OpenFlight (.flt) Extended Ma... hunter789 General 0 Wed Jan 13, 2016 6:07 pm View latest post
No new posts Dynamic terrains, DatabasePager + Pag... Castor General 11 Thu Nov 19, 2015 6:27 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