[BotW] Added optional rainbow beams, disabled by default

This commit is contained in:
Alex Chirila 2017-10-29 11:47:03 +02:00
parent 2d8d3319e1
commit a86d342c8f
2 changed files with 22 additions and 12 deletions

View File

@ -1,15 +1,16 @@
#version 420
#extension GL_ARB_texture_gather : enable
// shader 6fa2baef8a4ece42
// Divine Laser Beams Customizer - beams
// Divine Laser Beams Customizer - rings
// Credit for hsv functions below
// http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
#define DISABLE_BEAMS 1
#define HUE_ROTATION 330 //[0, 360] where 0 and 360 is unchanged Hue and 180 is completely opposite Hue. Check http://dba.med.sc.edu/price/irf/Adobe_tg/models/images/hsl_top.JPG
#define SATURATION_FACTOR 1.0 //[0.0, 1.0] 1.0 means unchanged Saturation, 0.0 means completely desaturated. Values above 1.0 are accepted, but they may cause clipping
#define RAINBOW_EFFECT 0 // [0 or 1] set it to 1 to enable rainbow beams effect. in that case, HUE_ROTATION is ignored
#define DISABLE_BEAMS 1 // [0 or 1] set it to 1 to hide the lasers completely
#define HUE_ROTATION 0 //[0, 360] where 0 and 360 is unchanged Hue and 180 is completely opposite Hue. Check http://dba.med.sc.edu/price/irf/Adobe_tg/models/images/hsl_top.JPG
#define SATURATION_FACTOR 1.1 //[0.0, 1.0] 1.0 means unchanged Saturation, 0.0 means completely desaturated. Values above 1.0 are accepted, but they may cause clipping
#define VALUE_FACTOR 1.0 //same as above; applies to Value
#define ALPHA_FACTOR 1.05 //same as above; applies to Transparency
#define ALPHA_FACTOR 1.0 //same as above; applies to Transparency
const float hueRotation = HUE_ROTATION / 360.0;
uniform ivec4 uf_remappedPS[3];
@ -51,7 +52,7 @@ vec3 hsv2rgb(vec3 c) {
}
void main()
{
#if (DISABLE_BEAMS == 1)
#if (DISABLE_BEAMS == 1) && (RAINBOW_EFFECT == 0)
discard;
#endif
vec4 R0f = vec4(0.0);
@ -133,6 +134,10 @@ R7f.w = mul_nonIEEE(R6f.w, PV1f.x);
if( ((vec4(R7f.x, R7f.y, R7f.z, R7f.w)).a > uf_alphaTestRef) == false) discard;
passPixelColor0 = vec4(R7f.x, R7f.y, R7f.z, R7f.w);
vec3 colhsv = rgb2hsv(passPixelColor0.rgb);
#if (RAINBOW_EFFECT == 1)
passPixelColor0.rgb = hsv2rgb(vec3(mod(colhsv.x + 1.5*R5f.y, 1.0), colhsv.y*SATURATION_FACTOR, colhsv.z*VALUE_FACTOR));
#else
passPixelColor0.rgb = hsv2rgb(vec3(mod(colhsv.x + hueRotation, 1.0), colhsv.y*SATURATION_FACTOR, colhsv.z*VALUE_FACTOR));
#endif
passPixelColor0.a *= ALPHA_FACTOR;
}

View File

@ -1,15 +1,16 @@
#version 420
#extension GL_ARB_texture_gather : enable
// shader de960d36a997b34d
// Divine Laser Beams Customizer - rings
// Divine Laser Beams Customizer - beams
// Credit for hsv functions below
// http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
#define DISABLE_BEAMS 1
#define HUE_ROTATION 330 //[0, 360] where 0 and 360 is unchanged Hue and 180 is completely opposite Hue. Check http://dba.med.sc.edu/price/irf/Adobe_tg/models/images/hsl_top.JPG
#define SATURATION_FACTOR 1.0 //[0.0, 1.0] 1.0 means unchanged Saturation, 0.0 means completely desaturated. Values above 1.0 are accepted, but they may cause clipping
#define RAINBOW_EFFECT 0 // [0 or 1] set it to 1 to enable rainbow beams effect. in that case, HUE_ROTATION is ignored
#define DISABLE_BEAMS 1 // [0 or 1] set it to 1 to hide the lasers completely
#define HUE_ROTATION 0 //[0, 360] where 0 and 360 is unchanged Hue and 180 is completely opposite Hue. Check http://dba.med.sc.edu/price/irf/Adobe_tg/models/images/hsl_top.JPG
#define SATURATION_FACTOR 1.1 //[0.0, 1.0] 1.0 means unchanged Saturation, 0.0 means completely desaturated. Values above 1.0 are accepted, but they may cause clipping
#define VALUE_FACTOR 1.0 //same as above; applies to Value
#define ALPHA_FACTOR 1.05 //same as above; applies to Transparency
#define ALPHA_FACTOR 1.0 //same as above; applies to Transparency
const float hueRotation = HUE_ROTATION / 360.0;
uniform ivec4 uf_remappedPS[3];
@ -52,7 +53,7 @@ vec3 hsv2rgb(vec3 c) {
}
void main()
{
#if (DISABLE_BEAMS == 1)
#if (DISABLE_BEAMS == 1) && (RAINBOW_EFFECT == 0)
discard;
#endif
vec4 R0f = vec4(0.0);
@ -151,6 +152,10 @@ R0f.w = mul_nonIEEE(R7f.w, PV1f.x);
if( ((vec4(R0f.x, R0f.y, R0f.z, R0f.w)).a > uf_alphaTestRef) == false) discard;
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
vec3 colhsv = rgb2hsv(passPixelColor0.rgb);
#if (RAINBOW_EFFECT == 1)
passPixelColor0.rgb = hsv2rgb(vec3(mod(colhsv.x + 3.0*R5f.y, 1.0), colhsv.y*SATURATION_FACTOR, colhsv.z*VALUE_FACTOR));
#else
passPixelColor0.rgb = hsv2rgb(vec3(mod(colhsv.x + hueRotation, 1.0), colhsv.y*SATURATION_FACTOR, colhsv.z*VALUE_FACTOR));
#endif
passPixelColor0.a *= ALPHA_FACTOR;
}