Particles how to blend them correctly

Started by
4 comments, last by dmatter 16 years, 7 months ago
Hi folks, here is the problem: as you can see the computer plane has a red trail, the first problem is as you can see clearly is that it renders very strange, now I think that this is because the render order is not correct however I hope it is not. I'd like that the alpha parts are really seen as alph not just alpha but everything after it is still drawn behind it :( second question, How can I blend it in such a way that it kinda lights up instead of just being a red trail. like: I hope you guys can help me out here :D greets, ghoti
Advertisement
Alpha objects are usually drawn last from back to front. That way they don't occlude each other, don't interfere with everything else, and properly blend on top of anything already rendered.

To make a glowing effect, you'll probably have to go with a specialized texture that has a bright center and fades a lot at the edges. That way, when you render a lot of them layered against each other, you'l get an intense center with a glow effect around them. It's likely that the example you posted involves more than just the same texture layered with multiple particles, though. You may need special flare textures that you can render last.

[Edited by - Waverider on September 5, 2007 10:16:06 AM]
It's not what you're taught, it's what you learn.
To get a sparkly particle effect you want to use additive blending. In OpenGL that's done with glBlendFunc(GL_SRC_ALPHA, GL_ONE), but you look like you've got default blending currently (glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).

It looks like you've left depth testing on for the particles, which causes them to block ones behind them. To fix this draw your particles last, and disable depth writing (glDepthWrite(false)) but leave depth testing enabled. Fortunately additive blending doesn't need particles to be sorted so you can just draw them in any order.

And don't forget to put your state back to it's previous setting so you don't affect other objects drawn after your particle system.
Looks to me like OrangyTang's got the answer - enable depth testing but disable depth writing. Should sort your problems out [smile]

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

hi,

sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); is the function is use, like you said, GU_ONE is not present.

here is what I can use:

GU_SRC_COLOR
GU_ONE_MINUS_SRC_COLOR
GU_SRC_ALPHA
GU_ONE_MINUS_SRC_ALPHA
GU_DST_ALPHA
GU_ONE_MINUS_DST_ALPHA
GU_DST_COLOR
GU_ONE_MINUS_DST_COLOR
GU_FIX

FIX i have tried and that does not work! I'll try them all but I also see that the color of the texture affects how it is rendered so maybe I use wrong colors so please let me know which one to use to get the desired effect.
Have you tried

sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_FIX, 0, 0x00ffffff);

This topic is closed to new replies.

Advertisement