Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hey everyone, I managed to finally sort this out. The bone weights that were displayed in the console as being too small, are I believe only the specific vertexes that had little to no weight. I re exported the .fbx file very carefully making sure the rigging was right and the bones were set up properly. This fixed the distortion issue, so it was a model problem and not the shader program. Much to my happiness :). I also did some deeper analysis of the frames and noticed that my animation models were causing sever delays, when I exported the fbx models to play animations the bone structure accidentally followed along, so for several models that had fairly high poly counts, the skinning was being done on the cpu. I removed the bone structure from my anim models, and now the hands are the only rigged structure on the scene and it makes use of skinning.vert with over 50 fps in debug mode! Thanks to everyone with the patience to help me sort through this. I still don't understand what that 11 as a value for attribIndex means in the init() method of RigTransformHardware, but maybe one day Ill figure that out :). -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62430#62430 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
This has all been very helpful guys! Thanks Sebastian, I've tried running our bone matrice updates without adding the model and just running nothing in the update callback both with the same results. Which even further reinforces the original suspicions that the hand model is being skinned on the CPU. I only use a traversal once in the setup phase to obtain references to the bones so the traversal class is not used in the update class. Now as you guys saw in the picture in release mode I was getting upwards of 12 for the update traversal. I managed to apply the shader program exactly as implemented in the osganimationhardware example on the hand model. (was a problem with relative paths), and in DEBUG mode the update traversal now is only at around 4. Which is great, i think. It totally screws up my hand model though. Distorts it very much. In the output it mentions almost all of my bones being too low in Bone Weight and therefore not being updated. I THINK (not a lot of experience with bone weight) this is the reason behind the distortion. How do I handle the weight of my bones, in the hand model being so small? Is there a way I can force low bone weights into the palette? Or would that be a bad idea? Or maybe that not the cause of the distortion? Im a bit confused aka noob-struck on this one. Also I noticed in the osganimationhardware example that in the init() method there is a property: int attribIndex = 11; Where does 11 come from? Im not sure how this number is derived. Is it chosen at random or does it relate to the Nathan model? Trying to read through the code and understand it and learn so it doesn't distort the crap out of my hand model. Thank you! Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62341#62341 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi Chris, On 14 January 2015 at 11:58, Chris Hidden ch...@erghis.com wrote: At the moment Im trying to get hardware skinning working by following the osganimationhardware example. As of now I haven't got it working as for some reason it won't load the shaders/skinning.vert file. Not sure why I just get an error saying it didn't load. The file path is ok as all of my other textures and models load no problems from that directory. I can't provide any guidance here as I don't have the set up to test myself. The best I can do is suggest enabling more verbose debug output to the console via OSG_NOTIFY_LEVEL=DEBUG. This will print out the paths it's testing. Yes the update traversal is a bit ridiculous isn't it? I am hoping the skinning might solve the issue but Im not sure. From your description of what you've done/tested the most likely cause of the bottleneck is the CPU update of skinning. I'm surprised the cost is quite so high. One way to test it is to use a hand model with lower resolution model and see if the update time varies. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi Chris, Did you simply try to do nothing in the callback? Maybe the callback is called to often per frame. Also I've sort of lost track how you apply the matrices to your boned model. If you are using visitors to retrieve the bones in the callback, it might be simply to slow. I would use some timers or a profiler or even simply skipping code to measure/determine which part of the update-callback slows you down. Hi guys thanks for the quick replies! I am indeed testing in Release always now. (I've learnt my lesson ;)). At the moment Im trying to get hardware skinning working by following the osganimationhardware example. As of now I haven't got it working as for some reason it won't load the shaders/skinning.vert file. Not sure why I just get an error saying it didn't load. The file path is ok as all of my other textures and models load no problems from that directory. Yes the update traversal is a bit ridiculous isn't it? I am hoping the skinning might solve the issue but Im not sure. In the updatecallback attached to the hand model is a call to our api and then adjusting the bones position and rotation using some matrix calculations. At first I thought it could be the way our calculations and api call were being done that was slowing things down. However, I tested this by simply not adding the model to the scene but still allowing the callback to perform all of its functions and api call and the update traversal dropped down to around 2.5 per frame. So i don't think its our api call or calculations that is sucking up so much time. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62329#62329 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
So I was just in the process of trying to attach the statshandler to my viewer and I can't seem to pull anything up on screen. I was looking at the osguserstats exmaple and it seems pretty straightforward. Just attach the pointer of a new statshandler to the viewer right? I took a look at the class reference as well and there are a few set key methods as well. I tried to pass in one of the keys but still wasn't able to get anything up on screen. Our application is completely transparent, except the models of course, could this be why we are not getting anything displaying for the statshandler? I was thinking that for any geometry I add to the scene I have to set depth test off and blend on. Which I can't do for the Statshandler geometry. Unless I wrote my own class extending from it. Is this the best way to go? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62308#62308 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
you did press the s key several times to enable all these statistics, right? I do not really know how to make your application compatible with the stats handler. maybe you can hack up a full screen, non-transparent version, just for testing. Christian 2015-01-13 16:17 GMT+01:00 Chris Hidden ch...@erghis.com: So I was just in the process of trying to attach the statshandler to my viewer and I can't seem to pull anything up on screen. I was looking at the osguserstats exmaple and it seems pretty straightforward. Just attach the pointer of a new statshandler to the viewer right? I took a look at the class reference as well and there are a few set key methods as well. I tried to pass in one of the keys but still wasn't able to get anything up on screen. Our application is completely transparent, except the models of course, could this be why we are not getting anything displaying for the statshandler? I was thinking that for any geometry I add to the scene I have to set depth test off and blend on. Which I can't do for the Statshandler geometry. Unless I wrote my own class extending from it. Is this the best way to go? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62308#62308 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
On 14 January 2015 at 11:20, Christian Buchner christian.buch...@gmail.com wrote: Your posting came through just fine, and it seems your draw performance is fine, but your update traversal is excessively slow. It would be important to find out if the CPU is spent in some inefficient parts of OSG, or if the majority is spent in some OpenGL driver API calls. CPU profiling will be helpful in determining this. For clarification, the update traversal stats are for only OSG update traversal and application update callbacks/operation, there are no OpenGL calls from the OSG during the update traversal. The only time that the OSG calls OpenGL is from the draw dispatch traversal. The stats Chris has provide suggest that it's purely an update traversal issue. Chris, are you testing with debug or release build? Are you using hardware skinning? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Your posting came through just fine, and it seems your draw performance is fine, but your update traversal is excessively slow. It would be important to find out if the CPU is spent in some inefficient parts of OSG, or if the majority is spent in some OpenGL driver API calls. CPU profiling will be helpful in determining this. 2015-01-14 12:17 GMT+01:00 Chris Hidden ch...@erghis.com: H... maybe my edit and other post haven't come through yet? I did get the statshandler working, I wrote an edit to my post, and posted some pictures and details about it yet another post underneath it. Are they not visible maybe? Thank you! Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62323#62323 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
H... maybe my edit and other post haven't come through yet? I did get the statshandler working, I wrote an edit to my post, and posted some pictures and details about it yet another post underneath it. Are they not visible maybe? Thank you! Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62323#62323 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
as the update traversal is CPU code, it might help to run a CPU based profiling tool over it to see where the time is actually being spent. The Visual Studio Community edition has a lot of useful profiling features. Christian 2015-01-13 17:19 GMT+01:00 Chris Hidden ch...@erghis.com: Now for the update. I got the profiler working and the vast bulk of each frame is taken up by the update. I've attached 3 different images to show how the profiler looks at different stages of the program. This is all in release mode. You can see that camera 2, which has the animated models on the right HUD make up the majority of the vertice count. But Im not 100% sure what Im looking for here. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62309#62309 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi guys thanks for the quick replies! I am indeed testing in Release always now. (I've learnt my lesson ;)). At the moment Im trying to get hardware skinning working by following the osganimationhardware example. As of now I haven't got it working as for some reason it won't load the shaders/skinning.vert file. Not sure why I just get an error saying it didn't load. The file path is ok as all of my other textures and models load no problems from that directory. Yes the update traversal is a bit ridiculous isn't it? I am hoping the skinning might solve the issue but Im not sure. In the updatecallback attached to the hand model is a call to our api and then adjusting the bones position and rotation using some matrix calculations. At first I thought it could be the way our calculations and api call were being done that was slowing things down. However, I tested this by simply not adding the model to the scene but still allowing the callback to perform all of its functions and api call and the update traversal dropped down to around 2.5 per frame. So i don't think its our api call or calculations that is sucking up so much time. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62328#62328 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi guys thanks for the quick replies! I am indeed testing in Release always now. (I've learnt my lesson ;)). At the moment Im trying to get hardware skinning working by following the osganimationhardware example. As of now I haven't got it working as for some reason it won't load the shaders/skinning.vert file. Not sure why I just get an error saying it didn't load. The file path is ok as all of my other textures and models load no problems from that directory. Yes the update traversal is a bit ridiculous isn't it? I am hoping the skinning might solve the issue but Im not sure. In the updatecallback attached to the hand model is a call to our api and then adjusting the bones position and rotation using some matrix calculations. At first I thought it could be the way our calculations and api call were being done that was slowing things down. However, I tested this by simply not adding the model to the scene but still allowing the callback to perform all of its functions and api call and the update traversal dropped down to around 2.5 per frame. So i don't think its our api call or calculations that is sucking up so much time. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62329#62329 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Great! Thanks Christian, Ill start with that and see what I can discern from the results. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62261#62261 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Ok, thanks Christian, Ill take a look at the example. Its a shame that I may need to do my own hardcoded shader for any models with bone structure :(. I don't have a lot of experience with writing shaders. ... Thank you! Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62248#62248 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi, There might still be other factors that might contribute to your low frame rates. e.g. the use of display lists when vertex buffer objects should be preferred. The hardware animation skinning becomes a real speed booster when you want to show dozens of animated models on screen - but in the case of two hands only this should not be strictly needed yet. You might want to run some profiling on your code to see where it spends most of your CPU and GPU time. e.g. is all your geometry using fast code paths? Christian 2015-01-07 10:09 GMT+01:00 Chris Hidden ch...@erghis.com: Ok, thanks Christian, Ill take a look at the example. Its a shame that I may need to do my own hardcoded shader for any models with bone structure :(. I don't have a lot of experience with writing shaders. ... Thank you! Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62248#62248 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hey Christian, thanks again for the reply. Right, so display lists can slow things down and VBO is often preferred. I think most of my implementation is fairly simple. The tow hands are single model that consists of two hands who's bone positions and rotations are updated every frame via our api. The other model is a sphere which consists of two hemispheres which just has its position updated each frame in relation to the hands. And finally I've built those two models together into one fbx file, where I do an animation to show the user how to work the system. That tutorial animation file as I call it is a seperate osgb file. So really I load the handmodel fbx, the two hemisphere fbx models and the one osgb model file. Barely anything at all. My biggest issue, is even with a profiler (which I should be using anyways) I don't really know how to make sure my geometry is using fast code paths. The only approach I've learned through looking at the forums and the osg exmaples, is to traverse through each model and make sure all of the geometry is set to use VBO instead of display lists (apropos my previous post with the traverser class). Are there other examples or approaches I am not aware of? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62253#62253 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
If you attach the StatsHandler to your OSG viewer you can call up some statistics on your scene graph (overall, and per camera view). It will detail you the number of geodes, transformations, drawables, vertices in the scene graph and also the total count of rendered instances thereof. Listed under drawables you will see more detail whether these drawables are actually triangles, quads, polygons, etc.. and if they are fast drawables or some that run slower code paths (e.g. those that run through a depth sorting because they are in the transparent render bins. Also the plots at the top of the screen will detail the execution time of various phases of the rendering process (cull traversal, draw time, etc...) Christian 2015-01-07 16:25 GMT+01:00 Chris Hidden ch...@erghis.com: Hey Christian, thanks again for the reply. Right, so display lists can slow things down and VBO is often preferred. I think most of my implementation is fairly simple. The tow hands are single model that consists of two hands who's bone positions and rotations are updated every frame via our api. The other model is a sphere which consists of two hemispheres which just has its position updated each frame in relation to the hands. And finally I've built those two models together into one fbx file, where I do an animation to show the user how to work the system. That tutorial animation file as I call it is a seperate osgb file. So really I load the handmodel fbx, the two hemisphere fbx models and the one osgb model file. Barely anything at all. My biggest issue, is even with a profiler (which I should be using anyways) I don't really know how to make sure my geometry is using fast code paths. The only approach I've learned through looking at the forums and the osg exmaples, is to traverse through each model and make sure all of the geometry is set to use VBO instead of display lists (apropos my previous post with the traverser class). Are there other examples or approaches I am not aware of? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62253#62253 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Happy new years everyone! Hope everyone had a great holidays! I just wanted to update this thread and bump it as I am now doing some further tweaking on getting things running optimally. I narrowed down some things, and I now have ONLY the hands being rendered in release mode. I get around 45 fps.. which is ok, but I would like to see it higher. Unless I am vastly overestimating the capability of this it should be able to render the hands up close to 60 fps on release mode. I've tested running only the API without rendering the hands and the frame rate stays a solid 58-60 fps. The moment I add the hands to the scene and they move around the FR drops to around 45. So I know the sensor data is not the source of the delay. I tried a traversal class that runs through the hand model. (Hand model is an FBX class with baked in texture and rigging exported from 3DS max) hoping to do all the work on the GPU: Code: class VBO_Updater : public osg::NodeVisitor { public: VBO_Updater() : NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN) {} ~VBO_Updater(){} virtual void apply(osg::Node node) { traverse(node); } virtual void apply(osg::Geode geode) { unsigned int numGeoms = geode.getNumDrawables(); for (unsigned int i = 0; i numGeoms; i++) { osg::ref_ptrosg::Geometry curGeom = geode.getDrawable(i)-asGeometry(); if (curGeom) { curGeom-setUseDisplayList(false); curGeom-setUseVertexBufferObjects(true); osg::ref_ptrVertexBufferObject df = curGeom-getOrCreateVertexBufferObject(); df-setUsage(GL_STREAM_DRAW); osg::ref_ptrosg::StateSet stateset = curGeom-getOrCreateStateSet(); stateset-setAttributeAndModes(new osg::CullFace()); } } } private: }; But this didn't seem to do anything for the frame rate. I assume that the fbx model is still not being skinned on the GPU. How do I make sure that the GPU is doing the hard work and not the CPU? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62226#62226 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
If I am not mistaken, you will have to run your own vertex shaders in order to do hardware animation skinning. The osganimationhardware example provides a very basic example of doing so. This may mean that your shader might have to be hardcoded to work with a specific 3D model (bone structure) only. Christian 2015-01-05 13:16 GMT+01:00 Chris Hidden ch...@erghis.com: Happy new years everyone! Hope everyone had a great holidays! I just wanted to update this thread and bump it as I am now doing some further tweaking on getting things running optimally. I narrowed down some things, and I now have ONLY the hands being rendered in release mode. I get around 45 fps.. which is ok, but I would like to see it higher. Unless I am vastly overestimating the capability of this it should be able to render the hands up close to 60 fps on release mode. I've tested running only the API without rendering the hands and the frame rate stays a solid 58-60 fps. The moment I add the hands to the scene and they move around the FR drops to around 45. So I know the sensor data is not the source of the delay. I tried a traversal class that runs through the hand model. (Hand model is an FBX class with baked in texture and rigging exported from 3DS max) hoping to do all the work on the GPU: Code: class VBO_Updater : public osg::NodeVisitor { public: VBO_Updater() : NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN) {} ~VBO_Updater(){} virtual void apply(osg::Node node) { traverse(node); } virtual void apply(osg::Geode geode) { unsigned int numGeoms = geode.getNumDrawables(); for (unsigned int i = 0; i numGeoms; i++) { osg::ref_ptrosg::Geometry curGeom = geode.getDrawable(i)-asGeometry(); if (curGeom) { curGeom-setUseDisplayList(false); curGeom-setUseVertexBufferObjects(true); osg::ref_ptrVertexBufferObject df = curGeom-getOrCreateVertexBufferObject(); df-setUsage(GL_STREAM_DRAW); osg::ref_ptrosg::StateSet stateset = curGeom-getOrCreateStateSet(); stateset-setAttributeAndModes(new osg::CullFace()); } } } private: }; But this didn't seem to do anything for the frame rate. I assume that the fbx model is still not being skinned on the GPU. How do I make sure that the GPU is doing the hard work and not the CPU? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62226#62226 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi Chris, Modern graphics hardware should have no problem with a model with 5000 vertices. Modern systems should be able to push a million vertices+ without problem at 60fps. However, if it's the animation side being done on the CPU that is bottleneck then simplifying the model could make a difference. Changing to doing the skinning on the GPU might the thing to do. Robert. On 21 October 2014 19:50, Chris Hidden ch...@erghis.com wrote: Thanks Robert and Sergey! I realize I was being a bit too general. I was just curious if having that many UpdateCallbacks would generally be an issue... but of course it all depends on what I am doing with everything. I took your advice and stepped through each step when creating the scene. I noticed right away that when I add my hand model, the FBX model, it slowed things down A LOT, even if it was just sitting still. So i opened it up in 3Ds maxed and noticed each hand had over 5000 vertices and 1 faces. I guess that is a bit much. I simplified the hands down to around 400 vertices and 800 faces per hand. This got me almost up to 30 fps Im wondering though if there is another way to solve this issue. The hands look OK now but were a lot nicer looking when they were more detailed. Ideally I should be over 30 fps always... Ill also give it a go tomorrow with implementing a list system sergey. We dont give info directly from the leap motion to OSG... it first runs through our API and is processed there... but it probably wouldnt hurt to create a similar list system in the OSG application as well. Thanks for you patience and help guys. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61354#61354 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Thanks Robert. Is there a book or tutorial or example that shows how I might let the GPU handle the skinning of the model? I realize this is not just a look at and fix kind of thing. I don't really know where to start though. In the mean time Ill keep googling :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61362#61362 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
convert the hand model to ASCII OSG format maybe, and try exchanging display lists and vertex buffer objects. In my experience this makes a big difference on Intel chips for more complex models. SetUseDisplayLists FALSE SetUseVertexBufferObjects TRUE Alternatively use a graph traversal to change the corresponding attributes from C++. 2014-10-22 10:05 GMT+02:00 Chris Hidden ch...@erghis.com: Thanks Robert. Is there a book or tutorial or example that shows how I might let the GPU handle the skinning of the model? I realize this is not just a look at and fix kind of thing. I don't really know where to start though. In the mean time Ill keep googling :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61362#61362 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi cbuchner. Thanks for your help. Does 3ds Max have an osg exporter? Also if I converted the .3ds file to osg will it retain the bone structure? The reason I export the hand models from .3ds to .fbx is to preserve the bone structure. Im assuming you mean that when I construct a model I would setUseDisplayLists to false and setUseVertexBufferObjects to true. As I am importing a finalized model I am avoiding making any direct geometry modification in OSG. If that is what you mean, unless I am misunderstanding. Also I took a look at osgAnimationhardware, thinking that might show me how to run stuff from osgAnimation on the GPU. However when I run the example FRAPS reports it at 5 fps?! So Im not really sure why its doing that. I also took a look at osgAnimationSkinning and the example shows how to skin a model you are building yourself. I already have the hand models built, skinned and rigged in 3ds Max. I was hoping there was a way to import that model as .fbx ( or sure even .osg if it preserves the rigging) and have good performance. My scene is incredibly simple as it includes only the .fbx hand models and 2 half sphere models So I am obviously doing something quite wrong, just not sure exactly what. Even with a delay from the sensor, I shouldn't be getting that low fps. If I understand what Robert has been getting at the CPU is handling all of my data for redrawing vertices. Im not sure how to tell osg to use the GPU or design or import my model so that it does or even how to recalculate the bone positioning so that it does. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61364#61364 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
On 22 October 2014 10:50, Chris Hidden ch...@erghis.com wrote: If I understand what Robert has been getting at the CPU is handling all of my data for redrawing vertices. Im not sure how to tell osg to use the GPU or design or import my model so that it does or even how to recalculate the bone positioning so that it does. No, I was suggesting that the skinning was being done on the GPU, not the rendering. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
If OpenScenegraph can load the 3DSMax 3D object, so can osgconv. osgconv will write an OSG file when given a file name with osg extension as second argument. Christian 2014-10-22 11:50 GMT+02:00 Chris Hidden ch...@erghis.com: Hi cbuchner. Thanks for your help. Does 3ds Max have an osg exporter? Also if I converted the .3ds file to osg will it retain the bone structure? The reason I export the hand models from .3ds to .fbx is to preserve the bone structure. Im assuming you mean that when I construct a model I would setUseDisplayLists to false and setUseVertexBufferObjects to true. As I am importing a finalized model I am avoiding making any direct geometry modification in OSG. If that is what you mean, unless I am misunderstanding. Also I took a look at osgAnimationhardware, thinking that might show me how to run stuff from osgAnimation on the GPU. However when I run the example FRAPS reports it at 5 fps?! So Im not really sure why its doing that. I also took a look at osgAnimationSkinning and the example shows how to skin a model you are building yourself. I already have the hand models built, skinned and rigged in 3ds Max. I was hoping there was a way to import that model as .fbx ( or sure even .osg if it preserves the rigging) and have good performance. My scene is incredibly simple as it includes only the .fbx hand models and 2 half sphere models So I am obviously doing something quite wrong, just not sure exactly what. Even with a delay from the sensor, I shouldn't be getting that low fps. If I understand what Robert has been getting at the CPU is handling all of my data for redrawing vertices. Im not sure how to tell osg to use the GPU or design or import my model so that it does or even how to recalculate the bone positioning so that it does. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61364#61364 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Oppps typo... On 22 October 2014 12:25, Robert Osfield robert.osfi...@gmail.com wrote: On 22 October 2014 10:50, Chris Hidden ch...@erghis.com wrote: If I understand what Robert has been getting at the CPU is handling all of my data for redrawing vertices. Im not sure how to tell osg to use the GPU or design or import my model so that it does or even how to recalculate the bone positioning so that it does. No, I was suggesting that the skinning was being done on the GPU, not the rendering. I mean CPU here not GPU, skinning done on the CPU. Chris, what hardware are you testing on. Also are you testing debug or release? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Ok, so I meant to imply skinning. I guess what I described was rendering. I am using debug. I know it affects performance, but by that much? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61372#61372 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Please try it in release. Debug will totally change the deal, as each access to stl containers might be checked etc (at least for VisualStudio) As OSG uses standard containers quite a lot internally it will have some serious impact on some platforms. Some compilers will also disable optimization like SSE in debug profiles, so math heavy code like matrix multiplication etc. will be somewhat slower or less cache friendly. Comparing fps really makes sense for optimized release code only. cheers Sebastian Ok, so I meant to imply skinning. I guess what I described was rendering. I am using debug. I know it affects performance, but by that much? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61372#61372 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi Chris, How to optimize your application will depend on where the bottleneck is. I'd suspect CPU, but as I don't have your application and data in front of me I can't really provide any specific advice. One thing I would suggest is making sure you are testing performance with a release build. Debug builds, especially under Windows are very slow indeed and will suggest bottlenecks that simply don't exist in final applications. Robert. On 21 October 2014 15:20, Chris Hidden ch...@erghis.com wrote: Hey everyone. I've come a far way since my last post. Our application is reading sensor data from the Leap Motion and we are interpreting this data and using OSG to display the hand models on scene. The issue now is that running on my laptop I get a tops of 20 fps. On other computers with lower specs the fr is abysmal. The way its set up right now is that we load the fbx model of a hand and traverse through its nodes. If it finds a bone and if it is one of the bones we want to affect we attach an updateCallback. The update callback queries our data for a new position and the position is updated using a matrix and then the new position is set: Code: osg::ref_ptrosgAnimation::Bonebone= dynamic_castosgAnimation::Bone*(node); if (bone) { ref_ptrosgAnimation::Bone parent = bone-getBoneParent(); const osg::Matrix matrix = _transforms.getMatrix(); _transforms.update (); setBoneOrientations (); setLocalMatrices (); setLocalTranslationsAndRotations(parent, matrix); if (parent) bone-setMatrixInSkeletonSpace(fingerSpace * fingerTranslation * parent-getMatrixInSkeletonSpace()); } traverse(node, nv); The setBoneOrientations(), setLocalMatrices() and setLocalTranslationsAndRotation() are methods used to manipulate the data so the it fits the position and rototaion on the screen properly. Basically converting the data to osg coordinate spaces. The viewer is basically just while(!viewer-done()) I believe in total we end up attaching a callback to about 40 - 50 bones. 20-25 on each hand. This doesn't feel like too much to process but Im no expert... far from it. Is this the reason causing my low frame rate? If so what are some steps or things to start looking at to improve performance. Thanks everyone! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61349#61349 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Hi Chris, one of the problem could be delays from sensors. to make things better I would suggest to have a three (maybe two will be enough, but generally an algo is such that it switches lists when either 'sensor' frame is finished and osg frame is finished - thus sensor frame and osg frame are completely separate and this requires three similar lists for sensor data ) lists which will store data from sensor - so that sensor thread pushes data to list and osg reads another list - and you switch pointers to lists everytime you make a frame() step - this way you don't wait for sensor data and process it as fast as osg can, but you always have a fresh data. Regards Sergey On Tue, Oct 21, 2014 at 6:41 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Chris, How to optimize your application will depend on where the bottleneck is. I'd suspect CPU, but as I don't have your application and data in front of me I can't really provide any specific advice. One thing I would suggest is making sure you are testing performance with a release build. Debug builds, especially under Windows are very slow indeed and will suggest bottlenecks that simply don't exist in final applications. Robert. On 21 October 2014 15:20, Chris Hidden ch...@erghis.com wrote: Hey everyone. I've come a far way since my last post. Our application is reading sensor data from the Leap Motion and we are interpreting this data and using OSG to display the hand models on scene. The issue now is that running on my laptop I get a tops of 20 fps. On other computers with lower specs the fr is abysmal. The way its set up right now is that we load the fbx model of a hand and traverse through its nodes. If it finds a bone and if it is one of the bones we want to affect we attach an updateCallback. The update callback queries our data for a new position and the position is updated using a matrix and then the new position is set: Code: osg::ref_ptrosgAnimation::Bonebone= dynamic_castosgAnimation::Bone*(node); if (bone) { ref_ptrosgAnimation::Bone parent = bone-getBoneParent(); const osg::Matrix matrix = _transforms.getMatrix(); _transforms.update (); setBoneOrientations (); setLocalMatrices (); setLocalTranslationsAndRotations(parent, matrix); if (parent) bone-setMatrixInSkeletonSpace(fingerSpace * fingerTranslation * parent-getMatrixInSkeletonSpace()); } traverse(node, nv); The setBoneOrientations(), setLocalMatrices() and setLocalTranslationsAndRotation() are methods used to manipulate the data so the it fits the position and rototaion on the screen properly. Basically converting the data to osg coordinate spaces. The viewer is basically just while(!viewer-done()) I believe in total we end up attaching a callback to about 40 - 50 bones. 20-25 on each hand. This doesn't feel like too much to process but Im no expert... far from it. Is this the reason causing my low frame rate? If so what are some steps or things to start looking at to improve performance. Thanks everyone! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61349#61349 ___ 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
Re: [osg-users] Low frame rate ( Update Callback on 50 bones ).
Thanks Robert and Sergey! I realize I was being a bit too general. I was just curious if having that many UpdateCallbacks would generally be an issue... but of course it all depends on what I am doing with everything. I took your advice and stepped through each step when creating the scene. I noticed right away that when I add my hand model, the FBX model, it slowed things down A LOT, even if it was just sitting still. So i opened it up in 3Ds maxed and noticed each hand had over 5000 vertices and 1 faces. I guess that is a bit much. I simplified the hands down to around 400 vertices and 800 faces per hand. This got me almost up to 30 fps Im wondering though if there is another way to solve this issue. The hands look OK now but were a lot nicer looking when they were more detailed. Ideally I should be over 30 fps always... Ill also give it a go tomorrow with implementing a list system sergey. We dont give info directly from the leap motion to OSG... it first runs through our API and is processed there... but it probably wouldnt hurt to create a similar list system in the OSG application as well. Thanks for you patience and help guys. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61354#61354 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org