diff options
author | BuildTools <james.jenour@protonmail.com> | 2021-02-16 03:08:30 +0800 |
---|---|---|
committer | BuildTools <james.jenour@protonmail.com> | 2021-02-16 03:08:30 +0800 |
commit | a0e7d174472d034142003e58a42d6beefe36a92b (patch) | |
tree | 37fbdf5c5c3af3e85ed05e6e17d64207b2a6d8c9 /src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape | |
parent | 6024bdf69193ad216e95fca53d7d28746f4269e0 (diff) | |
download | NotEnoughUpdates-a0e7d174472d034142003e58a42d6beefe36a92b.tar.gz NotEnoughUpdates-a0e7d174472d034142003e58a42d6beefe36a92b.tar.bz2 NotEnoughUpdates-a0e7d174472d034142003e58a42d6beefe36a92b.zip |
PRE21
Diffstat (limited to 'src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape')
-rw-r--r-- | src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag | 31 | ||||
-rw-r--r-- | src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert | 12 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag new file mode 100644 index 00000000..33d6b341 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag @@ -0,0 +1,31 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +uniform int millis; + +//Algorithm by hughsk +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() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + + float hue = mod(millis/10000.0f+gl_TexCoord[0].t, 1.0f); + float sat = 0.5f; + float val = 0.5f; + vec3 fade = hsv2rgb(vec3(hue, sat, val)); + + gl_FragColor = vec4(texture.rgb*texture.a + fade*(1.0f-texture.a), 1.0f) * passColour; + + vec3 fakeSunNormal = normalize(vec3(0.2f,1.0f,-0.2f)); + vec3 normNormal = normalize(passNormal); + float shading = max(0.6f, dot(fakeSunNormal, normNormal)); + + gl_FragColor = vec4(gl_FragColor.rgb*shading, gl_FragColor.a); +} diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert @@ -0,0 +1,12 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; + +void main() { + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_TexCoord[0] = gl_MultiTexCoord0; + + passColour = gl_Color; + passNormal = normalize(gl_Normal); +}
\ No newline at end of file |