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 | |
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')
18 files changed, 519 insertions, 0 deletions
diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.frag new file mode 100644 index 00000000..e3f7feba --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.frag @@ -0,0 +1,36 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +uniform int millis; +uniform int eventMillis; + +void main() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + + float t = gl_TexCoord[0].t; + t = clamp(t, 10.0f/1024.0f, 410.0f/1024.0f); + + float index = mod(millis/30.0f-t*1024.0f, 1024.0f); + float xIndex = mod(index, 1024.0f); + float yIndex = mod(gl_TexCoord[0].s*1024.0f+millis/500.0f, 421.0f)+421.0f; + vec3 lava = texture2D(textureIn, vec2(xIndex/1024.0f, yIndex/1024.0f)).xyz; + + if(eventMillis < 350) { + float scroll = (gl_TexCoord[0].s*1024.0f+gl_TexCoord[0].t*1024.0f); + float factor = (10 - abs(scroll - eventMillis*2))/20.0f; + if(factor > 0) { + lava += vec3(factor, factor, factor); + } + } + + gl_FragColor = vec4(texture.rgb*texture.a + lava*(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/biscuit_cape/biscuit_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_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 diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.frag new file mode 100644 index 00000000..bfc089bb --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.frag @@ -0,0 +1,16 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +void main() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + gl_FragColor = texture * 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); +}
\ No newline at end of file diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/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 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 diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.frag new file mode 100644 index 00000000..9fb35990 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.frag @@ -0,0 +1,32 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +uniform int millis; + +void main() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + + float t = gl_TexCoord[0].t; + t = clamp(t, 10.0f/1024.0f, 410.0f/1024.0f); + + float index = mod(millis/30.0f-t*1024.0f, 1024.0f); + float xIndex = mod(index, 1024.0f); + float yIndex = mod(gl_TexCoord[0].s*1024.0f+millis/500.0f, 421.0f)+421.0f; + vec3 lava = texture2D(textureIn, vec2(xIndex/1024.0f, yIndex/1024.0f)).xyz; + + float factor = (lava.r / 0.65f)*(lava.r / 0.65f); + lava.r += sin(mod(millis/2000.0f, 6.28f))*factor*0.15f+sin(mod(millis/500.0f, 6.28f))*factor*0.15f; + lava.g += sin(mod(millis/2000.0f, 6.28f))*factor*0.15f; + lava.b += sin(mod(millis/2000.0f, 6.28f))*factor*0.15f; + + gl_FragColor = vec4(texture.rgb*texture.a + lava*(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/lava_cape/lava_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_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 diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.frag new file mode 100644 index 00000000..1dc5e1c8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.frag @@ -0,0 +1,129 @@ +#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); +} + +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); +} + +void main() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + + float t = gl_TexCoord[0].t; + t = clamp(t, 10.0f/1024.0f, 410.0f/1024.0f); + + float start = 56.0f - 44.0f*t/(420.0f/1024.0f); + float width = 182.0f + 90.0f*t/(420.0f/1024.0f); + float scaleFactor = 1.0f/(width/1024.0f)*112.0f; + + float index = mod(millis/20.0f+t*scaleFactor, 2820.0f); + float yIndex = floor(index/1024.0f)*112.0f-(gl_TexCoord[0].s-start/1024.0f)*scaleFactor+532.0f; + float xIndex = mod(index, 1024.0f); + vec3 world = texture2D(textureIn, vec2(xIndex/1024.0f, yIndex/1024.0f)).xyz; + + float hue = 0.0f; + float saturation = 1.0f; + float value = 1.0f; + if(index < 208) { //sky + float blurFactor = clamp((index-158)/100.0f, 0.0f, 0.5f); + + hue = 200.0f; + saturation = 1.0f - blurFactor; + value = 0.9f - 0.6f*blurFactor; + } else if(index < 800) { //underground + if(index < 400) { + float blurFactor = clamp((258-index)/100.0f, 0.0f, 0.5f); + + hue = 200.0f; + saturation = 0.0f + blurFactor; + value = 0.3f + 0.6f*blurFactor; + } else { + float blurFactor = clamp((index-750)/100.0f, 0.0f, 0.5f); + + hue = 350.0f; + saturation = 0.0f + 0.5f*blurFactor; + value = 0.3f - 0.1f*blurFactor; + } + } else if(index < 1762) { //nether + if(index < 1200) { + float blurFactor = clamp((850-index)/100.0f, 0.0f, 0.5f); + + hue = 350.0f; + saturation = 0.5f - 0.5f*blurFactor; + value = 0.2f + 0.1f*blurFactor; + } else { + float blurFactor = clamp((index-1712)/100.0f, 0.0f, 0.5f); + + hue = 350.0f; + saturation = 0.5f - 0.5f*blurFactor; + value = 0.2f + 0.1f*blurFactor; + } + } else if(index < 2200) { //underground + if(index < 1900) { + float blurFactor = clamp((1812-index)/100.0f, 0.0f, 0.5f); + + hue = 350.0f; + saturation = 0.0f + 0.5f*blurFactor; + value = 0.3f - 0.1f*blurFactor; + } else { + float blurFactor = clamp((index-2150)/100.0f, 0.0f, 0.5f); + + hue = 0.0f; + saturation = 0.0f; + value = 0.3f - 0.3f*blurFactor; + } + } else if(index < 2600) { //end + if(index < 2400) { + float blurFactor = clamp((2250-index)/100.0f, 0.0f, 0.5f); + + hue = 0.0f; + saturation = 0.0f; + value = 0.0f + 0.3f*blurFactor; + } else { + float blurFactor = clamp((index-2550)/100.0f, 0.0f, 0.5f); + + hue = 200.0f; + saturation = 0.0f + blurFactor; + value = 0.0f + 0.9f*blurFactor; + } + } else { //sky + float blurFactor = clamp((2650-index)/100.0f, 0.0f, 0.5f); + + hue = 200.0f; + saturation = 1.0f - blurFactor; + value = 0.9f - 0.9f*blurFactor; + } + hue = mod(hue, 360.0f); + saturation = max(0.0f, min(1.0f, saturation)); + value = max(0.0f, min(1.0f, value)); + + vec3 hsv = rgb2hsv(texture.rgb); + hsv.x = hue/360.0f; + hsv.y *= saturation; + hsv.z *= value; + + gl_FragColor = vec4(hsv2rgb(hsv)*texture.a + world*(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/mcworld_cape/mcworld_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_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 diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.frag new file mode 100644 index 00000000..a601bd0c --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.frag @@ -0,0 +1,33 @@ +#version 130 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; +varying vec4 passPosition; +uniform vec2 screensize; + +int a(float f) { + return int(round(f*1999)); +} + +void main() { + vec2 viewportCoord = gl_FragCoord.xy/screensize.xy; + vec4 texture = texture2D(textureIn, viewportCoord); + + int offsetFactor = a(viewportCoord.x)^a(viewportCoord.y); + float dist = 1+mod(offsetFactor/4, 2); + float xOffset = dist*mod(offsetFactor-1, 2); + float yOffset = dist*mod(offsetFactor-2, 2); + + texture = texture2D(textureIn, vec2(viewportCoord.x+xOffset/screensize.x, viewportCoord.y+yOffset/screensize.y)); + texture = vec4(texture.rgb*texture.a, 1); + texture.rgb = 1 - texture.rgb; + + gl_FragColor = texture * 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, 1); +}
\ No newline at end of file diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.vert new file mode 100644 index 00000000..9ccbcd6f --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.vert @@ -0,0 +1,15 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +varying vec4 passPosition; +uniform vec2 screensize; + +void main() { + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_TexCoord[0] = gl_MultiTexCoord0; + + passColour = gl_Color; + passNormal = normalize(gl_Normal); + passPosition = gl_Position; +}
\ No newline at end of file diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.frag new file mode 100644 index 00000000..77e2c5eb --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.frag @@ -0,0 +1,26 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +uniform int millis; +uniform int eventMillis; + +void main() { + gl_FragColor = texture2D(textureIn, gl_TexCoord[0].st) * passColour; + + if(eventMillis < 350 && gl_TexCoord[0].s < 512 && gl_TexCoord[0].t < 512) { + float scroll = (gl_TexCoord[0].s*1024.0f+gl_TexCoord[0].t*1024.0f); + float factor = (10 - abs(scroll - eventMillis*2))/40.0f; + if(factor > 0) { + gl_FragColor.rgb += vec3(factor+0.25f, factor+0.25f, factor+0.25f); + } + } + + 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); +}
\ No newline at end of file diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_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 diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.frag new file mode 100644 index 00000000..e3e5d56e --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.frag @@ -0,0 +1,60 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +uniform int millis; +uniform int eventMillis; +uniform float eventRand; //0-1 + +void main() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + + vec2 texCoord = gl_TexCoord[0].st + vec2(mod(millis/100.0f,1024.0f)/1024.0f, 421.0f/1024.0f); + + vec4 extra = vec4(0,0,0,0); + if(eventRand < 0.4f) { + vec2 extraPos = vec2(45.0f+eventRand/0.4f*250.0f, eventMillis/300.0f*550.0f)/1024.0f; + vec2 extraTexCoord = vec2(48.0f/1024.0f-(gl_TexCoord[0].t-extraPos.y), gl_TexCoord[0].s-extraPos.x+894.0f/1024.0f); + if(extraTexCoord.x > 0.0f && extraTexCoord.x < 200.0f/1024.0f) { + if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { + extra = texture2D(textureIn, extraTexCoord); + } + } + } else if(eventRand < 0.45f) { + vec2 extraPos = vec2(-30.0f+eventMillis/2000.0f*370.0f, 50.0f+(eventRand-0.4f)/0.05f*300.0f)/1024.0f; + vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+248.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f); + if(extraTexCoord.x > 200.0f/1024.0f && extraTexCoord.x < 300.0f/1024.0f) { + if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { + extra = texture2D(textureIn, extraTexCoord); + } + } + } else if(eventRand < 0.47f) { + vec2 extraPos = vec2(-30.0f+eventMillis/2000.0f*370.0f, 50.0f+(eventRand-0.45f)/0.02f*300.0f)/1024.0f; + vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+348.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f); + if(extraTexCoord.x > 300.0f/1024.0f && extraTexCoord.x < 400.0f/1024.0f) { + if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { + extra = texture2D(textureIn, extraTexCoord); + } + } + } else if(eventRand < 0.48f) { + vec2 extraPos = vec2(-30.0f+eventMillis/2000.0f*370.0f, 50.0f+(eventRand-0.47f)/0.01f*300.0f)/1024.0f; + vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+448.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f); + if(extraTexCoord.x > 400.0f/1024.0f && extraTexCoord.x < 500.0f/1024.0f) { + if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { + extra = texture2D(textureIn, extraTexCoord); + } + } + } + + vec3 space = texture2D(textureIn, texCoord).rgb; + + gl_FragColor = vec4(texture.rgb*texture.a + extra.rgb*extra.a*(1.0f-texture.a) + space*(1.0f-texture.a)*(1.0f-extra.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/space_cape/space_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_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 diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.frag new file mode 100644 index 00000000..3809c133 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.frag @@ -0,0 +1,41 @@ +#version 130 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; +varying vec4 passPosition; +uniform vec2 screensize; +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() { + vec2 viewportCoord1 = (gl_FragCoord.xy+vec2(-millis/100.0f, 70)/5.0f)/screensize.yy; + vec4 texture1 = texture2D(textureIn, viewportCoord1); + + vec2 viewportCoord2 = (gl_FragCoord.xy/2.0f+vec2(50, millis/100.0f)/3.0f)/screensize.yy; + vec4 texture2 = texture2D(textureIn, viewportCoord2); + + vec2 viewportCoord3 = (gl_FragCoord.xy/3.0f+vec2(-millis/100.0f+30, millis/100.0f+90)/2.0f)/screensize.yy; + vec4 texture3 = texture2D(textureIn, viewportCoord3); + + vec2 viewportCoord4 = (gl_FragCoord.xy/3.0f+vec2(-millis/100.0f+50, -millis/100.0f+10)/2.0f)/screensize.yy; + vec4 texture4 = texture2D(textureIn, viewportCoord4); + + float r = texture1.r + texture2.r + texture3.r + texture4.r; + float g = texture1.g + texture2.g + texture3.g + texture4.g; + float b = texture1.b + texture2.b + texture3.b + texture4.b; + + if(r > 1) r = 1; + if(g > 1) g = 1; + if(b > 1) b = 1; + + vec4 colour = vec4(hsv2rgb(vec3(mod(millis/50000.0f+gl_FragCoord.x/screensize.x/3.0f, 1.0f), 0.35f, 1.0f)), 1.0f); + + gl_FragColor = vec4(r, g, b, 1) * passColour * colour; +}
\ No newline at end of file diff --git a/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.vert new file mode 100644 index 00000000..0cc39c90 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.vert @@ -0,0 +1,16 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +varying vec4 passPosition; +uniform vec2 screensize; +uniform int millis; + +void main() { + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_TexCoord[0] = gl_MultiTexCoord0; + + passColour = gl_Color; + passNormal = normalize(gl_Normal); + passPosition = gl_Position; +}
\ No newline at end of file |