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 

Ping pong with osgPPU


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgPPU [osgPPU]
View previous topic :: View next topic  
Author Message
vincent.honnet@oktal.fr
Newbie


Joined: 23 Sep 2010
Posts: 8

PostPosted: Fri Oct 01, 2010 6:32 am    Post subject:
Ping pong with osgPPU
Reply with quote

Hi,

I'm trying to implement a simulation using for example a "ping pong" implementation of render to texture (similar to the gameoflife example in osg). I'm using osgPPu for the rendering part of my simulation and I would like now to integrate the processing of the simulation on the GPU through osgPPU in some way.

For now, I have something like that:

processor
|-> unitTexture (to initialize or change the input texture through the cpu)
|-> processSimulationUnitInOut (will contain the shader for the processing of the simulation)
|-> blurUnitInOut
|-> computeNormalsUnitInOut
|-> outputUnitInOut to get the ouput texture

My idea was to add a UnitInOut as child of processSimulationUnitInOut. This new unit is initialized with an output texture (like outputUnitInOut) I thought then that I could deliver the new processed texture to unitTexture through a NodeCallBack by the call of unitTexture->setTexture( unit->getOutputTexture() ). But it doesn't work, the same if I try to copy the image data from one texture to the other.

Do I do the right way or is it totaly wrong or impossible that way ? I could use the gameoflife example but I don't see how I could integrate it.

Thanks a lot in advance for all your advises,
Vincent

...


Thank you!

Cheers,
Vincent
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: Tue Oct 05, 2010 1:06 pm    Post subject:
Reply with quote

Hi Vincent,

your idea about using ping pong wiht osgPPU is nice. I have already tried to do something similar and had no time to finish the example.

I am not sure if I get your osgPPu graph structure right, no I think I didn't get it. Can you give some drawing or similar thing showing you graph strucutre.

However, you write, that you are setting a texture to unitTexture as output of your other unit? Can you say me what is the purpose of that? Usually UnitTexture was meant to be able to put some texture as input to the osgPPU graph. Other children unit below the unittexture could use that then to process it. Settings manually an output texture of an unit as an input texture to the UnitTexture doesn't make sense. UnitTexture has no own shader, so to be processed you need to have another UnitInOut as a child of this UnitTexture.

Therefore I didn't really get what you would like to achieve. At least I am sure, that setting input texture to UnitTexture as output texture from UnitInOut is a wrong way to do it.

cheers,
art

Thank you!

Cheers,
Art
Back to top
View user's profile Send private message Visit poster's website
vincent.honnet@oktal.fr
Newbie


Joined: 23 Sep 2010
Posts: 8

PostPosted: Tue Oct 05, 2010 2:19 pm    Post subject:
Reply with quote

Hi Art,

I got my example of ping pong working. Here is the structure

processor
|-> unitTexture (to initialize or change the input texture through the cpu)
|-> processSimulationUnitInOut (will contain the shader for the processing of the simulation)
|-> blurUnitInOut
|-> computeNormalsUnitInOut
|-> outputUnitInOut to get the ouput texture

(the same as writen in my first post).

Then I set an output texturet hat has the same parameters of the input texture to processSimulationUnitInOut with processSimulationUnitInOut->setOutputTexture(processSimulationOutputTexture2D, 0);.
Then I add a osg::Camera::DrawCallback to the camera of the viewer (that is also the one of the processor). In the method operator() of this callback I extract the output texture from processSimulationUnitInOut with
osg::Texture2D* t0 = (osg::Texture2D*) processSimulationUnitInOut->getOutputTexture(0);
and give it to the input unit texture (unitTexture) with unitTexture->setTexture(t0);


One can do ping pong with several textures because of the mrt parameter of setOutputTexture and getOutputTexture, and it works.

I hope I was clear enough. If not, do not hesitate to ask me.

Vincent


...


Thank you!

Cheers,
Vincent
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 Contemporary multipass non-OsgPPU glo... Chris Hanson General 1 Mon Dec 14, 2015 8:47 pm View latest post
No new posts osgPPU or osgFX:EffectCompositor for ... creature General 0 Thu Oct 10, 2013 6:47 pm View latest post
No new posts osgPPU and wireframe art osgPPU [osgPPU] 4 Fri Mar 22, 2013 2:51 pm View latest post
No new posts How to use osgPPU in an environment w... wernerM osgPPU [osgPPU] 4 Wed Feb 06, 2013 2:32 pm View latest post
No new posts Normalmap with osgPPU Peterakos General 1 Tue Oct 09, 2012 12:45 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