[BotW] Added Divine Laser Beams Customizer

This commit is contained in:
Alex Chirila 2017-10-28 00:55:59 +03:00
parent d992c899a3
commit fda34ccde7
3 changed files with 63 additions and 6 deletions

View File

@ -1,7 +1,17 @@
#version 420
#extension GL_ARB_texture_gather : enable
// shader 6fa2baef8a4ece42
// Laser Beams - hidden
// 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 VALUE_FACTOR 1.0 //same as above; applies to Value
#define ALPHA_FACTOR 1.05 //same as above; applies to Transparency
const float hueRotation = HUE_ROTATION / 360.0;
uniform ivec4 uf_remappedPS[3];
uniform float uf_alphaTestRef;
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0x20fc2000 res 128x128x1 dim 1 tm: 4 format 0035 compSel: 0 1 1 1 mipView: 0x0 (num 0x8) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 0 0 0 border: 0
@ -25,9 +35,25 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
}
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main()
{
#if (DISABLE_BEAMS == 1)
discard;
#endif
vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0);
vec4 R2f = vec4(0.0);
@ -106,5 +132,7 @@ R7f.w = mul_nonIEEE(R6f.w, PV1f.x);
// export
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);
passPixelColor0.rgb = passPixelColor0.gbr;
vec3 colhsv = rgb2hsv(passPixelColor0.rgb);
passPixelColor0.rgb = hsv2rgb(vec3(mod(colhsv.x + hueRotation, 1.0), colhsv.y*SATURATION_FACTOR, colhsv.z*VALUE_FACTOR));
passPixelColor0.a *= ALPHA_FACTOR;
}

View File

@ -1,7 +1,17 @@
#version 420
#extension GL_ARB_texture_gather : enable
// shader de960d36a997b34d
// Laser Beam rings - hidden
// 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 VALUE_FACTOR 1.0 //same as above; applies to Value
#define ALPHA_FACTOR 1.05 //same as above; applies to Transparency
const float hueRotation = HUE_ROTATION / 360.0;
uniform ivec4 uf_remappedPS[3];
uniform float uf_alphaTestRef;
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0x210b5000 res 200x200x1 dim 1 tm: 4 format 0034 compSel: 0 0 0 0 mipView: 0x0 (num 0x8) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 0 0 0 border: 0
@ -26,9 +36,25 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
}
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main()
{
#if (DISABLE_BEAMS == 1)
discard;
#endif
vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0);
vec4 R2f = vec4(0.0);
@ -124,5 +150,7 @@ R0f.w = mul_nonIEEE(R7f.w, PV1f.x);
// export
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);
passPixelColor0.rgb = passPixelColor0.gbr;
vec3 colhsv = rgb2hsv(passPixelColor0.rgb);
passPixelColor0.rgb = hsv2rgb(vec3(mod(colhsv.x + hueRotation, 1.0), colhsv.y*SATURATION_FACTOR, colhsv.z*VALUE_FACTOR));
passPixelColor0.a *= ALPHA_FACTOR;
}

View File

@ -1,5 +1,6 @@
[Definition]
titleIds = 00050000101C9300,00050000101C9400,00050000101C9500
name = "The Legend of Zelda: Breath of the Wild - No Laser Beams"
name = "The Legend of Zelda: Breath of the Wild - Divine Laser Beam Customizer"
version = 2
# Completely hides the laser beams from the Divine Beasts
# Allows customization of the color of the Divine Beasts's Laser Beam
# Laser Beams can also be completely hidden