HI Christophe,

Thanks for the example.  I am not surprised that their are lighting
problems as particles don't have any unique normal, so there is no
point providing one.  A normal on a particle would only make sense if
you were simulating a planer particle, such as a chunk of armour
plating, for all other cases a single normal makes no sense, and
OpenGL vertex lighting will never produce an all round appropriate
behaviour.

I think the only way would could add some form of lighting sensitivity
into osgParticle would be have a pseudo lighting calculation done for
a whole ParicleSystem or perhaps individual Particle, this will come
up with a colour modulation of the particle that appears to take into
account diffuse and ambient colours in a way that makes sense.
Exactly how you'd want it to take account of the light source will
depend on the particle type.  For instance fire and exposion are
definitely something that is emissive, while smoke or debri style
particles would be something that  does take into account diffuse and
ambient lighting.  For best results I guess you'd even want to place a
light source at the center of an explosion.

Robert.

On Mon, Feb 23, 2009 at 5:13 PM, MEDARD Christophe
<[email protected]> wrote:
> Here is the source code of the osgparticle example a bit modify to show the
> issue with lighting.
> The key is the lighting parameter of the setDefaultParameters() method.
> I've created a box reacting both to ambient and diffuse to have a reference on
> lighting conditions in the scene.
>
> Diffuse lighting :
> In fact, while playing a bit with this sample, it seems that the diffuse
> lighting is taken into account when the lightsource is at 'one certain 
> position
> relative to the particles'. However, this one is unpredictable (there is no
> normal per vertex set onto particles sprites, so how odd ?) and must surely 
> vary
> with the manner the particlesystem animation is set/implemented (emitters and
> programs).
>
> Ambient lighting :
> If you set no diffuse light but an ambient in the scene the particles remain
> unvariably black, unreacting to it.
>
> If anybody has an idea of code modification to make it work. I'm highly
> interested !
> Again, just one of the two kind of lighting (diffuse or ambient) would be 
> enough
> for me to be happy !  ;)
>
> Christophe
>
>
> PS: I'm using myself customized PS subclasses (to ensure deterministic 
> randoms,
> and
> other things) and a bit more complex lighting conditions model, but the 
> problem
> I notice
> must be same.
>
> --- Message d'origine ---
>> De : MEDARD Christophe <[email protected]>
>> À : OpenSceneGraph Users <[email protected]>
>> Sujet : Re: [osg-users] Non emissive ParticleSystem and lighting
>> Date : lun 23 fév 2009 09:56:12 CET
>>
>> Sukender's post lets me know I'm not the only one having the problem, so I
>> must do things correctly.
>>
>> Sure, using the particles systems as emissive and changing on the run
>> particles
>> colors would work, but it's a pain (!).
>> Having a specific set of classes taking care of the internals of the particle
>> behaviour should allow the programmer to let them live they life whatever the
>> changing of conditions. Besides, it's what the interface leads to expect, the
>> emissive and lighting boolean being free to take the 'false' value (actually
>> I don't understand why it doesn't work - at least concerning the ambient -,
>> since
>> in the implementation everything seems to be done to enable LIGHTING onto the
>> stateset... but I must be missing something).
>>
>> If useful, I'll try today to find some time to modify the simple sample code
>> to show the problem.
>> As I recall, the key is the lighting parameter, the emissive_particles ones
>> allowing just to have an additive blend func on sprites...
>> I'm using myself customized PS subclasses (to ensure deterministic randoms,
>> and other things) and a bit more complex lighting conditions model, but the
>> anomaly will be same.
>>
>> Christophe
>>
>> --- Message d'origine ---
>> > De : Robert Osfield <[email protected]>
>> > À : OpenSceneGraph Users <[email protected]>
>> > Sujet : Re: [osg-users] Non emissive ParticleSystem and lighting
>> > Date : dim 22 fév 2009 11:41:45 CET
>> >
>> > Can't you change the particle colour to be appropriate for different
>> > times of day?
>> >
>> > Robert.
>>
>
>
> _______________________________________________
> 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

Reply via email to