add heat effect when on fire

This commit is contained in:
Xonk
2025-03-28 00:56:15 -04:00
parent 67da0ac493
commit 5a278d61ed
4 changed files with 27 additions and 18 deletions

View File

@ -12,6 +12,7 @@
uniform float exitWater;
uniform float enterWater;
uniform float exitLava;
// uniform float exitPowderSnow;
uniform int isEyeInWater;
@ -75,21 +76,33 @@ void applyGameplayEffects(inout vec3 color, in vec2 texcoord, float noise){
distortmask = max(distortmask, waterDrops);
}
if(enterWater > 0.0){
vec2 zoomTC = 0.5 + (texcoord - 0.5) * (1.0 - (1.0-sqrt(1.0-enterWater)));
vec2 zoomTC = 0.5 + (texcoord - 0.5) * (1.0 - (1.0-sqrt(1.0-enterWater)) );
float waterSplash = texture2D(noisetex, zoomTC * vec2(aspectRatio,1.0)).r * (1.0-enterWater);
distortmask = max(distortmask, waterSplash);
}
#endif
//////////////////////// HEAT DISTORTION /////////////////////
#if defined ON_FIRE_DISTORT_EFFECT
if(exitLava > 0.0){
vec2 zoomin = 0.5 + (texcoord - 0.5) * (1.0-pow(1.0-clamp(-texcoord.y*0.5+0.75,0.0,1.0),1.0)) * (1.0-pow(1.0-exitLava,2.0));
vec2 UV = zoomin;
float flameDistort = texture2D(noisetex, UV * vec2(aspectRatio,1.0) - vec2(0.0,frameTimeCounter*0.3)).b * clamp(-texcoord.y*0.3+0.3,0.0,1.0) * 0.75 * exitLava;
distortmask = max(distortmask, flameDistort);
}
#endif
//////////////////////// APPLY DISTORTION /////////////////////
// all of the distortion will be based around zooming the UV in the center
vec2 zoomUV = 0.5 + (texcoord - 0.5) * (1.0 - distortmask);
vec3 distortedColor = texture2D(colortex7, zoomUV).rgb;
#ifdef WATER_ON_CAMERA_EFFECT
#if defined WATER_ON_CAMERA_EFFECT || defined ON_FIRE_DISTORT_EFFECT
// apply the distorted water color to the scene, but revert back to before when it ends
if(exitWater > 0.01) color = distortedColor;
if(exitWater > 0.01 || exitLava > 0.01) color = distortedColor;
#endif