Artifacts when draw particles with some alpha
Posted
by
piotrek
on Game Development
See other posts from Game Development
or by piotrek
Published on 2012-09-16T14:28:06Z
Indexed on
2012/09/16
15:52 UTC
Read the original article
Hit count: 239
I want to draw in my game some particles. But when I draw one particle above another particle, alpha channel from this above "clear" previous drawed particle. I set in OpenGL blend in this way:
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
My fragment shader for particle is very simple:
precision highp float;
precision highp int;
uniform sampler2D u_maps[2];
varying vec2 v_texture;
uniform float opaque;
uniform vec3 colorize;
void main()
{
vec4 texColor = texture2D(u_maps[0], v_texture);
gl_FragColor.rgb = texColor.rgb * colorize.rgb;
gl_FragColor.a = texColor.a * opaque;
}
I attach screenshot from this:
Do you know what I made wrong ?
I use OpenGL ES 2.0.
© Game Development or respective owner