Hi Fred,

On Sat, Dec 13, 2008 at 4:02 PM, Frederic Bouvier <[email protected]> wrote:
> The same problem affect FlightGear too : it rains into the cockpit.
> Would it be possible to kill a particle when it comes under a certain
> distance from the viewer ?
>
> If you want to see this funny effect in action, watch this video
> http://www.vimeo.com/2511328 ( move forward to 5:00 )

The particle positions are generated down in the vertex program, so to
cull based on position them you'd need to add logic into the vertex
program to modify the alpha value to 0.0 to make it disappear.   It's
worth mentioning you can't cull vertices and associated primitives
with a vertex program as it's strictly one vertex one vertex out.  You
could use a geometry shader to cull, or a fragment shader.

A simpler route would be to use the stencil buffer to clip out the
fragment where you don't want rain.

Another route would be to drawn the scene in two passes, first draw
the terrain and precipitation effect, then draw the cockpit.   Using
such an approach would allow you to depth partition the scene and get
better depth precision for the two parts of the scene.  Personally
this would be the route I'd take.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to