[osg-users] Non emissive ParticleSystem and lighting

Christophe.medard christophe.medard at oktal.fr
Fri Mar 6 07:07:55 PST 2009

A patch solution could be introduced to give the impression ambient lighting works onto Particle System.

Into osgParticleSystem::update() method, after particles' update(dt) method call their _current_color are stepped.
We could there re-touch the stepped color and darken it according to an ambient color value if we can override setDefaultsAttributes not to have it enable LIGHTING when lighting parameter is true.

This trick should work provided :
1. ParticleSystem::setDefaultAttributes() method be set as virtual
2. Particle class be added a getColor()/setColor() method make it possible to read/write onto _current_color
3. We find a mean to get the active ambient lighting value in the place of the scenegraph where the ParticleSystem is attached

If someone has an idea for 3., I'm interested !
(A very ugly walkaround method would be to memorize a pointer onto the external osg::Vec4 value containing the ambient value and add a method into ParticleSystem interface just for this purpose, but how baaaaad !!!!)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090306/3ce8cb99/attachment-0002.htm>

More information about the osg-users mailing list