1

Why preformance is droping down when I load for example a 4900 of nodes to scene? If there a 125 it's ok, 200 still ok, but if there are more of them rendering framerate is droping dramaticaly? Root node contains childs that contains (model (in 3ds) + texture + some science calculation) and all created in cylce from 0 to 4899. I have tried to use osgUtil::Optimizer on root after all childs where in place but still no improvments. Tried to put all nodes in one geode but it didn't help too. How can I achieve balance between performance and number of nodes?

Azraith Sherkhan
  • 131
  • 2
  • 11
  • Really, to make the best suggestions, we'd have to know what kind of nodes these are and what they represent. Different strategies (instancing, etc) are used for different situations. – XenonofArcticus Apr 06 '15 at 16:49

1 Answers1

1

4900 nodes seems an awful lot of nodes!

You should start reading about LOD and PagedLOD. PageLOD will improve the performance. The idea is like this (imagine that the first image is a lot farther):

Low detail

High detail

Since you are far far away, you don't want a lot of detail. But when you zoom in, you want to see those details. You'll have to specify what models go in each LOD level and how you want to activate them. That's the tricky part.

Also, check if you can share nodes. For example, instead of having 4 different wheels, you just create one wheel. Then, add 4 PositionAttitudeTransform/MatrixTransform and add the wheel node to each of them. The same goes for StateAttributes, share them when possible!

Finally, if you have a lot of repeated geoms, take a look at geometry instancing.

Adri C.S.
  • 2,909
  • 5
  • 36
  • 63
  • Thanks a lot! It's looks like performance got a huge boost, but when I add all nodes to scene camera's behavior is going strange. For exampe if I get radius of camera's bounding sphere radius before i add whole bunch of nodes in scene it's equal something around 12.5f, but when all nodes in scene it going to 18000.0f. And second is there any way to set camera bit further from viewport (zoomout it a bit). – Azraith Sherkhan Apr 05 '15 at 15:40
  • For the camera, take a look [here](http://stackoverflow.com/questions/21180092/openscenegraph-set-the-camera-at-an-initial-position); the accepted answer has very useful comments on the camera. About your other problem: what is the misbehaviour when the camera radius changes? I don't quite understand :) – Adri C.S. Apr 06 '15 at 08:05
  • I'll try explain it. I have a trackball manipulator, when scene is empty camera movement is ok I can pan it by middle button of mouse very well, but when I add nodes to scene, and click on middle button makes everything disappear from camera. Only thing that I have noticed that is happen when camera radius is going insane 18k value. I can make a suggestion that trackball manipulator movement have some bound with camera's radius but can't get where this bound actually is. Other things such a Right Button and Left Button works normally. – Azraith Sherkhan Apr 07 '15 at 08:18
  • I had some issues with the manipulator too, and went directly to the code. I don't remember where it was, but the files I touched where the `OrbitManipulator` and the `TrackballManipulator` classes (maybe the `StandardManipulator` too). I changed a value in the `pan` method to reduce the 'speed' of the pan. It's a hack and probably it'd be better to add a custom manipulator of my own, but... :) – Adri C.S. Apr 07 '15 at 08:24