Re: [osg-users] What is the right way to save a FBO texture to disk?
Hi John, I haven't done what you want before but the way I'd tackle it would be to use a Camera post draw callback to call state.applyAttribute(texture); then image-readImageFromCurrentTexture(..). Robert. On 5 June 2012 22:08, John Kaniarz john.kani...@us.army.mil wrote: My program has 4 render to texture cameras that get composited into the frame buffer via custom shader. I want to make a screen capture of one of the texture as a response to an event. Attaching an Image to the camera works, but it copies the data to system memory after every frame. Not just when I need it. I tried calling camera-attach(image); viewer-frame(); osgDB::writeImageFile(image); camera-attach(texture); in my event handler, but the image saved was blank. I also tried calling texture-setImage(image), but that image is never updated with fresh data. I also tried calling osg::Image::readPixels() in a Camera::postDrawCallback. This doesn't work because RenderStage detaches the FBO before the callback and I get a screenshot of the framebuffer instead of the texture. Would calling RenderStage::setDisableFboAfterRender(false) fix this? Whats the place to call that function from. Will this screw something up when I try to render to the actual framebuffer? Is there another option I haven't thought of? Perhaps manually attaching the FBO and calling readPixels? Thanks, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48059#48059 ___ 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] Set Viewport background color as transparent
Hi Vishwa, On 6 June 2012 05:46, shekhar vishwa vishwa.shek...@gmail.com wrote: I am trying to implement the multiple views in same window. Each view render the diffrent models.User can set the view position at run time by mouse dragging. If dragged view is overlapped with any view then dragged view backgroud should be semi-trasparent. Please suggest me to resolve this. When you say background of the view being moved do you simply mean the clear colour that provides the normal background colour of a viewport needs to be disabled? This is an important point as there isn't really any concept of background in OpenGL or the OSG. Also be specific about what you mean by semi-transparent. I'm guessing that you want to see the underlying views being the viewport, but what blending do you intend between the view at the front and the back? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph on the Playbook
Hi gles 2 dont support fixed pipeline lighting stuff like GL_LIGHT# and such, which osg uses to manage lighting. To calculate proper lighting you should supply shaders with light source parameters(position\direction, color etc) through uniforms and use those. Cheers, Sergey. 06.06.2012, 03:52, Preet prismatic.proj...@gmail.com: After playing around with a couple of things, it seems like it still only partially works. I can draw the cube, but I don't see any lighting even though I see some DirectionalLight stuff in the vertex shader, and I do see proper lighting if I run the example on my desktop. But I'm seeing an object on the device which is a good sign :) I've attached CMakeCache files for both the device and the simulator included with BlackBerry NDK 2.0.1 in case anyone else wants to port OSG to the Playbook (you'll have to adjust the paths for your own system). Also: Build notes: * get openscenegraph from git * edit CMakeModules/CheckAtomicOps.cmake to default to using mutexes without testing * edit line 110 of src/OpenThreads/CMakeLists.txt and replace the MESSAGE(Sorry...) line with SUBDIRS(pthreads) to force pthreads usage Compile (your application) notes: * I get an error in include/osg/Array (in the install dir), lines 409 and 446, since I think GLdoubles are typedef'd to GLfloats with GL ES 1.1/2. Comment out those lines when building with osg. I'll update the list with an example project if I can get things working correctly. Regards, Preet ___ 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] [osgPlugins] FBX plugin: mixing skin and morph animation.
Hi, I found a workaround, Thanks for your leads, but they didn't help, I opened the converted fbx in osganimationviewer, and the distortion exist there too. I couldn't manage to link the collada plugin in mac, but windows does compile and link, and the animation imported from the collada works fine. so definitely the bug is in the fbx plugin. Thank you! Cheers, Gil -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48073#48073 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT using slave cameras (osgfpdeth example)
Tim, That would appear to explain it. Thanks. -Joel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48074#48074 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What is the right way to save a FBO texture to disk?
Thanks, I'll try that. Do I need to unapply the texture state when I'm done? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48076#48076 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What is the right way to save a FBO texture to disk?
On 6 June 2012 15:20, John Kaniarz john.kani...@us.army.mil wrote: Thanks, I'll try that. Do I need to unapply the texture state when I'm done? In theory osg::State should unapply it next time it does an State::apply() of the current state. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] One osgEarth performance issue of the new version
Hi all: We met one tough osg performance problem recently when we upgrade our osgEarth+gdal to the latest version. To simplify my statement, I will only describe the outline of our main work: void main() { osg::ref_ptrosgViewer::Viewer viewer = new osgViewer::Viewer; osg::ref_ptrosg::Node node = osgDB::readNodeFile(myEarth.earth); viewer-setSceneData(node); viewer-realize(); viewer-run(); } We use osgEarth to read a .earth file and show a globe, everything went well on the old version(osgEarth-2.1.0+gdal-1.8.1), it was very smooth to zoom in and out. However, after we upgraded the osgEarth and gdal to the new version (osgEarth-2.2.0+gdal-1.9.1), the process of loading data became very slow, so we did some investigations on the myEarth.earth file(I have attached this file): !-- heightfield name=terrain driver=gdal url./Image/wldTrn.tif/url /heightfield -- We found if we annotate this parameter, our app will be as smooth as the old version. So we suspect there are some performance issue of gdal loading height field data. Then we restored the gdal to old version(gdal-1.8), however this issue is still there for the current combination(osgEarth-2.2.0+gdal-1.8.1). It seems the problem is on the gdal's driver of osgEarth2.2, we spent a lot of time to locate this problem but not too much found. We are eager to known the why this happened and how to solve this issue, if you have any idea or suggestion, please let us known. Thanks a lot and Best Regards. myEarth.earth Description: Binary data ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What is the right way to save a FBO texture to disk?
It captured a texture, but not the texture I was looking for. Code: osg::State * state=renderInfo.getState(); state-applyAttribute(texture); osg::Image *image=new Image(); image-readImageFromCurrentTexture(renderInfo.getContextID(),false,GL_UNSIGNED_BYTE); osgDB::writeImageFile(*image,snap.png); I'm guessing I'm either using the wrong context ID, or that I'm not applying the texture in the right way. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48079#48079 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What is the right way to save a FBO texture to disk?
On 6 June 2012 15:57, John Kaniarz john.kani...@us.army.mil wrote: It captured a texture, but not the texture I was looking for. Code: osg::State * state=renderInfo.getState(); state-applyAttribute(texture); osg::Image *image=new Image(); image-readImageFromCurrentTexture(renderInfo.getContextID(),false,GL_UNSIGNED_BYTE); osgDB::writeImageFile(*image,snap.png); I'm guessing I'm either using the wrong context ID, or that I'm not applying the texture in the right way. I'm afraid I have tried specifically what you are trying before so can't help debug it. Perhaps others will have done something similar and be able to help. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Set Viewport background color as transparent
Hi Vishwa, the only way I can help you is giving you my code of initialization: Try to adapt it for non your platform. variables of instance: osg::ref_ptrosgViewer::Viewer _viewer; osg::ref_ptrosg::MatrixTransform _root; - (osg::ref_ptrosg::GraphicsContext)createGraphicContext { //create our graphics context directly so we can pass our own window osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; // probably you need to change this because it is for iOS osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowIOS::WindowData(self.view, osgViewer::GraphicsWindowIOS::WindowData::IGNORE_ORIENTATION); // Setup the traits parameters traits-x = 0; traits-y = 0; traits-width = //put here the width of the window view traits-height = //put here the height of the window view traits-depth = 24; //keep memory down, you can put 16 traits-windowDecoration = false; traits-alpha = 1; traits-doubleBuffer = true; traits-sharedContext = 0; traits-setInheritedWindowPixelFormat = true; //traits-windowName = osgViewer; traits-inheritedWindowData = windata; // Create the Graphics Context osg::ref_ptrosg::GraphicsContext graphicsContext = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::setNotifyLevel(osg::INFO); return graphicsContext; } This is the function that initialize everything: //here I call the function I previously defined to create graphics context osg::ref_ptrosg::GraphicsContext graphicsContext = [self createGraphicContext]; //create the viewer _viewer = new osgViewer::Viewer(); //if the context was created correctly then attach to our viewer if(graphicsContext) { //suppress annoying opengl warnings //attention please, you can comment the lines to debug graphicsContext-getState()-setCheckForGLErrors(osg::State::NEVER_CHECK_GL_ERRORS); _viewer-getCamera()-setGraphicsContext(graphicsContext); _viewer-getCamera()-setViewport(new osg::Viewport(0, 0, graphicsContext-getTraits()-width, graphicsContext-getTraits()-height)); } else { std::cout ERROR: I can't create graphic context std::endl; } //create root of the scenegraph tree _root = new osg::MatrixTransform(); //what I do here is simply create new nodes representing what i want to draw and add them as child of _root [self initModels]; //YOU PROBABLY DON'T NEED TO DO THIS part about shaders std::cout initing shaders std::endl; //initialize the shaders and attach them to _root [self initShaders]; std::cout setting scene data to root std::endl; //create scene and attach it to _viewer _viewer-setSceneData(_root.get()); //Set the threading model for the viewer, //Possible options are: SingleThreaded || DrawThreadPerContext _viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded); std::cout setup camera std::endl; //I setup the camera parameters such as clear color, clear mask, render order ... [self setupCamera]; _viewer-frame(); Then you call back _viewer-frame in a way I think you know. The function [self setupCamera] is this: - (void)setupCamera { //set the clear color of the camera to be semitransparent _viewer-getCamera()-setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.75f)); //set the clear mask for the camera _viewer-getCamera()-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); _viewer-getCamera()-setRenderOrder(osg::CameraNode::PRE_RENDER); _viewer-getCamera()-setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); } I personally tried the semi-transparency (with that value of 0.75) and it is working. I hope this helps. Just remember to attach a Camera manipulator or manually set ViewMatrix and ProjectionMatrix Cheers, John On Jun 6, 2012, at 10:58 AM, Robert Osfield wrote: Hi Vishwa, On 6 June 2012 05:46, shekhar vishwa vishwa.shek...@gmail.com wrote: I am trying to implement the multiple views in same window. Each view render the diffrent models.User can set the view position at run time by mouse dragging. If dragged view is overlapped with any view then dragged view backgroud should be semi-trasparent. Please suggest me to resolve this. When you say background of the view being moved do you simply mean the clear colour that provides the normal background colour of a viewport needs to be disabled? This is an important point as there isn't really any concept of background in OpenGL or the OSG. Also be specific about what you mean by semi-transparent. I'm guessing that you want to see the underlying views being the viewport, but what blending do you intend between the view at the front and the back? Robert. ___ osg-users mailing list
[osg-users] SIGGRAPH 2012: OpenSceneGraph BOF
Greetings All! I assume that we are going to have a BOF this year, since I just went over the SIGGRAPH conference schedule and there is a listing with John's name on it hosting. See you there! David Glenn - D Glenn David Glenn --- D Glenn 3D Computer Graphics amp; Media Systems. www.dglenn.com -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48083#48083 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What is the right way to save a FBO texture to disk?
I got it working. The issue is that readImageFromCurrentTexture() doesn't support TextureRectangle. I modified my program to use a Texture2D instead and it works now. Adding TextureRectangle support to Image doesn't look like it would be too hard except that GL_TEXTURE_BINDING_RECTANGLE isn't a readily available constant. (it shows up in gl3.h in the 3.1 section, but I'm sure there's an earlier extension) Thanks for the help, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48085#48085 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph on the Playbook
On Wed, Jun 6, 2012 at 5:30 AM, Sergey Polischuk pol...@yandex.ru wrote: Hi gles 2 dont support fixed pipeline lighting stuff like GL_LIGHT# and such, which osg uses to manage lighting. To calculate proper lighting you should supply shaders with light source parameters(position\direction, color etc) through uniforms and use those. Cheers, Sergey. In my previous email I noted that I'm using the shader provided with the Android OpenGL ES2 example. I started to see lighting after I stopped using Qt as a window manager -- I'll deal with that why using Qt changes the output later. I switched to using EGL directly through blackberry's utils. The result is much better, but still flawed. Right now, I'm seeing this weird effect where it seems like faces are either being culled incorrectly or showing the wrong front/back face at certain angles. I don't know how to describe this further so I uploaded a short video: http://youtu.be/_yxLrGJD8HM I'd appreciate it someone could take a look. I also tried explicitly setting cull face front and back state attributes to off, but it doesn't make any difference. The shaders from that example are here: http://pastie.org/4040310: Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph on the Playbook
It looks like backface culling is off (GLES2 does have back face culling). Turn this on. It also behaves as if you ended up with a context that perhaps has no Z buffer. This can happen if you choose your context poorly via EGL. On some Adreno GLES2 devices I've used, I had to drop down to a 5,6,5 RGB channel depth in order to get a Z buffer. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Open Asset Import Library
http://assimp.sourceforge.net/main_features.html Anybody used this? Might be interesting to begin an optional plugin to load files via this library, if you have it. Some of its importers might be more modern or more fully fleshed out than some of our native ones. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Self Shadowing Errors
Hi, Kim, Lispsm in default mode renders back facing polygons (in light space) to avoid self shadowing of front surfaces. In your case it looks like you would rather want to use front facing polygons to cast shadows instead. Normally its not neccessary because back facing normals would cause the backporch to be dark anyway so that shadows would indistiguishable from ambient colors. However in your case it looks like all building polys use the same normal (probably z up - facing light) so backfacing polys are incorrectly lit and then shadows cast only by light space backfaces look weird. So my suggestion is to change model normals to correct ones or change cull face for shadow map generation (that may require overriding technique though). Cheers, Wojtek 2012/6/6 Kim Bale kcb...@googlemail.com Dear all, I have a fairly simply model which I have applied a LISP shadow to and I'm having problems getting the correct self shadowing. Rather than the area under shadow being darkened it appears that the shadow from the geometry in front of it is being projected onto it (see pic). I'm sure I've seen this issue before but I can't remember what causes it. Has anyone else dealt with this issue? Regards, Kim. -- osgOcean - http://code.google.com/p/osgocean/ ___ 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] OpenSceneGraph on the Playbook
On Wed, Jun 6, 2012 at 5:48 PM, Chris Hanson xe...@alphapixel.com wrote: It looks like backface culling is off (GLES2 does have back face culling). Turn this on. It also behaves as if you ended up with a context that perhaps has no Z buffer. This can happen if you choose your context poorly via EGL. On some Adreno GLES2 devices I've used, I had to drop down to a 5,6,5 RGB channel depth in order to get a Z buffer. The Z buffer wasn't explicitly set in the blackberry utils... I played around with the screen modes and EGL attributes (used RGBA and had to specify a 24bit depth buffer with 8 bit stencil) and now it works! It's a bit slow on the device with higher poly models (dont know if the screen mode has anything to do with that) but it works! Woo playbook! Thank you so much to all for the help :) Here's a sample project (you'll need to adjust the paths to point to your own osg libs): https://github.com/canurabus/scratch-blackberry/tree/master/template_osg Regards, Preet -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ 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] SIGGRAPH 2012: OpenSceneGraph BOF
dglenn wrote: Greetings All! I assume that we are going to have a BOF this year, since I just went over the SIGGRAPH conference schedule and there is a listing with John's name on it hosting. See you there! I wish i could go to SIGGRAPH maybe some years later... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48091#48091 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Open Asset Import Library
Hi Chris, Oh, I'm just working on a new integration project of OSG and different kinds of 3rdparty libraries. Ande I've already wrote plugins of FreeImage and AssImp, as I think both are great for importing and exporting, too. https://github.com/xarray/osgRecipes/tree/master/integrations Unfortunately I haven't had time to test my AssImp plugin yet (the FreeImage one works well now and I'll try to submit it soon), so if you think it valuable and possible for use, please don't hesitate to test it and help me improve it. :-) Cheers, Wang Rui 2012/6/7 Chris Hanson xe...@alphapixel.com http://assimp.sourceforge.net/main_features.html Anybody used this? Might be interesting to begin an optional plugin to load files via this library, if you have it. Some of its importers might be more modern or more fully fleshed out than some of our native ones. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ 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] Open Asset Import Library
I'll just add my 2 (negative) cents on FreeImage: it does not dynamically links to libpng, libtga and other libs it uses. This goes against Gentoo policy and as such will prevent apps to go into Gentoo based distros. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Ambient Issues
Hi, I work in a research lab that uses a CAVE. We were recently given a large 3D model made in Google SketchUp to work with by a client. Unfortunately, we keep having issues when running it in the CAVE on OSG. The model seems to have it's ambient light amped up as it keeps glowing white and yet sometimes, if the camera is far enough, this light will fade (leading me to believe this might be a light attached to the camera. I'm not sure what it is, but the effect seems similar to when you ramp up the ambient light attribute of a model. I know not everyone works with CAVEs but does anyone think they know what the issue is? ... Thank you! Cheers, Jordan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48095#48095 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org