From b50af8ff4713fa1c8e6e939742b18a534d7fb1a1 Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Mon, 17 Apr 2017 10:30:49 +0300 Subject: [PATCH] Bugfix and noise seed option for ALS thrust flame shader --- Effects/thrust-flame.eff | 6 ++++++ Shaders/thrustflame-ALS.frag | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Effects/thrust-flame.eff b/Effects/thrust-flame.eff index be854b8f3..c5897ccce 100644 --- a/Effects/thrust-flame.eff +++ b/Effects/thrust-flame.eff @@ -24,6 +24,7 @@ 1.0 0.8 0.3 + 0.0 0.0 1 1 @@ -132,6 +133,11 @@ float noise_scale + + random_seed + float + random_seed + flame_color_low_r float diff --git a/Shaders/thrustflame-ALS.frag b/Shaders/thrustflame-ALS.frag index f2179dd2b..9fedd6921 100644 --- a/Shaders/thrustflame-ALS.frag +++ b/Shaders/thrustflame-ALS.frag @@ -14,6 +14,7 @@ uniform float shock_frequency; uniform float noise_strength; uniform float noise_scale; uniform float deflection_coeff; +uniform float random_seed; uniform float flame_color_low_r; uniform float flame_color_low_g; @@ -65,7 +66,7 @@ if (d_rad > radius) {return 0.0;} if (use_noise ==1) { - noise = Noise2D(vec2(pos.x - osg_SimulationTime * 30.0 , d_rad), noise_scale); + noise = Noise2D(vec2(pos.x - osg_SimulationTime * 30.0 + random_seed , d_rad), noise_scale); } density *= (1.0 - smoothstep(0.125, radius, d_rad)) * (1.0 - noise_strength + noise_strength* noise); @@ -73,7 +74,7 @@ density *= (1.0 - smoothstep(0.125, radius, d_rad)) * (1.0 - noise_strength + no if (use_shocks == 1) { float shock = sin(pos.x * 10.0 * shock_frequency); - density += shock * shock * shock * shock * (1.0 - longFade) * (1.0 - smoothstep(0.25*flame_radius_fraction, 0.5*flame_radius_fraction, d_rad)) * (1.0 - smoothstep(0.0, 1.0, thrust_collimation)); + density += shock * shock * shock * shock * (1.0 - longFade) * (1.0 - smoothstep(0.25*flame_radius_fraction, 0.5*flame_radius_fraction, d_rad)) * (1.0 - smoothstep(0.0, 1.0, thrust_collimation)) * (1.0 + 0.5 * base_flame_density); } @@ -133,7 +134,7 @@ vec3 flame_color_low = vec3 (flame_color_low_r, flame_color_low_g, flame_color_l vec3 flame_color_high = vec3 (flame_color_high_r, flame_color_high_g, flame_color_high_b); vec3 color = mix(flame_color_low, flame_color_high, density2); -color = mix(color, vec3(0.8, 1.0, 1.0), density1); +color = mix(color, vec3(base_flame_r, base_flame_g, base_flame_b), density1); vec4 finalColor = vec4 (color.rgb, density);