Re: [osg-users] OpenSceneGraph 3.2.1 release candidate 5 tagged, please test
Hi, I've just seen that I left a std::cout in my last 3DS plugin submission, In file osgPlugins/3ds/WriterNodeVisitor.cpp At line 772 Maybe you can remove this debug trace before tagging official 3.2.1 Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60066#60066 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph 3.2.1 release candidate 5 tagged, please test
Hi Robert, Line 772, I left an unconditonnal std::cout ! This is an error from me and I think it should be converted to OSG_DEBUG or removed. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60074#60074 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph 3.2.1 release candidate 5 tagged, please test
Ok, sorry for the confusion ! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60076#60076 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using osga archive bigger than 2Go
Hi, I've found the problem : In file osgPlugins\osg\BinaryStreamOperator.h, there is call to seekp / teelp to get current stream position, using int variables, which leads to problems if the stream size exceed 32-bits signed integer maximum limit. I've sent a submission to solve this here : http://forum.openscenegraph.org/viewtopic.php?t=13928 Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59751#59751 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Using osga archive bigger than 2Go
Hi, I'm using osga archive to store a lot of small files inside a single big one. I'm compiling a 32-bit windows executable with MSVC-2008. All librairies (osg 3.3.1 and dependencies) are compiled with the same compiler. Under this configuratin, I have no problem reading/writing files 2Go (or even 4Go) with GDAL or libTiff libraries, for example. But creating a big osga archive always fails when 2Go limit is execeed (32 bit signed integer max value) I'm currently looking inside osga source code, but I don't find any reason why the current code should not work. Is there any body here who experienced the same problems ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59725#59725 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using osga archive bigger than 2Go
When using .ive files, I can export archive bigger than 4 Go... So I think the problem is in osgb serializer... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59729#59729 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Promoting Drawable from being subclassed from osg::Object to osg::Node
Hi, Pjotr wrote: Also whats the point of a Drawable::Update/Event/CullCallback now, should't they be deprecated now that a Drawable is a Node and can use the Node's callbacks? I think Pjotr is right there. Maybe there's a way to solve this using C++ type erasure : create an osg::AbstractCallback class as nearly an empty shell, and all rewrite all current callbacks classes/structures as child of osg::AbstractCallback. All callbacks management methods (get/set/...) should also use (internally) osg::AbstractCallback interface. Maybe it would be easier to keep compatibility with exisiting code. Then if you set the use of osg::CallbackObject (which is also derived from osg::AbstractCallback) as the standard way in new code, it's possible to clean code and break API compatibility in a future OSG version simply by removing the osg::AbstractCallback class and keep only osg::CallbackObject as entry point in callbacks system. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59634#59634 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] New primitive restart mode leaking into other nodes
Hi, drawing 10 lines, needs 10*4=40 indices using LINES_ADJACENCY but only 12 indices using GL_LINESTRIP_ADJACENCY. So when you need adjacency, the PrimitiveRestart mode may still have some advantages. I didn't think about adjacency. In this case, it may still make sense to use primitive restart. But if you have 100.000 lines, and use unsigned int vertex index, you've got 100.000 * 4 = 400.000 = about 400 ko of indices data stored on GPU. This amount of data can be processed without any problem by a modern GPU. The bottlenecks are rarely on vertex shader stage, but often in fragment shader stage, sometimes in geometry / tesselation shader stages (especially if you use barriers). Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59154#59154 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] New primitive restart mode leaking into other nodes
Hi, But I am a little confused, why you judge the good old primitive restart functionality Because triangle strips are no longer faster than triangles. Using triangles with an optimized idexing (see post-transform cache optimization) is very performant. I also use GPU computing CUDA / OpenCL) to generate mesh in real time, and since I've switched to triangle instead of triangle strip, the performances are better : the code is simpler so I can use my time to optimize the bottlenecks (which are not the vertex shader, the only step optimized by primitive restart) Nevertheless I have to use PrimitiveRestart either way, because my primitives are created interactivly by a OSG-Compute and otherwise I had to have numerous buffers, one for each primitive. You can simply use indexed triangles, not triangles strips. So you don't need primitive restart, you just need a little more space for storing indexes, but this is no problem on modern hardware. If I got it right, your plugin makes it possible to set a PrimitiveRestartIndex. But how do I afterwards activate the mode for only some Geodes. Your proposal with the camera ( camera-getOrCreateStateSet()-setMode(GL_PRIMITIVE_RESTART, osg::StateAtribute::OFF) ) would affect all nodes, wouldn't it? Use camera-getOrCreateStateSet()-setMode(GL_PRIMITIVE_RESTART, osg::StateAtribute::OFF) on camera to set a default OFF value. Then of course, use node-getOrCreateStateSet()-setMode(GL_PRIMITIVE_RESTART, osg::StateAtribute::ON) on all nodes where you want to activate it. I already came across your post before. I did not concentrate on it, because you wrote it, when OSG 3.2 was not out yet. And as the release notes of OSG 3.2 mention PrimitiveRestart should be natively included now and I thought your implementation is therefore deprecated!? This post was a contribution to add PrimitiveRestart functionnality. So it's not outdated, it's whats new in 3.2 Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59136#59136 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] New primitive restart mode leaking into other nodes
Instead of calling many singleDraws or a multiDraw with all its offsets you have to remember I think you're talking about draw-instanced feature here, which is completely different, but very efficient. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59137#59137 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] New primitive restart mode leaking into other nodes
Hi, About the leaking problem : it is because the GL_PRIMITIVE_RESTART mode has no defaut value in OSG. So if you set anywhere in your scene graph, its value (ON or OFF) will not go back to a default OFF value (which is not set anywhere) It's probably possible to add this default OFF value in the OSG source code, but since GL_PRIMITIVE_RESTART is not available on all hardwares/profile, it's probably better to set it by yourself, for example, use this on your main camera : camera-getOrCreateStateSet()-setMode(GL_PRIMITIVE_RESTART, osg::StateAtribute::OFF) About using this feature : primitive restart is a low-level OpenGL feature, very difficult to integrate in a generic high-level framework like OSG. It can break ray-intersections code, introduce error in statistics, and a lot of other problems. To get a full integration, it needs a lot of work, and the benefit is very little : on modern hardward, using primitive restart does not really make faster performances, it's much more efficient to use indexed arrays and optimize the index order to use the GPU post-transform cache at its maximum. The osg::PrimitiveRestartIndex class is only a helper state attribute for defining the restart index, not for use it as an integrated feature, ready out-of-the-box If you really need to use primitive restart, you can read this : http://forum.openscenegraph.org/viewtopic.php?t=11817highlight=gl_primitive_restart But trust me, I avoid primitive restart every time I can (in fact, I only use it if my client really wants this, a good mesh indexing with a GPU post-transform cache optimization algorithm is more efficient) About post-transform cache : https://www.opengl.org/wiki/Post_Transform_Cache And keep in mind the following : even with a very efficient use of the post-transform cache it will only speed up (a little...) the vertex stage of your shader. So if your vertex shader consume only 20% of the rendering time (80% dispatched between texture memory access, rasterization, fragment operations...) you better should use your developpement time to optimize your scene graph hierarchy, the number of switch between StateSet, manually optimize your models (reduce vertex count, reduce drawables count, use texture atlas...) etc... Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59128#59128 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Pop Buffers with OpenSceneGraph
Hi, 5. Because the technique depends on the usage of a vertex shader I would add two static methods one returns a basic osg::Program with phong shading and another one only returns the shader code with the necessary uniforms and a vertex quantization function that should be used in the shader. Maybe there's an interesting idea in osgEarth : the use pseudo-loaders to create library-specific objects. It's possible to write a plugin which create shaders in the following way, by mapping popgeometry file extension to a pseudo-loader. The file name let you know the shader type : Code: osg::Shader* vertexShader = osgDB:readShaderFile(vertexShader.popgeometry) osg::Shader* fragmentShader = osgDB:readShaderFile(fragmentShader.popgeometry) You can create osg::Node, osg::Shader or any osg::Object subclass with a plugin, and even add parameters, in the filename or in the options parameters : Code: osg::Shader* vertexShader = osgDB:readShaderFile(vertexShader.lod1.popgeometry) osg::Shader* vertexShader = osgDB:readShaderFile(vertexShader.lod2.popgeometry) osg::Shader* vertexShader = osgDB:readShaderFile(vertexShader.lod3.popgeometry) osg::Shader* fragmentShader = osgDB:readShaderFile(fragmentShader.phong.popgeometry, options) osg::Shader* fragmentShader = osgDB:readShaderFile(fragmentShader.flat.popgeometry, options) osg::Shader* fragmentShader = osgDB:readShaderFile(fragmentShader.debug.popgeometry, options) Have a look here, there is a list of all factory methods available to plugins : http://trac.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01311.html#a78e08a10faa6c81a5c255d14f7c30cd7 And the base class for the plugins : http://trac.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00658.html To write a new plugin, an easy way is copy/paste the ReaderWriterOBJ.cpp file from the obj plugin, in ReaderWriterPopGeometry.cpp and replace all the code/parameters related to obj file format by code to handle PopGeometry objects creation (not from actually files, but using options parameters and your algorithms) Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59104#59104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgDEM] calculate height above ellipsoid in vertex shader
Hi, I'm facing the same problem, and I can't pre-compute vertex attributes on CPU because my vertex are moved by the shader him-self (displacement mapping). I've tried to use double matrices, but these leads to a lot of compatibility problem. Since the precision problem is in the temporary computation and not in the final result (result values are small and fit well in a 32 bits float) I precompute (on CPU) lot of values in a 2048 (or 4096) pixels wide Texture1D. In the shader I have only to read in this look-up-table. There are some limitations (linear sampling, max input value in look up table...) but for my problem, it works very well. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57581#57581 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Preferred method for per-context uniforms
Hi, If you have just a single uniform value per context then I'd simply place the Uniform on the each if the viiewer's osg::Camera's StateSet, such that each Camera assigned to each Context gets it's own state inherited down including the Uniform. Some nodes have a cull callback. During the cull traversal, the callback identify the current view/context and push the corresponding state set in the render graph, traverse the children and pop the state set. I have exactly the same needs, and I use the same solutions ! - Some of my per-view uniforms are static : their value never change = those are added on viewer's camera's stateset - Some of my per-view uniforms are dynamic : their value change at each frame (based on camera position, user settings, a specific object position...) = those are pushed at cull traversal : the view is identified from the cullvisitor, specific value computation is done there and the uniform is pushed. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56954#56954 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Preferred method for per-context uniforms
Hi, At cull traversal, I do the following (this is pseudo-code!) : Code: cullTraversal(pCullVisitor) { // Get per-view-data perViewData = getOrCreatePerViewData(pCullVisitor); // Compute dynamic uniforms perViewData.pDynamicUniform_1-set(value); perViewData.pDynamicUniform_2-set(value); perViewData.pDynamicUniform_3-set(value); // Push per-view data pCullVisitor-pushStateSet(perViewData.pStateSet); // Traverse node traverse() // Pop per-view data pCullVisitor-popStateSet(); } The getOrCreatePerViewData method returns a PerViewData struct : Code: struct PerViewData { osg::ref_ptrosg::StateSet pStateSet; osg::ref_ptrosg::Uniform pDynamicUniform_1; osg::ref_ptrosg::Uniform pDynamicUniform_2; osg::ref_ptrosg::Uniform pDynamicUniform_3; PerViewData() { pStateSet = new osg::StateSet(); pDynamicUniform_1 = osg::Uniform(); pDynamicUniform_2 = osg::Uniform(); pDynamicUniform_3 = osg::Uniform(); pStateSet-addUniform(pDynamicUniform_1); pStateSet-addUniform(pDynamicUniform_2); pStateSet-addUniform(pDynamicUniform_3); } } PerViewData getOrCreatePerViewData(pCullVisitor) { return m_perViewDataMap[pCullVisitor]; } Just be carrefull to : - remove PerViewData instance from the m_perViewDataMap when the corresponding pCullVisitor instance is destroyed. (use an osg::Observer here) - add any necessary mutex in multithreading mode Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56957#56957 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Preferred method for per-context uniforms
Hi, And then index that by the GC ID if it's available through the cv-getCurrentCamera(). That's a bit different for my solution : - in my idea, you get per-view uniforms : even if multiple views runs with the same graphics context, you still have different uniforms - in your idea, you get per-context uniforms This can be really usefull too, but this is really different in some situations ! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56963#56963 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Preferred method for per-context uniforms
Hi Robert, The CullVisitor::getRenderInfo() method could be used to access to the osg::State object and hence ContextID that is relevant to the current cull traversal. Will this works with shared contexts ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56966#56966 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] IncrementalCompileOperation OnDemandMode
Hi, Sorry, I wasn't able to retrieve this old piec of code... The state can be obtained from the viewer's graphics context, and the RenderInfo can be created using the state and the viewer. Before running the visitor, you should make sure that the viewer's OpenGL context is current (makeCurrent). Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56744#56744 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] mixing OpenGL with OSG - textures
Hi, Here it is : Code: #include RenderBox/GLBoxWrappers/GLBoxOsgTexture.h #include GLBox/Texture/Texture.h // MyTexture::MyTexture() : osg::StateAttribute () , p_CustomerTexture (NULL) { } // MyTexture::MyTexture(CustomerTexture* pCustomerTexture) : osg::StateAttribute () , p_CustomerTexture (NULL) { setCustomerTexture(pCustomerTexture); } // MyTexture::MyTexture(const MyTexture texture, const osg::CopyOp copyop) : osg::StateAttribute (texture, copyop) , p_CustomerTexture (NULL) { setCustomerTexture(texture.customerTexture()); } // osg::Object* MyTexture::cloneType() const { return new MyTexture (); } // osg::Object* MyTexture::clone(const osg::CopyOp copyop) const { return new MyTexture (*this, copyop); } // bool MyTexture::isSameKindAs(const osg::Object* pObj) const { return dynamic_castconst MyTexture *(pObj)!=NULL; } // const char* MyTexture::libraryName() const { return MyLibrary; } // const char* MyTexture::className() const { return MyTexture; } // MyTexture::~Texture() { } // CustomerTexture* MyTexture::customerTexture() const { return p_CustomerTexture; } // void MyTexture::setCustomerTexture(CustomerTexture* pCustomerTexture) { p_CustomerTexture = pCustomerTexture; } // osg::StateAttribute::Type MyTexture::getType() const { return osg::StateAttribute::TEXTURE; } // bool MyTexture::isTextureAttribute() const { return true; } // int MyTexture::compare(const osg::StateAttribute stateAttribute) const { MyTexture const* pOther = dynamic_castMyTexture const*(stateAttribute); if (pOther != NULL) { if (p_CustomerTexture == pOther-GLBoxTexture()) { return 0; } return 1; } return -1; } // bool MyTexture::getModeUsage(osg::StateAttribute::ModeUsage modeUsage) const { if (p_CustomerTexture != NULL) { modeUsage.usesTextureMode(p_CustomerTexture-target()); return true; } return false; } // void MyTexture::apply(osg::State /*state*/) const { if (p_CustomerTexture != NULL) { // Execute a glBind using the pre-allocated customer texure id // Take care of mulitple context/sharing contexts p_CustomerTexture-bindYourCustomerTexture(); } } // void MyTexture::compileGLObjects(osg::State /*state*/) const { // Nothing to do : the OpenGL texture should be managed by the CustomerTexture class } // void MyTexture::resizeGLObjectBuffers(unsigned int /*maxSize*/) { // Nothing to do : the OpenGL texture should be managed by the CustomerTexture class } // void MyTexture::releaseGLObjects(osg::State* /*pState*/) const { // Nothing to do : the OpenGL texture should be managed by the CustomerTexture class } Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56708#56708 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] IncrementalCompileOperation OnDemandMode
Hi, I used to do something like that... from my memories, all that I can say is I used the osgUtil::GLObjectsVisitor to do a on-demand-compile-traversal right after loading an object. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56716#56716 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] mixing OpenGL with OSG - textures
Hi, At first, I was playing with Texture::TextureObject, but I found difficult to make OSG to delegate the control on ressource allocation / release (which are managed by my customer's library) so I've switched to a subclass. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56679#56679 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Picking implementation
Hi, but I can't really afford the per-frame cost On modern GPU, the per-frame cost is near zero with reasonable scenes. (not a full 3d scene of 1+ objects like in video games). The heavy cost is paid when you actually download some data from GPU to read back, but you can do that only on picking request. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56535#56535 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Picking implementation
Hi, I've got the same picking problem with several mesh (which use vertex displacement or tesselation). To solve that, I always render my scene in a FBO, with 2 color attachements : - first draw buffer is a regular color texture - second draw buffer is a texture with only 1 channel, in int format My shaders always write an objectId value in the second buffer. Then I can pick a pixel at anytime. You can also get the 3D world position of the pixel using its window coordinates, its depth value and the camera matrices. This not ideal picking, it consume a lot of GPU memory bandwitdh (but on modern GPUs it's not a problem), but it's easy to setup and for applications which need exact picking it may be the best solution. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56528#56528 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Possible bug in osg::State::applyShaderCompositionUniform
Hi, Thanks for testing ! I've already seen the problem of the growing list... But I don't know how to avoid this, because if I left the call to currentShaderCompositionUniformList.clear(), some uniforms are not properly applied. For example : - Node A : Shader Program + Shader Composition Uniforms Child node B : nothing Child node C : Shader Program In this case, Shader Composition Uniforms are properly applied on the Shader Program from node A, but not on shader program from node C Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56450#56450 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Possible bug in osg::State::applyShaderCompositionUniform
Hi, Have a look here to see why I use this (on Robert's advice) : http://forum.openscenegraph.org/viewtopic.php?t=11769 I know this is more like a workaround, but it is really usefull to be able to write StateAttributes classes which manage and apply their own uniforms. To solve my problem described in this post, my guess is I have to replace the _currentShaderCompositionUniformList with a stack in which we can push and pop uniforms when StateAttributes are pushed and poped. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56452#56452 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Possible bug in osg::State::applyShaderCompositionUniform
Hi, If you do change the list to stack so you can push/pop uniforms you will end up redoing standard uniform handling but this time with a parallel uniform list. Yes, and I think this is what I need : - a standard uniform list, which contains uniforms setted from regular osg::Uniform instances - a comes-from-stateAttribute uniform list, in the same way there is associated modes with some StateAttributes In my opinion, theses uniforms are not really linked to the ShaderComposition system, but complementary : sometimes you just want to push some StateAttribute-associated uniforms in the state. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56461#56461 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Possible bug in osg::State::applyShaderCompositionUniform
For example, push uniforms with ambient, diffuse, specular and shininess values from osg::Material, for OpenGL 3.3 It could also be used for application-specific StateAttribute classes, for example an ObjectData StateAttribute which push several uniforms on the state. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56465#56465 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Proposal for uniforms applied from within a StateAttribute
Hi, As discuted multiple times with Robert and others, sometimes it's really usefull to have a StateAttribute which also provide its own uniforms. For example, I use it in a modified osg::Material class to apply maerial values as uniform or to handle specific ObjectData StateAttribute classes which apply one or several uniform. By now, I do this using state.applyShaderCompositionUniform(_myUniform); from the apply StateAttribute method. It perfectly fit my needs, but I discovered a bug : these uniforms are not part of the State uniform map, so they are not applied to osg::Programs below it. Here is a proposal to handle this properly : 1/ add a getBuiltInUniformList() in the StateAttribute class = this method is const, inline and should be very fast, and return an empty list by default 2/ Each StateAttribute subclass can populate this list with desired uniforms, and change their values when needed 3/ handle this list in osg::State when attributes are applied = something is really done only if the list is not empty, which should not happen really often 4/ Maybe add a compilation DEFINE to use this feature or not (very usefull, but very application-specific or if you want to handle standard osg StateAttributes in OpenGL 3.2) 5/ Or add a test, like already done for the _shaderCompositionEnabled flag Here is a piece of code to show what I have in mind (code not tested...) : Code: / // New typedef : / typedef std::map std::string,ref_ptr Uniform BuiltInUniformList; / // New method on StateAttribute : / inline const BuiltInUniformList getBuiltInUniformList() const { return _builtInUniformList; } / // Modified method on State : / inline void State::pushAttributeList(AttributeMap attributeMap,const StateSet::AttributeList attributeList) { for(StateSet::AttributeList::const_iterator aitr=attributeList.begin(); aitr!=attributeList.end(); ++aitr) { // get the attribute stack for incoming type {aitr-first}. AttributeStack as = attributeMap[aitr-first]; if (as.attributeVec.empty()) { // first pair so simply push incoming pair to back. as.attributeVec.push_back( AttributePair(aitr-second.first.get(),aitr-second.second)); // Push built-in uniforms from the StateAttribute pushUniformList(_uniformMap, aitr-second.first-getBuiltInUniformList(), aitr-second.second); } else if ((as.attributeVec.back().second StateAttribute::OVERRIDE) !(aitr-second.second StateAttribute::PROTECTED)) // check the existing override flag { // push existing back since override keeps the previous value. as.attributeVec.push_back(as.attributeVec.back()); // Push built-in uniforms from existing back since override keeps the previous value. pushUniformList(_uniformMap, as.attributeVec.back().first-getBuiltInUniformList(), as.attributeVec.back().second); } else { // no override on so simply push incoming pair to back. as.attributeVec.push_back( AttributePair(aitr-second.first.get(),aitr-second.second)); // No override on so simply push incoming built-in uniforms to back. pushUniformList(_uniformMap, aitr-second.first-getBuiltInUniformList(), aitr-second.second); } as.changed = true; } } / // New method on State : / inline void State::pushBuiltInUniformList(UniformMap uniformMap,const StateSet::BuiltInUniformList uniformList, StateAttribute::OverrideValue value) { for(StateSet::BuiltInUniformList::const_iterator aitr=uniformList.begin(); aitr!=uniformList.end(); ++aitr) { // get the uniform stack for incoming uniform {aitr-first}. UniformStack us = uniformMap[aitr-first]; if (us.uniformVec.empty()) { // first pair so simply push incoming pair to back. us.uniformVec.push_back( UniformStack::UniformPair(aitr-get(),value)); } else if ((us.uniformVec.back().second StateAttribute::OVERRIDE) !(value StateAttribute::PROTECTED)) // check the existing override flag { // push existing back since override keeps the previous value. us.uniformVec.push_back(us.uniformVec.back()); } else { // no override on so simply push incoming pair to back. us.uniformVec.push_back( UniformStack::UniformPair(aitr-get(),value)); } } } / // Modified method on State : / inline void State::popAttributeList(AttributeMap attributeMap,const StateSet::AttributeList attributeList) { for(StateSet::AttributeList::const_iterator aitr=attributeList.begin();
Re: [osg-users] Proposal for uniforms applied from within a StateAttribute
Hi Robert, No problem, script support in OSG will be great ! I'll try to make an optimized implementation and submit it. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56472#56472 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Possible bug in osg::State::applyShaderCompositionUniform
Hi Robert, A few month ago, you solved one of my issues : http://forum.openscenegraph.org/viewtopic.php?t=11769postdays=0postorder=ascstart=14 Today I've discovered some problems with this approach (I use it for materials, as you suggested in your post) : the shader composition uniforms seems to not been inherited correctly. I've spotted the problem source : in void State::apply(const StateSet* dstate), there is this line : _currentShaderCompositionUniformList.clear(); So all shader composition uniforms are cleared at each StateSet apply. I've tried to comment this line and everything seems to work. Since I don't really understand the shader cmoposition uniforms system, can you give me some advices on this issue ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56433#56433 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Possible bug in osg::State::applyShaderCompositionUniform
Hi rmilh, If there is some interest I could send all the stuff to the submissions at the end of this week Thanks for the sharing offer, I'm interested ! I think I've made some progress in the analysis of my problem, could you just test the following inside your experimental shader composition project ? (I would like to know if you have any side effects.) in osg/State.cpp : in the method : State::apply(const StateSet* dstate) comment the following line : _currentShaderCompositionUniformList.clear(); Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56446#56446 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG errors when running on a virtual machine
Hi, I've got some bad experience with virtual machines. The 3D hardware acceleration in a virtual machine is generally not that good. In fact, hardware acceleration is usualy not available at all on a Virtual Machine. Because this is a virtual machine. Just like a remote session on windows : you can't access directly to the hardware. There is 2 potential solutions : - try finding a virtual macine system which allow direct access to the hardware (don't know the status, but NVidia made a lot of efforts on this since last year) - try a full software openGL implementation, like MESA Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56129#56129 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineSegmentIntersector numerical imprecisions
Hi Robert, This is perhaps un-related, but in a previous project, I've experienced intersections numerical precision problems with big scenes, and I've switched to the double precision line segment intersector taken fomr osgEarth source code. Maybe swiching from float precision to double precision could also help dealing wih the problem described in this thread ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56057#56057 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Performance of Uniform-Buffer-Objects and question to the software design of osg::BufferObject
Hi, If you change data often, you can declare the vertex attribute array usage as STREAM_DRAW. And to pass 4x4 matrices, you can do this : - declare 4 vertex attributes array in OSG - fill them with the 4 colums of your matrices - bind them to attributes units 4, 5, 6, 7 (for example) - in your shader, you can read mat4 type attribute on unit 4 But sometimes, passing full mat4 to shader can be slower than passing less data (only a vec3 for a position) and compute the matrix in the shader. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56038#56038 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Performance of Uniform-Buffer-Objects and question to the software design of osg::BufferObject
Hi, UBO are not designed for random access from shader, but for block access. For hardware instancing, you should get best performances using vertex attribute divisor. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56020#56020 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Intersection visitor and osg::Viewport
Hi, I'm experiencing some problems to get correct intersections in following situation : I have a group in my scene graph which have a Viewport StateAttribute to modify its rendering frame on screen. All is works well for render, but intersector seems lost wih nodes below my group. Is there any viewport change management in osg::Intersector ? I didn't find any (except when traversing camera). Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55808#55808 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Intersection visitor and osg::Viewport
Hi, I've tried the following and it seems to solve my problem : Code: void IntersectionVisitor::apply(osg::Group group) { if (!enter(group)) return; osg::Viewport* pViewport = NULL; if (group.getStateSet() != NULL) { pViewport = dynamic_castosg::Viewport*(group.getStateSet()-getAttribute(osg::StateAttribute::VIEWPORT)); } if (pViewport != NULL) { pushWindowMatrix(pViewport); push_clone(); traverse(group); pop_clone(); popWindowMatrix(); } else { traverse(group); } leave(); } This modification was just a test, but I wonder if this should not be in every apply method of IntersectionVisitor, maybe with these modifications : - take care of the override value (do not push window matrix if the attribute is overriden) - push the window matrix and the intersector clone BEFORE the enter test to ensure the enter test is done with correct coordinates frame Or am I wrong with that and I've missed something ? Thanks. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55809#55809 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Bug in trunk with Intersector epsilon
Hi, I think there is a bug in the trunk : the epsilon used for osgUtil::Intersector class is not initialized. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55692#55692 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph-3.2.0 stable release tagged!
Hi Robert, Thanks a lot for all your work ! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55446#55446 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Node with a dynamic bounding box
Hi, Due to the use of displacement mapping, I have a node with dynamic bounding box. I mean the bounding box change every frame (but very fast to compute). For now I've done the following : - reimplement osg::Node::computeBound - on each update traversal, call dirtyBound() Is there any better way to do that ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55106#55106 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] External texture/fbo
Hi, I've done this for interoperability between OSG and client library, for exampe for a texture : I've created a WrapperTexture class which inherits from osg::StateAttribute directly. - It expose it's StateAttribute type (getType() method) as TEXTURE - It contain a member which is an instance of my client library's texture class - in apply method, it call the equivalent of apply on my client library texture class. You can start be creating a class which inherit from osg::StateAttribute, implements all pure-virtual methods and have a look to osg::Texture and osg::Texture2D to see what methods needs to be overriden (like getModeUsage() and isTextureAttribute()) Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55039#55039 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Instancing with VertexAttribDivisor
Hi, Unfortunally, support for ATTRIB_DIVISOR is removed from official osg source since today... You can still use it by crating a drawcallback (or subclassing a drawable) and call glVertexAttriDivisor were needed. Just be carefull to reset to previous values brfore exiting the drawImplementation method to not disturb the other nodes rendering. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55041#55041 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] External texture/fbo
Hi, This tip works well, but you have to be aware of ressource creation/deletion either by OSG and Qt5, specially be carefull of the current OpenGL context. I recommend you to write the wrapper for a simple texture, make it works, then make in works in all situation (a single graph / single viewer, multiple viewers, different treading modes, mulitple use of the texture node...) before going further with other classes like FBO or shaders. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55042#55042 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Per-view RenderBin
Hi, I'm facing a problem : I use custom RenderBins for custom rendering, but it would be *very* convenient to be able to identity which view use this RenderBin instance. I've tought about this modification on RenderBin::createRenderBin : Code: RenderBin* RenderBin::createRenderBin(const std::string binName[b], osgUtil::CullVisitor* pCullVisitor=NULL[/b]) { RenderBinPrototypeList* list = renderBinPrototypeList(); if (list) { RenderBin* prototype = getRenderBinPrototype(binName); if (prototype) { RenderBin* pResult = dynamic_castRenderBin*(prototype-clone(osg::CopyOp::DEEP_COPY_ALL)) if (pResult != NULL) { pResult-setCullVisitor(pCullVisitor); return resultt; } } } OSG_WARN Warning: RenderBin \binName\ implementation not found, using default RenderBin as a fallback.std::endl; return new RenderBin; } This should not modify any existing code (pCullVisitor has a NULL default value) and allow to store the CullVisitor instance (which is a good way to identify a view I think) Any thought about this ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54891#54891 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Per-view RenderBin
Hi Robert, You're right, the RenderInfo is probably enough for my needs. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54896#54896 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vec{2,3,4}{b,s,i,f,d,ub,us,ui} harmonisation
Hi, Those implementations are truly ugly. Yes, the C++ code is realy ugly. But the C++ interface (which is what developpers realy use) is ok, and the generated asm is great. Maybe there are some interesting ideas to take from that. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54578#54578 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vec{2,3,4}{b,s,i,f,d,ub,us,ui} harmonisation
Hi, I think this is a really interesting idea. Have a look here : http://glm.g-truc.net/ This library already implements a lot of glsl-like syntax. Before rewriting everything (that's not complex, but a lot of work) maybe we could make osg and glm work together ? Maybe adding to glm headers the needed methods to be compatible with osg code ? or copy-paste some code from glm to osg ? (license is MIT, so I think that's ok) Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54573#54573 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vec{2,3,4}{b,s,i,f,d,ub,us,ui} harmonisation
Forgotten link from previous message : http://devmaster.net/forums/topic/10009-swizzle-operator-in-c/ = interesting ideas on how to implement developper friendly but asm efficient swizzle in C++ -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54574#54574 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Deprecating vertex indices in osg::Geometry
robertosfield wrote: The PreserveDataType and AttribDivisor are entirely new and are intended to support new extensions being added to the OSG - but their implementation will have to wait till the GeometryNew refactor is further down the road. This is great ! robertosfield wrote: Alternatively we just drop backwards compatibility and force uses to set the binding directly on the array. I prefer this solution, sometimes changes are simply needed. robertosfield wrote: The naming of Binding is something I'm note yet sure of, with the introduction of AttribDivisor the binding becomes a bit less clearly defined as well. Not sure what to make of this yet... Maybe a single parameter, something like get/setRate, using an enum : enum Rate { RATE_OFF=0, // Attribute is never emitted =BIND_OFF - attribDivisor = 0 RATE_SINGLESHOT // Attribute is emitted once =BIND_OVERALL - attribDivisor = 0 RATE_PRIMITIVE_SET, // Attribute is emitted at each start of a primitive set = BIND_PRIMITIVE_SET - attribDivisor = 0 RATE_VERTEX , // Attribute is emitted at each vertex = BIND_VERTEX - attribDivisor = 0 RATE_INSTANCE_0, // Attribute is emitted at each vertex = BIND_VERTEX - attribDivisor = 0 RATE_INSTANCE_1, // Attribute is emitted at each instance = BIND_VERTEX - attribDivisor = 1 RATE_INSTANCE_2,// Attribute is emitted at each 2 instances = BIND_VERTEX - attribDivisor = 2 ... RATE_INSTANCE_9,// Attribute is emitted at each 2 instances = BIND_VERTEX - attribDivisor = 9 }; Of course, user can do setRate(RATE_INSTANCE_0 + 25) to have attribDivisor = 25 robertosfield wrote: I have now completed the removal of ArrayData container and all slow path support from GeometryNew. The size is now down to less than 2/3rd the size of the original Geometry.cpp. The largest bloat left is with helper functions for verifying and correcting bindings, but I now believe these should be placed into osgUtil as helper functions rather osg::Geometry so I'll likely remove these and the size will go small still. Great work ! I have a question about immediate mode deprecation : does that mean the array dispatchers are no more needed ? Do the osg::geometryNew class set vertex/normal/textcoords... pointers directly on the osg::State ? And about display list : I understand that it's too early to remove them, in some situations it's still usefull. But maybe it's time to use it per default ? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54456#54456 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] KML with texture fails to save as IVE
Hi, When I try to save the node I get this error on the console: image C:\Workspace\OpenSceneGraph\build\bin\models\untitled\texture.jpg' 256 128 Error writing IVE image: StateSet::write(): Unknown StateAttribute: VirtualProgram This is normal, osgEarth insert custom VirtualProgram state attribute and they are not serializable. If you want to remove this error, you'll have to use a osg::Visitor to remove all osgEarth::VirtualProgram attributes, but I don't think this error is a real problem and you probably can just ignore it. But the point is that's a little weird to save a KML file as an IVE file : KML files are XML files which declares some data (POI, image overlay...) and reference external models. You can probably just pick up the external model file, open your KML with a text editor and have a look at it to see where your model file is declared. Handling of KML files in osg are based on a several osgEarth specific classes, so you will get better answer on their forum I guess. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53301#53301 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Updating parameter-based procedural geometry
Hi, Yes, this is what I have in mind, and I think this is also the safer way to do geometry modifications in OSG. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53184#53184 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Updating parameter-based procedural geometry
Hi, I think the most standard way to do this is to use an UpdateCallback on your osg::Node. This ensure your update code to be executed in the main application thread : UpdateCallbacks are executed during the update traversal, and this is the best way to avoid threading issues. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53178#53178 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem loading RGBA bmp.
Hi, Alpha channel is not supported by all image file format. For example PNG support it, JPEG doesn't. I'm not sure the BMP format support alpha channel (or maybe no all variant of BMP format) Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53060#53060 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] the original QT events seems conflicted with osg's event handle.
Hi, I think this is a Qt issue : drag'n'drop need a little more work than jsut implementing a dropEvent method. First, you need to set setAcceptDrops(true) on your widget, then take a look at : http://doc.qt.digia.com/stable/dnd.html You should implement it before with a regular QWidget, then in your Qt/OSG viwer widget. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53045#53045 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PolytopeIntersector distance and Transform
Hi, I'm also interested if you have a solution to easily pick points lines ! Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52972#52972 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to render without a depth buffer ?
Hi, As a preprocessing, I need to render a lot of quads to a texure. I already have something working with a render to FBO, but since I don't use depth test and I disabled depth write, I'm looking for a way to save some GPU memory by avoid the use of a depth buffer. I tried this : p_camera-attach(osg::Camera::COLOR_BUFFER, _renderTexture); p_camera-detach(osg::Camera::DEPTH_BUFFER); To explicitly disable the depth buffer, but according to gDebuger, a depth buffer is still attached to my FBO. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52973#52973 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to render without a depth buffer ?
Hi Pjotr, This works, thanks a lot ! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52976#52976 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamic PagedLOD node creation
Hi, You should have a look to osgEarth source code : they use PagedLOD with pseudo-loaders to dynamically build new nodes, this is maybe a good way to go for you. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52931#52931 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to pass ModelMatrix to vertex using osg::Uniform
Hi, The original code is : Code: vPosition = ViewMatrix * ModelMatrix * vec4(Vertex * ModelScale, 1.0); So I think you can use this : Code: vPosition = osg_ModelViewMatrix * vec4(Vertex * ModelScale, 1.0); because osg_ModelViewMatrix is equivalent to ViewMatrix * ModelMatrix. Where i can find all the osg built-in variables? In State.cpp : look for osg_*, you'll find : - osg_ModelViewMatrix = equivalent to gl_ModelViewMatrix - osg_ModelViewProjectionMatrix = equivalent to gl_ModelViewProjectionMatrix - osg_ProjectionMatrix = equivalent to gl_ProjectionMatrix - osg_NormalMatrix = equivalent to gl_NormalMatrix In SceneView.cpp : look for osg_*, you'll find : - osg_ViewMatrix - osg_ViewMatrixInverse Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52867#52867 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to pass ModelMatrix to vertex using osg::Uniform
I forgot this : You declare an input attribute : Code: attribute vec3 Vertex; But have you set and bind any vertex attribute called Vertex ? I think you should remove this line and use : Code: vPosition = osg_ModelViewMatrix * vec4([b]gl_Vertex.xyz[/b] * ModelScale, 1.0); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52868#52868 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] custom vertex attribut, using BIND_OVERALL
Hi, I've posted a submission which should solve this issue : http://forum.openscenegraph.org/viewtopic.php?p=52849#52849 The problem was in the ArrayDispatcher.cpp file : some kind of array types (like ArrayInt you use here) where not registered with associated dispatchers. It solves my issue, could you test if it solve yours ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52850#52850 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] initializing the depth buffer with another camera's buffer before rendering
Hi, I haven't yet figured out how to get from an osg.:Camera or an osg::RenderInfo to an actual fbo pointer. *sigh* Such a method should be usefull, but I didn't find a way to do it neither. In my application, I do something really close, but I affect explicity the texture to use for color buffer and depth buffer : Code: p_sceneCamera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); p_sceneCamera-attach(osg::Camera::COLOR_BUFFER, p_sceneColorOutputBuffer); p_sceneCamera-attach(osg::Camera::DEPTH_BUFFER, p_sceneDepthOutputBuffer) Where p_sceneDepthOutputBuffer : - internalFormat = GL_DEPTH_COMPONENT32 - sourceFormat = GL_DEPTH_COMPONENT - sourceType = GL_FLOAT So I don't need to extract the pointer to the depth buffer, because I already nknow it : it is p_sceneDepthOutputBuffer And then I can share it with another camera or copy it using a renderquad and a shader (but this copy is maybe not as edficient as a glBlitFramebuffer call) Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52816#52816 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenCL post processing example: anyone care to share?
Hi, I used to do post processing with Cuda. But I've switched to full GLSL : - no compatibility problem - no performance overhead due to interoperability To compute histogram, you can use the method described in this link : http://http.developer.nvidia.com/GPUGems3/gpugems3_ch41.html I use it, it's pretty efficient (and really efficient if you don't compute the histogram for the full image, but only 1/4 pixel) I've try to compute histogram with compute shader, too, but it doesn't work for now. The most difficult in postprocessing is to insert CPU control code, for example to read back values in the histogram and set these values as input for the equalization pass. For this I use a lot of PostDrawCallbacks. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52793#52793 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem with 2 RTT cameras
Hi, Not sure about that, but you traverse the both camera with the same cull visitor instance... I think render target is assigned within the cull visitor, so you maybe should use 2 cull visitor different instances. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52803#52803 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Cheaper way to implement rendering-to-texture and post-processing pipeline?
Hi, the concept of post-processing is inherently non-spatial, so it really doesn't belong in a scene graph at all = this is why I think we should be able to execute a render pass on an arbitrary camera : the subgraph of this camera may not have a spatial organization, but a process-logic organization Wouldn't it be better to have a list of dedicated RTT objects as described by Rui, and process them as a Camera post-draw callback = this also my idea : have a dedicated executeCamera method which take a camera and a state as arguments : with that we can call it from a final / post draw call back. Rather than a list of dedicated RTT objects which will never cover all the diferent use cases, I think this is better to re-use the camera class with it's subgraph, which already works well : by building different small sub-graph we can implement different processing (with a render quad as input, or with a point cloud, or with anything else). Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52688#52688 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Cheaper way to implement rendering-to-texture and post-processing pipeline?
Hi, Thanks for sharing this, I've never think to this way, and it's very interseting. Not really for performance reason, but also for simplicity reasons. I'll try to dig that further to see if it can be usefull to implement what is discussed here : http://forum.openscenegraph.org/viewtopic.php?t=11577 (using renderbin to configure current FBO) One use case could be one of the applications I'm working on : - I have a scene with multiple objects - I render the scene using HDR shader : scene = FBO 1 - Post process (tone mapping) : FBO 1 = FBO 2 - render GUI elements with normal shader : FBO 2 + GUI = FBO 3 I would like to move an object from HDR to normal rendering and vice-versa by simply specify its RenderBin as FBO 1 or FBO 3. I've already have a shader system with automatically switch between HDR and normal rendering, but for now I have to move the object from a sub graph to another, which breaks the graph logics for user and also for events o intersectors. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52679#52679 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Cheaper way to implement rendering-to-texture and post-processing pipeline?
Hi all, I'm not sure the CPU cost is really the issue here, but it would be usefull to have that kind of methods : executeCamera(osg::Camera*, osg::State*) executeCameraAsync(osg::Camera*, osg::State*) = execute all needed code to render the sub graph of the camera, with async wait. = inputs are controled using the StateSet of the camera + subgraph = outputs are controled by the camera render target So, we can do processing like that in a PostDraw/FinalDraw callback : Code: executeCamera(cameraBlur, renderinfo.getState()); if (something) { executeCamera(cameraFX, renderinfo.getState()) } float x = computeSomething(); cameraToneMapping-getStateSet-setUniform(x); executeCamera(cameraToneMapping, renderinfo.getState()) with : cameraBlur : a small graph : a render quad, a shader and main scene bound as input texture cameraFX : similar, another FX cameraToneMapping : similar, execute a tone mapping controled via uniform x Here we can mix GLSL processing and CPU control code, for advanced processing it's very usefull. It's also difficult to achieve using a standard graph, without playing a lot with callbacks and render order. Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52684#52684 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] useVertexAttributeAliasing and vertex color
Hi, I've sent a patch for this : http://forum.openscenegraph.org/viewtopic.php?p=52418#52418 About my second message, forgot it, it was an error in my shader code -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52419#52419 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] An OSG Resource Compiler ?
Hi, I use OSG in a Qt application, and I do this : osg::ref_ptrosg::Object osgDB::readObject(:/some-label/object.osgt.qtresource); The .qtresource extension is mapped to a pseudo-loader written using Qt classes to load :/some-label/object.osgt file from Qt resources and decode it using the plugin associated to .osgt extension Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52437#52437 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] useVertexAttributeAliasing and vertex color
Hi, I'm trying to use the useVertexAttributeAliasing. Nearly all my shaders are ported and now works, but I have a problem with the vertex color : in case of useVertexAttributeAliasing, vertex colors are binded as an attribute using : Code: setVertexAttribPointer(_colorAlias._location, size, type, GL_FALSE, stride, ptr); With normalization = GL_FALSE So, in my shaders, I get vertex colors values between 0 and 255. Should this line be : Code: setVertexAttribPointer(_colorAlias._location, size, type, [b]GL_TRUE[/b], stride, ptr); So we always get values between 0.0 and 1.0 in shaders, even if we use vec4ub colors or vec4f colors ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52391#52391 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] useVertexAttributeAliasing and vertex color
Hum, I don't really get it... When I build a model from code (create an osg::Geometry, fill a vertex array, a normal array, a color array) I get [0.0 - 1.0] values in my shader When I load a model from a file (.3ds or .osgb) I get [0.0 - 255.0] values in my shader Have someone experienced problems like this ? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52392#52392 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to convert an array to BIND_PER_VERTEX
Hi, I'm writing an application which execute some algorithms on model's geometries. To make simplier code, I would like to convert all nodes in a model file to a specific structure, for example : - use only TRIANGLES primitive - use only PER_VERTEX bindings - etc... I know this could lead to a bigger memory footprint, but I makes our algorithms code really simplier. I could do a lot of the work using standard osg utilitary visitor (like optimizer) but I didn't find anything to convert an array from BIND_OVERALL or BIND_PRIMITIVE or BIND_PRIMITIVESET to BIND_PER_VERTEX. Before I start to write the conversion code myself, is there any way to do this using an existing osg visitor or primitive functor ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51851#51851 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG COLLADA build problem, Windows, vs2008
Hi, I've sent a fix for that : http://forum.openscenegraph.org/viewtopic.php?t=11204 The fix is not yet merged into trunk. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51798#51798 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Create a custom RenderStage
Hi, I use differents custom RenderStages : as pre-renderstage for pre-processing and as post-renderstage for post processing. These processing are executed using FBO render targets. Currently I'm doing that with slaves cameras, but : - the RenderStage class is derived from the RenderBin class - it is possible to register new RenderBins using the addRenderBinPrototype method So I wonder if it is possible to create a new RenderStage prototype to replace my slave cameras ? How to configure the rendertarget of these renderstages ? My goal here is to learn how to create / customize RenderStages and RenderBins. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51746#51746 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create a custom RenderStage
Hi Wang, Thanks for your quick answer ! I'm already doing pre and post-processing of various king : tone-mapping, DOF, motion blur... using multiple cameras, slave or childs. Now I'm trying to create custom renderstages, without multiple cameras, but using a RenderBin prototype. This could be very usefull in some situations, for example : - having a graph with a parent group and 3 childs : A, B and C - render node A and node C using a custom pre-renderstage - render node B as usual To do so with multiple cameras, the graph need to be manipulated to create a new camera and move A and C under this camera. Using a custom RenderStage registered as a RenderBin prototype, there is no need to edit the scene graph, but just edit the RenderBin of A and C statesets. In this situation, culling and events traversal are also done as described in the main graph : - parent --- A --- B --- C But whith multiple cameras it leads to something like : - parent --- child camera -- A -- C --- B Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51748#51748 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create a custom RenderStage
Thanks for these informations, I'll try to do something with that. I was thinking about a more simple approach : - register a RenderBin prototype which is a class deriver from RenderStage - use this renderbin for some nodes I've already created custom RenderBin prototypes (it's pretty easy, just override the needed method) but the RenderStage class seems to need more parameters (renderTarget, writeBuffer...). My first idea was to hardcode (for testing) these parameters in MyRenderStageBin constructor, but I don't know which values to use. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51750#51750 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create a custom RenderStage
Hi Paul, Thanks a lot, these are very intersting informations ! Actually, I need to use custom RenderStages and not only RenderBins because I want to render to different FBO's (for pre and post process purposes) - Editing manually the RenderGraph sounds a little bit complicated to me - Creating a CustomNode class as you suggest is very close to using multiple cameras : it leads to scene graph manipulations as the nodes rendered into this RenderStage need to be child of the CustomNode and I would like to avoid this I'm still looking for a way to create a RenderBin prototype which is actually a RenderStage instance and re-implement its reset (and probably others) method to make it works. The final goal is to easily move individual nodes from a RenderStage to another without editing the scene graph, just edit the StateSet's RenderBin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51753#51753 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Animating articulated osg models
Hi, In general, am I correct in expecting setUpdateCallback to behave this way? = yes In the situation you describe, the osg model is shared against multiple parent, event if there is a specific matrix transform : Common parent | |- Matrix_1 - Osg_Model | |- Matrix_2 - Osg_Model | |- Matrix_3 - Osg_Model | |- Matrix_n - Osg_Model the Osg_Model node is displayed n times in your scene All Matrix_1 to Matrix_n nodes allow to draw the multiples Osg_Model at different places, but there is only one Osg_Model instance in memory, so if your update callback update a node which is below Osg_Model in the hierarchy, all update callbacks edit the same node. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51756#51756 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Questions about mip maps
Thanks a lot for this very precise answer ! Just one more question, you said : each successive level should be an integer quotient of the previous level's size and two So, for n-th level, the size should be : (size of n-1 level) / (2*k) with arbitrary k ? Is it possible to have multiple levels with the same size ? For example : Texture : 512x512 Level 1 : 256x256 Level 2 : 256x256 Level 3 : 256x256 Level 4 : 256x256 Level 5 : 128x128 Level 6 : 128x128 Level 7 : 128x128 Level 8 : 128x128 Level 9 : 1x1 Mipmaps levels stop here. I know this is a little weird, but my procedural textures can be generated for any size and any distance, so in my case tghis should be interesting to have mulitple levels with the same texture resolution, but different spatial resolution inside the texture. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51594#51594 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Questions about mip maps
Hi, I have a set of pre-computed procedurals textures, and my texture generation system can produce high-quality downsampled textures. So I would like to use them as mipmaps for my textures : - is it possible to allocate and load mipmaps from CPU, just like we load an osg::Image into an osg::Texture2D ? - is there any example of that ? - is it mandatory that each mipmap level is exactly half size of the previous ? - is it mandatory that texture size is a power of two ? how to deal with odd texture size ? (or odd n-th mipmap size) ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51590#51590 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Sharing culling results among multiple cameras
Hi, Thanks a lot for this idea ! I'll try to do something based on it. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51457#51457 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Inherit depth buffer attachment for a child camera ?
Hi, In my scene graph, I use a main camera with FBO severals attached : - a FBO for COLOR0 - a FBO for COLOR1 - a FBO for DEPTH I would like to use a child camera (not slave) with : - another FBO attached to COLOR0 - the same FBO a main camera for DEPTH buffer Is there anyway to inherit the DEPTH buffer attachment from main camera ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51433#51433 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Sharing culling results among multiple cameras
Hi, I'm intersted by this topic, because in my application, sometimes I need to render the same scene multiple times. For example, I render the scene a first time to generate a regular OpenGL image. Then I render with different shaders/textures to generate an image with computation results (often using a FBO and RGBA32F render target) So, between these different image, the only modified data are the StateAttribute : shaders, uniforms and textures. In this situation, is there anyway to share the culling results ? Maybe anyway to retrieve the RenderGraph and re-excute it ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51447#51447 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer instance coordinates
Hi, I use a TextureRectangle to store instances transformations matrix : - TextureRectangle because it's easier to read a specific coordinate - texure format is set on RGBA_32F to get full 32 bit floating point precision - RGBA = there are 4 values (R, G, B, A) per pixel So, a full transform matrix is 4x4 = 16 values = I use 4 pixels to store a full matrix this way : - Texture size is 4 x InstanceCount - on each row, there are 4 pixels = 16 values So, in the shader, to retrieve the full matrix, I can do this : (code from memory, no garanty this is exact) mat4 matrix; matrix[0] = Texture2DRectangle(myTexture, 0, gl_InstanceID); = read 4 values matrix[1] = Texture2DRectangle(myTexture, 1, gl_InstanceID); = read 4 values matrix[2] = Texture2DRectangle(myTexture, 2, gl_InstanceID); = read 4 values matrix[3] = Texture2DRectangle(myTexture, 3, gl_InstanceID); = read 4 values and I transform gl_Vertex with this matrix. It's a little heavy (4 texel fetch for each vertex) but it allow to send full matrix (position, attitude, scale...). If you need only the position, you can store it as a vec4 in a RGBA_32F TextureRectangle of 1 pixel width. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51309#51309 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] custom vertex attribut, using BIND_OVERALL
Hi, Does anyone have a solution for this issue ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51227#51227 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] manually calling drawImplementation
Hi, Is there a reason why you can't just use a osg::Camera that is drawn after the main scene? I'm facing the same problem : in my OSG graph, I render data from physical simulations using a RTT camera and I need to postprocess the rendered texture before display it. The problem is to easily execute different postprocess algorithms : they are not suitable for a simple render quad or a simple subgraph. In some cases, I need to do sequencial multiple post processing, and between each step I have to readback some values to CPU, compute something on the CPU and feed the next shader with it. It can be done with multiples Camera/CameraCallBack, but this is a lot of coding and complex scene graph. Having a solution to manually execute a draw on a Camera using a specified state would be great (no Viewer involved). It allow to write this kind of stuff : 1/ Create different simple graph to compute each step, each graph is something like : Camera (RTT) | RenderQuad (with postprocessing shader) 2/ Add a PostDrawCallback to main Camera 3/ In this PostDrawCallback execute this : - subgraph_step_1-draw(pState); - readback / compute something - subgraph_step_2-draw(pState); - readback / compute something - subgraph_step_3-draw(pState); - readback / compute something I think this should work only if subgraph cameras are RTT cameras. And maybe the rendering should be really simple : no event / update traversal, maybe not even culling, just draw all objects[/quote] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51198#51198 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Custom CullingVisitor
Hi, Thank you! I use custom cull visitor to store extra global-to-scene data and define some extra methods. These data are then read and write during culling by some specific nodes, to render parametric objects and/or select which StateSet to apply. Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50831#50831 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Custom CullingVisitor
Hi, In my application, I use a custom CullVisitor, this way : osgUtil::CullVisitor::prototype() = new MyCustomCullVisitor(); But this affects all viewers in my application. Is there anyway to explicitly set a custom CullVisitor on a specific osgViewer::Viewer ? I would like to use twos different CullVisitor for two different viewers. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50750#50750 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] custom vertex attribut, using BIND_OVERALL
Hi, I think OpenGL specs doesn't allow to share a vertex attribute values between multiple vertices. Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50753#50753 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to copy an FBO used as RTT target ?
Hi, I have a scene graph with multiple cameras as follow : Camera 1 : - clear mask : color and depth - use FBO_Camera_1_Color as color buffer attachment - use FBO_Camera_1_Depth as depth buffer attachment Camera 2 : - clear mask : none - use FBO_Camera_2_Color as color buffer attachment - use FBO_Camera_2_Depth as depth buffer attachment Now, I would like the Camera 2 : - to use FBO_Camera_1_Color as an INPUT color buffer (do not write into this buffer, write into FBO_Camera_2_Color) - to use FBO_Camera_1_Depth as an INPUT depth buffer (do not write into this buffer, write into FBO_Camera_2_Depth) So this way : - FBO_Camera_1_Color and FBO_Camera_1_Depth remains intact even after camera 2 rendering. - everywhere the camera 2 do not write data, data from camera 1 are visible The first solution would probably to copy FBOs before camera 2 rendering : - FBO_Camera_1_Color into FBO_Camera_2_Color - FBO_Camera_1_Depth into FBO_Camera_2_Depth How to do that ? Should I use another camera and a renderquad to perform the copy, or is there any OSG functionnality to copy FBO ? Even better, is there a second solution to provide an input buffer attachement to a camera ? Thank you! Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50713#50713 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Tesselator and output primitives
Thanks, the IndexMeshVisitor does exactly what I need. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50563#50563 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Tesselator and output primitives
Hi, I use tesselator to generate a geometry from a LINE_LOOP primitive. The tesselator output give me a TRIANGLES_FAN primitive which seems to be correct. Now I would like to get the tesselator output as TRIANGLES primitive. Is there anyway to control the primitive type built by the tesselator ? Or is there any OSG tool function / visitor that can convert TRIANGLES_FAN to TRIANGLES ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50551#50551 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bug in Qt thread integration
Hi, I'm surprised that QThread::currentThread() can return something else than a QThread instance. But if this is really the case, the following should solve the issue : Code: QThread* pQThread = dynamic_cast QThread* (QThread::currentThread()); if (pQThread != NULL) { QtThreadPrivateData* pd = static_cast QtThreadPrivateData (pQThread); } -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50337#50337 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problem with DXT textures : osgconv works, nvtt does not ?
Hi, I try to compress all my model textures. The first try was using osgconv and the --compressed-dxt3 option. This works well. The second try is made in my application code, using a node visitor which compress all textures to DXT3 using the nvtt plugin. In the second case, the files are correctly generated, can be opened with a DDS reader software but doesn't appears in osgviewer. If I replace all the .dds textures files of the second try with the files generated by osgconv, everything is working fine. Does anyone have experienced problems with nvtt plugin ? I've try with DXT1 / DXT5 compression, but the result is always the same : textures files seems to be valid (can be opened in any software) but are not displayed in osgviewer. Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49706#49706 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PagedLOD - How to not page a specific node ?
Thanks for your idea, I'll try it. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49219#49219 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] PagedLOD - How to not page a specific node ?
Hi, In my application, I display some very heavy models (about 100Mo of textures + 20 Mo of vertex) This model is created proceduraly, and I can control the level of detail for the geometry and the textures, so I build 5 PagedLod : from very simple model to full data resolution. My problem is about the most detailed level : this one is very heavy and I would like to never keep it in cache to avoid over memory usage. Is there any parameter to tweak on this PagedLod (priority, time stamp, minimum expiry time..) to get the following behaviour : - when this PagedLod is needed for display, it is loadded and displayed - when this PagedLod is no more needed for display, it is deleted from CPU memory and GPU memory, even if the OSG_MAX_PAGEDLOD is not reached Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49207#49207 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render a sub part of the viewport
Hi, Thanks for your guidelines, this is exactly what I try to do... no sucess for the moment but it's probably just a math issue with the projection matrix modification. Another question : how can I render only this camera ? (not the main one) I tried to modify cameras node masks so when I call the frame() method, only the fragment info is rendered but I always get : - no camera render at all or - main and fragment info camera are rendered Thank you! Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47757#47757 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render a sub part of the viewport
Thanks, I'll work on it on monday... What about my 2nd question ? (render only this camera) Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47761#47761 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render a sub part of the viewport
Hi, I've made a render graph with a main camera and several RTT cameras. One of these cameras is disabled by default and is used to compute informations about the fragments (shader program is used to compute image signal parameters, not visible colors) When the user activate a read info mode, for each click on the viewer : - this special fragment info camera is enabled - the fragment info camera matrices (view and projection) are copied from the main camera (to get the same point of view) - the fragment info camera viewport is copied from the main camera (to get the same image) - a frame is rendered = the fragment info camera write informations into a framebuffer - the informations from the fragment info pixel under the mouse are read and displayed to the user This works well, but I have a performance issue : - the fragment info shaders are complex - the fragment info framebuffer is the same size as the main viewer, which is useless since I have to read only a few pixels So I'm looking for a way to compute : - the fragment info camera matrices (view and projection) from the main camera matrices - the fragment info camera viewport from the main camera matrices to get : - only a 9x9 pixels image - the center pixel of this image centered with the mouse cursor coordinate Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47741#47741 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] osgdem not output .osga compressed file
Hi, I have the same problem with : - OSG 3.1.2 - VPB 0.9.12 - Windows 7 32 bit - osga plugin compiled Did you found any solution ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47166#47166 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org