[osg-users] Displaying cables
Mike Weiblen
mweiblen at zebraimaging.com
Mon Feb 4 10:40:55 PST 2008
Hi J-S
Some thoughts...
- any ideas on exactly where you're bottlenecked?
- if perception of cable width is critical, how are you ensuring the quads are orthogonal to the viewer? Billboards, adjusting the quad verts, viewer/quad relationship is fixed, etc?
- quadstrips are converted to tristrips in the driver; perhaps there's advantage in dispatching tristrips directly.
- Ideally, and your target hardware supports it, suggest dispatch linestrip and tessellate each linesegment into a pair of tris in a geometry shader. A vertex shader could take care of texcoord computation given cable/segment lengths.
Cheers
-- mew
> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-
> bounces at lists.openscenegraph.org] On Behalf Of Jean-Sébastien Guay
> Sent: Monday, February 04, 2008 9:43 AM
> To: OpenSceneGraph Users
> Subject: [osg-users] Displaying cables
>
> Hello,
>
> I imagine this is pretty common, I'm just looking for a few hints of
> how
> to optimize things.
>
> Our apps need to display cables (and most of the time, a large number
> of
> them). The cables themselves are controlled by a physical simulation
> which gives us a set of transforms for the ends of each segment of a
> cable.
>
> For now, we are creating some geometry (quad strips, specifically) to
> display the cables, and assigning texture coordinates to that geometry,
> on the fly. This is needed because if, for example, a cable is
> lengthened (because it's being spooled out of a pulley system for
> example) the texture shouldn't stretch over it. Similarly, if the
> physical simulation subdivides the cable into more segments than it was
> in the last frame, we need to have correct texture coordinates to
> (hopefully) make the fact that the cable now has more, shorter segments
> invisible to the user.
>
> 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?
>
> Thanks in advance,
>
> J-S
More information about the osg-users
mailing list