diff --git a/pack/assets/minecraft/shaders/core/rendertype_end_portal.fsh b/pack/assets/minecraft/shaders/core/rendertype_end_portal.fsh new file mode 100644 index 0000000..4265316 --- /dev/null +++ b/pack/assets/minecraft/shaders/core/rendertype_end_portal.fsh @@ -0,0 +1,74 @@ +#version 150 + +#moj_import + +uniform sampler2D Sampler0; +uniform sampler2D Sampler1; + +uniform float GameTime; +uniform int EndPortalLayers; + +in vec4 texProj0; + +// removed the `const` keyword here because we're going to modify these values in main() +vec3[] COLORS = vec3[]( + vec3(0.022087, 0.098399, 0.110818), // weird foreground layer? + vec3(0.011892, 0.095924, 0.089485), // stars in background + vec3(0.027636, 0.101689, 0.100326), // also stars + vec3(0.046564, 0.109883, 0.114838), // more stars + vec3(0.064901, 0.117696, 0.097189), // the stars are getting bigger + vec3(0.063761, 0.086895, 0.123646), // take a guess + vec3(0.084817, 0.111994, 0.166380), // bigger stars + vec3(0.097489, 0.154120, 0.091064), // would almost consider them foreground objects now + vec3(0.106152, 0.131144, 0.195191), // . + vec3(0.097721, 0.110188, 0.187229), // . + vec3(0.133516, 0.138278, 0.148582), // ! + vec3(0.070006, 0.243332, 0.235792), // !! + vec3(0.196766, 0.142899, 0.214696), // !!! + vec3(0.047281, 0.315338, 0.321970), // the turquoise thingies going from left to right + vec3(0.204675, 0.390010, 0.302066), // green things going from top to bottom + vec3(0.080955, 0.314821, 0.661491) // blue things going from right to left +); + +const vec3 PINK = vec3(0.898, 0.541, 0.749); + +const mat4 SCALE_TRANSLATE = mat4( + 0.5, 0.0, 0.0, 0.25, + 0.0, 0.5, 0.0, 0.25, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 +); + +mat4 end_portal_layer(float layer) { + mat4 translate = mat4( + 1.0, 0.0, 0.0, 17.0 / layer, + 0.0, 1.0, 0.0, (2.0 + layer / 1.5) * (GameTime * 1.5), + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 + ); + + mat2 rotate = mat2_rotate_z(radians((layer * layer * 4321.0 + layer * 9.0) * 2.0)); + + mat2 scale = mat2((4.5 - layer / 4.0) * 2.0); + + return mat4(scale * rotate) * translate * SCALE_TRANSLATE; +} + +out vec4 fragColor; + +void main() { + // start at 1 because we don't want to change the foreground noise here + for (int i = 1; i < 16; i++) { + float intensity = float(i) / 16.0; + COLORS[i] = mix(COLORS[i], PINK, intensity * 0.7); + } + + // slightly shift foreground to pink as well :3 + COLORS[0] = mix(COLORS[0], PINK, 0.15); + + vec3 color = textureProj(Sampler0, texProj0).rgb * COLORS[0]; + for (int i = 0; i < EndPortalLayers; i++) { + color += textureProj(Sampler1, texProj0 * end_portal_layer(float(i + 1))).rgb * COLORS[i]; + } + fragColor = vec4(color, 1.0); +}