Re: [osg-users] Render to Texture Question for Integrating Vendor's Flash Renderer
Thanks Robert for taking the time to reply. Also, I want to say thanks to you and other main developers of OSG, because I have found OSG quite easy to work with so far. I haven’t had to post to the forum thus far because of the learning environment that the forum content has provided, along with all the various code examples and tutorials available. I hope as my knowledge builds that I can provide additional useful forum and example content. Back to the post’s thread. Scaleform does convert Flash swf files to OpenGL calls. One of the other important reasons that we chose to use Scaleform was that it has a C++ code interface to Action Script (Flash programming language) so we can talk directly to the Flash content to update state information and we have significant amounts of Flash content that we can reuse in our project. Here is a bit more background on Scaleform for reference. Scaleform is a product that was recently taken over by Autodesk. It has been used in many games for rendering interactive flash screens into a 3D world, but more often for developing the game setup/information HUD. It is a third party vendor product so there is a cost involve for our project, but it has the capabilities we need. The product has SDK builds for OpenGL, Direct3D, PS2, and several other game platforms so we are able to integrate Scaleform into OSG with the OpenGL build. Scaleform also manages thread synchronization between the render thread and the thread that updates the Flash content state through its own snapshot buffer, so we can easily hook in our network interface to the simulation program that provides system state content updates. I would appreciate it if you would review my previous description on the use of the FBO camera and provide any suggestions you might have. Thanks! Glen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40117#40117 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to Texture Question for Integrating Vendor's Flash Renderer
Hi Glen, Thanks for the explanation about Scaleform. Given that it's doing OpenGL calls for you you'll need to be mindful of the effect of OSG state on Scalform and visa-versa. The issues of integration of 3rd party OpenGL codes with the OSG is something that has been disucssed a number of times on osg-users so I recommend look into these discussions. I would also recommend getting the integration working in just the main window to start with, you can use osg::Camera in scene as a render to texture camera or just a Camera that just renders directly as part of the main view so you can toggle to use of RTT camera later. Once the simple Camera usage works fine then enabling RTT by assigned a Texture as a colour attachment as set the Camera::RenderOrder to PRE_RENDER. Use of FBO's shouldn't be something you need to worry about too much - you just enable the Camera to use it if you want, as per the osgprerender example. For rendering multiple cameras on different frames you can simply have a Switch above these Camera in the scene graph and toggle them off as you need them. Alternatively you can use a NodeMask on the Camera's to switch them off. Finally a custom CullCallback attached to the parent of the Camera's would enable you to decide whether to visit its children (the Camera) or not. Switching off a RTT Camera only switches off the rendering traversal for that camera, any texture that it renders to will still be valid for any geometry that is rendered with it in the main scene. When toggling on/off cameras you'll need to careful to make sure that a RTT Camera renders to a texture before the first time it's need in the scene graph - this is an obvious requirement, but will need a little planning to make sure it all works coherently. Robert. On Mon, Jun 6, 2011 at 3:56 PM, Glen Swanger glen.swan...@jhuapl.edu wrote: Thanks Robert for taking the time to reply. Also, I want to say thanks to you and other main developers of OSG, because I have found OSG quite easy to work with so far. I haven’t had to post to the forum thus far because of the learning environment that the forum content has provided, along with all the various code examples and tutorials available. I hope as my knowledge builds that I can provide additional useful forum and example content. Back to the post’s thread. Scaleform does convert Flash swf files to OpenGL calls. One of the other important reasons that we chose to use Scaleform was that it has a C++ code interface to Action Script (Flash programming language) so we can talk directly to the Flash content to update state information and we have significant amounts of Flash content that we can reuse in our project. Here is a bit more background on Scaleform for reference. Scaleform is a product that was recently taken over by Autodesk. It has been used in many games for rendering interactive flash screens into a 3D world, but more often for developing the game setup/information HUD. It is a third party vendor product so there is a cost involve for our project, but it has the capabilities we need. The product has SDK builds for OpenGL, Direct3D, PS2, and several other game platforms so we are able to integrate Scaleform into OSG with the OpenGL build. Scaleform also manages thread synchronization between the render thread and the thread that updates the Flash content state through its own snapshot buffer, so we can easily hook in our network interface to the simulation program that provides system state content updates. I would appreciate it if you would review my previous description on the use of the FBO camera and provide any suggestions you might have. Thanks! Glen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40117#40117 ___ 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] Render to Texture Question for Integrating Vendor's Flash Renderer
Robert, Just what I was looking for...Thanks! I do have a prototype working using an RTT camera which updates a texture on an object in the scene. On your suggestion about minding the state, it did take me a while to work through the interaction between OSG and Scaleform on the state since Scaleform has its own Hardware Abstraction Layer implementation, but I will review the osg-users discussions you recommend to make sure I haven't missed anything. I hadn't thought about placing multiple cameras under a Switch for selecting the correct camera each frame, Greate Advice...and for the advice for using the custom CullCallback. I will let you know how it all works out and a summary of my final solution. Thank again! Glen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40132#40132 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to Texture Question for Integrating Vendor's Flash Renderer
Hi Glen, Have a glimpse of the osgXI project on sourceforge.net. It has an osgFlash absolute layer and two different implementations using Scaleform and gameswf, written by one of my cooperators. It is not written in a uniform format at present so you may have to ignore many Chinese comments in the source code. :-) Cheers, Wang Rui 2011/6/7 Glen Swanger glen.swan...@jhuapl.edu: Robert, Just what I was looking for...Thanks! I do have a prototype working using an RTT camera which updates a texture on an object in the scene. On your suggestion about minding the state, it did take me a while to work through the interaction between OSG and Scaleform on the state since Scaleform has its own Hardware Abstraction Layer implementation, but I will review the osg-users discussions you recommend to make sure I haven't missed anything. I hadn't thought about placing multiple cameras under a Switch for selecting the correct camera each frame, Greate Advice...and for the advice for using the custom CullCallback. I will let you know how it all works out and a summary of my final solution. Thank again! Glen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40132#40132 ___ 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
[osg-users] Render to Texture Question for Integrating Vendor's Flash Renderer
Hi, I have some questions concerning the best approach to update textures using a pre-render FBO camera. First I want to provide a little background before my questions. For the project I'm working on I've been integrating a 3rd party vendor product (Scaleform) into OpenSceneGraph to pre-render Flash swf movies to texture, which are then mapped to objects in the main scene. I have this successfully working in a prototype along with in-world mouse events being sent to the swf movies to interact with the Flash content. The Flash movies I need to render update at a reasonable slow rate (10 fps) relative to the main scene render frame rate so I'm able to render just one Flash movie per render loop cycle to minimize the impact on performance. I may be cycling through up to six different Flash movies at the same time and the textures that are the targets will probably include the following sizes (256x256, 512x512, 1024x1024 and possibly 2048x2048 (rarely)). Also, I've derived a class from osg::Drawable which encapsulates the Flash movie rendering using Scaleform in the drawImplementation. An instance of this class is attached to an instance of an osg::Geode which is then added as a child to the pre-render camera as the render scene. To my questions: Is it possible to use one pre-render camera which uses an fbo target implementation, then during a render loop cycle perform the following steps: (1) remove the last Flash movie geode child from the camera, (2) detach the last target texture, (3) set the viewport size based on the next target texture size, (4) attach the next target texture and finally (5) add the next Flash movie geode as a child to the camera in order to set up the camera for rendering the next movie? Or, would it be better (or necessary) to have separate pre-render cameras for each texture size, then attach the next target texture and Flash movie geode to the appropriate camera for rendering? Finally, where would be the best place to insert the updates to the camera(s) prior to rendering the actual movie during each cycle, Update callback, PreDraw callback, ...? Thanks in advance for your help! Cheers, Glen Swanger -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40055#40055 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to Texture Question for Integrating Vendor's Flash Renderer
Hi Glen, The solution you are explaining sounds far too complicated for what is actually needed. I can't see why a pre-render FBO camera would be required, unless Scaleform is using OpenGL. The normal way to implement video textures with the OSG is to subclass from osg::ImageStream as the ffmpeg, quicktime plugins do. Each of these plugins creates it's own thread to manage the video reading and writng to the image. On the OSG rendering side the OSG simply downloads to the texture when the image is dirtied - there isn't any need for compicated interaction of the threads. Robert. On Fri, Jun 3, 2011 at 5:15 PM, Glen Swanger glen.swan...@jhuapl.edu wrote: Hi, I have some questions concerning the best approach to update textures using a pre-render FBO camera. First I want to provide a little background before my questions. For the project I'm working on I've been integrating a 3rd party vendor product (Scaleform) into OpenSceneGraph to pre-render Flash swf movies to texture, which are then mapped to objects in the main scene. I have this successfully working in a prototype along with in-world mouse events being sent to the swf movies to interact with the Flash content. The Flash movies I need to render update at a reasonable slow rate (10 fps) relative to the main scene render frame rate so I'm able to render just one Flash movie per render loop cycle to minimize the impact on performance. I may be cycling through up to six different Flash movies at the same time and the textures that are the targets will probably include the following sizes (256x256, 512x512, 1024x1024 and possibly 2048x2048 (rarely)). Also, I've derived a class from osg::Drawable which encapsulates the Flash movie rendering using Scaleform in the drawImplementation. An instance of this class is attached to an instance of an osg::Geode which is then added as a child to the pre-render camera as the render scene. To my questions: Is it possible to use one pre-render camera which uses an fbo target implementation, then during a render loop cycle perform the following steps: (1) remove the last Flash movie geode child from the camera, (2) detach the last target texture, (3) set the viewport size based on the next target texture size, (4) attach the next target texture and finally (5) add the next Flash movie geode as a child to the camera in order to set up the camera for rendering the next movie? Or, would it be better (or necessary) to have separate pre-render cameras for each texture size, then attach the next target texture and Flash movie geode to the appropriate camera for rendering? Finally, where would be the best place to insert the updates to the camera(s) prior to rendering the actual movie during each cycle, Update callback, PreDraw callback, ...? Thanks in advance for your help! Cheers, Glen Swanger -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40055#40055 ___ 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
[osg-users] Render-to-texture question.
Hi, I was wondering if you can provide me with some guidance regarding RTT. BTW: I read and understood the osgMultipleRenderTargets example very well (hopefully 8)). However, I was wondering if it would be possible to simply it a little for my app. My application has multiple slave cameras using osgViewer (not composite viewer). Each camera can show the scene using a different sensor mode (i.e thermal, day, nigt-vision, etc). On a per camera basis, I need to render the scene to a texture. Each of those cameras then render their respective image to a simple quad in their own window. The questions is: can I do this without adding a seperate RTT camera for each slave camera? Will enabling RTT for each slave camera and drawing a simple quad in the PostDrawCallback/FinalDrawCallback work (using direct opengl calls)? Do I absolutely need to add another camera in the scene to make RTT work? Maybe if I understood the render-to-texture process in the camera a little better, especially when it starts and when it ends, then I would have a better idea if what I'm trying to is possible. Any help would be appreciated. Cheers, Guy -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=13317#13317 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org