Multiple ModelNode - FPS DropDown

classic Classic list List threaded Threaded
4 messages Options
marcoma9023 marcoma9023
Reply | Threaded
Open this post in threaded view
|

Multiple ModelNode - FPS DropDown

Hi,

I'm currently trying to create a Vessel Traffic Monitoring for real-time traffic.

Then, to represent Boat I'm using an .obj or .3ds file. The logic to create a VesselModel is following:

1)I generate the node from the .obj file
osg::ref_ptr<osg::Node> fishVesselModel = osgDB::readNodeFile("osgearth-master/USA/FishingBoat/12219_boat_v2_L2.obj")

2)Through PositionAttitudeTransform I assign scale, orientation ...
Then, I assign the previous node as the child of attitude.

3)I create a osgEarth::Symbology::Style and I assign as Model the PositionAttitudeTransform

4)Then, the VesselModel is loaded as ModelNode and giving it the style as before.

Node -> PositionAttitudeTransform ->osgEarth::Symbology::Style->ModelNode

In the normal conditions, with as example 10 Boat in thw view, the FPS are 60.

Then, as test (but it can be a real condition), I'm trying to generate 1000 Boat.

If I have few ships inside the room, the FPS is high (60 FPS)


On the other hand, if I have a lot of ships in the room, the FPS is very low (2-5 FPS)



Do you have any solution?
Blanky Blanky
Reply | Threaded
Open this post in threaded view
|

Re: Multiple ModelNode - FPS DropDown

Hi Marcoma!

Unfortunately you've found the limitations of flat scene graphs. The CPU has to (for each osg::Viewer frame() call) iterate through all objects in the scene graph. If you don't break up the objects into parenting groups that may be culled (not rendered) because none of the children 's bounding boxes are within the osg::Viewer's camera. I'm assuming you've parented the osgEarth::ModelNodes to the root osgEarth::MapNode. By doing this, the frame() call actually traverses the graph for every single node. I bet if you made groups based on location (like moving things based on where they are latitudinally / longitudinally) and you zoom in a bit more, then you should see your FPS recover a bit. Zooming out will always be of this poor performance though since scene graph's, like osg, weren't meant for this type of behavior in the first place. Hopefully this information helps you a bit.

- Blanky
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Multiple ModelNode - FPS DropDown

Blanky is right. Depending on how complex your boat model is you may need to implement an LOD scheme. (This is more of an OSG topic, you could check the OSG mailing list for more info.) Also, ModelNode is kind of a "heavyweight" class that is more suited to earth file annotations -- you might fare better just using a simple GeoTransform above your model. Hope this helps.
Glenn Waldron / Pelican Mapping
Himbeertoni Himbeertoni
Reply | Threaded
Open this post in threaded view
|

Re: Multiple ModelNode - FPS DropDown

The obvious way to approach this would be OpenGL instancing, if you just need to display the same model 1000 times. You'd probably would not even need an LOD scheme, just a buffer to store 1000 transform matrices. However, I don't know how to setup instancing in OSG. osgEarth does seem to support instancing but for ground cover, not arbitrary models.