├── .gitignore ├── Depth Shader Test (Distance) ├── assets │ └── minecraft │ │ └── shaders │ │ ├── post │ │ └── transparency.json │ │ └── program │ │ ├── blit_util.vsh │ │ ├── distance.fsh │ │ └── distance.json ├── pack.mcmeta └── pack.png ├── Depth Shader Test (DoF) ├── assets │ └── minecraft │ │ └── shaders │ │ ├── post │ │ └── transparency.json │ │ └── program │ │ ├── blit_util.vsh │ │ ├── depth_of_field.fsh │ │ └── depth_of_field.json ├── pack.mcmeta └── pack.png ├── Depth Shader Test (Fog) ├── assets │ └── minecraft │ │ └── shaders │ │ ├── post │ │ └── transparency.json │ │ └── program │ │ ├── blit_util.vsh │ │ ├── depth_test.fsh │ │ └── depth_test.json ├── pack.mcmeta └── pack.png ├── Depth Shader Test (Stripes) ├── assets │ └── minecraft │ │ └── shaders │ │ ├── post │ │ └── transparency.json │ │ └── program │ │ ├── blit_util.vsh │ │ ├── stripes.fsh │ │ └── stripes.json ├── pack.mcmeta └── pack.png ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | distr -------------------------------------------------------------------------------- /Depth Shader Test (Distance)/assets/minecraft/shaders/post/transparency.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | "water", 4 | "translucent", 5 | "itemEntity", 6 | "particles", 7 | "clouds", 8 | "weather", 9 | "final", 10 | "swap" 11 | ], 12 | "passes": [ 13 | { 14 | "name": "transparency", 15 | "intarget": "minecraft:main", 16 | "outtarget": "swap", 17 | "auxtargets": [ 18 | { 19 | "name": "DiffuseDepthSampler", 20 | "id": "minecraft:main:depth" 21 | }, 22 | { 23 | "name": "TranslucentSampler", 24 | "id": "translucent" 25 | }, 26 | { 27 | "name": "TranslucentDepthSampler", 28 | "id": "translucent:depth" 29 | }, 30 | { 31 | "name": "ItemEntitySampler", 32 | "id": "itemEntity" 33 | }, 34 | { 35 | "name": "ItemEntityDepthSampler", 36 | "id": "itemEntity:depth" 37 | }, 38 | { 39 | "name": "ParticlesSampler", 40 | "id": "particles" 41 | }, 42 | { 43 | "name": "ParticlesDepthSampler", 44 | "id": "particles:depth" 45 | }, 46 | { 47 | "name": "CloudsSampler", 48 | "id": "clouds" 49 | }, 50 | { 51 | "name": "CloudsDepthSampler", 52 | "id": "clouds:depth" 53 | }, 54 | { 55 | "name": "WeatherSampler", 56 | "id": "weather" 57 | }, 58 | { 59 | "name": "WeatherDepthSampler", 60 | "id": "weather:depth" 61 | } 62 | ] 63 | }, 64 | { 65 | "name": "distance", 66 | "intarget": "swap", 67 | "outtarget": "final", 68 | "auxtargets": [ 69 | { 70 | "name": "DiffuseDepthSampler", 71 | "id": "minecraft:main:depth" 72 | } 73 | ] 74 | }, 75 | { 76 | "name": "blit", 77 | "intarget": "final", 78 | "outtarget": "minecraft:main", 79 | "auxtargets": [ 80 | { 81 | "name": "DiffuseDepthSampler", 82 | "id": "minecraft:main:depth" 83 | } 84 | ] 85 | } 86 | ] 87 | } 88 | -------------------------------------------------------------------------------- /Depth Shader Test (Distance)/assets/minecraft/shaders/program/blit_util.vsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec4 Position; 4 | 5 | uniform mat4 ProjMat; 6 | uniform vec2 InSize; 7 | 8 | out vec2 texCoord; 9 | out vec2 oneTexel; 10 | 11 | void main() { 12 | vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); 13 | gl_Position = vec4(outPos.xy, 0.2, 1.0); 14 | 15 | oneTexel = 1.0 / InSize; 16 | texCoord = outPos.xy * 0.5 + 0.5; 17 | } 18 | -------------------------------------------------------------------------------- /Depth Shader Test (Distance)/assets/minecraft/shaders/program/distance.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D DiffuseSampler; 4 | uniform sampler2D DiffuseDepthSampler; 5 | 6 | uniform vec2 ScreenSize; 7 | uniform float _FOV; 8 | 9 | in vec2 texCoord; 10 | out vec4 fragColor; 11 | 12 | float near = 0.1; 13 | float far = 1000.0; 14 | 15 | float LinearizeDepth(float depth) 16 | { 17 | float z = depth * 2.0 - 1.0; 18 | return (near * far) / (far + near - z * (far - near)); 19 | } 20 | 21 | void main() { 22 | float depth = LinearizeDepth(texture(DiffuseDepthSampler, texCoord).r); 23 | float distance = length(vec3(1., (2.*texCoord - 1.) * vec2(ScreenSize.x/ScreenSize.y,1.) * tan(radians(_FOV / 2.))) * depth); 24 | if (mod(distance, 1.0) <= 0.05) { 25 | fragColor = vec4(0.0,0.0,0.0,1.0); 26 | } else { 27 | fragColor = vec4(texture(DiffuseSampler, texCoord).rgb, 1.0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Depth Shader Test (Distance)/assets/minecraft/shaders/program/distance.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "one", 5 | "dstrgb": "zero" 6 | }, 7 | "vertex": "blit_util", 8 | "fragment": "distance", 9 | "attributes": [ "Position" ], 10 | "samplers": [ 11 | { "name": "DiffuseSampler" }, 12 | { "name": "DiffuseDepthSampler" } 13 | ], 14 | "uniforms": [ 15 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 16 | { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 17 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 18 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 19 | { "name": "_FOV", "type": "float", "count": 1, "values": [ 70.0 ] } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Depth Shader Test (Distance)/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 9, 4 | "description": "§bBy Onnowhere" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Depth Shader Test (Distance)/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onnowhere/depth_shaders/ad2a0c7eb30daeeabfdcea046990ddc726956659/Depth Shader Test (Distance)/pack.png -------------------------------------------------------------------------------- /Depth Shader Test (DoF)/assets/minecraft/shaders/post/transparency.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | "water", 4 | "translucent", 5 | "itemEntity", 6 | "particles", 7 | "clouds", 8 | "weather", 9 | "final", 10 | "blur", 11 | "swap" 12 | ], 13 | "passes": [ 14 | { 15 | "name": "transparency", 16 | "intarget": "minecraft:main", 17 | "outtarget": "final", 18 | "auxtargets": [ 19 | { 20 | "name": "DiffuseDepthSampler", 21 | "id": "minecraft:main:depth" 22 | }, 23 | { 24 | "name": "TranslucentSampler", 25 | "id": "translucent" 26 | }, 27 | { 28 | "name": "TranslucentDepthSampler", 29 | "id": "translucent:depth" 30 | }, 31 | { 32 | "name": "ItemEntitySampler", 33 | "id": "itemEntity" 34 | }, 35 | { 36 | "name": "ItemEntityDepthSampler", 37 | "id": "itemEntity:depth" 38 | }, 39 | { 40 | "name": "ParticlesSampler", 41 | "id": "particles" 42 | }, 43 | { 44 | "name": "ParticlesDepthSampler", 45 | "id": "particles:depth" 46 | }, 47 | { 48 | "name": "CloudsSampler", 49 | "id": "clouds" 50 | }, 51 | { 52 | "name": "CloudsDepthSampler", 53 | "id": "clouds:depth" 54 | }, 55 | { 56 | "name": "WeatherSampler", 57 | "id": "weather" 58 | }, 59 | { 60 | "name": "WeatherDepthSampler", 61 | "id": "weather:depth" 62 | } 63 | ] 64 | }, 65 | { 66 | "name": "blur", 67 | "intarget": "final", 68 | "outtarget": "swap", 69 | "uniforms": [ 70 | { 71 | "name": "BlurDir", 72 | "values": [ 1.0, 0.0 ] 73 | }, 74 | { 75 | "name": "Radius", 76 | "values": [ 10.0 ] 77 | } 78 | ] 79 | }, 80 | { 81 | "name": "blur", 82 | "intarget": "swap", 83 | "outtarget": "blur", 84 | "uniforms": [ 85 | { 86 | "name": "BlurDir", 87 | "values": [ 0.0, 1.0 ] 88 | }, 89 | { 90 | "name": "Radius", 91 | "values": [ 10.0 ] 92 | } 93 | ] 94 | }, 95 | { 96 | "name": "depth_of_field", 97 | "intarget": "final", 98 | "outtarget": "swap", 99 | "auxtargets": [ 100 | { 101 | "name": "BlurSampler", 102 | "id": "blur" 103 | }, 104 | { 105 | "name": "DiffuseDepthSampler", 106 | "id": "minecraft:main:depth" 107 | }, 108 | { 109 | "name": "TranslucentSampler", 110 | "id": "translucent" 111 | }, 112 | { 113 | "name": "TranslucentDepthSampler", 114 | "id": "translucent:depth" 115 | } 116 | ] 117 | }, 118 | { 119 | "name": "blit", 120 | "intarget": "swap", 121 | "outtarget": "minecraft:main" 122 | } 123 | ] 124 | } 125 | -------------------------------------------------------------------------------- /Depth Shader Test (DoF)/assets/minecraft/shaders/program/blit_util.vsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec4 Position; 4 | 5 | uniform mat4 ProjMat; 6 | uniform vec2 InSize; 7 | 8 | out vec2 texCoord; 9 | out vec2 oneTexel; 10 | 11 | void main() { 12 | vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); 13 | gl_Position = vec4(outPos.xy, 0.2, 1.0); 14 | 15 | oneTexel = 1.0 / InSize; 16 | texCoord = outPos.xy * 0.5 + 0.5; 17 | } 18 | -------------------------------------------------------------------------------- /Depth Shader Test (DoF)/assets/minecraft/shaders/program/depth_of_field.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D BlurSampler; 4 | uniform sampler2D DiffuseSampler; 5 | uniform sampler2D DiffuseDepthSampler; 6 | uniform sampler2D TranslucentSampler; 7 | uniform sampler2D TranslucentDepthSampler; 8 | 9 | uniform vec2 FocusRange; 10 | uniform vec2 DepthScale; 11 | 12 | in vec2 texCoord; 13 | in vec2 oneTexel; 14 | out vec4 fragColor; 15 | 16 | float near = 0.1; 17 | float far = 100.0; 18 | 19 | float LinearizeDepth(float depth) 20 | { 21 | float z = depth * 2.0 - 1.0; // back to NDC 22 | return (2.0 * near * far) / (far + near - z * (far - near)); 23 | } 24 | 25 | void main() { 26 | float depth = LinearizeDepth(texture(TranslucentDepthSampler, texCoord).r) / far; // divide by far for demonstration 27 | depth = clamp(depth, 0.0, 1.0); 28 | vec4 col = vec4(texture(DiffuseSampler, texCoord).rgb, 1.0); 29 | vec4 col_blur = vec4(texture(BlurSampler, texCoord).rgb, 1.0); 30 | vec2 focus_range = FocusRange; 31 | if (depth > focus_range.y) { 32 | depth *= DepthScale.x; 33 | focus_range.y *= DepthScale.x; 34 | depth -= focus_range.y; 35 | depth = clamp(depth, 0.0, 1.0); 36 | col = col*(1.0-depth) + col_blur*(depth); 37 | } else if (depth < focus_range.x) { 38 | depth *= DepthScale.y; 39 | focus_range.x *= DepthScale.y; 40 | depth += 1.0 - focus_range.x; 41 | depth = clamp(depth, 0.0, 1.0); 42 | col = col*(depth) + col_blur*(1.0-depth); 43 | } 44 | fragColor = col; 45 | } 46 | -------------------------------------------------------------------------------- /Depth Shader Test (DoF)/assets/minecraft/shaders/program/depth_of_field.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "one", 5 | "dstrgb": "zero" 6 | }, 7 | "vertex": "blit_util", 8 | "fragment": "depth_of_field", 9 | "attributes": [ "Position" ], 10 | "samplers": [ 11 | { "name": "BlurSampler" }, 12 | { "name": "DiffuseSampler" }, 13 | { "name": "DiffuseDepthSampler" }, 14 | { "name": "TranslucentSampler" }, 15 | { "name": "TranslucentDepthSampler" } 16 | ], 17 | "uniforms": [ 18 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 19 | { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 20 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 21 | { "name": "FocusRange", "type": "float", "count": 2, "values": [ 0.45, 0.485 ] }, 22 | { "name": "DepthScale", "type": "float", "count": 2, "values": [ 8.0, 8.0 ] } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /Depth Shader Test (DoF)/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 9, 4 | "description": "§bBy Onnowhere" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Depth Shader Test (DoF)/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onnowhere/depth_shaders/ad2a0c7eb30daeeabfdcea046990ddc726956659/Depth Shader Test (DoF)/pack.png -------------------------------------------------------------------------------- /Depth Shader Test (Fog)/assets/minecraft/shaders/post/transparency.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | "water", 4 | "translucent", 5 | "itemEntity", 6 | "particles", 7 | "clouds", 8 | "weather", 9 | "final", 10 | "swap" 11 | ], 12 | "passes": [ 13 | { 14 | "name": "transparency", 15 | "intarget": "minecraft:main", 16 | "outtarget": "swap", 17 | "auxtargets": [ 18 | { 19 | "name": "DiffuseDepthSampler", 20 | "id": "minecraft:main:depth" 21 | }, 22 | { 23 | "name": "TranslucentSampler", 24 | "id": "translucent" 25 | }, 26 | { 27 | "name": "TranslucentDepthSampler", 28 | "id": "translucent:depth" 29 | }, 30 | { 31 | "name": "ItemEntitySampler", 32 | "id": "itemEntity" 33 | }, 34 | { 35 | "name": "ItemEntityDepthSampler", 36 | "id": "itemEntity:depth" 37 | }, 38 | { 39 | "name": "ParticlesSampler", 40 | "id": "particles" 41 | }, 42 | { 43 | "name": "ParticlesDepthSampler", 44 | "id": "particles:depth" 45 | }, 46 | { 47 | "name": "CloudsSampler", 48 | "id": "clouds" 49 | }, 50 | { 51 | "name": "CloudsDepthSampler", 52 | "id": "clouds:depth" 53 | }, 54 | { 55 | "name": "WeatherSampler", 56 | "id": "weather" 57 | }, 58 | { 59 | "name": "WeatherDepthSampler", 60 | "id": "weather:depth" 61 | } 62 | ] 63 | }, 64 | { 65 | "name": "depth_test", 66 | "intarget": "swap", 67 | "outtarget": "final", 68 | "auxtargets": [ 69 | { 70 | "name": "DiffuseDepthSampler", 71 | "id": "minecraft:main:depth" 72 | } 73 | ] 74 | }, 75 | { 76 | "name": "blit", 77 | "intarget": "final", 78 | "outtarget": "minecraft:main", 79 | "auxtargets": [ 80 | { 81 | "name": "DiffuseDepthSampler", 82 | "id": "minecraft:main:depth" 83 | } 84 | ] 85 | } 86 | ] 87 | } 88 | -------------------------------------------------------------------------------- /Depth Shader Test (Fog)/assets/minecraft/shaders/program/blit_util.vsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec4 Position; 4 | 5 | uniform mat4 ProjMat; 6 | uniform vec2 InSize; 7 | 8 | out vec2 texCoord; 9 | out vec2 oneTexel; 10 | 11 | void main() { 12 | vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); 13 | gl_Position = vec4(outPos.xy, 0.2, 1.0); 14 | 15 | oneTexel = 1.0 / InSize; 16 | texCoord = outPos.xy * 0.5 + 0.5; 17 | } 18 | -------------------------------------------------------------------------------- /Depth Shader Test (Fog)/assets/minecraft/shaders/program/depth_test.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D DiffuseSampler; 4 | uniform sampler2D DiffuseDepthSampler; 5 | 6 | in vec2 texCoord; 7 | in vec2 oneTexel; 8 | out vec4 fragColor; 9 | 10 | void main() { 11 | float col = 1.0-(1.0-texture(DiffuseDepthSampler, texCoord).r)*500.0; 12 | fragColor = vec4(vec3(col), 1.0); 13 | } 14 | -------------------------------------------------------------------------------- /Depth Shader Test (Fog)/assets/minecraft/shaders/program/depth_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "one", 5 | "dstrgb": "zero" 6 | }, 7 | "vertex": "blit_util", 8 | "fragment": "depth_test", 9 | "attributes": [ "Position" ], 10 | "samplers": [ 11 | { "name": "DiffuseSampler" }, 12 | { "name": "DiffuseDepthSampler" } 13 | ], 14 | "uniforms": [ 15 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 16 | { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 17 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Depth Shader Test (Fog)/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 9, 4 | "description": "§bBy Onnowhere" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Depth Shader Test (Fog)/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onnowhere/depth_shaders/ad2a0c7eb30daeeabfdcea046990ddc726956659/Depth Shader Test (Fog)/pack.png -------------------------------------------------------------------------------- /Depth Shader Test (Stripes)/assets/minecraft/shaders/post/transparency.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | "water", 4 | "translucent", 5 | "itemEntity", 6 | "particles", 7 | "clouds", 8 | "weather", 9 | "final", 10 | "swap" 11 | ], 12 | "passes": [ 13 | { 14 | "name": "transparency", 15 | "intarget": "minecraft:main", 16 | "outtarget": "swap", 17 | "auxtargets": [ 18 | { 19 | "name": "DiffuseDepthSampler", 20 | "id": "minecraft:main:depth" 21 | }, 22 | { 23 | "name": "TranslucentSampler", 24 | "id": "translucent" 25 | }, 26 | { 27 | "name": "TranslucentDepthSampler", 28 | "id": "translucent:depth" 29 | }, 30 | { 31 | "name": "ItemEntitySampler", 32 | "id": "itemEntity" 33 | }, 34 | { 35 | "name": "ItemEntityDepthSampler", 36 | "id": "itemEntity:depth" 37 | }, 38 | { 39 | "name": "ParticlesSampler", 40 | "id": "particles" 41 | }, 42 | { 43 | "name": "ParticlesDepthSampler", 44 | "id": "particles:depth" 45 | }, 46 | { 47 | "name": "CloudsSampler", 48 | "id": "clouds" 49 | }, 50 | { 51 | "name": "CloudsDepthSampler", 52 | "id": "clouds:depth" 53 | }, 54 | { 55 | "name": "WeatherSampler", 56 | "id": "weather" 57 | }, 58 | { 59 | "name": "WeatherDepthSampler", 60 | "id": "weather:depth" 61 | } 62 | ] 63 | }, 64 | { 65 | "name": "stripes", 66 | "intarget": "swap", 67 | "outtarget": "final", 68 | "auxtargets": [ 69 | { 70 | "name": "DiffuseDepthSampler", 71 | "id": "minecraft:main:depth" 72 | } 73 | ] 74 | }, 75 | { 76 | "name": "blit", 77 | "intarget": "final", 78 | "outtarget": "minecraft:main", 79 | "auxtargets": [ 80 | { 81 | "name": "DiffuseDepthSampler", 82 | "id": "minecraft:main:depth" 83 | } 84 | ] 85 | } 86 | ] 87 | } 88 | -------------------------------------------------------------------------------- /Depth Shader Test (Stripes)/assets/minecraft/shaders/program/blit_util.vsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec4 Position; 4 | 5 | uniform mat4 ProjMat; 6 | uniform vec2 InSize; 7 | 8 | out vec2 texCoord; 9 | out vec2 oneTexel; 10 | 11 | void main() { 12 | vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); 13 | gl_Position = vec4(outPos.xy, 0.2, 1.0); 14 | 15 | oneTexel = 1.0 / InSize; 16 | texCoord = outPos.xy * 0.5 + 0.5; 17 | } 18 | -------------------------------------------------------------------------------- /Depth Shader Test (Stripes)/assets/minecraft/shaders/program/stripes.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D DiffuseSampler; 4 | uniform sampler2D DiffuseDepthSampler; 5 | 6 | in vec2 texCoord; 7 | out vec4 fragColor; 8 | 9 | float near = 0.1; 10 | float far = 1000.0; 11 | 12 | float LinearizeDepth(float depth) 13 | { 14 | float z = depth * 2.0 - 1.0; 15 | return (near * far) / (far + near - z * (far - near)); 16 | } 17 | 18 | void main() { 19 | float depth = LinearizeDepth(texture(DiffuseDepthSampler, texCoord).r); 20 | if (mod(depth, 1.0) <= 0.02) { 21 | fragColor = vec4(0.0,0.0,0.0,1.0); 22 | } else { 23 | fragColor = vec4(texture(DiffuseSampler, texCoord).rgb, 1.0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Depth Shader Test (Stripes)/assets/minecraft/shaders/program/stripes.json: -------------------------------------------------------------------------------- 1 | { 2 | "blend": { 3 | "func": "add", 4 | "srcrgb": "one", 5 | "dstrgb": "zero" 6 | }, 7 | "vertex": "blit_util", 8 | "fragment": "stripes", 9 | "attributes": [ "Position" ], 10 | "samplers": [ 11 | { "name": "DiffuseSampler" }, 12 | { "name": "DiffuseDepthSampler" } 13 | ], 14 | "uniforms": [ 15 | { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, 16 | { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, 17 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Depth Shader Test (Stripes)/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 9, 4 | "description": "§bBy Onnowhere" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Depth Shader Test (Stripes)/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onnowhere/depth_shaders/ad2a0c7eb30daeeabfdcea046990ddc726956659/Depth Shader Test (Stripes)/pack.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Download these resource packs from the [Releases page](https://github.com/onnowhere/depth_shaders/releases).** 2 | 3 | ---- 4 | 5 | These resource packs utilize the new depth buffers introduced in Minecraft Snapshot 20w22a. 6 | 7 | See https://imgur.com/a/yz9rPP1 for examples uses of depth shaders (not all shaders in the album are included here). 8 | 9 | ### License 10 | 11 | This project is made available under the [Creative Commons CC0 Public Domain license](LICENSE). 12 | --------------------------------------------------------------------------------