Skip to content

Instantly share code, notes, and snippets.

@Bloeckchengrafik
Created April 29, 2025 08:50
Show Gist options
  • Save Bloeckchengrafik/bca7a6999be904d0571dc420290329aa to your computer and use it in GitHub Desktop.
Save Bloeckchengrafik/bca7a6999be904d0571dc420290329aa to your computer and use it in GitHub Desktop.
Minestom Logo Text Shader (original by Godlander)
#version 150
#moj_import <minecraft:fog.glsl>
uniform sampler2D Sampler0;
uniform vec4 ColorModulator;
uniform float FogStart;
uniform float FogEnd;
uniform vec4 FogColor;
uniform float GameTime;
in float vertexDistance;
in vec4 vertexColor;
in vec2 texCoord0;
in vec2 uv;
out vec4 fragColor;
flat in int functionId;
#define ANIM_DIAG 0
#define ANIM_POLAR 1
void animageMinestomLogo(int animType) {
fragColor = vec4(0, 0, 0, 0);
//palette
vec3 color = mix(vec3(1.0, 0.5, 0.6), vec3(0.9, 0.4, 0.3), -uv.x + uv.y);
//square
if (all(lessThan(uv, vec2(1.))) && all(greaterThan(uv, vec2(0.)))) {
//coordinate
vec2 coord = floor(uv * 5.);
vec2 tile = fract(uv * 5.) - 0.5;
//animation
float anim = GameTime;
float size = 0.3;
if (animType == ANIM_DIAG) {
//diagonal
anim = sin(-coord.x + coord.y + GameTime * 10000.);
size = mix(0.2, 0.35, anim);
} else {
//polar
coord -= 2.;
float angle = atan(coord.x, coord.y);
anim = (0.5 + sin(angle * 2. + GameTime * 10000.)) * length(coord) / 3.;
size = mix(0.1, 0.3, anim);
}
//draw boxes
float box = length(max(abs(tile) - size, 0.)) - 0.1;
//smooth edges
float sharpness = 80.;
float aa = 1.0 - smoothstep(0.0, 1.0, box * sharpness);
fragColor = mix(vec4(0, 0, 0, 0.5), vec4(color, 1), aa);
}
}
void main() {
if (functionId == 1) {
animageMinestomLogo(ANIM_DIAG);
return;
} else if (functionId == 2) {
animageMinestomLogo(ANIM_POLAR);
return;
}
vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
if (color.a < 0.1) {
discard;
}
fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
}
#version 330
#moj_import <minecraft:fog.glsl>
#define ONE_COLVAL 0.0039215686
#define ANIMATION 0
in vec3 Position;
in vec4 Color;
in vec2 UV0;
in ivec2 UV2;
uniform sampler2D Sampler2;
uniform mat4 ModelViewMat;
uniform mat4 ProjMat;
uniform int FogShape;
out float vertexDistance;
out vec4 vertexColor;
out vec2 texCoord0;
out vec2 uv;
flat out int functionId;
void main() {
vec3 vPos = Position;
vec4 vColor = Color;
functionId = 257;
if (Color.r > 0.996078 && Color.r < 1.0 && Color.g > 0.996078 && Color.g < 1.0) {
vColor = vec4(1.0, 1.0, 1.0, 1.0);
if (Color.b < ONE_COLVAL) {
vPos.y -= 11;
functionId = 0;
} else if (Color.b < ONE_COLVAL * 2) {
functionId = 1;
} else if (Color.b < ONE_COLVAL * 3) {
functionId = 2;
}
}
gl_Position = ProjMat * ModelViewMat * vec4(vPos, 1.0);
vertexDistance = fog_distance(Position, FogShape);
vertexColor = vColor * texelFetch(Sampler2, UV2 / 16, 0);
texCoord0 = UV0;
int vertexId = gl_VertexID % 4;
if (vertexId == 0) {
uv = vec2(0.0, 1.0);
} else if (vertexId == 1) {
uv = vec2(0.0, 0.0);
} else if (vertexId == 2) {
uv = vec2(1.0, 0.0);
} else {
uv = vec2(1.0, 1.0);
}
}
@Bloeckchengrafik
Copy link
Author

Text component: [{"text":"X","color":"#FEFE01",shadow_color:[0.0,0.0,0.0,0.0]}," ",{"text":"X","color":"#FEFE02",shadow_color:[0.0,0.0,0.0,0.0]}]

Don't mind the extra upwards shift thing, it is from something else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment