From 7a95d46448c2619bb0a8f20edefd5227d7209e4f Mon Sep 17 00:00:00 2001 From: vincentlj Date: Mon, 6 Jan 2014 22:35:54 +0000 Subject: [PATCH] GPUParticles: Use smoothstep for fade out and remove direction modulation by size. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14944 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/shaders/particle.frag | 2 +- src/graphics/gpuparticles.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/shaders/particle.frag b/data/shaders/particle.frag index 3587367b0..08157c24e 100644 --- a/data/shaders/particle.frag +++ b/data/shaders/particle.frag @@ -21,5 +21,5 @@ void main(void) float len = dot(vec3(1.0), abs(texture2D(normals_and_depth, xy).xyz)); float alpha = (len < 0.2) ? 1. : clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.); color = texture2D(texture, tc); - color.a *= alpha * (1. - lf); + color.a *= alpha * smoothstep(1., 0.8, lf); } diff --git a/src/graphics/gpuparticles.cpp b/src/graphics/gpuparticles.cpp index 34285e935..1de3853ec 100644 --- a/src/graphics/gpuparticles.cpp +++ b/src/graphics/gpuparticles.cpp @@ -116,9 +116,9 @@ void generateLifetimeSizeDirection(scene::IParticleEmitter *emitter, float &life particledir.rotateYZBy(os::Randomizer::frand() * emitter->getMaxAngleDegrees()); particledir.rotateXZBy(os::Randomizer::frand() * emitter->getMaxAngleDegrees()); - dirX = particledir.X / size; - dirY = particledir.Y / size; - dirZ = particledir.Z / size; + dirX = particledir.X; + dirY = particledir.Y; + dirZ = particledir.Z; } struct ParticleData