Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualVincent_M

Posted 15 May 2013 - 10:00 AM

I'm trying to perform additive blending for my particle engine, and I'm having some issues getting this right. I'm using a 128x128 texture that's in a 32-bit R8G8B8A8 format. When I try rendering my particle with additive blending using GL_ONE for both source and destination alpha, I get flat colors with overall blending applied to it instead of blending applied from my texture. I have a screenshot showing that below. When I try using GL_SRC_ALPHA for glBlendFunc's source alpha, and GL_ONE for destination alpha, I get better results, but it's still not perfect. As the sprite particles move into themselves, you'll notice the dark, round edges of the particle cutting into adjacent particles. There's a screenshot displaying that as well. I've also attached the 32-bit RGBA texture I'm using as well. I also have GL_DEPTH_TEST disabled.

 

 

EDIT: Here's how I'm shading my sprite in the shader:

gl_FragColor = texture2D(u_texture, v_coord) * v_color;

 

v_color: vec4 vertex color

 

Here are the colors for each sprite:

 

sprite[0]->SetColor(Color32b(255, 64, 64,255));

sprite[1]->SetColor(Color32b(255, 64,255,255));

sprite[2]->SetColor(Color32b(255,255, 64,255));

sprite[3]->SetColor(Color32b( 64, 64,255,255));

 


#1Vincent_M

Posted 15 May 2013 - 09:56 AM

I'm trying to perform additive blending for my particle engine, and I'm having some issues getting this right. I'm using a 128x128 texture that's in a 32-bit R8G8B8A8 format.

 

When I try rendering my particle with additive blending using GL_ONE for both source and destination alpha, I get flat colors with overall blending applied to it instead of blending applied from my texture. I have a screenshot showing that below.

 

When I try using GL_SRC_ALPHA for glBlendFunc's source alpha, and GL_ONE for destination alpha, I get better results, but it's still not perfect. As the sprite particles move into themselves, you'll notice the dark, round edges of the particle cutting into adjacent particles. There's a screenshot displaying that as well.

 

I've also attached the 32-bit RGBA texture I'm using as well. I also have GL_DEPTH_TEST disabled.


PARTNERS