Re: [osg-users] OpenThreads, scheduling, etc ... policies
Thanks Robert. I am going to try it right away. Just to clarify, this is the address of the current trunk, right? http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk On Fri, May 2, 2014 at 11:56 AM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, Last month I checked in a fix for this issue, could you try out svn/trunk to see if it things work now as you were expecting? Robert. On 1 May 2014 18:49, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community my client found interesting behaviour on OpenThreads under 64bit OpenSuSE linux. It seam none of the calls like setSchedulePolicy, setProcessorAffinity and setSechedulePriority of OpenThreads::Thread are working. After running a code, they all return 0 (success) but after inspecting the threads in some tools, they show they are not set as expected. So I gave it a try on Ubuntu 64bit. On my linux box none werle working - all returned -1 (failure). Attached is simple code from Rui's book that ilustrate the problem. Any help is appreciated ! Also, the OSG version tested is 3.3.1 Nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenThreads, scheduling, etc ... policies
Hi Robert, I just build the latest from the trunk - revision 14188, and no changes. Still geting failures (-1) on these calls. But on Windows it works well. Any ideas? Could you give it a shot to the attached file, it is selfcontained Thanks a bunch! Nick On Fri, May 2, 2014 at 12:18 PM, Robert Osfield robert.osfi...@gmail.comwrote: On 2 May 2014 10:12, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Thanks Robert. I am going to try it right away. Just to clarify, this is the address of the current trunk, right? http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk Yep, that is correct. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenThreads, scheduling, etc ... policies
Hi Community my client found interesting behaviour on OpenThreads under 64bit OpenSuSE linux. It seam none of the calls like setSchedulePolicy, setProcessorAffinity and setSechedulePriority of OpenThreads::Thread are working. After running a code, they all return 0 (success) but after inspecting the threads in some tools, they show they are not set as expected. So I gave it a try on Ubuntu 64bit. On my linux box none werle working - all returned -1 (failure). Attached is simple code from Rui's book that ilustrate the problem. Any help is appreciated ! Also, the OSG version tested is 3.3.1 Nick /* -*-c++-*- Copyright (C) 2010 Wang Rui wangray84 at gmail dot com * OpenSceneGraph Beginners Guide * Using a separate thread for supplying data to a node in the main process */ #include osg/Geode #include osgDB/ReadFile #include osgText/Text #include osgViewer/Viewer #include iostream class DataReceiverThread : public OpenThreads::Thread { public: DataReceiverThread() : OpenThreads::Thread() { int status = setProcessorAffinity(0); printf(setProcessorAffinity status: %d\n, status); } virtual int cancel() { _done = true; while( isRunning() ) YieldCurrentThread(); return 0; } virtual void run() { _done = false; _dirty = true; do { YieldCurrentThread(); char ch; std::cin.get(ch); printf([%c][%d] , ch, ch); switch (ch) { case 0: break; // We donĄŻt want ĄŽ\0ĄŻ to be added case 9: _done = true; break; // Tab = 9 default: addToContent(ch); break; } } while( !_done ); } void addToContent( int ch ) { OpenThreads::ScopedLockOpenThreads::Mutex lock(_mutex); _content += ch; _dirty = true; } bool getContent( std::string str ) { OpenThreads::ScopedLockOpenThreads::Mutex lock(_mutex); if ( _dirty ) { str += _content; _dirty = false; return true; } return false; } protected: OpenThreads::Mutex _mutex; std::string _content; bool _done; bool _dirty; }; class UpdateTextCallback : public osg::Drawable::UpdateCallback { public: UpdateTextCallback(DataReceiverThread* rcvrthrd) : rcvrthread(rcvrthrd) {} virtual void update( osg::NodeVisitor* nv, osg::Drawable* drawable ) { osgText::Text* text = static_castosgText::Text*( drawable ); if ( text ) { std::string str(# ); //if ( DataReceiverThread::instance()-getContent(str) ) if ( rcvrthread-getContent(str) ) text-setText( str ); } } DataReceiverThread* rcvrthread; }; int main( int argc, char** argv ) { int status; osg::ref_ptrosgText::Text text = new osgText::Text; text-setFont( fonts/arial.ttf ); text-setAxisAlignment( osgText::TextBase::SCREEN ); text-setDataVariance( osg::Object::DYNAMIC ); text-setInitialBound( osg::BoundingBox(osg::Vec3(), osg::Vec3(400.0f, 20.0f, 20.0f)) ); DataReceiverThread* rcvrthread = new DataReceiverThread; rcvrthread-Init(); text-setUpdateCallback( new UpdateTextCallback(rcvrthread)); osg::ref_ptrosg::Geode geode = new osg::Geode; geode-addDrawable( text.get() ); geode-getOrCreateStateSet()-setMode( GL_LIGHTING, osg::StateAttribute::OFF ); osgViewer::Viewer viewer; viewer.setSceneData( geode.get() ); viewer.setUpViewInWindow( 50, 50, 640, 480 ); //status = rcvrthread-setProcessorAffinity(0); //printf(setProcessorAffinity status: %d\n, status); status = rcvrthread-setSchedulePolicy(OpenThreads::Thread::THREAD_SCHEDULE_ROUND_ROBIN); printf(setSchedulePolicy status: %d\n, status); if(!status) printf(getSchedulePolicy: %d\n,rcvrthread-getSchedulePolicy()); status = rcvrthread-setSchedulePriority(OpenThreads::Thread::THREAD_PRIORITY_HIGH); printf(setSchedulePriority status: %d\n, status); if(!status) printf(getSchedulePriority: %d\n,rcvrthread-getSchedulePriority()); rcvrthread-startThread(); viewer.run(); rcvrthread-cancel(); return 0; } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems with keyboard events
Hi Alvaro, your update callback is expecting PositionAttitudeTransform*, so make circulo() function to return it. Something like* sphere-getOrCreateStateSet()-setAttribute(rojo); PositionAttitudeTransform* pat = new PositionAttitudeTransform; pat-addChild(sphere); return pat; I think with this change it will work NIck On Tue, Apr 29, 2014 at 10:38 AM, alvaro ginestar rodriguez alvarogines...@hotmail.com wrote: Hi i'm learning OSG and i have some problems with keyboard events. I want move a sphere with the keyboard. I´m following OSG tutorial Handling Keyboard Input to Update a Callback: http://trac.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicKeyboardInput And i don´t know why it dosen´t work. The code : https://github.com/a5rojo/CirculoOSG/blob/master/circulo.cpp THX ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Keyboard-callback model tranformation
Hi Laura, the osgGA library holds classes that are responsible for managing events from mouse, keyboard etc. You would be interested in osgGA::GUIEventHandler and its *handle* method. So You might want to inherit and override the *handle *method that will do processing based on keypress event - the event and the key are hidden in the first argument osgGA::GUIEventAdapter. Once you have Your new EventHandler you simply add it to Your viewer - there is a method for it, see the osgviewer.cpp example The best for moving the ship in your scene is osg::MatrixTransoform - this is a node with a matrix to spatially manipulate parts of the scenegraph. Let this MatrixTransform be your root of the model (its child can be Your ship model) and you modify only the matrix which is part iof the MT. Do a research on the mentioned above, if you got stuck feel free to ask, someone might give you some code snippets as well Good luck! Nick On Mon, Apr 28, 2014 at 7:03 AM, Laura Mac randomweirdadventure...@yahoo.com wrote: Hello all, I am a beginner with OSG and with graphics programming in general, so please excuse the elementary question. I am interested in rendering a ship model rotating the model (through interpolation) whenever particular keys are pressed. As I am new to OSG, I have been browsing through the provided examples to find anything similar which I could use as my base. However, it seems most examples do not demonstrate on-call model translation/transformation. Could anyone direct me to an example of a similar implementation, or at least a number of classes/functions which I would find useful? Thank you very much! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59167#59167 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Best way balance tree??
Hi Jaime, what is the format of your terrain model (the file extension)? Nick On Thu, Apr 24, 2014 at 11:38 AM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Hi Jaime, Thanks for your response! I have a lot (5000 aprox) of trees in my example scene. Each tree has got two planes and textures. However, my terrain geometry is relatively simple. I think that the terrain is not the problem. And there are some buildings in some places. Also, there are cars and pedestrians. So, it is a complex scene. If you don't need alpha blending (or at least correctly sorted blending) you might want to use instancing. In combination with geometry-shader based LoD (e.g. displaying a billboard which is rotated in the geometry shader for far trees) I got pretty decent results with 1k to 16k objects. You will still have to split the trees into a quadtree, since instancing has its peak performance for certain batch sizes. But you will have to figure it out by experiment since this seems highly dependent on the geometry and the other work on the GPU. Also having potentially 5000 draw calls each frame will have a serious impact on performance. If your trees are scattered in bigger groups (e.g. alleys or forests) it might be a good idea to bundle a certain amount of trees into one drawable (e.g. a group of three or five trees). This can improve your performance by trading of some bigger vertex arrays/display lists with less drawcalls. Nowadays, the performance is not good (20 fps aprox). We are not using any LOD nodes. Because of that, I thought in that solution. Using LODs won't help here too much with your trees (simplifying 2 quads is quite hard) , but might help you with your more complex objects as houses etc. Take a look at the GeometrySimplifier in osgUtil it can generate some LODs for testing for you. What are your tips? How about using VisibilityGroup? Unfortunately I didn't try this, but since your description doesn't sound like you have big occluders. I'm not quite up to date on the topic, but using Occlusion culling is not very efficient since it requires a GPU-CPU roundtrip. Cheers Sebastian Thanks :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59139#59139 ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Best way balance tree??
Hi Jaime, my last project was a car simulator for Williams F1. And I want to give you few hints. In theory, quad tree spatial terrain database suits best, and this is output from known terrain tools from Presagis, TerraSim, TrianGraphics - they do this automatically for You. So this is the first answer. However, from my last project, and this is based on lots of experimenting with OSG and the latest graphics hardware, I found that a flat structure - nodes by nodes - can perform almost with double performance, if they are meshed - by meshing I mean here preparing the geometry into large meshes based on material, textures (state). On todays hardware you can have large terrain models (all into memory) like this, no paging. And for this you can use Presagis Creator or the modeler from Remo 3D - I assume you will use the standard format for this which sits in the sim industry for decades, like OpenFlight, which is good for modelling and you can further optimized it with OSG for rendering into formats like .ive, .osgb etc. If you have REALLY large terrain model then you can consider some formats that supports paging. So far I am familiar with TerraVista and Presagis TerraPage, which has it as quadtree and something called smart mesh - this is here and available for decade or so and I still think it is the best and the most lightweight LOD paging schema and supported by the native OSG PagedLOD. So I guess You should tell us more about your terrain model, how you build it or you plan to build it so we might have more hints for you Hope these helps Cheers, Nick On Wed, Apr 23, 2014 at 11:00 AM, Robert Osfield robert.osfi...@gmail.comwrote: HI Jamie, On 23 April 2014 09:58, Jaime xatp...@hotmail.com wrote: What about 'pools'? We have been thinking about having a pool system to manage trees (lamps, cars, etc.). We would render only the objects that are near the player. The nodes of the scene graph are pretty lightweight, it's the geometry and textures that are large so what you want to achieve is sharing of the geometry and textures (and other state) but you generally don't need to attempt to save internal nodes in the scene graph. This means that when you build the scene graph build the internal nodes so it provides well balanced culling - via both spatial and LOD culling and share as much of the leaves and state as you can. If you have a static scene then you probably won't need to worry about managing a pool of geometry and state apart from for the purposes of building the scene graph in the first place. If you are needing to page the database because it's far too big to fit in memory then there may be value in managing a pool that is shared. The osgDB library has a cache which you can use for this purpose, or you could create a pseudo loader to managing the instances. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] request for small source change in StandardShadowMap
Hi Robert, let me do the changes then and I will send them to You so You decide. And thanks! Nick On Thu, Apr 17, 2014 at 10:44 AM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, There isn't any way of me judging changes I haven't seen. In general if there is part of the OSG that isn't able to do what a users need it to do but a small change that is consistent with the overall design can achieve this then I'll be open to considering it to be merged. However, I have to see the code to know. It could also be that what you are trying to do can be done without any mods. Robert. On 14 April 2014 19:58, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, I am not sure if you are familiar with this code ( I bet You are ;-) ). I have a case where I want to mix shaders with the one that are provided to this class and I need access through the interface to the osg::Program which holds these shaders and it is instantiated locally in the scope of some method - StandardShadowMap.cpp Line: 544. I would welcome something like getProgram() and expose this object to the interface. Are you friendly to such a change - it won't brake anything. Please let me know Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Text with border
I am not very familiar with but try searching for osgPango. It should have various text effects Nick On Wed, Apr 16, 2014 at 6:53 PM, Peter Bako osgfo...@tevs.eu wrote: Hello! Does anyone have an idea, how to create osgText with border? for example white text with black border. I need this, because I want to make screenshots of scenes with texts but the background can be any color so the white text as I use it now, is not readable every time. My only idea is to create two osgText::text objects, one with normal font (white), one with bold (black) and put the black text a little bit behind the white. The problem is that the text is always facing to the camera eye (setAutoRotateToScreen(true)), so this wouldn't work. If there is no other solution, I can switch this option off. Thank you for your ideas. Cheers, Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58966#58966 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap + Other shaders (bump, specular, etc) example???
Hi Michael, this sounds good but I just tried and it seam without changing the OSG code it is not possible as well. The StandardShadowMap does not holds any instance of the StandardShadowMap::ViewData where the _stateset is kept. Nick On Tue, Apr 15, 2014 at 7:29 AM, michael kapelko korn...@gmail.com wrote: I would derive from StandardShadowMap to gain access to _stateset variable. Then, osg::StateSet::getAttribute can return osg::Program it contains. 2014-04-14 22:44 GMT+07:00 Trajce Nikolov NICK trajce.nikolov.n...@gmail.com: I looked at the code of StandardShadowMap.cpp and I think this object at line: 544 osg::Program has to be exposed to the interface as well. Robert, will You accept such a change, it is minor but will change the interface with one getProgram() method and will not brake anything. This case is good example of such a need when you for example wants to mix the shaders of the ShadowMap with your own Nick On Mon, Apr 14, 2014 at 12:35 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Knowing the problem a bit I think the question is how to access the osg::Program of the shader technique for binding vertex attributes like the binormal and tangents arrays. Nick On Mon, Apr 14, 2014 at 11:07 AM, Jaime xatp...@hotmail.com wrote: Thanks kornerr. I was checking your code, but the problem is that I don't want deferred shading, because I need transparency too. I think I should use LightSpacePerspectiveShadowMap because there I can use setShadowVertex/FragementeShader. Nick helped me with his code (thanks again Nick!), but we need to pass the attributes (binormal and tangent) to the shader, and then it has to be used by osg Shadow Mapping. So, does anybody know how to pass attributes to this shaders?? Thanks a lot! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58910#58910 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap + Other shaders (bump, specular, etc) example???
Knowing the problem a bit I think the question is how to access the osg::Program of the shader technique for binding vertex attributes like the binormal and tangents arrays. Nick On Mon, Apr 14, 2014 at 11:07 AM, Jaime xatp...@hotmail.com wrote: Thanks kornerr. I was checking your code, but the problem is that I don't want deferred shading, because I need transparency too. I think I should use LightSpacePerspectiveShadowMap because there I can use setShadowVertex/FragementeShader. Nick helped me with his code (thanks again Nick!), but we need to pass the attributes (binormal and tangent) to the shader, and then it has to be used by osg Shadow Mapping. So, does anybody know how to pass attributes to this shaders?? Thanks a lot! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58910#58910 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap + Other shaders (bump, specular, etc) example???
I looked at the code of StandardShadowMap.cpp and I think this object at line: 544 osg::Program has to be exposed to the interface as well. Robert, will You accept such a change, it is minor but will change the interface with one getProgram() method and will not brake anything. This case is good example of such a need when you for example wants to mix the shaders of the ShadowMap with your own Nick On Mon, Apr 14, 2014 at 12:35 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Knowing the problem a bit I think the question is how to access the osg::Program of the shader technique for binding vertex attributes like the binormal and tangents arrays. Nick On Mon, Apr 14, 2014 at 11:07 AM, Jaime xatp...@hotmail.com wrote: Thanks kornerr. I was checking your code, but the problem is that I don't want deferred shading, because I need transparency too. I think I should use LightSpacePerspectiveShadowMap because there I can use setShadowVertex/FragementeShader. Nick helped me with his code (thanks again Nick!), but we need to pass the attributes (binormal and tangent) to the shader, and then it has to be used by osg Shadow Mapping. So, does anybody know how to pass attributes to this shaders?? Thanks a lot! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58910#58910 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] request for small source change in StandardShadowMap
Hi Robert, I am not sure if you are familiar with this code ( I bet You are ;-) ). I have a case where I want to mix shaders with the one that are provided to this class and I need access through the interface to the osg::Program which holds these shaders and it is instantiated locally in the scope of some method - StandardShadowMap.cpp Line: 544. I would welcome something like getProgram() and expose this object to the interface. Are you friendly to such a change - it won't brake anything. Please let me know Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap + Other shaders (bump, specular, etc) example???
Hi Jaime, yes, I have such an example. If you have the bump mapping GLSL code ready you can mix it with the shadow map shaders and set it to your shadow mapping technique - there are methods like setShadowVertexShader/setShadowFragmentShader/setMainVertexShader/setMainFragmentShader Nick On Fri, Apr 11, 2014 at 10:50 AM, Jaime xatp...@hotmail.com wrote: Hi, Does anybody have any example where I could find any solution to combine shadow maps and other shaders, specially bump mapping?? Thanks! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58876#58876 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap + Other shaders (bump, specular, etc) example???
yes. I will ping you on email Nick On Fri, Apr 11, 2014 at 11:05 AM, Jaime xatp...@hotmail.com wrote: Thanks for your response Nick. Yes, I have my bump shader. But I don't know how to combine. Please, could you give me an example with code?? Thanks! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58878#58878 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Artefact and jitter effects using osgShadows
Hi Yann, from my experience with different shadow maps techniques the best results I am getting with open terrain and models is with LightSpacePerspectiveShadowMapDB. To answer your question: probably you have found the masks for shadow casting and recieval with setReceivesShadowTraversalMask and setCastsShadowTraversalMask methods of ShadowedScene. Then you set these masks in the node-setNodeMask. For the terrain you set the nodemask to terrain-setNodeMask(CastsShadowTraversalMask | ReceivesShadowTraversalMask) and for the truck you do truck-setNodeMask(ReceivesShadowTraversalMask) I have some code I can share if you wish that works well with huge terrains and models. Ping me on my email if you want Nick On Thu, Apr 10, 2014 at 4:27 PM, Yann Takvorian ytakvor...@virtualsim.comwrote: Hi, I have tried to use osgShadow on a terrain database to make it more reallistic but could not get what I want. I started with the osgShadow sample (v3.1.5) and noticed on the island demo (-4) that the shadows where jittering when the light was moving. Then, I replaced the island with an OSG database onto which I added one truck. So, my shadowedScene contains 2 nodes, the osg database node and the truck node. On the final result, I tried several shadow techniques. The ShadowMap is the one I like the most but the result with the moving truck is not satisfactory. I believe that the selfshadowing is the problem because, when the terrain is receving only and the truck is casting, the shadow of the truck is nice, BUT, there is no shadow for all buildings and trees of the database ! Is is possible to remove the selfshadowing effect ? Could it be possible to make the terrain apply the shadow on itself, without the truck node, then cast the truck node on the terrain only ? (so that to prevent the terrain from casting shadows on the truck) Any hint would help me. Thanks in advance. ... Thank you! Cheers, Yann -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58872#58872 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Artefact and jitter effects using osgShadows
wops, your truck has to be set to truck-setNodeMask( CastsShadowTraversalMask ) only .. was a typo Nick On Thu, Apr 10, 2014 at 7:46 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Yann, from my experience with different shadow maps techniques the best results I am getting with open terrain and models is with LightSpacePerspectiveShadowMapDB. To answer your question: probably you have found the masks for shadow casting and recieval with setReceivesShadowTraversalMask and setCastsShadowTraversalMask methods of ShadowedScene. Then you set these masks in the node-setNodeMask. For the terrain you set the nodemask to terrain-setNodeMask(CastsShadowTraversalMask | ReceivesShadowTraversalMask) and for the truck you do truck-setNodeMask(ReceivesShadowTraversalMask) I have some code I can share if you wish that works well with huge terrains and models. Ping me on my email if you want Nick On Thu, Apr 10, 2014 at 4:27 PM, Yann Takvorian ytakvor...@virtualsim.com wrote: Hi, I have tried to use osgShadow on a terrain database to make it more reallistic but could not get what I want. I started with the osgShadow sample (v3.1.5) and noticed on the island demo (-4) that the shadows where jittering when the light was moving. Then, I replaced the island with an OSG database onto which I added one truck. So, my shadowedScene contains 2 nodes, the osg database node and the truck node. On the final result, I tried several shadow techniques. The ShadowMap is the one I like the most but the result with the moving truck is not satisfactory. I believe that the selfshadowing is the problem because, when the terrain is receving only and the truck is casting, the shadow of the truck is nice, BUT, there is no shadow for all buildings and trees of the database ! Is is possible to remove the selfshadowing effect ? Could it be possible to make the terrain apply the shadow on itself, without the truck node, then cast the truck node on the terrain only ? (so that to prevent the terrain from casting shadows on the truck) Any hint would help me. Thanks in advance. ... Thank you! Cheers, Yann -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58872#58872 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bigger bounding box to make picking (intersection) easier?
Ahoj Petr, you can override the bound volume calculation with your own code via callback. Have a look in the Node class /** Callback to allow users to override the default computation of bounding volume.*/ struct ComputeBoundingSphereCallback : public osg::Object { virtual BoundingSphere computeBound(const osg::Node) const { return BoundingSphere(); } }; so here you do the default Node::computeBound and adjust the radius by something small (like radius *= 1.1) Hope this helps Nick On Fri, Mar 28, 2014 at 10:00 PM, Petr Svoboda upd...@seznam.cz wrote: Hi, I would like to ask if there is some way how to create bigger bounding box over some model to make it easier to pick it/ intersect with. For example if there is a cow.osg model and I want to pick it then how do it in a way that I dont need to click with my mouse exactly on that model but a bit next to it. Is that was is osg::BoundingBox made for? Or the purpose of BoundingBox is just for culling etc.? I would like to use osg::LineSegmentIntersector + osg::IntersectVisitor. Thank you! Cheers, Petr -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58760#58760 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bug in Collada reader
from what you are stating if the color array is Vec4Array in creation you should cast to the same in the reading portion - I guess the 4th component is alpha of the color which is the proper way to have the colors stored. So the fix would be casting to Vec4array in the reading part to get valid array object Nick On Thu, Mar 27, 2014 at 3:35 PM, Bolstad, Mark bolst...@janelia.hhmi.orgwrote: While trying to map some functionality to color per vertex, I came across a bug in that colors aren't loaded properly. At daeReader::resolveMeshArrays:931 (daeRGeometry.cpp) it calls out to createGeometryArrays with types of Vec4Array. If you trace this down into the daeSourceReader call to getArray, you'll find that it reads the data into a Vec3Array, then returns the Vec4Array resulting in no colors. Anyone have a quick fix? (I'm currently attempting to change the array to Vec3, then convert it to a Vec4 in resolve MeshArrays). Attached is a small collada file created in Blender that shows the problem. Mark ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bug in Collada reader
I read the code fast, actually it is the other way around I think. In the reader it should read Vec4Array. Can you point me to the reading part (file:line) where to look? Nick On Thu, Mar 27, 2014 at 4:21 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: from what you are stating if the color array is Vec4Array in creation you should cast to the same in the reading portion - I guess the 4th component is alpha of the color which is the proper way to have the colors stored. So the fix would be casting to Vec4array in the reading part to get valid array object Nick On Thu, Mar 27, 2014 at 3:35 PM, Bolstad, Mark bolst...@janelia.hhmi.orgwrote: While trying to map some functionality to color per vertex, I came across a bug in that colors aren't loaded properly. At daeReader::resolveMeshArrays:931 (daeRGeometry.cpp) it calls out to createGeometryArrays with types of Vec4Array. If you trace this down into the daeSourceReader call to getArray, you'll find that it reads the data into a Vec3Array, then returns the Vec4Array resulting in no colors. Anyone have a quick fix? (I'm currently attempting to change the array to Vec3, then convert it to a Vec4 in resolve MeshArrays). Attached is a small collada file created in Blender that shows the problem. Mark ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] lighting flickering
Thanks Kostantin! I will try to do that Nick On Wed, Mar 12, 2014 at 8:24 AM, Konstantin lalakos...@gmail.com wrote: Hello Trajce!!! LightSource may be traversed after some Drawables. This may be the problem! Try to move LightSource node upper to be traversed first. KOS 2014-02-25 0:44 GMT+04:00 Trajce Nikolov NICK trajce.nikolov.n...@gmail.com: Hi Community, I have a scene where I use light lobes (shader based) which seam to work well. The lights are attached through osg::LightSource and are moved by osg::MatrixTransforms. All works well. Part of the scene is rendered by a third party rendering engine and I see the lights flicker there, this part is litten when I zoom in or pan, when the eye is static it does not. The software allows me to inject my own shaders for the lighting so I use the same shader that is proven to work. It is somewhat as losing or changing the gl_LightSource (ehm, I know I could use uniforms for this, but it is bit of old code) positions on the fly. Any clue what this zoom in flicker could be? Any idea is welcome -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -- С уважением, Матвеев Константин Руководитель проекта +7 (917) 554 44 64 konstantin.matve...@eligovision.ru EligoVision. Интерактивные Технологии http://www.eligovision.ru ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Painting terrain
Hi Srikanth, I have some time now these days to help you. If you could post your code and the terrain model I can look at it. Feel free to use my email Nick On Wed, Feb 26, 2014 at 6:41 AM, Srikanth Prahlad osgfo...@tevs.eu wrote: Hi, The screen shot has been taken from a far off pint to show entire terrain. ... Thank you! Cheers, Srikanth -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58381#58381 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] lighting flickering
Hi Community, I have a scene where I use light lobes (shader based) which seam to work well. The lights are attached through osg::LightSource and are moved by osg::MatrixTransforms. All works well. Part of the scene is rendered by a third party rendering engine and I see the lights flicker there, this part is litten when I zoom in or pan, when the eye is static it does not. The software allows me to inject my own shaders for the lighting so I use the same shader that is proven to work. It is somewhat as losing or changing the gl_LightSource (ehm, I know I could use uniforms for this, but it is bit of old code) positions on the fly. Any clue what this zoom in flicker could be? Any idea is welcome -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::CullSettings::ClampProjectionMatrixCallback
Hi Community, Any insights how this works? I have inherited from this class and tried to set my computation of the znear/zfar but it seam it is not called. The code is like this: class MyClass : public osg::CullSettings::ClampProjectionMatrixCallback { ... bool clampProjectionMatrixImplementation(osg::Matrixf projection, double znear, double zfar) const { znear = 1.0; zfar = 1000; return true; } // same for the double implementation then this callback is attached to the main camera, but it is not called ever Any clue? Thanks a bunch Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::CullSettings::ClampProjectionMatrixCallback
yeah, I have set setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); for the camera. Removing it did the work. Thanks for the hint Robert Nick On Tue, Feb 11, 2014 at 9:02 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, The callback is only called when you have enable the compute near far mode. I don't recall the details off the top of my head, but I'd guess if you have slave Camera's in action you'll need to attach to the Slave Camera. Robert. On 11 February 2014 17:56, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, Any insights how this works? I have inherited from this class and tried to set my computation of the znear/zfar but it seam it is not called. The code is like this: class MyClass : public osg::CullSettings::ClampProjectionMatrixCallback { ... bool clampProjectionMatrixImplementation(osg::Matrixf projection, double znear, double zfar) const { znear = 1.0; zfar = 1000; return true; } // same for the double implementation then this callback is attached to the main camera, but it is not called ever Any clue? Thanks a bunch Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] force fixed function pipeline
HI Daniel, you can set an empty Program in the stateset instead of disabling it. This way the subgraph will be rendered using the fixed pipe-line. Like stateset-setAttributeAndModes( new osg::Program, on, override, whatever ) Nick On Fri, Feb 7, 2014 at 1:14 PM, Daniel Schmid daniel.sch...@swiss-simtec.ch wrote: Hi Robert and all I have a main shader for my scene graph. Then I have some parts of my loaded models that I want to explicitely render with the fixed-function-pipeline (FFP). In osg 3.1.5 I was able to modify a particular stateset by writing a_node.getOrCreateStateSet()-setAttributeAndModes(new osg::Program, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED); Like this, the main shader was ignored for the the node and underlying children and the FFP was used. I don't know why but in OSG 3.2.0 this doesn't work anymore. I tried with osg::StateAttribute::OFF/ON etc. I just cant switch back to FFP . 1. What is the reason this behaviour changed? 2. What is the correct way to bypass/disable a shader at some particular point in the scene-graph? Thanks for help! Daniel ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving a Named Group in Optimize
also if you put comment attributes it will not be removed on optimize Nick On Wed, Feb 5, 2014 at 12:54 AM, Farshid Lashkari fla...@gmail.com wrote: Hi Karl, Setting the data variance of a node to DYNAMIC should prevent the optimizer from removing it: group-setDataVariance(osg::Object::DYNAMIC); Cheers, Farshid On Tue, Feb 4, 2014 at 1:49 PM, Cary, Karl A. karl.a.c...@leidos.comwrote: Is there a way to save a named group from being optimized away by setting either some type of option or flag before running the optimizer? I can always write a custom optimize visitor to handle it, but it just seemed like it might be a common case that is handled and I haven't known about. Thanks. Karl ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] space partitioning
Hi Deniz, I have a terrain model built in Creator (OpenFlight) and I want to make a quad tree like structure to optimize it since it is done really bad - roads and other linear features as one large mesh that can be decomposed and tiled and things like that, buildings far away from eachother in one mesh etc. The author I guess has meshed based on the attributes (texture), but to make it tiled it can be better I think. There is a tool for this (DART from Presagis) but I don't have it and I don't want to do it in Creator manually (btw, is there a way to do it in Creator ?). Can someone give insides in the KdTree implementation in OSG? And thanks for the hint! Cheers, Nick On Fri, Jan 31, 2014 at 7:52 PM, deniz diktas denizdik...@gmail.com wrote: Hi Nick, There is the osg::KdTree, but I have never used it before. What do you want to use the space partitioning for? -deniz Trajce Nikolov NICK wrote: Hi Community, is there a way to do this with osg (not with engineering) maybe something built in Thanks a bunch! Nick -- trajce nikolov nick -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58117#58117 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] space partitioning
No, the model was actually modeled without sense for real-time (or maybe I am too old school). But the rendering performance on the latest NVIDIA board are really bad. Can you tell more about your work on the space partitioning you have done? If this is not osg related we can go off-line from the list. Please let me know. Nick On Fri, Jan 31, 2014 at 8:16 PM, deniz diktas denizdik...@gmail.com wrote: Hi Nick, ok, I see. Where is this thing being done bad? Inside OSG? My main line of previous work was space partitioning. Let me know if I can be of any help there. Best, -deniz Trajce Nikolov NICK wrote: Hi Deniz, I have a terrain model built in Creator (OpenFlight) and I want to make a quad tree like structure to optimize it since it is done really bad - roads and other linear features as one large mesh that can be decomposed and tiled and things like that, buildings far away from eachother in one mesh etc. The author I guess has meshed based on the attributes (texture), but to make it tiled it can be better I think. There is a tool for this (DART from Presagis) but I don't have it and I don't want to do it in Creator manually (btw, is there a way to do it in Creator ?). Can someone give insides in the KdTree implementation in OSG? And thanks for the hint! Cheers, Nick On Fri, Jan 31, 2014 at 7:52 PM, deniz diktas () wrote: Hi Nick, There is the osg::KdTree, but I have never used it before. What do you want to use the space partitioning for? -deniz Trajce Nikolov NICK wrote: Hi Community, is there a way to do this with osg (not with engineering) maybe something built in Thanks a bunch! Nick -- trajce nikolov nick -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58117#58117 ( http://forum.openscenegraph.org/viewtopic.php?p=58117#58117) ___ osg-users mailing list () http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org( http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) -- trajce nikolov nick -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58119#58119 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Blending and hiding/showing a triangle face of the model
Hi Emeric, although they are right in the book about colors being vertex attributes I think You can achieve the effect You are after by using osg::Material and adjusting the alpha and then use a proper Blending Function. Have a look at osghud example it has blended quad on top of the screen. If You want to show/hide then probably the best is to use setNodeMask on Your osg::Geode containing the osg::Geometry Hope this helps Cheers, Nick On Fri, Jan 24, 2014 at 9:10 PM, Émeric MASCHINO emeric.masch...@gmail.comwrote: Hi, In the OpenSceneGraph 3 Cookbook is explained how to highlight the selected triangle face of a model. This is performed by creating a new triangle Geode that overlaps the selected triangle face. As outlined in the book: Maybe you are still looking for a way to change the face's color to highlight it. Unfortunately it is impossible to modify the face color in OpenGL because color is in fact a vertex attribute. Shaders may help represent a specified face with a different color or transparency, but it seems to make a mountain out of a molehill in this recipe. Now, this is what I'm looking for, so I need to make this mountain in order to display the selected triangle face as a transparent surface. Are there any pointers on how to achieve this with a shader as anticipated in the book? Or is there yet another solution? Rather than blending the selected triangle face, suppose that I want to hide/show it, would I use the same technique than for blending it or not? Thanks, Émeric ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] space partitioning
Hi Community, is there a way to do this with osg (not with engineering) maybe something built in Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CompositeViewer with multiple RTT camera views
); hudCamera-getOrCreateStateSet()-setTextureAttributeAndModes( 0, tex2D.get() ); rightView-addSlave(hudCamera, osg::Matrixd(), osg::Matrixd()); viewer.addView(rightView); return viewer.run(); robertosfield wrote: Hi Conan, On 23 January 2014 12:58, Conan () wrote: I thought the prefered method to handle multiple independent views was with a composite viewer. Can I add slave cameras to a composite viewer Yes, this is why I was referring to View rather than View(er) in my previous reply. osgViewer is deliberately designed so that each View has a master Camera that controls the overall view, and an optional set of slave Camera's that are used to render that view. The osgViewer::CompsoiteViewer composes a set of View objects, while osgViewer::Viewer for ease of use just inherits from View but can't handle multiple views obvious as it's just a single View under the hood. You can mix and match multiple View, multiple Scenes, multiple Contexts, multiple slave Camera in any way that you choose. Robert. -- Post generated by Mail2Forum Code: -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57974#57974 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bug in initial renderer compile?
Hi, I have the same issue on my ATI laptop but it is not happening on NVIDIA machines Nick On Wed, Jan 22, 2014 at 1:58 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Micahel, It could be a big with the GLCompileVisitor not cleaning up on the state it's compiling. Could you create a small example that illustrates this problem - such as modifiying one the OSG examples such as osgshape so it can reproduce the error. With such an example I can then step through what is being set and work out what might be going on, and what needs to be done to address the issue. Robert. On 22 January 2014 10:33, Michael Bach Jensen mich...@ifad.dk wrote: Hi, During development of a new shader-based point-rendering system I started getting INVALID_OPERATION at start of State::apply(StateSet*) for the first rendered frame (subsequent frames are OK). The scene consists of a geode, shapedrawable box (no stateset/fixed function pipeline) and the point rendering node (shader pipeline) both under the same parent group. When rendering, the box is drawn before the points. It turned out to be due to my point shader being active for the box. The shader becomes active (by mistake?) as a result of the renderer calling compile(). Adding a stateset to the box node with an empty program fixes the issue since it forces fixed function into effect before drawing the box. It would be nice to avoid this initial INVALID_OPERATION message. Has anyone else encountered this or something similar? It looks like a bug to me. What do you think? Thank you! Cheers, Michael -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57951#57951 ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Simple demo freezes on touchpad disable/enable (bug?)
Hmm I don't think by default the osgViewer::Viewer class provides CameraManipulator. Just give it a try. something like viewer.setCameraManipulator( new TrackballManipulator ). Also, the app should exit when you press ESC. Nick On Mon, Jan 13, 2014 at 1:09 PM, Ivan Nikolaev void...@develer.com wrote: Well, just following OpenSceneGraph 3.0 Beginners Guide book, and since it's a Viewer instance, everything should work out of the box, at least on my Ubuntu 12.04 machine with Unity shell it *seems* that it never manifested similiar problems. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Simple demo freezes on touchpad disable/enable (bug?)
the viewer will automatically attach a TrackballManipulator when you call Viewer::run() as a fallback Sorry :-), Didn't knew that Nick On Mon, Jan 13, 2014 at 1:22 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Ivan, You example is fine, the viewer will automatically attach a TrackballManipulator when you call Viewer::run() as a fallback. In principle it's better to explicitly add the camera manipulator you want as it's clearer what is being set up. As for the demo freezing, I don't know why this might be happening, I haven't heard others having an issue. I would strongly suspect an issue with the window manager as the OSG has nothing to do with the touchpad itself. One experiment you could do is attach the StatsHandler and then bring up on screen stats to see if the viewer is still running then do the touchpad re-enable. Another would be to look at different window managers. Robert. On 13 January 2014 10:09, Ivan Nikolaev void...@develer.com wrote: Well, just following OpenSceneGraph 3.0 Beginners Guide book, and since it's a Viewer instance, everything should work out of the box, at least on my Ubuntu 12.04 machine with Unity shell it *seems* that it never manifested similiar problems. ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Simple demo freezes on touchpad disable/enable (bug?)
Is this your whole code? I would add CameraMainpulator , like TrackballManipulator. That is what I am seeing missing Nick On Sat, Jan 11, 2014 at 2:20 PM, Ivan Nikolaev void...@develer.com wrote: Hi, I've just started programming 3D stuff with OpenSceneGraph, and noticed that if during a full-screen rendering I try to disable and then re-enable my laptop's touchpad (with a Fn+F9 combination, in my case), everything freezes and the viewer doesn't react to any input, both from keyboard or mouse/touchpad, so the only way to close it is by killing it. Using Fedora 20 with Gnome 3 on ASUS Zenbook with integrated Intel GPU, the dedicated nVidia is disabled. OpenSceneGraph v 3.2.0 Here's the code of my simple demo application: --- #include osgViewer/Viewer #include osg/Geode #include osg/ShapeDrawable int main(int argc, char** argv) { osg::ref_ptrosg::ShapeDrawable box = new osg::ShapeDrawable; box-setShape(new osg::Box(osg::Vec3(3.0f, 0.0f, 0.0f), 2.0f, 2.0f, 1.0f)); osg::ref_ptrosg::Geode root = new osg::Geode; root-addDrawable(box.get()); osgViewer::Viewer viewer; viewer.setSceneData(root.get()); return viewer.run(); } --- Is this a bug? Thank you! Cheers, Ivan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg rain effect on multiple channels
Hi Robert, after examining all the options it turned to be the visual system (which is a commercial black box OSG based) doing this somehow. When I attach the osgParticle::PrecipitationEffecte somewhere else in the scenegraph it show to work. So sorry for the false report again. And thanks! Happy Holidays Nick On Mon, Dec 23, 2013 at 4:46 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi again Robert, It has to do something with the ClipNode (mimiced code from the osgprecipitation example). On one of the channels the rain is less dense then on the other two, I managed to get some rain visible by reducing the clip distance on the ClipPlane. Nick On Mon, Dec 23, 2013 at 1:43 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, machine per channel, the view matrices are set to blend on the edges. I will try your hint and let you know Nick On Mon, Dec 23, 2013 at 12:47 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Nick, On 23 December 2013 07:41, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I tried the default osgParticle::PrecipitationEffect accross three channels (left,center,right) with the default settings and the observation is that is shows ok on the center and right channels, however there is no effect on the left channels - same code only the view and projection matrix different. Any clue why? I don't have any ideas why this might happen. How are you setting up the different channels? Different machines? Sample machine different graphics contexts? What happens if you change the view matrix of the left channel to be nearer to the centre direction? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::MatrixTransform delays
Hi Sebastian, when the particle system is frozen, then it is moving without delays. Otherwise I see still delays. Robert, any comment on this issue. It is sort of big for me Thanks a bunch! Nick On Fri, Dec 20, 2013 at 1:30 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Hi Nick, just one idea: Can you replace the particle system with something else. So maybe it is strictly particle system related. (I'm assuming, that you use osgParticle here) Hi Sebastian, You are right, that is the structure and the first thing I tried was to attach it directly to the body but then I saw this artifact like the particles following the model with delay. So I tried the update callback. Now I am thinking to have the particles attached to the main camera so they move with the view but here is again update callbacks and such. Thanks anyway ! Nick On Thu, Dec 19, 2013 at 9:35 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 12:09, schrieb Trajce Nikolov NICK: Sebastian, it was too early to be happy. Changing it to traverse first then update didn't helped actually. On the windshield model I have attached ParticleSystem that is actually delayed with the windshield. Any other ideas? I also tried to attach this directly to parts of the model but same results. It is about rain effect. This particle system is firing rain drops on the windshield geometry and it suppose to move with the car model, however it is delayed as it moves. Sorry, I'm out of ideas here too. If I got you correctly you have some group which represents a body and another one representing the windshield with the particlesystem attached. And you are updating the later with the update-callback. I don't understand why the two groups must be disjoint. Can you explain the reason for this? Are those two different render passes? If you explain your structure a bit more in depth I maybe can point to an alternative solution. cheers Sebastian Thanks Nick On Thu, Dec 19, 2013 at 12:02 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: You're welcome Thanks Sebastian. That was it. It did helped! Nick On Thu, Dec 19, 2013 at 11:53 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Sebastian, that is actually a good idea to do the traversal first. Let me try it first. Thanks ! Nick On Thu, Dec 19, 2013 at 11:51 AM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 09:26, schrieb Trajce Nikolov NICK: Hi Nick, My first question would be: Why don't you simply attach the windshield to the model ;-) No seriously, I had those effects too, when retrieving e.g. the ModelView matrix in callbacks. The problem usually was gone whe doing the traverse first and the get the matrices. Maybe you can give it a try, or paste some of your update-callback code here, so we can help. So basically this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } traverse(node,nv); osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() } will yield different results than this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() traverse(node,nv); } This at least solved problems in multipass-rendering, where multiple cameras had to be synced relative to each other. Hope this helps. cheers Sebastian Hi Community, I have a simple scene of a car model with a windshield (two separate models combined in runtime). There is osg::MatrixTransform node on top of the car that moves it around, and the windshield is attached to the scene that also has osg::MatrixTransform on top of it with an UpdateCallback that copies the car's matrix. ( the real scene is a bit different but this is the concept) I am seeing the windshild has some delay in following the car model while moving and at lower framerates. I think I just tried everything but always this is the same case Any clue and hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick -- trajce nikolov nick ___ osg
Re: [osg-users] osg::MatrixTransform delays
ok. thanks. as I mentioned in my other post, it is a black box with plugin architecture allowing to plug osg code here and there, so it is not flexible. I tried everything and I think the particles are updated prior to the matrix that moves the entity, so it is always a bit ahead when it moves. I got confirmed by their support people that they have their own schema on updating models, so it is definitely not happening in the update traversal. Merry Christmas to you as well :-) Nick On Tue, Dec 24, 2013 at 3:24 PM, Robert Osfield robert.osfi...@gmail.comwrote: On 24 December 2013 11:54, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: when the particle system is frozen, then it is moving without delays. Otherwise I see still delays. Robert, any comment on this issue. It is sort of big for me It is almost certainly an order of operations issue, but can't say what exactly you are doing wrong or what to do about it. I would have commented already if I had any constructive ideas. Merry Christmas :-) Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg rain effect on multiple channels
Hi Robert, machine per channel, the view matrices are set to blend on the edges. I will try your hint and let you know Nick On Mon, Dec 23, 2013 at 12:47 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, On 23 December 2013 07:41, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I tried the default osgParticle::PrecipitationEffect accross three channels (left,center,right) with the default settings and the observation is that is shows ok on the center and right channels, however there is no effect on the left channels - same code only the view and projection matrix different. Any clue why? I don't have any ideas why this might happen. How are you setting up the different channels? Different machines? Sample machine different graphics contexts? What happens if you change the view matrix of the left channel to be nearer to the centre direction? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg rain effect on multiple channels
Hi again Robert, It has to do something with the ClipNode (mimiced code from the osgprecipitation example). On one of the channels the rain is less dense then on the other two, I managed to get some rain visible by reducing the clip distance on the ClipPlane. Nick On Mon, Dec 23, 2013 at 1:43 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, machine per channel, the view matrices are set to blend on the edges. I will try your hint and let you know Nick On Mon, Dec 23, 2013 at 12:47 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Nick, On 23 December 2013 07:41, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I tried the default osgParticle::PrecipitationEffect accross three channels (left,center,right) with the default settings and the observation is that is shows ok on the center and right channels, however there is no effect on the left channels - same code only the view and projection matrix different. Any clue why? I don't have any ideas why this might happen. How are you setting up the different channels? Different machines? Sample machine different graphics contexts? What happens if you change the view matrix of the left channel to be nearer to the centre direction? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg rain effect on multiple channels
Hi Community, I tried the default osgParticle::PrecipitationEffect accross three channels (left,center,right) with the default settings and the observation is that is shows ok on the center and right channels, however there is no effect on the left channels - same code only the view and projection matrix different. Any clue why? Thanks Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::MatrixTransform delays
Hi Community, I have a simple scene of a car model with a windshield (two separate models combined in runtime). There is osg::MatrixTransform node on top of the car that moves it around, and the windshield is attached to the scene that also has osg::MatrixTransform on top of it with an UpdateCallback that copies the car's matrix. ( the real scene is a bit different but this is the concept) I am seeing the windshild has some delay in following the car model while moving and at lower framerates. I think I just tried everything but always this is the same case Any clue and hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::MatrixTransform delays
Hi Sebastian, that is actually a good idea to do the traversal first. Let me try it first. Thanks ! Nick On Thu, Dec 19, 2013 at 11:51 AM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 09:26, schrieb Trajce Nikolov NICK: Hi Nick, My first question would be: Why don't you simply attach the windshield to the model ;-) No seriously, I had those effects too, when retrieving e.g. the ModelView matrix in callbacks. The problem usually was gone whe doing the traverse first and the get the matrices. Maybe you can give it a try, or paste some of your update-callback code here, so we can help. So basically this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } traverse(node,nv); osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() } will yield different results than this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() traverse(node,nv); } This at least solved problems in multipass-rendering, where multiple cameras had to be synced relative to each other. Hope this helps. cheers Sebastian Hi Community, I have a simple scene of a car model with a windshield (two separate models combined in runtime). There is osg::MatrixTransform node on top of the car that moves it around, and the windshield is attached to the scene that also has osg::MatrixTransform on top of it with an UpdateCallback that copies the car's matrix. ( the real scene is a bit different but this is the concept) I am seeing the windshild has some delay in following the car model while moving and at lower framerates. I think I just tried everything but always this is the same case Any clue and hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::MatrixTransform delays
Thanks Sebastian. That was it. It did helped! Nick On Thu, Dec 19, 2013 at 11:53 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Sebastian, that is actually a good idea to do the traversal first. Let me try it first. Thanks ! Nick On Thu, Dec 19, 2013 at 11:51 AM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 09:26, schrieb Trajce Nikolov NICK: Hi Nick, My first question would be: Why don't you simply attach the windshield to the model ;-) No seriously, I had those effects too, when retrieving e.g. the ModelView matrix in callbacks. The problem usually was gone whe doing the traverse first and the get the matrices. Maybe you can give it a try, or paste some of your update-callback code here, so we can help. So basically this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } traverse(node,nv); osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() } will yield different results than this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() traverse(node,nv); } This at least solved problems in multipass-rendering, where multiple cameras had to be synced relative to each other. Hope this helps. cheers Sebastian Hi Community, I have a simple scene of a car model with a windshield (two separate models combined in runtime). There is osg::MatrixTransform node on top of the car that moves it around, and the windshield is attached to the scene that also has osg::MatrixTransform on top of it with an UpdateCallback that copies the car's matrix. ( the real scene is a bit different but this is the concept) I am seeing the windshild has some delay in following the car model while moving and at lower framerates. I think I just tried everything but always this is the same case Any clue and hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::MatrixTransform delays
Sebastian, it was too early to be happy. Changing it to traverse first then update didn't helped actually. On the windshield model I have attached ParticleSystem that is actually delayed with the windshield. Any other ideas? I also tried to attach this directly to parts of the model but same results. It is about rain effect. This particle system is firing rain drops on the windshield geometry and it suppose to move with the car model, however it is delayed as it moves. Thanks Nick On Thu, Dec 19, 2013 at 12:02 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: You're welcome Thanks Sebastian. That was it. It did helped! Nick On Thu, Dec 19, 2013 at 11:53 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Sebastian, that is actually a good idea to do the traversal first. Let me try it first. Thanks ! Nick On Thu, Dec 19, 2013 at 11:51 AM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 09:26, schrieb Trajce Nikolov NICK: Hi Nick, My first question would be: Why don't you simply attach the windshield to the model ;-) No seriously, I had those effects too, when retrieving e.g. the ModelView matrix in callbacks. The problem usually was gone whe doing the traverse first and the get the matrices. Maybe you can give it a try, or paste some of your update-callback code here, so we can help. So basically this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } traverse(node,nv); osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() } will yield different results than this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() traverse(node,nv); } This at least solved problems in multipass-rendering, where multiple cameras had to be synced relative to each other. Hope this helps. cheers Sebastian Hi Community, I have a simple scene of a car model with a windshield (two separate models combined in runtime). There is osg::MatrixTransform node on top of the car that moves it around, and the windshield is attached to the scene that also has osg::MatrixTransform on top of it with an UpdateCallback that copies the car's matrix. ( the real scene is a bit different but this is the concept) I am seeing the windshild has some delay in following the car model while moving and at lower framerates. I think I just tried everything but always this is the same case Any clue and hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::MatrixTransform delays
Hi Sebastian, You are right, that is the structure and the first thing I tried was to attach it directly to the body but then I saw this artifact like the particles following the model with delay. So I tried the update callback. Now I am thinking to have the particles attached to the main camera so they move with the view but here is again update callbacks and such. Thanks anyway ! Nick On Thu, Dec 19, 2013 at 9:35 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 12:09, schrieb Trajce Nikolov NICK: Sebastian, it was too early to be happy. Changing it to traverse first then update didn't helped actually. On the windshield model I have attached ParticleSystem that is actually delayed with the windshield. Any other ideas? I also tried to attach this directly to parts of the model but same results. It is about rain effect. This particle system is firing rain drops on the windshield geometry and it suppose to move with the car model, however it is delayed as it moves. Sorry, I'm out of ideas here too. If I got you correctly you have some group which represents a body and another one representing the windshield with the particlesystem attached. And you are updating the later with the update-callback. I don't understand why the two groups must be disjoint. Can you explain the reason for this? Are those two different render passes? If you explain your structure a bit more in depth I maybe can point to an alternative solution. cheers Sebastian Thanks Nick On Thu, Dec 19, 2013 at 12:02 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: You're welcome Thanks Sebastian. That was it. It did helped! Nick On Thu, Dec 19, 2013 at 11:53 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Sebastian, that is actually a good idea to do the traversal first. Let me try it first. Thanks ! Nick On Thu, Dec 19, 2013 at 11:51 AM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Am 19.12.2013 09:26, schrieb Trajce Nikolov NICK: Hi Nick, My first question would be: Why don't you simply attach the windshield to the model ;-) No seriously, I had those effects too, when retrieving e.g. the ModelView matrix in callbacks. The problem usually was gone whe doing the traverse first and the get the matrices. Maybe you can give it a try, or paste some of your update-callback code here, so we can help. So basically this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } traverse(node,nv); osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() } will yield different results than this: void CameraUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (!cv) { return; } osg::Camera camera = *cv-getRenderInfo().getView()-getCamera(); camera.getViewMatrix() traverse(node,nv); } This at least solved problems in multipass-rendering, where multiple cameras had to be synced relative to each other. Hope this helps. cheers Sebastian Hi Community, I have a simple scene of a car model with a windshield (two separate models combined in runtime). There is osg::MatrixTransform node on top of the car that moves it around, and the windshield is attached to the scene that also has osg::MatrixTransform on top of it with an UpdateCallback that copies the car's matrix. ( the real scene is a bit different but this is the concept) I am seeing the windshild has some delay in following the car model while moving and at lower framerates. I think I just tried everything but always this is the same case Any clue and hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi
[osg-users] Point Particle system with variable Point Size
Hello Community, I am trying to achieve this and started with the osgparticle sample. I am using Particle template where I have set the proper Size Range for the particles and made this default template. The particles displayed are very small and same in size. I tried to add to the StateSet osg::Point with min/max point size but still no luck, getting them same in size. Any hints? What is the trick behind? Thank You Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Curious compiler behavior
Hi Lionel, this topic was discussed before as I can recall and there was a neat solution (with #ifdefs) posted to avoid the conflict. Have a look in the archive, can not remember the author Nick On Fri, Dec 13, 2013 at 1:41 PM, Lionel Lagarde lionel.laga...@oktal-se.frwrote: My problem looks like the osgDB::fstream / std::fstream conflict which was resolved using the /FORCE:MULTIPLE linker flag. Does anyone has more information on this ? On 12/12/2013 18:39, Lionel Lagarde wrote: It seems that osg80-osgd.dll contains the symbols of scalar integer (char, uchar, short, ushort, int, uint) specializations of the MixinVector. The vector and floating point specializations are not defined. On 12/12/2013 18:19, Lionel Lagarde wrote: Hi, I use Visual Express C++ 2010. The following code works very well: osg::FloatArray *array = ... (*array)[i] = 10.0; I decided to add integer support: osg::IntArray *array = ... (*array)[i] = 10; And the linker says: osgd.lib(osg80-osgd.dll) : error LNK2005: public: int __cdecl osg::MixinVector::operator[](unsigned __int64) already defined in libseFastOsgCored.lib(OsgUniform.obj) Any idea ? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users- openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Curious compiler behavior
yes, that was what I saw earlier in one post. But good you made it work :-) Nick On Fri, Dec 13, 2013 at 3:00 PM, Lionel Lagarde lionel.laga...@oktal-se.frwrote: Hi Nick, The solution involving the #ifdefs is to use the osgDB::fstream classes instead of the std ones using #defines: #ifdef WIN32 // Replace STL fstream with OSG fstream #include osgDB/fstream #define ifstream osgDB::ifstream #define ofstream osgDB::ofstream #else #include fstream #define ifstream std::ifstream #define ofstream std::ofstream #endif It doesn't apply in my case. But I manage to make the it works using directly the vector implementation of the MixinVector: osg::IntArray *array = ... std::vectorint v = array-asVector(); v[0] = 10; On 13/12/2013 11:50, Trajce Nikolov NICK wrote: Hi Lionel, this topic was discussed before as I can recall and there was a neat solution (with #ifdefs) posted to avoid the conflict. Have a look in the archive, can not remember the author Nick On Fri, Dec 13, 2013 at 1:41 PM, Lionel Lagarde lionel.laga...@oktal-se.fr wrote: My problem looks like the osgDB::fstream / std::fstream conflict which was resolved using the /FORCE:MULTIPLE linker flag. Does anyone has more information on this ? On 12/12/2013 18:39, Lionel Lagarde wrote: It seems that osg80-osgd.dll contains the symbols of scalar integer (char, uchar, short, ushort, int, uint) specializations of the MixinVector. The vector and floating point specializations are not defined. On 12/12/2013 18:19, Lionel Lagarde wrote: Hi, I use Visual Express C++ 2010. The following code works very well: osg::FloatArray *array = ... (*array)[i] = 10.0; I decided to add integer support: osg::IntArray *array = ... (*array)[i] = 10; And the linker says: osgd.lib(osg80-osgd.dll) : error LNK2005: public: int __cdecl osg::MixinVector::operator[](unsigned __int64) already defined in libseFastOsgCored.lib(OsgUniform.obj) Any idea ? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] disabling lighting in RTT scene
Hi Community, for some reason I can not disable lighting in the RTT scene. The scene is being rendered with the main scene lighting ON. I tried the basics things like geode-getOrCreateStateSet()-setMode( GL_LIGHTING, osg::StateAttribute::OFF|osg::StateAttribute::OVERRIDE ); I even tried to override it with a shader still lighting is applied to the whole scene. I see changes when pressing 'l' in the osgviewer (extended sample) Any clue, hints? Thanks a bunch! Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] disabling lighting in RTT scene
I tried that Robert as well. I have PROTECTED on the RTT camera but the lighting is still active from the main view. I can make a sample to demonstrate this Nick On Mon, Dec 9, 2013 at 1:14 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, You use OVERRIDE when you want to override the state below that StateSet in the scene graph, and you use PROTECTED when you want to avoid a subgraph being overridden from above. So for your usage case I think PROTECTED would be appropriate rather than OVERRIDE. Robert. On 9 December 2013 09:17, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, for some reason I can not disable lighting in the RTT scene. The scene is being rendered with the main scene lighting ON. I tried the basics things like geode-getOrCreateStateSet()-setMode( GL_LIGHTING, osg::StateAttribute::OFF|osg::StateAttribute::OVERRIDE ); I even tried to override it with a shader still lighting is applied to the whole scene. I see changes when pressing 'l' in the osgviewer (extended sample) Any clue, hints? Thanks a bunch! Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] disabling lighting in RTT scene
Hi Robert, I tried this in osgprerender to disable the lighting on the camera with PROTECTED and I can confirm it doesn't it. Can you try on your end and confirm, seam like a bug somewhere Thank You. Nick On Mon, Dec 9, 2013 at 1:18 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I tried that Robert as well. I have PROTECTED on the RTT camera but the lighting is still active from the main view. I can make a sample to demonstrate this Nick On Mon, Dec 9, 2013 at 1:14 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, You use OVERRIDE when you want to override the state below that StateSet in the scene graph, and you use PROTECTED when you want to avoid a subgraph being overridden from above. So for your usage case I think PROTECTED would be appropriate rather than OVERRIDE. Robert. On 9 December 2013 09:17, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, for some reason I can not disable lighting in the RTT scene. The scene is being rendered with the main scene lighting ON. I tried the basics things like geode-getOrCreateStateSet()-setMode( GL_LIGHTING, osg::StateAttribute::OFF|osg::StateAttribute::OVERRIDE ); I even tried to override it with a shader still lighting is applied to the whole scene. I see changes when pressing 'l' in the osgviewer (extended sample) Any clue, hints? Thanks a bunch! Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] disabling lighting in RTT scene
Actually, it is the on screen quad that was causing the lighting issue. Works fine after setting the mode to the quad itself. Sorry for the false bug report Nick On Mon, Dec 9, 2013 at 2:00 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, I tried this in osgprerender to disable the lighting on the camera with PROTECTED and I can confirm it doesn't it. Can you try on your end and confirm, seam like a bug somewhere Thank You. Nick On Mon, Dec 9, 2013 at 1:18 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I tried that Robert as well. I have PROTECTED on the RTT camera but the lighting is still active from the main view. I can make a sample to demonstrate this Nick On Mon, Dec 9, 2013 at 1:14 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, You use OVERRIDE when you want to override the state below that StateSet in the scene graph, and you use PROTECTED when you want to avoid a subgraph being overridden from above. So for your usage case I think PROTECTED would be appropriate rather than OVERRIDE. Robert. On 9 December 2013 09:17, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, for some reason I can not disable lighting in the RTT scene. The scene is being rendered with the main scene lighting ON. I tried the basics things like geode-getOrCreateStateSet()-setMode( GL_LIGHTING, osg::StateAttribute::OFF|osg::StateAttribute::OVERRIDE ); I even tried to override it with a shader still lighting is applied to the whole scene. I see changes when pressing 'l' in the osgviewer (extended sample) Any clue, hints? Thanks a bunch! Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick -- trajce nikolov nick -- trajce nikolov nick ___ 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
@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] list of random Particle templates
Hi Community, I went through the osgParticle code and I am wondering if some of its parts can be extended to support list of templates instead of single one for the Particles. I think it shouldn't be very hard to implement. Any thoughts? Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help with callbacks and cameras
Hi Sebastian, I struggled with the same problem. The way how I resolved this was by keeping reference to the camera and working with the NodeMask (the camera was turned on at each N-th frame, otherwise was off). And the framebuffer was kept this way Hope this helps Nick On Tue, Dec 3, 2013 at 1:57 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Hi folks, I have a camera responsible for updating some texture by rendering to it. What is the preferred way/callback to let the camera run only every 10th frame or so. I know I can use the the nodevisitor to get the framenumber, but I'm puzzled which callback to use to skip the camera all together for a frame. By skipping I also mean that the attached texture/FBO is not cleared and so on. Can this be done with the event callback (like skipping the frame event?) cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] rendering millions of spheres
Hi Community, I remember someone has faced this problem and I think with some solution. Anyone knowing some pointers willing to share some hints, techniques? Thanks a bunch Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] rendering millions of spheres
Thanks Robert, and Alistair for the detailed info. I have done this in the past as you mentioned with geometry shaders by passing the centers and radiuses as vertex array and attribs and expanding them into spheres in a geometry shader. Can not use it now though. So your another hint was the sample from the osg repo. I will have a look at it. I have to model rain drops on wind shield, and not aligned to screen but in 3d. I have set of rain drop models from Modo and looking around for the best approach to get these models randomly placed in 3D on a geometry (the wind shield) as many as possible. Thanks a bunch again for the hints. Nick On Mon, Dec 2, 2013 at 5:44 PM, Alistair Baxter alist...@mve.com wrote: In order to render a large amount of identical primitives, you probably want to use either instancing or geometry shaders. If your target hardware supports OpenGl 3.x features, then the latter is better. You can use arrays of per-vertex data to specify the differences between your spheres (radius, colour etc), create your osg::geometry as a list of points and have your geometry shader expand that into spheres. For the spheres themselves, it’s far quicker to create them as camera-facing impostors, and have your fragment shader just draw spheres for each of them (various examples are available on the web), which can be lit as needs be. The trouble is that they will be flat, which might not be ideal if many of your spheres intersect. You could at least save some triangles by generating camera-facing hemispheres. I’m not sure what the effect would be if you changed the z-values in the fragment shader, but I am advised that’s not a good idea, because it means z-buffer-testing can’t be done before your fragment shader is run. If you’re stuck with older or mobile hardware, then (extensions permitting) you can use shader instancing to do the same thing. Create a single sphere (or hemisphere or quad, for an impostor) , put your per-instance data into a texture, and sample that texture in your vertex shader (ensure you set your texture filtering modes appropriately). There is an example osgdrawinstanced supplied with the OpenSceneGraph distribution that shows you basically how that is done. If you don’t have the instancing extension available (MESA software rendering, some older mobile OpenGLES 2 chipsets, VERY old desktop hardware) you need to just make sure you render them in large batches of vertices, which means making 1, or only a few Geometries containing multiple spheres (or quads if you can still use a vertex shader to orient them). Quite a lot of ideas there for things to try, I think, apologies if any of that is a bit confusing. Alistair Baxter Software Engineer Have you downloaded your FREE copy of *FieldMove Clino? *Find out more about our app for iPhone and Android smartphones: http://news.mve.com/fieldmoveclino Midland Valley Exploration Ltd. 144 West George Street Glasgow G2 2HG United Kingdom Tel: +44 (0) 141 332 2681 Fax:+44 (0) 141 332 6792 The structural geology experts *From:* osg-users-boun...@lists.openscenegraph.org [mailto: osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Trajce Nikolov NICK *Sent:* 02 December 2013 13:50 *To:* OpenSceneGraph Users *Subject:* [osg-users] rendering millions of spheres Hi Community, I remember someone has faced this problem and I think with some solution. Anyone knowing some pointers willing to share some hints, techniques? Thanks a bunch Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] rendering millions of spheres
Hi Robert, you are right, and probably that is the best approach. How would you approach the coalescing of drops? I am aware of papers of properly doing it as well. However, I took the fastest approach :-) ... Tried that in Modo based on some modeling tutorial and now trying to mimic it into real-time. Don't care about the physic that much, and to make it accurate, just to make it as soon as possible with some good visual. In Modo it works in a way you model few drops and you morph them as they run across the screen, and also the models are fired on the screen with particle effect choosing random models and positions. This is what I am trying to mimic. The results visually are great, and I can agree with you it is not the best approach, but let see how far I get. At the moment I am worrying only about performance. So for the first run I am to learn about the techniques of instancing etc. that's why I have asked for the simple case of rendering spheres, At the end I am not going to have spheres but some other geometries, maybe even your suggested textured quads. also want to ask the community, specially those with advanced GLSL skills, if someone can rewrite the vertex program into GLSL example, please email me Nick On Mon, Dec 2, 2013 at 7:02 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, On 2 December 2013 15:18, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I have to model rain drops on wind shield, and not aligned to screen but in 3d. I have set of rain drop models from Modo and looking around for the best approach to get these models randomly placed in 3D on a geometry (the wind shield) as many as possible. I wouldn't personally render rain drops with traditional geometry, rather I'd try and create quads that are textured and using pixel shaders that do motion blur and refraction effects that are required. On the wind shield rain drops are only briefly round and will quickly coalesce with other drops and then run across the screen with gravity and wind effects, here sphere's wouldn't appropriate at all. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] rendering millions of spheres
the vertex program from osgvertexprogram sample ;-) .. forgot to mention Nick On Mon, Dec 2, 2013 at 7:21 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, you are right, and probably that is the best approach. How would you approach the coalescing of drops? I am aware of papers of properly doing it as well. However, I took the fastest approach :-) ... Tried that in Modo based on some modeling tutorial and now trying to mimic it into real-time. Don't care about the physic that much, and to make it accurate, just to make it as soon as possible with some good visual. In Modo it works in a way you model few drops and you morph them as they run across the screen, and also the models are fired on the screen with particle effect choosing random models and positions. This is what I am trying to mimic. The results visually are great, and I can agree with you it is not the best approach, but let see how far I get. At the moment I am worrying only about performance. So for the first run I am to learn about the techniques of instancing etc. that's why I have asked for the simple case of rendering spheres, At the end I am not going to have spheres but some other geometries, maybe even your suggested textured quads. also want to ask the community, specially those with advanced GLSL skills, if someone can rewrite the vertex program into GLSL example, please email me Nick On Mon, Dec 2, 2013 at 7:02 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, On 2 December 2013 15:18, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: I have to model rain drops on wind shield, and not aligned to screen but in 3d. I have set of rain drop models from Modo and looking around for the best approach to get these models randomly placed in 3D on a geometry (the wind shield) as many as possible. I wouldn't personally render rain drops with traditional geometry, rather I'd try and create quads that are textured and using pixel shaders that do motion blur and refraction effects that are required. On the wind shield rain drops are only briefly round and will quickly coalesce with other drops and then run across the screen with gravity and wind effects, here sphere's wouldn't appropriate at all. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to getting the number of vertices
Hi, maybe you write a NodeVisitor and collect these informations on Geode and Geometry level by getting the vertex arrays and their count. If you want to see how many are in the current view you traverse only the active children (setting in the NodeVisitor) Nick On Mon, Dec 2, 2013 at 9:49 AM, Kim JongBum osgfo...@tevs.eu wrote: Hi, i would like to know the number of vertices in the scene. i know how to see the value of vertices as i press 's'button. but i wanna know how can i get the value (ex_for storing into variable) Thank you! Cheers, Kim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57508#57508 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgcluster small fix
Hi Robert, just a note, I have tested the osgcluster example and I found a missing setup, just a line of code. You have to set at ln 530 if (viewerMod != SLAVE) viewer.setCameraManipulator(...) Otherwise it doesn't work Cheers, Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgcluster small fix
Hi Robert, it makes sense what you just wrote. When I ran the sample, I was able to control the model with the camera manipulator in slave mode, so I just look fast in the sample and come up with this fix. For some reason, the camera view matrix gets valid from the camera manipulator, no idea why. If I find some time today I might investigate this further, but it is welcome if the community test it as well Thanks Nick On Thu, Nov 21, 2013 at 2:15 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, This code hasn't changed and used to work. Could you example Otherwise it doesn't work as I'd like to get to the bottom of when and where it does and doesn't work and why. The slave viewer camera's view matrix is overwritten on each new frame just before renderingTraversals(), this will be any setting from the camera manipulator will be overridden so functionally should be fine. Ideally one wouldn't have any camera manipulators on the slave so you suggested change is good practice, but why it's actually required when you've tested needs to be explained as something else must be going on. Robert. On 21 November 2013 08:28, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, just a note, I have tested the osgcluster example and I found a missing setup, just a line of code. You have to set at ln 530 if (viewerMod != SLAVE) viewer.setCameraManipulator(...) Otherwise it doesn't work Cheers, Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Pivot point in osgViewer
Hi Jason, very easy to do this. You control the view matrix manually. Something like viewer.getCamera()-setViewMatrixAsLookAt(eye,center, up) probably you would want to do an UpdateCallback for the camera that gets the new pivot point and change only the center Nick On Thu, Nov 21, 2013 at 8:01 AM, Jason Anderssen janders...@exactal.comwrote: Hi all, Im experimenting with osgViewer, and would like to know how I would go about changing the pivot point of the scene if the user clicks on an object and I want to use the scenes object's centre point as the new pivot point? Is this possible with the current manipulators? So ultimately I am trying to implement dynamic pivot point selection by the user but still maintaining the current view position. Thank you in advance. Cheers Jason ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Pivot point in osgViewer
Hi Jason, I guess you have to have a look at the CameraManipulators available and probably inherit and override some code. There is some OrbitManipulator maybe you can start with. Nick On Thu, Nov 21, 2013 at 9:17 AM, Jason Anderssen janders...@exactal.comwrote: Hi Trajce, Thank you for your response, so will this still allow the user to be looking at one location, while the scene itself rotates around a different location? I did think I tried this, and I thought the whole view changed to the new centre, I will try again all the same. Cheers Jason From: Trajce Nikolov NICK trajce.nikolov.n...@gmail.com Reply-To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Date: Thu, 21 Nov 2013 15:19:42 +1000 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Pivot point in osgViewer Hi Jason, very easy to do this. You control the view matrix manually. Something like viewer.getCamera()-setViewMatrixAsLookAt(eye,center, up) probably you would want to do an UpdateCallback for the camera that gets the new pivot point and change only the center Nick On Thu, Nov 21, 2013 at 8:01 AM, Jason Anderssen janders...@exactal.comwrote: Hi all, Im experimenting with osgViewer, and would like to know how I would go about changing the pivot point of the scene if the user clicks on an object and I want to use the scenes object's centre point as the new pivot point? Is this possible with the current manipulators? So ultimately I am trying to implement dynamic pivot point selection by the user but still maintaining the current view position. Thank you in advance. Cheers Jason ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] obtain osgViewer::Viewer handle from the scenegraph
Hi Community, I am working with OSG based application that has plug-in based architecture. So I wrote plugins that has to deal with the scene, and these are dlls with some interface. The only available data structure in the interface is the scene root. Is there a way to get a pointer to the Viewer from the scene? I was hoping to find something like osg::Camera* camera = ... camera-getView()-getViewer() but there is nothing like this in the API. Any hints? Thanks a bunch Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] obtain osgViewer::Viewer handle from the scenegraph
yeah .. I saw it too a bit late. My intellisense was dropping osg::View methods so I totally missed osgViewer::View. Works now. Thanks Mattias Cheers, Nick On Mon, Nov 18, 2013 at 12:54 PM, Mattias Helsing helsin...@gmail.comwrote: ...sorry, the last should be: osgViewer::Viewer* viewer = dynamic_castosgViewer::CompositeViewer*(view-getViewerBase()); Mattias On Mon, Nov 18, 2013 at 10:52 AM, Mattias Helsing helsin...@gmail.com wrote: Hi Nick, try one of: osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(camera-getView()); or osgViewer::View* view = dynamic_castosgViewer::View*(camera-getView()); osgViewer::Viewer* viewer = dynamic_castosgViewer::CompositeViewer*(view); ...from top of head :) Mattias On Mon, Nov 18, 2013 at 10:27 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, I am working with OSG based application that has plug-in based architecture. So I wrote plugins that has to deal with the scene, and these are dlls with some interface. The only available data structure in the interface is the scene root. Is there a way to get a pointer to the Viewer from the scene? I was hoping to find something like osg::Camera* camera = ... camera-getView()-getViewer() but there is nothing like this in the API. Any hints? Thanks a bunch Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Model attached to Camera
Hi Community, I would like to do this mentioned in the subject and I am facing issues. Sounds pretty simple but need help. The model is attached to osg::MatrixTransform and I have osg::UpdateCallback attached to it that sets the Matrix based on the camera. So here is the snippet from the callback: osg::MatrixTransform* mxt = dynamic_castosg::MatrixTransform*(node); osg::Vec3 pos = camera-getInverseViewMatrix().getTrans(); osg::Quat rot = camera-getInverseViewMatrix().getRotate(); mxt-setMatrix(osg::Matrix::rotate(rot)*osg::Matrix::translate(pos)). It doesn't look right. What is wrong with this code? Also, there is some delay (when I don't apply the orientation just for debug), the model when attached is sort of delayed following the camera. Any hints? Thanks a bunch Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Model attached to Camera
I gave up on this approach. Used another Camera that mimic HUD but with Prespective projection. Works now. Have to learn to stress less when looking for answers :-) Cheers, Nick On Thu, Nov 14, 2013 at 1:32 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, I would like to do this mentioned in the subject and I am facing issues. Sounds pretty simple but need help. The model is attached to osg::MatrixTransform and I have osg::UpdateCallback attached to it that sets the Matrix based on the camera. So here is the snippet from the callback: osg::MatrixTransform* mxt = dynamic_castosg::MatrixTransform*(node); osg::Vec3 pos = camera-getInverseViewMatrix().getTrans(); osg::Quat rot = camera-getInverseViewMatrix().getRotate(); mxt-setMatrix(osg::Matrix::rotate(rot)*osg::Matrix::translate(pos)). It doesn't look right. What is wrong with this code? Also, there is some delay (when I don't apply the orientation just for debug), the model when attached is sort of delayed following the camera. Any hints? Thanks a bunch Nick -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Model attached to Camera
Hi Robert, thanks for the hint. I don't have CameraManipulator. Anyway I made it work with HUD like approach. Thanks again Nick On Thu, Nov 14, 2013 at 2:55 PM, Robert Milharcic robert.milhar...@ib-caddy.si wrote: On 14.11.2013 11:32, Trajce Nikolov NICK wrote: It doesn't look right. What is wrong with this code? Also, there is some delay (when I don't apply the orientation just for debug), the model when attached is sort of delayed following the camera. Any hints? Hi Nick, I'm just guessing here, but if model is delayed, it probably means that camera's view matrix wasn't updated yet. If I remember correctly, Viewer will update its camera by calling cameraManipulator-updateCamera() somewhere in the update traversal too... so, maybe node callback is called before updateCamera()? Maybe you could cast camera-getView() to osg::Viewer::View and then call getViewerBase(), cast it to proper Viewer and call viewer-getCameraManipulator()-updateCamera() ... Robert Milharcic ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] composite viewer: fixed view size on resize event
Hi Gianni, I ve been following your posts about this issue and I think you are chasing features of CompositeViewer beyond it's implementation. I found myself in a similar position while back when working on a project and I ended up with a HUD. Just a hint Nick On Mon, Nov 11, 2013 at 1:07 PM, Gianni Ambrosio ga...@vi-grade.com wrote: Hi All, I have a osgViewer::CompositeViewer. Then I add another osgViewer::View with viewer-addView() method. Now, when I resize the main window the added view resizes accordingly. I would like the view I add to the composite viewer does not change on resize event. Is it possible? I'm working with Qt so I got osgviewerQT as starting example. Regards, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57170#57170 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG Qt integration and thread safety
Hi Jan, Your approach isn't safe. OSG is *not threadsafe*. Or, rather, it is not threadsafe from arbitrary modifications. If you want to be safe, the only time when modifications to the scene graph may happen is before or after the frame() is invoked, not while frame() is running. On Wed, Nov 6, 2013 at 9:19 PM, Jan Ciger jan.ci...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello Deniz, On 11/06/2013 07:07 PM, Deniz Koçak wrote: This is already a long mail, still I have more to say, many code to post, but I am not sure where should I begin. I can provide as much as possible. However, before ending my e-mail, I would like to ask if this approach is safe or not? I mean, I call frame() method within a Qt slot and again update related datas within another Qt slot. Qt has a main loop (GUI thread) of course, and is it possible to cause a race-condition with OSG, because it has its own threading model? Please ask if you need more information and of course you will, I would be glad to tell more. Your approach isn't safe. OSG is *not threadsafe*. Or, rather, it is not threadsafe from arbitrary modifications. If you want to be safe, the only time when modifications to the scene graph may happen is before or after the frame() is invoked, not while frame() is running. If your GUI is modifying the vertex array from the Qt slot, that is, by definition, asynchronous - you have no idea when the user presses that button. Which may well be during the rendering when OSG is using that data structure. If you are clearing the vertex array while the size of the array is still set, it will go boom. One way to solve this is to use the slot to only modify a buffer/set a flag and then use e.g. an update callback on the affected OSG node to pick up the changes and implement them in the scene graph when it is safe (during update traversal). Regards, J. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iD8DBQFSeqRWn11XseNj94gRAuBdAKDuE2rxjaXltXEWg4g2Mka1ZBqVIgCfbKju vGG9MllrwxlDZjkUd1HHg+8= =S3At -END PGP SIGNATURE- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG Qt integration and thread safety
Hi Jan, You can modify the scenegraph in the update traversal as well. Like I did in the TerraPage (txp) loader. In the Cull traversall I collect info for what is to be modified and then in the update traversal I update the scenegraph safely. Just a note Nick On Thu, Nov 7, 2013 at 9:33 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Jan, Your approach isn't safe. OSG is *not threadsafe*. Or, rather, it is not threadsafe from arbitrary modifications. If you want to be safe, the only time when modifications to the scene graph may happen is before or after the frame() is invoked, not while frame() is running. On Wed, Nov 6, 2013 at 9:19 PM, Jan Ciger jan.ci...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello Deniz, On 11/06/2013 07:07 PM, Deniz Koçak wrote: This is already a long mail, still I have more to say, many code to post, but I am not sure where should I begin. I can provide as much as possible. However, before ending my e-mail, I would like to ask if this approach is safe or not? I mean, I call frame() method within a Qt slot and again update related datas within another Qt slot. Qt has a main loop (GUI thread) of course, and is it possible to cause a race-condition with OSG, because it has its own threading model? Please ask if you need more information and of course you will, I would be glad to tell more. Your approach isn't safe. OSG is *not threadsafe*. Or, rather, it is not threadsafe from arbitrary modifications. If you want to be safe, the only time when modifications to the scene graph may happen is before or after the frame() is invoked, not while frame() is running. If your GUI is modifying the vertex array from the Qt slot, that is, by definition, asynchronous - you have no idea when the user presses that button. Which may well be during the rendering when OSG is using that data structure. If you are clearing the vertex array while the size of the array is still set, it will go boom. One way to solve this is to use the slot to only modify a buffer/set a flag and then use e.g. an update callback on the affected OSG node to pick up the changes and implement them in the scene graph when it is safe (during update traversal). Regards, J. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iD8DBQFSeqRWn11XseNj94gRAuBdAKDuE2rxjaXltXEWg4g2Mka1ZBqVIgCfbKju vGG9MllrwxlDZjkUd1HHg+8= =S3At -END PGP SIGNATURE- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG Qt integration and thread safety
Hi Deniz, yes I read Jan has mentioned this. Have a look in the osgdb_txp loader in TXPNode::traverse() for inspiration if helps a bit Nick On Thu, Nov 7, 2013 at 9:40 AM, Deniz Koçak lend...@gmail.com wrote: Hi Trajce, I think Jan's answer [1] in the first mail mentions a similar solution. Setting a flag (by using userdata of the drawable may be) and updating the drawable in the osg::Drawable::UpdateCallback (of course by checking the flag) MAY solve the problem. It seems that, thrusting the Qt's Signal/Slot mechanism is not a good option as Jan pointed. Cheers, Deniz [1] One way to solve this is to use the slot to only modify a buffer/set a flag and then use e.g. an update callback on the affected OSG node to pick up the changes and implement them in the scene graph when it is safe (during update traversal). On Thu, Nov 7, 2013 at 10:35 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Jan, You can modify the scenegraph in the update traversal as well. Like I did in the TerraPage (txp) loader. In the Cull traversall I collect info for what is to be modified and then in the update traversal I update the scenegraph safely. Just a note Nick On Thu, Nov 7, 2013 at 9:33 AM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Jan, Your approach isn't safe. OSG is *not threadsafe*. Or, rather, it is not threadsafe from arbitrary modifications. If you want to be safe, the only time when modifications to the scene graph may happen is before or after the frame() is invoked, not while frame() is running. On Wed, Nov 6, 2013 at 9:19 PM, Jan Ciger jan.ci...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello Deniz, On 11/06/2013 07:07 PM, Deniz Koçak wrote: This is already a long mail, still I have more to say, many code to post, but I am not sure where should I begin. I can provide as much as possible. However, before ending my e-mail, I would like to ask if this approach is safe or not? I mean, I call frame() method within a Qt slot and again update related datas within another Qt slot. Qt has a main loop (GUI thread) of course, and is it possible to cause a race-condition with OSG, because it has its own threading model? Please ask if you need more information and of course you will, I would be glad to tell more. Your approach isn't safe. OSG is *not threadsafe*. Or, rather, it is not threadsafe from arbitrary modifications. If you want to be safe, the only time when modifications to the scene graph may happen is before or after the frame() is invoked, not while frame() is running. If your GUI is modifying the vertex array from the Qt slot, that is, by definition, asynchronous - you have no idea when the user presses that button. Which may well be during the rendering when OSG is using that data structure. If you are clearing the vertex array while the size of the array is still set, it will go boom. One way to solve this is to use the slot to only modify a buffer/set a flag and then use e.g. an update callback on the affected OSG node to pick up the changes and implement them in the scene graph when it is safe (during update traversal). Regards, J. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iD8DBQFSeqRWn11XseNj94gRAuBdAKDuE2rxjaXltXEWg4g2Mka1ZBqVIgCfbKju vGG9MllrwxlDZjkUd1HHg+8= =S3At -END PGP SIGNATURE- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
Hi Gianni, since you dont need manipulator for the map view you can only set the viewmatrix. Something like view-getCamera()-setViewMatrixAsLookAt() and you make a top down view Nick On Mon, Nov 4, 2013 at 3:24 PM, Gianni Ambrosio ga...@vi-grade.com wrote: Hi All, to disable mouse intaraction I used: view-getCamera()-setAllowEventFocus(false); Does it make sense? Is there a better way? In case this another option I have to set manually in my track map object copy constructor since a clone method is not available for a view. Moreover, I set a camera manipulator to the track map view just to call home() method to fit the track. In fact the home() implementation works only if a manipulator is set. Since I really don't need a manipulator fot that view, what should I do get the same behavior without a manipulator? Regards, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57061#57061 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] question about black-out(BO) of airport runway(light control)
Hi Kim, yes, it is possible. One way is to write a NodeVisitor and to launch it on each loaded tile (in readCallback). This NodeVisitor shell collect the lightPoint structures - have a look in osgSim project what is the representation of the OpenFlight lightpoints. Then you have a handle of it and you control it in a way you want Nick On Fri, Nov 1, 2013 at 7:38 AM, Kim JongBum osgfo...@tevs.eu wrote: Hi, guys i m trying to develop flight simulation with osg. for the airport, i load .txp(terrain) with .flt(airport). and there are black-out(BO) at the airport runway. for more information, i attached the pciture of black-out(BO) of airport runway. so my question is is it possible to control the black-out(BO) of airport runway(light control)? i want to turn on(or off) the light. Thanks in advance guys ; ) Cheers, Kim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57036#57036 Attachments: http://forum.openscenegraph.org//files/blackout_airport_runway_211.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Disabling shadows for text
Hi Anders, Try putting an empty osg::Program in the stateset for the text geodes Nick On Thu, Oct 31, 2013 at 11:24 AM, Anders Backman ande...@cs.umu.se wrote: Hi all. Assume I want to add text following an object in the scenegraph, so I create a geode with text below a MatrixTransform in the scene. Now assume I want to disable shadows (when ShadowMap) for the text (obviously). Is the only way to do that, to have a separate graph for the text (without a ShadowedScene node above)? The setReceivesShadowTraversalMask does not apply for ShadowMap (which I noticed after some testing). But is there any other way? /Anders -- __ Anders Backman, HPC2N 90187 Umeå University, Sweden and...@cs.umu.se http://www.hpc2n.umu.se Cell: +46-70-392 64 67 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
Hi Gianni, so as I understand you you have one scene but you want to have a different representationsof the objects from the main scene into the map scene. I would do it with updateCallback. Let say you have a car that MatrixTransfrom is moving in the main scene. And you want icon in the map scene but following an object from the main scene. So let say: main view: MatrixTransform * mainSceneObject = map view: MatrixTransofrm* mapSceneObject (this one with scale but following an object from the main scene). you do updateCallback on the mapSceneObject where you simply copy the matrix from the main scene for translation and use a scale, like class FollowNodeFromMainSceneNodeCallback : public osg::NodeCallback { public: FollowNodeFromMainSceneNodeCallback(osg::MatrixTransform* mxt) : _mainSceneObject(mxt) {} virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::MatrixTransform* mapSceneObject = dynamic_castosg::MatrixTransform*(node); mapSceneObject-setMatrix(osg::Matrix::scale(x,y,z)*_mainSceneObject-getMatrix().getTrans()); } protected: osg::MatrixTransform* _mainSceneObject; }; and you do then mapSceneObject-setUpdateCallback( new FollowNodeFromMainSceneNodeCallback(mainSceneObject); this way you have two MatrixTransoform for the same object across the scenes, one following the other plus scale. On Wed, Oct 30, 2013 at 10:36 AM, Gianni Ambrosio ga...@vi-grade.comwrote: Hi Nick, I'm not sure the point is the type of node used. I try to explain in detail. Basically I would like to use the same sub-scene that represents my moving object both on the main 3D view and on the track map. A moving object is insert in the scene of the main view. It can be scaled and its transformation matrix changes during animation. The transformation is a PositionAttitudeTransform but a MatrixTransform should work the same. The problem is now related to the fact I would like to add the root node of the sub-scene also to the root node of the track map view. That is useful since updated transformations for the moving objects are automatically reflected on the track map. That means the moving object moves correctly on the track. But the track map view is much smaller than the main view. So that, if the track graphics is fine, the moving objects on the track are too small to be seen. So I need to scale the moving object on the track map view, but without changing the scale on the 3D main view nor on the transformation that must move correctly also on the track map view. Regards Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57003#57003 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
Hi Gianni, I never used PositionAttitudeTransform. Try MatrixTransform instead. You can combine different transformation in the final Matrix. Something like: osg::MatrixTransform* mxt = new osg::MatrixTransform; mxt-setMatrix(osg::Matrix::scale(x,y,z)*osg::Matrix::translate(x,y,z)) Nick On Tue, Oct 29, 2013 at 3:50 PM, Gianni Ambrosio ga...@vi-grade.com wrote: Here I am again ... Every moving object is something like this: osg::PositionAttitudeTransform (for trasnformations wrt global) osg::PositionAttitudeTransform (for scaling underlying graphics, not transformations) osg::Group (that contains real graphics) As suggested, the track map is basically an osgViewer::View with a osg::PositionAttitudeTransform as scene data. As child of that PositionAttitudeTransform I add a node with the track graphics and the PositionAttitudeTransform (i.e. transfirmation node) of each moving object. In this way I can see objects moving correctly on the track but they are too small to be seen. Adding a PositionAttitudeTransform for scaling each moving object does not work since also the PositionAttitudeTransform (i.e. transformation node) is scaled accordingly. Now, is there a way (and does it make sense) to apply a scale for each moving object only in the track map view so that transformations are preserved? Would it be a better solution to add a sphere with proper radius for each moving object so that it can be rendered just in the track map view? Thanks for help Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56997#56997 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
Hi Gianni, what do you mean by cloning a View? Clone the View structure or clone what is in it displayed? If later you just share the scene across multiple views, put the same node in setSceneData() Nick On Fri, Oct 25, 2013 at 10:08 AM, Gianni Ambrosio ga...@vi-grade.comwrote: Hi, since my track objcts are now osgViewer::View, what should I do to clone a View? I didn't found a clone method so I used the copy constructor but in this way the camera manipulator is not copied. A camera manipulator itself doesn't have a clone method and since a view can have a camera manipulator of any type I can't clone it exactly. Any idea? Regards Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56970#56970 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] deferred shading in osg explained
Hi Community, is there some materials on this topic available somewhere? I know Wang Rui pointed to some code in osgRecipes for this, I am more into books, papers etc. Thanks, Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
I have solved this in the past with composite viewer. It's up to you what you put in your views, like, the 2D view can have ortho and rendering totaly different stuff then the 3D rendering complex graphics. Maybe try what Jordi suggested with hud display Nick On Wed, Oct 16, 2013 at 2:48 PM, Gianni Ambrosio ga...@vi-grade.com wrote: Trajce Nikolov NICK wrote: Hi Gianni, have a look at osgcompositeviewer example. You can add another view in the corner (no need of osgWidget::Window). There is a class osgViewer::CompositeViewer and osgViewer::View. The example demonstrated how to have multiple views each with separate renderings. Hi Nick, I'm not sure the composite viewer is what I need. I would like something that the user can move around. More over the scene is not the same: I have a real and complex road graphics shown in the 3d viewer, while the 2D track should show just the centerline of the road (so a different graphic). Regards Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56801#56801 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
You can use HUD for this. It will work better with resizing then the comosite viewer with views. In any case you will have a separate osg::Camera that for the HUD case will render to texture and apply to osg::Geometry. This is very simple task. Have a look at the hud sample, osgprerender for render to texture. If got stuck I can help you with some code Nick On Wed, Oct 16, 2013 at 4:06 PM, Gianni Ambrosio ga...@vi-grade.com wrote: Thanks Jordi and Nick for the replay. I thought of a HUD but I didn't investigate if a hud can be dragged or resized. If so then that's will be fine. I'm attaching an image to show what I need. Just consider that the 2D track and 3D scene can be overlapped. Hope this is clearer. Regards Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56805#56805 Attachments: http://forum.openscenegraph.org//files/example_467.png ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Track map on a 3D view
Hi Gianni, have a look at osgcompositeviewer example. You can add another view in the corner (no need of osgWidget::Window). There is a class osgViewer::CompositeViewer and osgViewer::View. The example demonstrated how to have multiple views each with separate renderings. Nick On Tue, Oct 15, 2013 at 2:56 PM, Gianni Ambrosio ga...@vi-grade.com wrote: Hi All, I have a scene with moving objects (basically cars) in a 3D view and a fixed object (i.e. the track). Now I need to show a simplified track (just the centerline of the track, coming from a separate graphic file, if needed) in one corner of the 3D viewer with runnig cars as simple colored points. I thought of an object derived from osgWidget::Window, or simply a Camera, or both? Anything else is more appropriated? Thank you! Regads, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56786#56786 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] File reading and node traversal problem.
Hi Murat, maybe you post your code snippet of the traversal so we see what might be wrong there Cheers, Nick On Sun, Oct 13, 2013 at 5:16 PM, Murat KIRTAY muratk...@gmail.com wrote: Dear All, I am getting my hands dirty with osg, and I have faced below problem and could not find a solution on the previous posts, forums etc. *Problem:* when reading a osg file via osgDB::readNodeFile( fileNameStr ) in order to create a node (osg::Node), while traversing this node with visitor, in first traversing apply method were performed to all child nodes, yet when we performed for same node again, it does not call the apply method for the child nodes. In addition, no joy for cloning the node as well. Why I can not visit child nodes in the 2nd traversal? Any clue or references to fade away this problem. Best. -- Murat. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ 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 Aurelien, I am seeing you are using custom API for the textures. My case was pure OpenGL (which I don;t think it makes any difference). I found the way to reuse the texture I am creating and only installing new Texture::TextureObject from my initial attempt. The not implemented release is still present when app exits but no longer bugged with the warnings in real-time. Thanks again for sharing. This email was more for the archive if someone ends up in similar situation Nick On Thu, Oct 10, 2013 at 12:39 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: thanks ! Nick On Thu, Oct 10, 2013 at 12:13 PM, Aurelien Albert aurelien.alb...@alyotech.fr wrote: 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 -- trajce nikolov nick -- trajce nikolov nick ___ 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 Aurlien, Are you willing and free to share the GL Texture wrapper code? Nick On Tue, Oct 8, 2013 at 10:43 PM, Aurelien Albert aurelien.alb...@alyotech.fr wrote: 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 -- trajce nikolov nick ___ 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
thanks ! Nick On Thu, Oct 10, 2013 at 12:13 PM, Aurelien Albert aurelien.alb...@alyotech.fr wrote: 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 -- trajce nikolov nick ___ 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 Community, me again on this issue. As I mentioned in my previous post, I figured out a way how to wrap a OpejnGL texture created externaly with OpenGL calls into osg::Texture. Following is the code snippet for that and it seam to be working. However when I run the app I am getting this warning. Any clue? TextureObjectManager::releaseTextureObject(Texture::TextureObject* to) Not implemented yet GLuint textureHandle = (GLuint)texHandle; _texture = new osg::Texture2D; osg::ref_ptrosg::Texture::TextureObject textureObject = new osg::Texture::TextureObject(_texture.get(),textureHandle,GL_TEXTURE_2D); textureObject-setAllocated(); _texture-setTextureObject(renderInfo.getContextID(),textureObject.get()); state.setActiveTextureUnit(_textureStage); _texture-apply( state ); // Tell state about our changes state.haveAppliedTextureAttribute(_textureStage, _texture.get()); Thanks a bunch! Nick On Sat, Oct 5, 2013 at 5:10 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Found the way, it is possible. Thanks anyway ! :-) Nick On Sat, Oct 5, 2013 at 4:16 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, I ran into a topic of this mentioned in the subject. I am using 3rd party SDK (OpenGL) with OSG and I get a texture created by this SDK. Is there a way to wrap it into osg TextureObject and have it all osg-ish without mixing with GL calls? Thanks a bunch! Nick -- trajce nikolov nick -- trajce nikolov nick -- trajce nikolov nick ___ 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 Aurelien, thanks for the hints. I was also suggested by someone else to either subclass or do what you have done, but I found it working with this Texture::TextureObject trick, and it works well, so I am not to leave this method only was curious if there is something else to be set to get rid of the warning. Thanks again Nick On Tue, Oct 8, 2013 at 4:30 PM, Aurelien Albert aurelien.alb...@alyotech.fr wrote: Hi, I've done the same a few weeks ago : - a customer low-level OpenGL API is creating some ressources (like textures) - my OSG applicatino have to use these ressources So I created a MyTexture class : Code: class MyTexture : public osg::StateAttribute { private: CustomerGL::Texture p_CustomerTexture; public: Texture(); Texture(CustomerGL::Texture* p_CustomerTexture); Texture(const MyTexture texture,const osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY); virtual osg::Object* cloneType() const; virtual osg::Object* clone(const osg::CopyOp copyop) const; virtual bool isSameKindAs(const osg::Object* pObj) const; virtual const char* libraryName() const; virtual const char* className() const; private: Texture operator=(constMyTexture other); // No copy protected: virtual ~Texture(); public: CustomerGL::Texture* CustomerGLTexture() const; void setCustomerGLTexture(CustomerGL* pGLBoxTexture); virtual osg::StateAttribute::Type getType() const; virtual bool isTextureAttribute() const; virtual int compare(const osg::StateAttribute stateAttribute) const; virtual bool getModeUsage(osg::StateAttribute::ModeUsage modeUsage) const; virtual void apply(osg::State state) const; virtual void compileGLObjects(osg::State state) const; virtual void resizeGLObjectBuffers(unsigned int maxSize); virtual void releaseGLObjects(osg::State* pState=NULL) const; }; The virtual methods are pretty simple to implement : have a look to osg::Texture2D implementations. By subclassing osg::StateAttribute and not osg::Texture, I'm sure that all OSG algorithms (such as texture resizing) will not be applied to MyTexture class. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56673#56673 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] mixing OpenGL with OSG - textures
Hi Community, I ran into a topic of this mentioned in the subject. I am using 3rd party SDK (OpenGL) with OSG and I get a texture created by this SDK. Is there a way to wrap it into osg TextureObject and have it all osg-ish without mixing with GL calls? Thanks a bunch! Nick -- trajce nikolov nick ___ 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
Found the way, it is possible. Thanks anyway ! :-) Nick On Sat, Oct 5, 2013 at 4:16 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, I ran into a topic of this mentioned in the subject. I am using 3rd party SDK (OpenGL) with OSG and I get a texture created by this SDK. Is there a way to wrap it into osg TextureObject and have it all osg-ish without mixing with GL calls? Thanks a bunch! Nick -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] question about culling (z-fighting)
I thought that. This can be more like TerraVista issue. In TerraVista, in the Page Compiler settings set the TileOrigin to LocalTile (something like that). It should help for large coordinates in a way that each tile will be built in Local Coordinates and a matrix will be placed on top. having it built the archive this way should avoid any z-fighting Cheers, Nick On Thu, Oct 3, 2013 at 8:12 AM, Kim JongBum osgfo...@tevs.eu wrote: hi, Nick our terrain format is .txp files. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56595#56595 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] question about culling (z-fighting)
What is your terrain format? Nick On Wed, Oct 2, 2013 at 8:34 AM, Kim JongBum osgfo...@tevs.eu wrote: Hi, guys i m doing with culling to my application because my end of terrain is blinking when i move (i guess this is called z-fighting problem) could u tell me the the meaning of function and its parameters. setCullingActive(true); -meaning : ? setNearFarRatio(0.1f); -meaning : ? -parameters : ? setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); -meaning : ? -parameters : ? setSmallFeatureCullingPixelSize(-1.0f); -meaning : ? -parameters : ? Thank you! Cheers, Kim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56572#56572 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 32 bit depth buffer
Hi Community, any hint how to setup this for the main viewer camera? Thanks a lot nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 32 bit depth buffer
Thanks Robert! nick On Wed, Oct 2, 2013 at 3:29 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, You should be able to set the number of bits for the depth buffer via the GraphicsContext::Traits when creating your graphics context. Robert. On 2 October 2013 13:12, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, any hint how to setup this for the main viewer camera? Thanks a lot nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] default OSG InverseViewMatrix uniform
Robert, osg_ViewMatrixInverse seam to not be set properly in case of nested cameras nick On Wed, Sep 25, 2013 at 7:23 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Thanks Robert. Didn't know where to search for it eaither. Thanks ! Nick On Wed, Sep 25, 2013 at 7:19 PM, Robert Osfield robert.osfi...@gmail.comwrote: A grep of src/osgUtil/SceneView.cpp reveals: osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_FrameNumber,osg::Uniform::UNSIGNED_INT); osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_FrameTime,osg::Uniform::FLOAT); osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_DeltaFrameTime,osg::Uniform::FLOAT); osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_SimulationTime,osg::Uniform::FLOAT); osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_DeltaSimulationTime,osg::Uniform::FLOAT); osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_ViewMatrix,osg::Uniform::FLOAT_MAT4); osg::Uniform* uniform = _localStateSet-getOrCreateUniform(osg_ViewMatrixInverse,osg::Uniform::FLOAT_MAT4); So I guess you want the last one :-) Robert. On 25 September 2013 16:21, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Community, I recall there was a uniform set by osg doing this but can not recall the correct name. Any hints? Thanks a bunch! Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgOcean] Some questions about osgRiver ???
3 -for the sea I use osgOcean, Nothing against osgOcean. I have used it as well in a project, but switched over to Triton (check it out, same coming from sundog-soft as SilverLining ) Nick On Fri, Sep 27, 2013 at 8:56 PM, Chris Hanson xe...@alphapixel.com wrote: 4-for the sky I am trying with Silverlight(the demo), I think you mean Silver Lining. Good luck and you're welcome! -- 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 • osgEarth • Terrain • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android @alphapixel https://twitter.com/alphapixel facebook.com/alphapixel (775) 623-PIXL [7495] ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgOcean] Some questions about osgRiver ???
and if you are really after fully opensource you can look for osgEphemeris, a work I think done by Don Burns years ago, but that was my initial step before figuring out SilverLining as well Nick On Fri, Sep 27, 2013 at 9:00 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: 3 -for the sea I use osgOcean, Nothing against osgOcean. I have used it as well in a project, but switched over to Triton (check it out, same coming from sundog-soft as SilverLining ) Nick On Fri, Sep 27, 2013 at 8:56 PM, Chris Hanson xe...@alphapixel.comwrote: 4-for the sky I am trying with Silverlight(the demo), I think you mean Silver Lining. Good luck and you're welcome! -- 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 • osgEarth • Terrain • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android @alphapixel https://twitter.com/alphapixel facebook.com/alphapixel (775) 623-PIXL [7495] ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org