Hi JS,
A couple of ideas off the top of my head are:
1) Do two passes, a first pass that draws all the fully opaque parts
and then a
second that does the blended parts. First pass with blending
off, and alpha func
set to clip out all fragments that have an alpha of less than 1.0
(or similar high cut
off). The second pass then does the opposite - just accepting
everything or
everything below 1.0 (or your cut off).
2) Do fine grained depth sorting via a cull/draw callback. I'd sort contents of
a DrawElements rather than the vertices themselves, as this would allow
you to manage the vertices consistently in an animation/update
code you have.
3) Break your particles into clumbs and the let the OSG does it's usual depth
sorting. Results will be better than crap, but possibly not that
much better...
4) Have your particles entered into an osg::Geometry/custom geometry, and have
a drawImplementation/draw callback that selects an appropriate DrawElements
that has been presorted for the viewing direction the viewing is currently
looking from. Such an approach will work best with static data though.
Perhaps others in the community will be able to chip in with their own
ideas, no doubt there will be plenty ;-)
Robert.
On Tue, Jun 15, 2010 at 5:48 PM, Jean-Sébastien Guay
<[email protected]> wrote:
> Hi all,
>
> I saw a post from Robert today suggesting to use osg::PointSprite for
> particles.
>
> One question I have about that is - say the texture you use for the point
> sprite looks like a dust particle, with the contour transparent and the
> edges semitransparent. Since the sprites are rendered from a single
> Geometry, OSG won't sort the particles from back to front in eye space, so
> the transparency will look bad. On the other hand, I can't use a
> BlendFunc(SRC_ALPHA,DST_ALPHA) because I don't want it to look like light
> points either - that will give additive blending, which is not what I want.
> And I can't disable depth test or anything like that because my particles
> are supposed to interact with other objects, for example be contained in a
> shovel.
>
> Does anyone have any tips about how to handle this case? Seems to me like it
> would be a pretty common thing to do.
>
> Thanks in advance,
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay [email protected]
> http://www.cm-labs.com/
> http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org