Make particles in GLES renderer to look a bit better.

Now kart exhaust is not too dark anymore.
This commit is contained in:
Deve 2017-09-02 01:01:35 +02:00
parent f07a7062b3
commit 6f11a1669f
3 changed files with 9 additions and 7 deletions

View File

@ -22,7 +22,7 @@ float anglespeed;
out float lf;
out vec2 tc;
out vec3 pc;
out vec4 pc;
void main(void)
{
@ -68,5 +68,5 @@ void main(void)
vec4 viewpos = ViewMatrix * vec4(newposition + newquadcorner, 1.0);
gl_Position = ProjectionMatrix * viewpos;
pc = vec3(1.);
pc = vec4(1.);
}

View File

@ -4,7 +4,7 @@ uniform mat4 invproj;
in float lf;
in vec2 tc;
in vec3 pc;
in vec4 pc;
out vec4 FragColor;
#stk_include "utils/getPosFromUVDepth.frag"
@ -17,6 +17,5 @@ void main(void)
float EnvZ = texture(dtex, xy).x;
vec4 EnvPos = getPosFromUVDepth(vec3(xy, EnvZ), InverseProjectionMatrix);
float alpha = clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.);
vec4 color = texture(tex, tc) * vec4(pc, 1.0);
FragColor = color * alpha * smoothstep(1., 0.8, lf);
FragColor = texture(tex, tc) * pc * alpha;
}

View File

@ -19,13 +19,16 @@ in vec2 quadcorner;
out float lf;
out vec2 tc;
out vec3 pc;
out vec4 pc;
void main(void)
{
tc = Texcoord;
lf = lifetime;
pc = color_from + (color_to - color_from) * lifetime;
pc = vec4(vec3(color_from + (color_to - color_from) * lf), 1.0) * smoothstep(1., 0.8, lf);
#if defined(GL_ES) && !defined(Advanced_Lighting_Enabled)
pc.rgb = pow(pc.rgb, vec3(1. / 2.2));
#endif
vec3 newposition = Position;
vec4 viewpos = ViewMatrix * vec4(newposition, 1.0);