Game Development Community

SetBlendColour() on paritcle effect?

by Jason McIntosh · in Torque Game Builder · 07/25/2005 (1:46 pm) · 5 replies

Does this work or am I doing it wrong?
%eff = new fxParticleEffect2D() { scenegraph etc };
%eff.loadEffect( "mine.eff" );
// setLayer etc here
%eff.playEffect();
%eff.setBlendColour( "255 0 255 255" ); // has no effect?
Please tell me I'm doing it wrong. :)

#1
07/25/2005 (4:10 pm)
Read my resource on doing blending. It will tell you everything you need to know. Or, most of it, anyway.
#2
07/25/2005 (7:10 pm)
Thanks for the link, Smaug.

I'm not sure it's the same as what I am asking, though. I know what blending equations are, etc, but if I call .setBlendColour() on a sprite, for example, it will change the color as specified. If I do it with a particle effect, nothing changes. I suspect it's because the particles also have their own red_life, green_life, blue_life color values and those must override the .setBlendColour() call.

I managed to get the effect I was looking for by changing each of the red_life, green_life, and blue_life graph values "by hand" with a wrapper call. It's not generically applicable, but it does what I needed it to.

I guess I could maybe get a similar effect by making direct GL calls? I'm not sure, since you can't touch individual particles that way that I'm aware of (from script). I'm not going to dig into the engine just for this, though. I prefer to keep C++ modifications minimal.
#3
07/26/2005 (7:05 am)
Jason,

As you say, the particles have their own colourisation/blending controls and bypass this setting. This is because particles control this stuff over time rather than a single setting.

Your wrapper call is the way to go so as you say, it is possible to write a call that writes over the first keys of red, green, blue but it would either have to assume a single key or enforce it. This could very confusing for others though but I'm open to suggestions.

I'm going to try to document the handful of these functional exceptions at some point as they are in lots of cases unavoidable.

The only thing I'll add it that the particle effect isn't something that emits particles, it's a container for particle-emitters. It's these that would contain any funtctionality, not the particle effect.

- Melv.
#4
07/26/2005 (7:44 am)
If these kinds of exceptions are documented, that should be good enough. It wasn't difficult to write the wrapper, etc, just didn't realize why it didn't work at first. :)

Thanks for the reply.
#5
07/26/2005 (9:26 am)
Agreed. I'll add this job to my list.

Thanks.

- Melv.