├── Resource Pack ├── pack.png ├── pack.mcmeta └── assets │ └── minecraft │ └── shaders │ ├── core │ ├── rendertype_text.fsh │ ├── rendertype_text.json │ └── rendertype_text.vsh │ └── include │ ├── color.glsl │ └── animation.glsl ├── Animated Emoji Pack ├── pack.png ├── pack.mcmeta └── assets │ ├── emoji │ └── textures │ │ ├── animation.png │ │ └── animation2.png │ └── minecraft │ ├── font │ └── default.json │ └── shaders │ ├── core │ ├── rendertype_text.fsh │ ├── rendertype_text.json │ └── rendertype_text.vsh │ └── include │ └── animation.glsl └── README.md /Resource Pack/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vekhove/Minecraft-Text-Shaders/HEAD/Resource Pack/pack.png -------------------------------------------------------------------------------- /Animated Emoji Pack/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vekhove/Minecraft-Text-Shaders/HEAD/Animated Emoji Pack/pack.png -------------------------------------------------------------------------------- /Animated Emoji Pack/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 34, 4 | "description": "§7Animated Emojis!" 5 | } 6 | } -------------------------------------------------------------------------------- /Resource Pack/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 8, 4 | "description": "§7Example Files for Text Shaders" 5 | } 6 | } -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/emoji/textures/animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vekhove/Minecraft-Text-Shaders/HEAD/Animated Emoji Pack/assets/emoji/textures/animation.png -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/emoji/textures/animation2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vekhove/Minecraft-Text-Shaders/HEAD/Animated Emoji Pack/assets/emoji/textures/animation2.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repo will be used for information about text-based Minecraft Core shaders. 2 | All information can be viewed on the [wiki](https://github.com/Vekhove/Minecraft-Text-Shaders/wiki), the repo includes some examples of shaders. 3 | -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/minecraft/font/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "providers": [ 3 | { 4 | "type": "bitmap", 5 | "file": "emoji:animation.png", 6 | "ascent": 8, 7 | "height": 8, 8 | "chars": [ 9 | "\uE000" 10 | ] 11 | }, 12 | { 13 | "type": "bitmap", 14 | "file": "emoji:animation2.png", 15 | "ascent": 8, 16 | "height": 8, 17 | "chars": [ 18 | "\uE001" 19 | ] 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /Resource Pack/assets/minecraft/shaders/core/rendertype_text.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | #moj_import 4 | 5 | uniform sampler2D Sampler0; 6 | 7 | uniform vec4 ColorModulator; 8 | uniform float FogStart; 9 | uniform float FogEnd; 10 | uniform vec4 FogColor; 11 | 12 | in float vertexDistance; 13 | in vec4 vertexColor; 14 | in vec2 texCoord0; 15 | 16 | out vec4 fragColor; 17 | 18 | void main() { 19 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 20 | if (color.a < 0.1) discard; 21 | 22 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 23 | } 24 | -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/minecraft/shaders/core/rendertype_text.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | #moj_import 4 | 5 | uniform sampler2D Sampler0; 6 | 7 | uniform vec4 ColorModulator; 8 | uniform float FogStart; 9 | uniform float FogEnd; 10 | uniform vec4 FogColor; 11 | 12 | in float vertexDistance; 13 | in vec4 vertexColor; 14 | in vec2 texCoord0; 15 | in vec2 UV0; 16 | 17 | out vec4 fragColor; 18 | 19 | void main() { 20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; 21 | if (color.a < 0.1) discard; 22 | 23 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); 24 | } 25 | -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/minecraft/shaders/include/animation.glsl: -------------------------------------------------------------------------------- 1 | // Animations 2 | 3 | vec2 spritesheet(int frames, int rows, int columns, int width, int height, vec2 UV, float GameTime, float speed, float vertex) { 4 | 5 | int frame = int(mod(GameTime * 20 * 60 * speed, frames)); 6 | int x = frame % columns; 7 | int y = frame / columns; 8 | 9 | float spriteWidth = width / columns; 10 | float spriteHeight = height / rows; 11 | float widthRatio = 1 / spriteWidth; 12 | float heightRatio = 1 / spriteHeight; 13 | 14 | vec2 texCoord0 = vec2(UV.x + (widthRatio * x), UV.y + (heightRatio * y)); 15 | 16 | if (vertex == 1 || vertex == 2) { 17 | texCoord0.y -= heightRatio * (rows - 1); 18 | } 19 | 20 | if (vertex == 3 || vertex == 2) { 21 | texCoord0.x -= widthRatio * (columns - 1); 22 | } 23 | 24 | return texCoord0; 25 | } -------------------------------------------------------------------------------- /Resource Pack/assets/minecraft/shaders/core/rendertype_text.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_text", 8 | "fragment": "rendertype_text", 9 | "attributes": ["Position", "Color", "UV0", "UV2"], 10 | "samplers": [{ 11 | "name": "Sampler0" 12 | }, { 13 | "name": "Sampler2" 14 | }], 15 | "uniforms": [{ 16 | "name": "ModelViewMat", 17 | "type": "matrix4x4", 18 | "count": 16, 19 | "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] 20 | }, { 21 | "name": "ProjMat", 22 | "type": "matrix4x4", 23 | "count": 16, 24 | "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] 25 | },{ 26 | "name": "ColorModulator", 27 | "type": "float", 28 | "count": 4, 29 | "values": [1, 1, 1, 1] 30 | }, { 31 | "name": "GameTime", 32 | "type": "float", 33 | "count": 1, 34 | "values": [0] 35 | }] 36 | } -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/minecraft/shaders/core/rendertype_text.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "srcalpha", 5 | "dstrgb": "1-srcalpha" 6 | }, 7 | "vertex": "rendertype_text", 8 | "fragment": "rendertype_text", 9 | "attributes": ["Position", "Color", "UV0", "UV2"], 10 | "samplers": [{ 11 | "name": "Sampler0" 12 | }, { 13 | "name": "Sampler2" 14 | }], 15 | "uniforms": [{ 16 | "name": "ModelViewMat", 17 | "type": "matrix4x4", 18 | "count": 16, 19 | "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] 20 | }, { 21 | "name": "ProjMat", 22 | "type": "matrix4x4", 23 | "count": 16, 24 | "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] 25 | },{ 26 | "name": "ColorModulator", 27 | "type": "float", 28 | "count": 4, 29 | "values": [1, 1, 1, 1] 30 | }, { 31 | "name": "GameTime", 32 | "type": "float", 33 | "count": 1, 34 | "values": [0] 35 | }] 36 | } -------------------------------------------------------------------------------- /Resource Pack/assets/minecraft/shaders/include/color.glsl: -------------------------------------------------------------------------------- 1 | // Color Utilities 2 | 3 | // Generate a Rainbow 4 | vec4 rainbow(float posX, float time, sampler2D sampler, ivec2 uv, float speed) { 5 | float oscillationFactor = posX + time * speed; 6 | 7 | vec4 sineWave = sin(vec4(10.0 * oscillationFactor) + vec4(0, 10, 21, 1)); 8 | 9 | vec4 scaledSineWave = 0.6 + (0.6 * sineWave); 10 | 11 | vec4 withOpaque = scaledSineWave + vec4(0.0, 0.0, 0.0, 1.0); 12 | 13 | return withOpaque; 14 | } 15 | 16 | // Generate a Gradient 17 | vec4 gradient(float posX, float time, sampler2D sampler, ivec2 uv, float speed, vec4 color1, vec4 color2) { 18 | float oscillationFactor = posX + time * speed * 0.5; 19 | 20 | vec4 sineWave = sin(vec4(10.0 * oscillationFactor)); 21 | 22 | vec4 scaledSineWave = 0.5 + (sineWave) / 2; 23 | 24 | vec4 gradientColor = mix(color1, color2, clamp(scaledSineWave, 0.0, 1.0)); 25 | gradientColor.w = 1.0; 26 | 27 | return gradientColor; 28 | } -------------------------------------------------------------------------------- /Resource Pack/assets/minecraft/shaders/core/rendertype_text.vsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | #moj_import 4 | #moj_import 5 | #moj_import 6 | 7 | in vec3 Position; 8 | in vec4 Color; 9 | in vec2 UV0; 10 | in ivec2 UV2; 11 | 12 | uniform sampler2D Sampler2; 13 | 14 | uniform mat4 ModelViewMat; 15 | uniform mat4 ProjMat; 16 | uniform float GameTime; 17 | 18 | out float vertexDistance; 19 | out vec4 vertexColor; 20 | out vec2 texCoord0; 21 | 22 | void main() { 23 | vec4 vertex = vec4(Position, 1.0); 24 | float vertexId = mod(gl_VertexID, 4.0); 25 | 26 | vec4 rainbowStop = vec4(0, 28, 21, 1); 27 | vec4 rainbowBrightness = vec4(0.0, 0.0, 0.0, 1.0); 28 | 29 | // Initialise default values. 30 | gl_Position = ProjMat * ModelViewMat * vertex; 31 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 32 | 33 | // Rainbow - #FFFFFE 34 | if (Color.xyz == vec3(255.0, 255.0, 254.0) / 255.0) { 35 | float speed = 4.0; // EDITABLE 36 | vertexColor = rainbow(gl_Position.x, GameTime, Sampler2, UV2, speed * 100); 37 | } 38 | 39 | // {COLOR1} to {COLOR2} Gradient - #FFFEFF 40 | else if (Color.xyz == vec3(255.0, 254.0, 255.0) / 255.0) { 41 | float speed = 4.0; 42 | vec4 color1 = vec4(255.0, 255.0, 255.0, 255.0) / 255.0; 43 | vec4 color2 = vec4(0.0, 0.0, 0.0, 255.0) / 255.0; 44 | vertexColor = gradient(gl_Position.x, GameTime, Sampler2, UV2, speed * 100.0, color1, color2); 45 | } 46 | 47 | // Bounce - #FEFFFF 48 | else if (Color.xyz == vec3(254.0, 255.0, 255.0) / 255.0) { 49 | float speed = 3.0; 50 | vec4 bounce = bounce(vertexId, vertex, GameTime, speed); 51 | gl_Position = ProjMat * ModelViewMat * bounce; 52 | } 53 | 54 | vertexDistance = length((ModelViewMat * vertex).xyz); 55 | texCoord0 = UV0 + vec2(5.0, 1.0); 56 | } -------------------------------------------------------------------------------- /Animated Emoji Pack/assets/minecraft/shaders/core/rendertype_text.vsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | #moj_import 4 | #moj_import 5 | 6 | in vec3 Position; 7 | in vec4 Color; 8 | in vec2 UV0; 9 | in ivec2 UV2; 10 | 11 | uniform sampler2D Sampler2; 12 | 13 | uniform mat4 ModelViewMat; 14 | uniform mat4 ProjMat; 15 | uniform float GameTime; 16 | 17 | out float vertexDistance; 18 | out vec4 vertexColor; 19 | out vec2 texCoord0; 20 | 21 | void main() { 22 | vec4 vertex = vec4(Position, 1.0); 23 | float vertexId = mod(gl_VertexID, 4.0); 24 | 25 | // Initialise default values. 26 | gl_Position = ProjMat * ModelViewMat * vertex; 27 | vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0); 28 | vertexDistance = length((ModelViewMat * vertex).xyz); 29 | texCoord0 = UV0 + vec2(5.0, 1.0); 30 | 31 | // Each animation with a different amount of frames, size, or speed needs to be a different colour. 32 | // Each frame needs to be 16x16. 33 | // #FFFF04 34 | if (Color.xyz == vec3(255.0, 255.0, 4.0) / 255.0) { 35 | vertexColor = vec4(1.0, 1.0, 1.0, vertexColor.a); 36 | texCoord0 = spritesheet(83, 10, 10, 160, 160, UV0, GameTime, 30.0, vertexId); 37 | } 38 | 39 | // Remove the shadow (depends on the colour used). 40 | if (Color.xyz == floor(vec3(255.0, 255.0, 4.0) / 4.0) / 255.0) { 41 | vertexColor = vec4(0.0, 0.0, 0.0, 0.0); 42 | } 43 | 44 | // A second animation. 45 | // #FFFF08 46 | if (Color.xyz == vec3(255.0, 255.0, 8.0) / 255.0) { 47 | vertexColor = vec4(1.0, 1.0, 1.0, vertexColor.a); 48 | texCoord0 = spritesheet(51, 8, 8, 128, 128, UV0, GameTime, 12.0, vertexId); 49 | } 50 | 51 | // Remove the shadow for this animation. 52 | if (Color.xyz == floor(vec3(255.0, 255.0, 8.0) / 4.0) / 255.0) { 53 | vertexColor = vec4(0.0, 0.0, 0.0, 0.0); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Resource Pack/assets/minecraft/shaders/include/animation.glsl: -------------------------------------------------------------------------------- 1 | // Animations 2 | 3 | vec4 bounce(float vertexId, vec4 vertex, float GameTime, float speed) { 4 | if (vertexId == 0.0 || vertexId == 3.0) vertex.y -= cos(GameTime * (speed * 1000.0)) * 3.0; 5 | vertex.y -= max(cos(GameTime * (speed * 1000.0)) * 5.0, 0.0); 6 | 7 | vertex.z += 1.0; 8 | return vertex; 9 | } 10 | 11 | float flash(float GameTime, float speed) { 12 | return cos(GameTime * (speed * 1000.0)) * 1.0; 13 | } 14 | 15 | vec4 pulse(float vertexId, vec4 vertex, float GameTime, float speed) { 16 | if (vertexId == 0.0) { 17 | vertex.y -= max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 18 | vertex.x -= max(cos(GameTime * (speed * 1000.0)) * 1.75, 0.0); 19 | } 20 | 21 | if (vertexId == 1.0) { 22 | vertex.y += max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 23 | vertex.x -= max(cos(GameTime * (speed * 1000.0)) * 1.75, 0.0); 24 | } 25 | 26 | if (vertexId == 2.0) { 27 | vertex.y += max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 28 | vertex.x += max(cos(GameTime * (speed * 1000.0)) * 1.75, 0.0); 29 | } 30 | 31 | if (vertexId == 3.0) { 32 | vertex.y -= max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 33 | vertex.x += max(cos(GameTime * (speed * 1000.0)) * 1.75, 0.0); 34 | } 35 | 36 | return vertex; 37 | } 38 | 39 | vec4 rubberBand(float vertexId, vec4 vertex, float GameTime, float speed) { 40 | if (vertexId == 0.0) { 41 | vertex.y += max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 42 | vertex.x -= max(cos(GameTime * (speed * 1000.0)) * 2.25, 0.0); 43 | } 44 | 45 | if (vertexId == 1.0) { 46 | vertex.y -= max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 47 | vertex.x -= max(cos(GameTime * (speed * 1000.0)) * 2.25, 0.0); 48 | } 49 | 50 | if (vertexId == 2.0) { 51 | vertex.y -= max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 52 | vertex.x += max(cos(GameTime * (speed * 1000.0)) * 5, 0.0); 53 | } 54 | 55 | if (vertexId == 3.0) { 56 | vertex.y += max(cos(GameTime * (speed * 1000.0)) * 1, 0.0); 57 | vertex.x += max(cos(GameTime * (speed * 1000.0)) * 5, 0.0); 58 | } 59 | 60 | return vertex; 61 | } 62 | 63 | vec4 shakeX(float vertexId, vec4 vertex, float GameTime, float speed) { 64 | vertex.x += sin(GameTime * (speed * 1000.0)) * 5.0; 65 | return vertex; 66 | } 67 | 68 | vec4 shakeY(float vertexId, vec4 vertex, float GameTime, float speed) { 69 | vertex.y += sin(GameTime * (speed * 1000.0)) * 2.5; 70 | return vertex; 71 | } 72 | 73 | vec4 swing(float vertexId, vec4 vertex, float GameTime, mat4 ModelViewMat, float speed) { 74 | vec4 worldPosition = ModelViewMat * vertex; 75 | 76 | worldPosition.y += sin(GameTime * (speed * 1000.0)) * (worldPosition.x * 0.1); 77 | 78 | vec4 localVertex = inverse(ModelViewMat) * worldPosition; 79 | 80 | return localVertex; 81 | } 82 | 83 | vec4 circle(float vertexId, vec4 vertex, float GameTime, mat4 ModelViewMat, float speed) { 84 | vertex.x += cos(GameTime * (speed * 1000.0)) * 5.0;; 85 | vertex.y += sin(GameTime * (speed * 1000.0)) * 5.0;; 86 | 87 | return vertex; 88 | } 89 | --------------------------------------------------------------------------------