[osg-users] Displaying cables
Laurent Di Cesare
laurent.dicesare at masagroup.net
Mon Feb 4 09:09:33 PST 2008
Jean-Sébastien Guay wrote :
> Hello,
>
> For now, we are creating some geometry (quad strips, specifically) to
> display the cables, and assigning texture coordinates to that geometry,
> on the fly.
>
(...)
> I know the cable display needs to be optimized because if I just set the
> cables' nodemasks to 0, the draw times go from 6.6ms to 2.2ms (for the
> same view). And there are not *that* many cables... There's a lot of
> other geometry in the scene which is still drawn in the 2.2ms time...
>
> So I would appreciate some pointers. I would have assumed quad strips
> are pretty fast, so perhaps something else is the problem?
>
> There's the fact that the geometry is dynamic, which could mean that OSG
> is trying to recreate display lists each frame, but I tried
> setUseDisplayList(false) on the geometry and the cables just did not
> display anymore... Is there something else I need to do in that case?
>
I have a somewhat similar situation myself. I use capsules to display
hoses,
which aren't textured but just have a color, and use display lists.
Capsules are just cylinders and half spheres, but these are made of a
lot of vertices.
I ran at something like 1-2 fps(!) when I was redrawing the whole hose
everytime the hose changed.
When no geometry changed, I shot back to around 25 fps.
I got three times faster when I limited myself to changing only the end
of the hose, thus keeping the same capsules rather than replacing them
with new ones with the same coordinates, color, etc.
I then got another factor 3 by making sure I drew as few capsules as I
needed.
In my case too, the capsules are not that many, I have tens of animated
characters moving around, plus a scene to render, but the dynamic shapes
ate way more than anything else.
I'm not sure if this helps a lot, but I just did this today, and
optimizing the geometry was clearly a big win for me.
If your app doesn't change all the cables at once, only one part of one
cable at a time (a given frame), keeping the geometry should give you a
decent boost.
If anyone else has other suggestions, I'm interested to hear them too.
Sincerely,
Laurent Di Cesare.
More information about the osg-users
mailing list