Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Robert Osfield
Hi JS, On Tue, Jun 15, 2010 at 7:16 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: I thought manually sorting all vertices might be too long since I can have hundreds or thousands of sprites... But maybe not, I'd have to try it. Also the other method I have of rendering the

Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Jean-Sébastien Guay
Hi Robert, If you use billboard quads then the OSG will have to depth sort all the osg::Geometry of the quads, as well as do the cull and draw traversals through all the separate nodes and geometry. Sorting just a index array will only have the cost of the sort, and given the nature of the

Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Jean-Sébastien Guay
Hi again Paul, Another idea: draw your point sprites after all the opaque geometry, with depth write disabled and depth test enabled. Then they will interact in z correctly with other objects in your scene. This will result in some visual artifacts due to incorrect ordering of the point

Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Robert Osfield
Hi JS, On Wed, Jun 16, 2010 at 1:51 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: That's what I'm doing now. It works OK, but not that great. The problem is compounded by the fact that my particles represent dirt, and so the particles are generally pretty close together, which

Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Robert Osfield
Hi JS, On Wed, Jun 16, 2010 at 1:47 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Just to make sure I understand, you don't mean sorting the indices themselves, right? That would always give 0...n of course... So I'd have to calculate the distance between the eye and the

Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Jean-Sébastien Guay
Hi Robert, Your sort functor would take a reference to the Vec3Array+lookvector or an array of the distances to sort against and then make decision of based on the dereferencing the indices. Preparing an array of distances based would mean you only do the compute of the distance once per

Re: [osg-users] Using point sprites for particles - blending

2010-06-16 Thread Jean-Sébastien Guay
Hi Robert, Have you tried doing the two pass strategy - first the opaque pass clipping out the alpha 1.0, then a second blended pass accepting all alpha 1.0. This won't cure the ordering issue completely but it will lead to less obvious artefact's as it'll only be the transparent edge that

[osg-users] Using point sprites for particles - blending

2010-06-15 Thread Jean-Sébastien Guay
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

Re: [osg-users] Using point sprites for particles - blending

2010-06-15 Thread Robert Osfield
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

Re: [osg-users] Using point sprites for particles - blending

2010-06-15 Thread Jean-Sébastien Guay
Hi Robert, 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. I thought manually sorting all vertices

Re: [osg-users] Using point sprites for particles - blending

2010-06-15 Thread Jean-Sébastien Guay
Hi Paul, Another idea: draw your point sprites after all the opaque geometry, with depth write disabled and depth test enabled. Then they will interact in z correctly with other objects in your scene. This will result in some visual artifacts due to incorrect ordering of the point sprites, of