Premultiply alpha for particles too.
This commit is contained in:
parent
6936f30b36
commit
648d076e00
@ -20,6 +20,5 @@ void main(void)
|
||||
EnvPos /= EnvPos.w;
|
||||
float alpha = clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.);
|
||||
vec4 color = texture(tex, tc) * vec4(pc, 1.0);
|
||||
color.a *= alpha * smoothstep(1., 0.8, lf);
|
||||
FragColor = vec4(color.rgb * color.a, color.a);
|
||||
FragColor = color * alpha * smoothstep(1., 0.8, lf);
|
||||
}
|
||||
|
@ -351,7 +351,9 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
|
||||
{
|
||||
for (unsigned i = 0; i < w * h; i++)
|
||||
{
|
||||
float alpha = pow(data[4 * i + 3] / 255., 1. / 2.2);
|
||||
float alpha = data[4 * i + 3];
|
||||
if (alpha > 0.)
|
||||
alpha = pow(alpha / 255., 1. / 2.2);
|
||||
data[4 * i] *= alpha;
|
||||
data[4 * i + 1] *= alpha;
|
||||
data[4 * i + 2] *= alpha;
|
||||
|
@ -360,7 +360,7 @@ void ParticleSystemProxy::setEmitter(scene::IParticleEmitter* emitter)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
video::ITexture *tex = getMaterial(0).getTexture(0);
|
||||
compressTexture(tex, true);
|
||||
compressTexture(tex, true, true);
|
||||
texture = getTextureGLuint(getMaterial(0).getTexture(0));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user