Remake post effects for taking damage, and make use of IRIS features to detect low health. ADDED new submenu "GAMPLAY POST EFFECTS"

This commit is contained in:
Xonk
2024-03-27 16:11:28 -04:00
parent 1a6e378870
commit 0fc3d21d8a
5 changed files with 129 additions and 29 deletions

View File

@ -0,0 +1,73 @@
#ifdef IS_IRIS
uniform float currentPlayerHealth;
uniform float maxPlayerHealth;
uniform float oneHeart;
uniform float threeHeart;
#else
uniform bool isDead;
#endif
uniform float hurt;
// uniform float currentPlayerHunger;
// uniform float maxPlayerHunger;
// uniform float currentPlayerArmor;
// uniform float maxPlayerArmor;
// uniform float currentPlayerAir;
// uniform float maxPlayerAir;
// uniform bool is_sneaking;
// uniform bool is_sprinting;
// uniform bool is_hurt;
// uniform bool is_invisible;
// uniform bool is_burning;
// uniform bool is_on_ground;
// uniform bool isSpectator;
void applyGameplayEffects_FRAGMENT(inout vec3 color, in vec2 texcoord){
#if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT
// detect when health is zero
#ifdef IS_IRIS
bool isDead = currentPlayerHealth * maxPlayerHealth <= 0.0 && currentPlayerHealth > -1;
#else
float oneHeart = 0.0;
float threeHeart = 0.0;
#endif
float vignette = sqrt(clamp(dot(texcoord*2.0 - 1.0, texcoord*2.0 - 1.0) * 0.5, 0.0, 1.0));
// heart beat effect to scale stuff with, make it more intense. theres a multiplier "MOTION_AMOUNT" for accessiblity
float beatingRate = isDead ? 0.0 : (oneHeart > 0.0 ? 15.0 : 7.5);
float heartBeat = (pow(sin(frameTimeCounter * beatingRate)*0.5+0.5,2.0)*0.2 + 0.1);
// scale UV to be more and more lower frequency towards the edges of the screen, to create a tunnel vision effect,
vec2 zoomUV = 0.5 + (texcoord - 0.5) * (1.0 - vignette * (isDead ? 0.7 : heartBeat * MOTION_AMOUNT));
vec3 distortedScreen = vec3(1.0, 0.0, 0.0) * dot(texture2D(colortex7, zoomUV).rgb, vec3(0.21, 0.72, 0.07));
#ifdef LOW_HEALTH_EFFECT
// at 1 heart or 3 hearts, create 2 levels of a strain / tunnel vision effect.
// black and white version of the scene color.
vec3 colorLuma = vec3(1.0, 1.0, 1.0) * dot(color,vec3(0.21, 0.72, 0.07));
// I LOVE LINEAR INTERPOLATION
color = mix(color, mix(colorLuma, distortedScreen, vignette), mix(vignette * threeHeart, oneHeart, oneHeart));
if(isDead) color = distortedScreen*0.3;
#endif
#ifdef DAMAGE_TAKEN_EFFECT
// when damage is taken, flash the above effect. because it uses the stuff above, it seamlessly blends to them.
color = mix(color, distortedScreen, (vignette*vignette) * sqrt(hurt));
#endif
// if(isDead) color = vec3(0);
#endif
}

View File

@ -579,6 +579,15 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
//#define BICUBIC_UPSCALING
///////////////////////////////////////////////////////
// ----- GAMEPLAY POST EFFECT RELATED SETTINGS ----- //
///////////////////////////////////////////////////////
#define MOTION_AMOUNT 0.25 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#define DAMAGE_TAKEN_EFFECT
#define LOW_HEALTH_EFFECT
/////////////////////////////////////////
// ----- NETHER RELATED SETTINGS ----- //
@ -605,7 +614,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define ORB_ColMult 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 ]
///////////////////////////////
// ----- MISC SETTINGS ----- //
///////////////////////////////
@ -627,7 +635,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define LIT_PARTICLE_BRIGHTNESS 2.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.]
#define HURT_AND_DEATH_EFFECT
#define SELECT_BOX
#define LIGHTNING_FLASH // FOR OPTIFINE USERS. some mods change the sky color, which can trigger the lightning flash detection.