├── LICENSE
├── README.md
├── center-crosshair
├── assets
│ └── minecraft
│ │ ├── shaders
│ │ └── core
│ │ │ ├── position_tex.fsh
│ │ │ ├── position_tex.json
│ │ │ └── position_tex.vsh
│ │ └── textures
│ │ └── gui
│ │ └── icons.png
└── pack.mcmeta
├── extended-sky
├── assets
│ └── minecraft
│ │ └── shaders
│ │ ├── core
│ │ ├── position.fsh
│ │ ├── position.json
│ │ └── position.vsh
│ │ └── include
│ │ └── fog.glsl
└── pack.mcmeta
├── faster-fabulous
├── assets
│ └── minecraft
│ │ └── shaders
│ │ └── program
│ │ └── transparency.fsh
└── pack.mcmeta
├── floofy-clouds
├── assets
│ └── minecraft
│ │ └── shaders
│ │ ├── post
│ │ └── transparency.json
│ │ └── program
│ │ ├── cloudblur.fsh
│ │ ├── cloudblur.json
│ │ ├── transparency.fsh
│ │ └── transparency.json
└── pack.mcmeta
├── holo-minimap
├── assets
│ └── minecraft
│ │ └── shaders
│ │ ├── core
│ │ ├── position.fsh
│ │ ├── position.json
│ │ ├── position.vsh
│ │ ├── rendertype_cutout.fsh
│ │ ├── rendertype_cutout.json
│ │ ├── rendertype_cutout.vsh
│ │ ├── rendertype_cutout_mipped.fsh
│ │ ├── rendertype_cutout_mipped.json
│ │ ├── rendertype_cutout_mipped.vsh
│ │ ├── rendertype_solid.fsh
│ │ ├── rendertype_solid.json
│ │ ├── rendertype_solid.vsh
│ │ ├── rendertype_translucent.fsh
│ │ ├── rendertype_translucent.json
│ │ └── rendertype_translucent.vsh
│ │ ├── include
│ │ ├── fog.glsl
│ │ └── holo.glsl
│ │ ├── post
│ │ └── transparency.json
│ │ └── program
│ │ ├── composite.fsh
│ │ ├── composite.json
│ │ ├── copy.json
│ │ ├── copy.vsh
│ │ ├── transparency2.fsh
│ │ ├── transparency2.json
│ │ ├── transparency3.fsh
│ │ └── transparency3.json
└── pack.mcmeta
├── images
├── center-crosshair.png
├── extended-sky.png
├── floofy-clouds.png
├── holo-minimap.png
├── light-level-detect.png
├── smooth-clouds.png
├── sun-position.gif
├── vaporwave-solid.png
└── vaporwave.png
├── light-level-detect
├── assets
│ └── minecraft
│ │ └── shaders
│ │ └── include
│ │ └── light.glsl
└── pack.mcmeta
├── smooth-clouds
├── assets
│ └── minecraft
│ │ └── shaders
│ │ └── core
│ │ ├── position_tex_color_normal.fsh
│ │ ├── position_tex_color_normal.json
│ │ └── position_tex_color_normal.vsh
└── pack.mcmeta
├── sun-position
├── assets
│ └── minecraft
│ │ └── shaders
│ │ ├── core
│ │ ├── position.fsh
│ │ ├── position.json
│ │ ├── position.vsh
│ │ ├── position_color.fsh
│ │ ├── position_color.json
│ │ ├── position_color.vsh
│ │ ├── position_tex.fsh
│ │ ├── position_tex.json
│ │ ├── position_tex.vsh
│ │ ├── position_tex_color.fsh
│ │ ├── position_tex_color.json
│ │ ├── position_tex_color.vsh
│ │ ├── rendertype_armor_cutout_no_cull.fsh
│ │ ├── rendertype_armor_cutout_no_cull.json
│ │ ├── rendertype_armor_cutout_no_cull.vsh
│ │ ├── rendertype_beacon_beam.fsh
│ │ ├── rendertype_beacon_beam.json
│ │ ├── rendertype_beacon_beam.vsh
│ │ ├── rendertype_cutout.fsh
│ │ ├── rendertype_cutout.json
│ │ ├── rendertype_cutout.vsh
│ │ ├── rendertype_cutout_mipped.fsh
│ │ ├── rendertype_cutout_mipped.json
│ │ ├── rendertype_cutout_mipped.vsh
│ │ ├── rendertype_end_gateway.json
│ │ ├── rendertype_end_portal.fsh
│ │ ├── rendertype_end_portal.json
│ │ ├── rendertype_end_portal.vsh
│ │ ├── rendertype_energy_swirl.fsh
│ │ ├── rendertype_energy_swirl.json
│ │ ├── rendertype_energy_swirl.vsh
│ │ ├── rendertype_entity_cutout.fsh
│ │ ├── rendertype_entity_cutout.json
│ │ ├── rendertype_entity_cutout.vsh
│ │ ├── rendertype_entity_cutout_no_cull.fsh
│ │ ├── rendertype_entity_cutout_no_cull.json
│ │ ├── rendertype_entity_cutout_no_cull.vsh
│ │ ├── rendertype_entity_cutout_no_cull_z_offset.fsh
│ │ ├── rendertype_entity_cutout_no_cull_z_offset.json
│ │ ├── rendertype_entity_cutout_no_cull_z_offset.vsh
│ │ ├── rendertype_entity_no_outline.fsh
│ │ ├── rendertype_entity_no_outline.json
│ │ ├── rendertype_entity_no_outline.vsh
│ │ ├── rendertype_entity_shadow.fsh
│ │ ├── rendertype_entity_shadow.json
│ │ ├── rendertype_entity_shadow.vsh
│ │ ├── rendertype_entity_smooth_cutout.fsh
│ │ ├── rendertype_entity_smooth_cutout.json
│ │ ├── rendertype_entity_smooth_cutout.vsh
│ │ ├── rendertype_entity_solid.fsh
│ │ ├── rendertype_entity_solid.json
│ │ ├── rendertype_entity_solid.vsh
│ │ ├── rendertype_entity_translucent.fsh
│ │ ├── rendertype_entity_translucent.json
│ │ ├── rendertype_entity_translucent.vsh
│ │ ├── rendertype_entity_translucent_cull.fsh
│ │ ├── rendertype_entity_translucent_cull.json
│ │ ├── rendertype_entity_translucent_cull.vsh
│ │ ├── rendertype_eyes.fsh
│ │ ├── rendertype_eyes.json
│ │ ├── rendertype_eyes.vsh
│ │ ├── rendertype_leash.fsh
│ │ ├── rendertype_leash.json
│ │ ├── rendertype_leash.vsh
│ │ ├── rendertype_solid.fsh
│ │ ├── rendertype_solid.json
│ │ └── rendertype_solid.vsh
│ │ ├── include
│ │ ├── fog.glsl
│ │ ├── light.glsl
│ │ ├── matrix.glsl
│ │ ├── projection.glsl
│ │ └── utils.glsl
│ │ ├── post
│ │ └── transparency.json
│ │ └── program
│ │ ├── shading.fsh
│ │ ├── shading.json
│ │ └── shading.vsh
└── pack.mcmeta
├── vaporwave-solid
├── assets
│ └── minecraft
│ │ ├── shaders
│ │ ├── core
│ │ │ ├── position.fsh
│ │ │ ├── position.json
│ │ │ ├── position.vsh
│ │ │ ├── position_tex_color_normal.fsh
│ │ │ ├── position_tex_color_normal.json
│ │ │ ├── position_tex_color_normal.vsh
│ │ │ ├── rendertype_cutout.fsh
│ │ │ ├── rendertype_cutout.json
│ │ │ ├── rendertype_cutout.vsh
│ │ │ ├── rendertype_cutout_mipped.fsh
│ │ │ ├── rendertype_cutout_mipped.json
│ │ │ ├── rendertype_cutout_mipped.vsh
│ │ │ ├── rendertype_solid.fsh
│ │ │ ├── rendertype_solid.json
│ │ │ ├── rendertype_solid.vsh
│ │ │ ├── rendertype_translucent.fsh
│ │ │ ├── rendertype_translucent.json
│ │ │ └── rendertype_translucent.vsh
│ │ ├── include
│ │ │ ├── fog.glsl
│ │ │ ├── light.glsl
│ │ │ └── utils.glsl
│ │ ├── post
│ │ │ └── transparency.json
│ │ └── program
│ │ │ ├── bloom.fsh
│ │ │ ├── bloom.json
│ │ │ └── bloom.vsh
│ │ └── textures
│ │ └── environment
│ │ ├── moon_phases.png
│ │ └── sun.png
└── pack.mcmeta
└── vaporwave
├── assets
└── minecraft
│ ├── shaders
│ ├── core
│ │ ├── position.fsh
│ │ ├── position.json
│ │ ├── position.vsh
│ │ ├── position_tex_color_normal.fsh
│ │ ├── position_tex_color_normal.json
│ │ ├── position_tex_color_normal.vsh
│ │ ├── rendertype_cutout.fsh
│ │ ├── rendertype_cutout.json
│ │ ├── rendertype_cutout.vsh
│ │ ├── rendertype_cutout_mipped.fsh
│ │ ├── rendertype_cutout_mipped.json
│ │ ├── rendertype_cutout_mipped.vsh
│ │ ├── rendertype_solid.fsh
│ │ ├── rendertype_solid.json
│ │ ├── rendertype_solid.vsh
│ │ ├── rendertype_translucent.fsh
│ │ ├── rendertype_translucent.json
│ │ └── rendertype_translucent.vsh
│ ├── include
│ │ ├── fog.glsl
│ │ ├── light.glsl
│ │ └── utils.glsl
│ ├── post
│ │ └── transparency.json
│ └── program
│ │ ├── bloom.fsh
│ │ ├── bloom.json
│ │ └── bloom.vsh
│ └── textures
│ └── environment
│ ├── moon_phases.png
│ └── sun.png
└── pack.mcmeta
/README.md:
--------------------------------------------------------------------------------
1 | # shader-toolkit
2 | useful MC 1.17 vanilla shader examples
3 |
4 | ## extended-sky
5 | Modifies vanilla sky so that it can be drawn below the horizon. Allows drawing of all of the sky. Also minimally affects the default sky. Horizon fog changes a bit. This is good for full custom skyboxes.
6 |
7 | Requirements:
8 | - none
9 |
10 |
11 | ## holo-minimap
12 | !!!PROOF OF CONCEPT!!! WILL BREAK IN MANY SCENARIOS (to keep the shader simple).
13 | Exemplifies rendering the scene twice (in an arguably cool way). Creates a second 3D hologram of terrain around the player in lower right of screen. Pseudo-random selection of frames to choose between renders.
14 |
15 | Requirements:
16 | - Fabulous
17 |
18 |
19 | ## sun-position
20 | Exemplifies extracting sun position, ProjMat, ModelViewMat from core and passing into post. Computes directional lighting based on sun position and tod.
21 |
22 | Requirements:
23 | - Fabulous
24 |
25 |
26 | ## vaporwave
27 | A E S T H E T I C. Couple neat tricks here. Bloom shader, waving water. Detecting water by using model height instead of texture. Barycentric coordinates to tell where on a face a fragment is. Also making use of extended sky. Does not include entities to keep the pack simple.
28 |
29 | Requirements:
30 | - none for base
31 | - Fabulous for bloom
32 |
33 |
34 | ## vaporwave-solid
35 | A E S T H E T I C. Solid version for those who actually want to play with this on. My question: WHY!?
36 |
37 | Requirements:
38 | - none for base
39 | - Fabulous for bloom
40 |
41 |
42 | ## faster-fabulous
43 | Tweak transparency shader for a small performance boost, especially on weaker systems. Up to 10% fps boost on UHD 630.
44 |
45 | Requirements:
46 | - Fabulous duh
47 |
48 | ## center-crosshair
49 | MC-157252 (and it's predecessor MC-5024) has plagued MC for ages. With core shaders, it is now possible to fix it! Forget waiting for Mojang! Main concept is to calculate center of screen from within the shader and reposition the crosshair sprite (!!!Note that crosshair sprite has an even pixel width so be careful when creating your crosshairs!!!).
50 |
51 | Requirements:
52 | - none
53 |
54 |
55 | ## floofy-clouds
56 | Fully post process soft clouds. No fancy volumetric math and/or voxelization. Just a simple blur can achieve great things.
57 |
58 | Requirements:
59 | - Fabulous
60 |
61 |
62 | ## smooth-clouds
63 | Core smooth cloud shading. No fancy volumetric math and/or voxelization. Just a gradient on the cloulds.
64 |
65 | Requirements:
66 | - none
67 |
68 |
69 | ## light-level-detect
70 | Extremely simple core shader to check for mob spawning light levels pre 1.19.
71 |
72 | Requirements:
73 | - No Optifine
74 |
--------------------------------------------------------------------------------
/center-crosshair/assets/minecraft/shaders/core/position_tex.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D Sampler0;
4 |
5 | uniform vec4 ColorModulator;
6 |
7 | in vec2 texCoord0;
8 | in vec3 vertexColor;
9 |
10 | out vec4 fragColor;
11 |
12 | void main() {
13 | vec4 color = texture(Sampler0, texCoord0);
14 | if (color.a == 0.0) {
15 | discard;
16 | }
17 | color.rgb *= vertexColor;
18 | fragColor = color * ColorModulator;
19 | }
20 |
--------------------------------------------------------------------------------
/center-crosshair/assets/minecraft/shaders/core/position_tex.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_tex",
8 | "fragment": "position_tex",
9 | "attributes": [
10 | "Position",
11 | "UV0"
12 | ],
13 | "samplers": [
14 | { "name": "Sampler0" }
15 | ],
16 | "uniforms": [
17 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
20 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/center-crosshair/assets/minecraft/shaders/core/position_tex.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec2 UV0;
5 |
6 | uniform sampler2D Sampler0;
7 | uniform mat4 ModelViewMat;
8 | uniform mat4 ProjMat;
9 | uniform vec2 ScreenSize;
10 |
11 | out vec2 texCoord0;
12 | out vec3 vertexColor;
13 |
14 | #define CROSSHAIRSIZE 0.05 // target crosshair size as multiple of Y height
15 | #define CROSSHAIRSIZEMIN 80.0 // minimum crosshair size on screen in pix (entire sprite, not just visible portion)
16 | #define FUDGE 0.999 // for UV to prevent stitching effect. no touchy!
17 | #define SPRITESIZE 1.0 / 16.0 // size of crosshair on icons.png. no touchy!
18 | #define MINTEXSIZE 1024.0 // minimum size of crosshair+ui texture
19 |
20 | void main() {
21 | vec4 pos = ProjMat * ModelViewMat * vec4(Position, 1.0);
22 | vec2 dim = textureSize(Sampler0, 0);
23 | float ratio = ScreenSize.y / ScreenSize.x;
24 | texCoord0 = UV0;
25 | vertexColor = vec3(1.0);
26 |
27 |
28 | if (dim.x >= MINTEXSIZE && dim.y >= MINTEXSIZE && abs(pos.x) <= 0.1 * ratio && abs(pos.y) <= 0.1 && Position.z == 0.0 && UV0.x < SPRITESIZE && UV0.y < SPRITESIZE) {
29 | if (pos.x < 0.0) {
30 | pos.x = -max(CROSSHAIRSIZE * ratio, CROSSHAIRSIZEMIN / ScreenSize.x);
31 | texCoord0.x = SPRITESIZE * (1.0 - FUDGE);
32 | } else {
33 | texCoord0.x = SPRITESIZE * FUDGE;
34 | pos.x = max(CROSSHAIRSIZE * ratio, CROSSHAIRSIZEMIN / ScreenSize.x);
35 | }
36 | if (pos.y < 0.0) {
37 | texCoord0.y = SPRITESIZE * (1.0 - FUDGE);
38 | pos.y = -max(CROSSHAIRSIZE, CROSSHAIRSIZEMIN / ScreenSize.y);
39 | } else {
40 | texCoord0.y = SPRITESIZE * FUDGE;
41 | pos.y = max(CROSSHAIRSIZE, CROSSHAIRSIZEMIN / ScreenSize.y);
42 | }
43 |
44 | if (int(ScreenSize.x) % 2 == 1) { // handle odd width case
45 | pos.x -= 1.0 / ScreenSize.x;
46 | }
47 | if (int(ScreenSize.y) % 2 == 1) { // handle odd height case
48 | pos.y -= 1.0 / ScreenSize.y;
49 | }
50 | }
51 | gl_Position = pos;
52 | }
53 |
--------------------------------------------------------------------------------
/center-crosshair/assets/minecraft/textures/gui/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/center-crosshair/assets/minecraft/textures/gui/icons.png
--------------------------------------------------------------------------------
/center-crosshair/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Centered Crosshair"
5 | }
6 | }
--------------------------------------------------------------------------------
/extended-sky/assets/minecraft/shaders/core/position.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform vec4 ColorModulator;
6 | uniform float FogStart;
7 | uniform float FogEnd;
8 | uniform vec4 FogColor;
9 | uniform vec2 ScreenSize;
10 |
11 | in mat4 ProjInv;
12 | in float isSky;
13 | in float vertexDistance;
14 |
15 | out vec4 fragColor;
16 |
17 | #define GRIDOFFSET 0.078
18 | #define GRIDDENSITY 10.0
19 |
20 | void main() {
21 | // get player space view vector
22 | vec4 screenPos = gl_FragCoord;
23 | screenPos.xy = (screenPos.xy / ScreenSize - vec2(0.5)) * 2.0;
24 | screenPos.zw = vec2(1.0);
25 | vec3 view = normalize((ProjInv * screenPos).xyz);
26 |
27 | float vdn = dot(view, vec3(0.0, 1.0, 0.0));
28 | float vdt = dot(view, vec3(1.0, 0.0, 0.0));
29 | float vdb = dot(view, vec3(0.0, 0.0, 1.0));
30 |
31 | // custom fog calculation if sky because sky disc is no longer above the head
32 | if (isSky > 0.5) {
33 | float ndusq = clamp(dot(view, vec3(0.0, 1.0, 0.0)), 0.0, 1.0);
34 | ndusq = ndusq * ndusq;
35 |
36 | fragColor = linear_fog(ColorModulator, pow(1.0 - ndusq, 8.0), 0.0, 1.0, FogColor);
37 | }
38 | // default shading for void plane and stars
39 | else {
40 | fragColor = linear_fog(ColorModulator, vertexDistance, FogStart, FogEnd, FogColor);
41 | }
42 |
43 | // drawing the red grid
44 | if (fract(vdn * GRIDDENSITY + GRIDOFFSET) < 0.01
45 | || fract(vdt * GRIDDENSITY + GRIDOFFSET) < 0.01
46 | || fract(vdb * GRIDDENSITY + GRIDOFFSET) < 0.01) {
47 | fragColor = vec4(1.0, 0.0, 0.0, 1.0);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/extended-sky/assets/minecraft/shaders/core/position.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position",
8 | "fragment": "position",
9 | "attributes": [
10 | ],
11 | "samplers": [
12 | ],
13 | "uniforms": [
14 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
17 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
19 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
20 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
21 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/extended-sky/assets/minecraft/shaders/core/position.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 |
5 | uniform mat4 ModelViewMat;
6 | uniform mat4 ProjMat;
7 | uniform float FogEnd;
8 |
9 | out mat4 ProjInv;
10 | out float isSky;
11 | out float vertexDistance;
12 |
13 | #define BOTTOM -32.0
14 | #define SCALE 0.01
15 | #define SKYHEIGHT 16.0
16 | #define SKYRADIUS 512.0
17 | #define FUDGE 0.004
18 |
19 | void main() {
20 | vec3 scaledPos = Position;
21 | ProjInv = inverse(ProjMat * ModelViewMat);
22 | isSky = 0.0;
23 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
24 |
25 | // sky disk is by default 16.0 units above with radius of 512.0 around the camera at all times.
26 | if (abs(scaledPos.y - SKYHEIGHT) < FUDGE && (length(scaledPos.xz) <= FUDGE || abs(length(scaledPos.xz) - SKYRADIUS) < FUDGE)) {
27 | isSky = 1.0;
28 |
29 | // Make sky into a cone by bringing down edges of the disk.
30 | if (length(scaledPos.xz) > 1.0) {
31 | scaledPos.y = BOTTOM;
32 | }
33 |
34 | // Make it big so it does not interfere with void plane.
35 | scaledPos.xyz *= SCALE;
36 |
37 | // rotate to z axis
38 | scaledPos = scaledPos.xzy;
39 | scaledPos.z *= -1;
40 |
41 | // ignore model view so the cone follows the camera angle.
42 | gl_Position = ProjMat * vec4(scaledPos, 1.0);
43 | } else {
44 | gl_Position = ProjMat * ModelViewMat * vec4(scaledPos, 1.0);
45 | }
46 | }
--------------------------------------------------------------------------------
/extended-sky/assets/minecraft/shaders/include/fog.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
4 | if (vertexDistance <= fogStart) {
5 | return inColor;
6 | }
7 |
8 | float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
9 | return vec4(mix(inColor.rgb, fogColor.rgb, fogValue * fogColor.a), inColor.a);
10 | }
11 |
12 | float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
13 | if (vertexDistance <= fogStart) {
14 | return 1.0;
15 | } else if (vertexDistance >= fogEnd) {
16 | return 0.0;
17 | }
18 |
19 | return smoothstep(fogEnd, fogStart, vertexDistance);
20 | }
21 |
--------------------------------------------------------------------------------
/extended-sky/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Draw Below the Horizon"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/faster-fabulous/assets/minecraft/shaders/program/transparency.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D DiffuseDepthSampler;
5 | uniform sampler2D TranslucentSampler;
6 | uniform sampler2D TranslucentDepthSampler;
7 | uniform sampler2D ItemEntitySampler;
8 | uniform sampler2D ItemEntityDepthSampler;
9 | uniform sampler2D ParticlesSampler;
10 | uniform sampler2D ParticlesDepthSampler;
11 | uniform sampler2D WeatherSampler;
12 | uniform sampler2D WeatherDepthSampler;
13 | uniform sampler2D CloudsSampler;
14 | uniform sampler2D CloudsDepthSampler;
15 |
16 | in vec2 texCoord;
17 |
18 | #define NUM_LAYERS 6
19 |
20 | vec4 color_layers[NUM_LAYERS];
21 | float depth_layers[NUM_LAYERS];
22 | int index_layers[NUM_LAYERS] = int[NUM_LAYERS](0, 1 ,2, 3, 4, 5);
23 | int active_layers = 0;
24 |
25 | out vec4 fragColor;
26 |
27 | void try_insert( vec4 color, sampler2D dSampler ) {
28 | if ( color.a == 0.0 ) {
29 | return;
30 | }
31 |
32 | float depth = texture( dSampler, texCoord ).r;
33 | color_layers[active_layers] = color;
34 | depth_layers[active_layers] = depth;
35 |
36 | int jj = active_layers++;
37 | int ii = jj - 1;
38 | while ( jj > 0 && depth > depth_layers[index_layers[ii]] ) {
39 | int indexTemp = index_layers[ii];
40 | index_layers[ii] = index_layers[jj];
41 | index_layers[jj] = indexTemp;
42 |
43 | jj = ii--;
44 | }
45 | }
46 |
47 | vec3 blend( vec3 dst, vec4 src ) {
48 | return ( dst * ( 1.0 - src.a ) ) + src.rgb;
49 | }
50 |
51 | void main() {
52 | color_layers[0] = vec4( texture( DiffuseSampler, texCoord ).rgb, 1.0 );
53 | depth_layers[0] = texture( DiffuseDepthSampler, texCoord ).r;
54 | active_layers = 1;
55 |
56 | try_insert( texture( CloudsSampler, texCoord ), CloudsDepthSampler);
57 | try_insert( texture( TranslucentSampler, texCoord ), TranslucentDepthSampler);
58 | try_insert( texture( ParticlesSampler, texCoord ), ParticlesDepthSampler);
59 | try_insert( texture( WeatherSampler, texCoord ), WeatherDepthSampler);
60 | try_insert( texture( ItemEntitySampler, texCoord ), ItemEntityDepthSampler);
61 |
62 | vec3 texelAccum = color_layers[index_layers[0]].rgb;
63 | for ( int ii = 1; ii < active_layers; ++ii ) {
64 | texelAccum = blend( texelAccum, color_layers[index_layers[ii]] );
65 | }
66 |
67 | fragColor = vec4( texelAccum.rgb, 1.0 );
68 | }
--------------------------------------------------------------------------------
/faster-fabulous/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Fabulous FPS Boost on Weaker Systems"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/floofy-clouds/assets/minecraft/shaders/post/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | "swap1",
4 | "swap2",
5 | "translucent",
6 | "itemEntity",
7 | "particles",
8 | "clouds",
9 | "weather"
10 | ],
11 | "passes": [
12 | {
13 | "name": "cloudblur",
14 | "intarget": "clouds",
15 | "outtarget": "swap1",
16 | "auxtargets": [
17 | {
18 | "name": "DepthSampler",
19 | "id": "clouds:depth"
20 | }
21 | ],
22 | "uniforms": [
23 | {
24 | "name": "BlurDir",
25 | "values": [ 1.0, 0.0 ]
26 | },
27 | {
28 | "name": "FirstPass",
29 | "values": [ 1.0 ]
30 | }
31 | ]
32 | },
33 | {
34 | "name": "cloudblur",
35 | "intarget": "swap1",
36 | "outtarget": "swap2",
37 | "auxtargets": [
38 | {
39 | "name": "DepthSampler",
40 | "id": "clouds:depth"
41 | }
42 | ],
43 | "uniforms": [
44 | {
45 | "name": "BlurDir",
46 | "values": [ 0.0, 1.0 ]
47 | },
48 | {
49 | "name": "FirstPass",
50 | "values": [ 0.0 ]
51 | }
52 | ]
53 | },
54 | {
55 | "name": "transparency",
56 | "intarget": "minecraft:main",
57 | "outtarget": "swap1",
58 | "auxtargets": [
59 | {
60 | "name": "DiffuseDepthSampler",
61 | "id": "minecraft:main:depth"
62 | },
63 | {
64 | "name": "TranslucentSampler",
65 | "id": "translucent"
66 | },
67 | {
68 | "name": "TranslucentDepthSampler",
69 | "id": "translucent:depth"
70 | },
71 | {
72 | "name": "ItemEntitySampler",
73 | "id": "itemEntity"
74 | },
75 | {
76 | "name": "ItemEntityDepthSampler",
77 | "id": "itemEntity:depth"
78 | },
79 | {
80 | "name": "ParticlesSampler",
81 | "id": "particles"
82 | },
83 | {
84 | "name": "ParticlesDepthSampler",
85 | "id": "particles:depth"
86 | },
87 | {
88 | "name": "CloudsSampler",
89 | "id": "swap2"
90 | },
91 | {
92 | "name": "CloudsDepthSampler",
93 | "id": "clouds:depth"
94 | },
95 | {
96 | "name": "WeatherSampler",
97 | "id": "weather"
98 | },
99 | {
100 | "name": "WeatherDepthSampler",
101 | "id": "weather:depth"
102 | }
103 | ]
104 | },
105 | {
106 | "name": "blit",
107 | "intarget": "swap1",
108 | "outtarget": "minecraft:main"
109 | }
110 | ]
111 | }
112 |
--------------------------------------------------------------------------------
/floofy-clouds/assets/minecraft/shaders/program/cloudblur.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D DepthSampler;
5 |
6 | in vec2 texCoord;
7 | in vec2 oneTexel;
8 |
9 | uniform vec2 InSize;
10 | uniform vec2 BlurDir;
11 | uniform float FirstPass;
12 |
13 | out vec4 fragColor;
14 |
15 | #define BOOST 1.15
16 | #define SCREENEDGE 0.01
17 | #define RADIUSMIN 10.0
18 | #define RADIUSMAX 30.0
19 | #define NEAR 0.1
20 | #define FAR 1536.0
21 | #define ALPHAOVERRIDE 0.95
22 |
23 | float LinearizeDepth(float depth) {
24 | float z = depth * 2.0 - 1.0;
25 | return (NEAR * FAR) / (FAR + NEAR - z * (FAR - NEAR));
26 | }
27 |
28 |
29 | void main() {
30 |
31 | vec4 blurred = vec4(0.0);
32 | float totalStrength = 0.0;
33 | float totalAlpha = 0.0;
34 | float totalSamples = 0.0;
35 | vec4 center = texture(DiffuseSampler, texCoord);
36 | float depth = clamp(LinearizeDepth(texture(DepthSampler, texCoord).r) / 64.0, 0.0, 1.0);
37 | float radius = round(depth * RADIUSMIN + (1.0 - depth) * RADIUSMAX);
38 |
39 | if (center.a > 0.0) { // only do cloud processing if current pixel is in the cloud
40 | blurred = center;
41 | totalAlpha = center.a;
42 | totalSamples = 1.0;
43 | for(float r = 1.0; r <= radius; r += 1.0) {
44 | vec2 c1 = texCoord + oneTexel * r * BlurDir;
45 | vec2 c2 = texCoord + oneTexel * -r * BlurDir;
46 | vec4 sampleValue1 = texture(DiffuseSampler, c1);
47 | vec4 sampleValue2 = texture(DiffuseSampler, c2);
48 | sampleValue1.rgb *= BOOST;
49 | sampleValue2.rgb *= BOOST;
50 |
51 | // deal with edge effect
52 | if (c1.x > 1.0 + SCREENEDGE|| c1.x < 0.0 - SCREENEDGE|| c1.y > 1.0 + SCREENEDGE|| c1.y < 0.0 - SCREENEDGE) {
53 | sampleValue1.a = 0.0;
54 | }
55 | if (c2.x > 1.0 + SCREENEDGE|| c2.x < 0.0 - SCREENEDGE|| c2.y > 1.0 + SCREENEDGE|| c2.y < 0.0 - SCREENEDGE) {
56 | sampleValue1.a = 0.0;
57 | }
58 |
59 | // override default cloud alpha. It is too low for the new blending.
60 | if (FirstPass == 1.0 && sampleValue1.a > 0.1) {
61 | sampleValue1.a = ALPHAOVERRIDE;
62 | }
63 | if (FirstPass == 1.0 && sampleValue2.a > 0.1) {
64 | sampleValue2.a = ALPHAOVERRIDE;
65 | }
66 |
67 | // accumulate average alpha
68 | totalSamples = totalSamples + 2.0;
69 |
70 | // accumulate smoothed blur
71 | float strength = 1.0 - abs(r / radius);
72 | totalStrength = totalStrength + (2.0 * strength);
73 | if (sampleValue1.a <= 0.0) {
74 | blurred += vec4(center.rgb, 0.0);
75 | } else {
76 | totalAlpha += sampleValue1.a;
77 | blurred += sampleValue1;
78 | }
79 | if (sampleValue2.a <= 0.0) {
80 | blurred += vec4(center.rgb, 0.0);
81 | } else {
82 | totalAlpha += sampleValue2.a;
83 | blurred += sampleValue2;
84 | }
85 | }
86 | }
87 | fragColor = vec4(blurred.rgb / (radius * 2.0 + 1.0), clamp((totalAlpha / (radius * 2.0 + 1.0) - 0.5) * 2.0, 0.0, 1.0));
88 | }
89 |
--------------------------------------------------------------------------------
/floofy-clouds/assets/minecraft/shaders/program/cloudblur.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "sobel",
8 | "fragment": "cloudblur",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" },
12 | { "name": "DepthSampler" }
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": "BlurDir", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
19 | { "name": "FirstPass", "type": "float", "count": 1, "values": [ 1.0 ] }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/floofy-clouds/assets/minecraft/shaders/program/transparency.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D DiffuseDepthSampler;
5 | uniform sampler2D TranslucentSampler;
6 | uniform sampler2D TranslucentDepthSampler;
7 | uniform sampler2D ItemEntitySampler;
8 | uniform sampler2D ItemEntityDepthSampler;
9 | uniform sampler2D ParticlesSampler;
10 | uniform sampler2D ParticlesDepthSampler;
11 | uniform sampler2D WeatherSampler;
12 | uniform sampler2D WeatherDepthSampler;
13 | uniform sampler2D CloudsSampler;
14 | uniform sampler2D CloudsDepthSampler;
15 |
16 | in vec2 texCoord;
17 |
18 | #define NUM_LAYERS 6
19 |
20 | // Layer struct to add blending mode
21 | struct Layer
22 | {
23 | vec4 color;
24 | int mode;
25 | };
26 |
27 | Layer color_layers[NUM_LAYERS];
28 | float depth_layers[NUM_LAYERS];
29 | int index_layers[NUM_LAYERS] = int[NUM_LAYERS](0, 1 ,2, 3, 4, 5);
30 | int active_layers = 0;
31 |
32 | out vec4 fragColor;
33 |
34 | void try_insert( vec4 color, int mode, sampler2D dSampler ) {
35 | if ( color.a == 0.0 ) {
36 | return;
37 | }
38 |
39 | float depth = texture( dSampler, texCoord ).r;
40 | color_layers[active_layers] = Layer(color, mode);
41 | depth_layers[active_layers] = depth;
42 |
43 | int jj = active_layers++;
44 | int ii = jj - 1;
45 | while ( jj > 0 && depth > depth_layers[index_layers[ii]] ) {
46 | int indexTemp = index_layers[ii];
47 | index_layers[ii] = index_layers[jj];
48 | index_layers[jj] = indexTemp;
49 |
50 | jj = ii--;
51 | }
52 | }
53 |
54 | vec3 blend( vec3 dst, vec4 src ) {
55 | return ( dst * ( 1.0 - src.a ) ) + src.rgb;
56 | }
57 |
58 | void main() {
59 | color_layers[0] = Layer(vec4( texture( DiffuseSampler, texCoord ).rgb, 1.0 ), 0);
60 | depth_layers[0] = texture( DiffuseDepthSampler, texCoord ).r;
61 | active_layers = 1;
62 |
63 | try_insert( texture( CloudsSampler, texCoord ), 1, CloudsDepthSampler);
64 | try_insert( texture( TranslucentSampler, texCoord ), 0, TranslucentDepthSampler);
65 | try_insert( texture( ParticlesSampler, texCoord ), 0, ParticlesDepthSampler);
66 | try_insert( texture( WeatherSampler, texCoord ), 0, WeatherDepthSampler);
67 | try_insert( texture( ItemEntitySampler, texCoord ), 0, ItemEntityDepthSampler);
68 |
69 | vec3 texelAccum = color_layers[index_layers[0]].color.rgb;
70 | for ( int ii = 1; ii < active_layers; ++ii ) {
71 | Layer l = color_layers[index_layers[ii]];
72 |
73 | // Choose between default blend and mix
74 | if (l.mode == 0) {
75 | texelAccum = blend( texelAccum, l.color);
76 | } else {
77 | texelAccum = mix(texelAccum, l.color.rgb, l.color.a);
78 | }
79 | }
80 |
81 | fragColor = vec4( texelAccum.rgb, 1.0 );
82 | }
--------------------------------------------------------------------------------
/floofy-clouds/assets/minecraft/shaders/program/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "screenquad",
8 | "fragment": "transparency",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" },
12 | { "name": "DiffuseDepthSampler" },
13 | { "name": "TranslucentSampler" },
14 | { "name": "TranslucentDepthSampler" },
15 | { "name": "ItemEntitySampler" },
16 | { "name": "ItemEntityDepthSampler" },
17 | { "name": "ParticlesSampler" },
18 | { "name": "ParticlesDepthSampler" },
19 | { "name": "CloudsSampler" },
20 | { "name": "CloudsDepthSampler" },
21 | { "name": "WeatherSampler" },
22 | { "name": "WeatherDepthSampler" }
23 | ],
24 | "uniforms": [
25 | { "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 ] },
26 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/floofy-clouds/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Floofy Clouds"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/position.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform vec4 ColorModulator;
6 | uniform float FogStart;
7 | uniform float FogEnd;
8 | uniform vec4 FogColor;
9 | uniform vec2 ScreenSize;
10 |
11 | in mat4 ProjInv;
12 | in float isSky;
13 | in float vertexDistance;
14 |
15 | out vec4 fragColor;
16 |
17 | #define GRIDOFFSET 0.078
18 | #define GRIDDENSITY 10.0
19 |
20 | void main() {
21 |
22 | // custom fog calculation if sky because sky disc is no longer above the head
23 | if (isSky > 0.5) {
24 | // get player space view vector
25 | vec4 screenPos = gl_FragCoord;
26 | screenPos.xy = (screenPos.xy / ScreenSize - vec2(0.5)) * 2.0;
27 | screenPos.zw = vec2(1.0);
28 | vec3 view = normalize((ProjInv * screenPos).xyz);
29 | float ndusq = clamp(dot(view, vec3(0.0, 1.0, 0.0)), 0.0, 1.0);
30 | ndusq = ndusq * ndusq;
31 |
32 | fragColor = linear_fog(ColorModulator, pow(1.0 - ndusq, 8.0), 0.0, 1.0, FogColor);
33 | }
34 | // default shading for void plane and stars
35 | else {
36 | fragColor = linear_fog(ColorModulator, vertexDistance, FogStart, FogEnd, FogColor);
37 | }
38 |
39 | // draw control pixel in corner. Only in no holo mode can this actually be drawn
40 | if (gl_FragCoord.x <= 1.0 && gl_FragCoord.y <= 1.0) {
41 | fragColor = vec4(1.0, 0.0, 0.0, 1.0);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/position.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position",
8 | "fragment": "position",
9 | "attributes": [
10 | ],
11 | "samplers": [
12 | ],
13 | "uniforms": [
14 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
17 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
19 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
20 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
21 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/position.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 | #moj_import
3 |
4 | in vec3 Position;
5 |
6 | uniform mat4 ModelViewMat;
7 | uniform mat4 ProjMat;
8 | uniform float FogEnd;
9 | uniform float GameTime;
10 |
11 | out mat4 ProjInv;
12 | out float isSky;
13 | out float vertexDistance;
14 |
15 | #define BOTTOM -32.0
16 | #define SKYSCALE 0.01
17 | #define SKYHEIGHT 16.0
18 | #define SKYRADIUS 512.0
19 | #define FUDGE 0.004
20 |
21 | void main() {
22 | vec3 scaledPos = Position;
23 | ProjInv = inverse(ProjMat * ModelViewMat);
24 | isSky = 0.0;
25 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
26 |
27 | // sky disk is by default 16.0 units above with radius of 512.0 around the camera at all times.
28 | if (abs(scaledPos.y - SKYHEIGHT) < FUDGE && (length(scaledPos.xz) <= FUDGE || abs(length(scaledPos.xz) - SKYRADIUS) < FUDGE)) {
29 | isSky = 1.0;
30 |
31 | // Make sky into a cone by bringing down edges of the disk.
32 | if (length(scaledPos.xz) > 1.0) {
33 | scaledPos.y = BOTTOM;
34 | }
35 |
36 | // Make it big so it does not interfere with void plane.
37 | scaledPos.xyz *= SKYSCALE;
38 |
39 | // rotate to z axis
40 | scaledPos = scaledPos.xzy;
41 | scaledPos.z *= -1;
42 |
43 | // ignore model view so the cone follows the camera angle.
44 | gl_Position = removeView(mat4(1.0), ProjMat, GameTime, scaledPos);
45 | } else {
46 | gl_Position = removeView(ModelViewMat, ProjMat, GameTime, scaledPos);
47 | }
48 | }
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_cutout.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 vec4 gl_FragCoord;
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 | if (color.a < 0.1) {
23 | discard;
24 | }
25 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
26 | if (gl_FragCoord.x <= 1.0 && gl_FragCoord.y <= 1.0) {
27 | fragColor = vec4(1.0, 0.0, 0.0, 1.0);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_cutout.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout",
8 | "fragment": "rendertype_cutout",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_cutout.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 | #moj_import
3 |
4 | in vec3 Position;
5 | in vec4 Color;
6 | in vec2 UV0;
7 | in ivec2 UV2;
8 | in vec3 Normal;
9 |
10 | uniform sampler2D Sampler2;
11 |
12 | uniform mat4 ModelViewMat;
13 | uniform mat4 ProjMat;
14 | uniform vec3 ChunkOffset;
15 | uniform float GameTime;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec4 normal;
21 |
22 | void main() {
23 | gl_Position = scaleView(ModelViewMat, ProjMat, GameTime, Position + ChunkOffset);
24 |
25 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
26 | vertexColor = Color;
27 | if (!inHolo(GameTime)) {
28 | vertexColor *= texelFetch(Sampler2, UV2 / 16, 0);
29 | }
30 | texCoord0 = UV0;
31 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
32 | }
33 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_cutout_mipped.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 vec4 gl_FragCoord;
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 | if (color.a < 0.1) {
23 | discard;
24 | }
25 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
26 | if (gl_FragCoord.x <= 1.0 && gl_FragCoord.y <= 1.0) {
27 | fragColor = vec4(1.0, 0.0, 0.0, 1.0);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_cutout_mipped.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout_mipped",
8 | "fragment": "rendertype_cutout_mipped",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 | #moj_import
3 |
4 | in vec3 Position;
5 | in vec4 Color;
6 | in vec2 UV0;
7 | in ivec2 UV2;
8 | in vec3 Normal;
9 |
10 | uniform sampler2D Sampler2;
11 |
12 | uniform mat4 ModelViewMat;
13 | uniform mat4 ProjMat;
14 | uniform vec3 ChunkOffset;
15 | uniform float GameTime;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec4 normal;
21 |
22 | void main() {
23 | gl_Position = scaleView(ModelViewMat, ProjMat, GameTime, Position + ChunkOffset);
24 |
25 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
26 | vertexColor = Color;
27 | if (!inHolo(GameTime)) {
28 | vertexColor *= texelFetch(Sampler2, UV2 / 16, 0);
29 | }
30 | texCoord0 = UV0;
31 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
32 | }
33 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_solid.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 vec4 gl_FragCoord;
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
23 | if (gl_FragCoord.x <= 1.0 && gl_FragCoord.y <= 1.0) {
24 | fragColor = vec4(1.0, 0.0, 0.0, 1.0);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_solid.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_solid",
8 | "fragment": "rendertype_solid",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_solid.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 | #moj_import
3 |
4 | in vec3 Position;
5 | in vec4 Color;
6 | in vec2 UV0;
7 | in ivec2 UV2;
8 | in vec3 Normal;
9 |
10 | uniform sampler2D Sampler2;
11 |
12 | uniform mat4 ModelViewMat;
13 | uniform mat4 ProjMat;
14 | uniform vec3 ChunkOffset;
15 | uniform float GameTime;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec4 normal;
21 |
22 | void main() {
23 | gl_Position = scaleView(ModelViewMat, ProjMat, GameTime, Position + ChunkOffset);
24 |
25 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
26 | vertexColor = Color;
27 | if (!inHolo(GameTime)) {
28 | vertexColor *= texelFetch(Sampler2, UV2 / 16, 0);
29 | }
30 | texCoord0 = UV0;
31 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
32 | }
33 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_translucent.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 vec4 normal;
16 |
17 | out vec4 fragColor;
18 |
19 | void main() {
20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
21 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
22 | }
23 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_translucent.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_translucent",
8 | "fragment": "rendertype_translucent",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/core/rendertype_translucent.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 | #moj_import
3 |
4 | in vec3 Position;
5 | in vec4 Color;
6 | in vec2 UV0;
7 | in ivec2 UV2;
8 | in vec3 Normal;
9 |
10 | uniform sampler2D Sampler2;
11 |
12 | uniform mat4 ModelViewMat;
13 | uniform mat4 ProjMat;
14 | uniform vec3 ChunkOffset;
15 | uniform float GameTime;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec2 texCoord2;
21 | out vec4 normal;
22 |
23 | void main() {
24 | gl_Position = scaleView(ModelViewMat, ProjMat, GameTime, Position + ChunkOffset);
25 |
26 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
27 | vertexColor = Color;
28 | if (!inHolo(GameTime)) {
29 | vertexColor *= texelFetch(Sampler2, UV2 / 16, 0);
30 | }
31 | texCoord0 = UV0;
32 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
33 | }
34 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/include/fog.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
4 | if (vertexDistance <= fogStart) {
5 | return inColor;
6 | }
7 |
8 | float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
9 | return vec4(mix(inColor.rgb, fogColor.rgb, fogValue * fogColor.a), inColor.a);
10 | }
11 |
12 | float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
13 | if (vertexDistance <= fogStart) {
14 | return 1.0;
15 | } else if (vertexDistance >= fogEnd) {
16 | return 0.0;
17 | }
18 |
19 | return smoothstep(fogEnd, fogStart, vertexDistance);
20 | }
21 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/include/holo.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define OFFSET vec3(0.75, -0.25, -0.5)
4 | #define BIGPRIME 781633
5 | #define PERIOD 10
6 | #define SCALE 300
7 | #define OUTOFWORLD 1000
8 |
9 | // check if current frame is a holo render
10 | bool inHolo(float GameTime) {
11 | return mod(GameTime * BIGPRIME, PERIOD) < 1.0;
12 | }
13 |
14 | // output scaled position if holo frame
15 | vec4 scaleView(mat4 ModelViewMat, mat4 ProjMat, float GameTime, vec3 Position) {
16 | if (inHolo(GameTime)) {
17 | Position /= SCALE;
18 | }
19 | vec4 scaledPos4 = ModelViewMat * vec4(Position, 1.0);
20 | if (mod(GameTime * BIGPRIME, PERIOD) < 1.0) {
21 | scaledPos4.xyz += OFFSET;
22 | }
23 | scaledPos4 = ProjMat * scaledPos4;
24 | return scaledPos4;
25 | }
26 |
27 | // remove target from render view if holo
28 | vec4 removeView(mat4 ModelViewMat, mat4 ProjMat, float GameTime, vec3 Position) {
29 | vec4 scaledPos4 = ProjMat * ModelViewMat * vec4(Position, 1.0);
30 | if (inHolo(GameTime)) {
31 | scaledPos4 /= scaledPos4.w;
32 | scaledPos4.y += OUTOFWORLD;
33 | }
34 | return scaledPos4;
35 | }
36 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/post/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | "swap1",
4 | "swap2",
5 | "minimap",
6 | "render",
7 | "translucent",
8 | "itemEntity",
9 | "particles",
10 | "clouds",
11 | "weather"
12 | ],
13 | "passes": [
14 | {
15 | "name": "transparency",
16 | "intarget": "minecraft:main",
17 | "outtarget": "swap1",
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": "transparency2",
67 | "intarget": "minecraft:main",
68 | "outtarget": "swap2",
69 | "auxtargets": [
70 | {
71 | "name": "CurrentFrameSampler",
72 | "id": "swap1"
73 | },
74 | {
75 | "name": "PastFrameSampler",
76 | "id": "render"
77 | }
78 | ]
79 | },
80 | {
81 | "name": "copy",
82 | "intarget": "swap2",
83 | "outtarget": "render"
84 | },
85 | {
86 | "name": "transparency3",
87 | "intarget": "minecraft:main",
88 | "outtarget": "swap1",
89 | "auxtargets": [
90 | {
91 | "name": "DiffuseDepthSampler",
92 | "id": "minecraft:main:depth"
93 | },
94 | {
95 | "name": "TranslucentSampler",
96 | "id": "translucent"
97 | },
98 | {
99 | "name": "TranslucentDepthSampler",
100 | "id": "translucent:depth"
101 | },
102 | {
103 | "name": "PastFrameSampler",
104 | "id": "minimap"
105 | }
106 | ]
107 | },
108 | {
109 | "name": "copy",
110 | "intarget": "swap1",
111 | "outtarget": "minimap"
112 | },
113 | {
114 | "name": "composite",
115 | "intarget": "render",
116 | "outtarget": "minecraft:main",
117 | "auxtargets": [
118 | {
119 | "name": "MinimapSampler",
120 | "id": "minimap"
121 | }
122 | ]
123 | }
124 | ]
125 | }
126 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/composite.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D MinimapSampler;
5 |
6 | in vec2 texCoord;
7 |
8 | out vec4 fragColor;
9 |
10 | #define HOLOALPHA 0.7
11 |
12 | void main() {
13 |
14 | // overlay the holo onto the rendered frame
15 | fragColor = texture( DiffuseSampler, texCoord );
16 | vec4 mSample = texture( MinimapSampler, texCoord );
17 | fragColor = vec4(mix(fragColor.rgb, mSample.rgb, mSample.a * HOLOALPHA), 1.0);
18 | }
19 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/composite.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "screenquad",
8 | "fragment": "composite",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" },
12 | { "name": "MinimapSampler" }
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": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/copy.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "copy",
8 | "fragment": "blit",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" }
12 | ],
13 | "uniforms": [
14 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
15 | { "name": "Scale", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
16 | { "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/copy.vsh:
--------------------------------------------------------------------------------
1 | #version 120
2 |
3 | attribute vec4 Position;
4 |
5 | uniform vec2 OutSize;
6 | uniform vec2 Scale;
7 |
8 | varying vec2 texCoord;
9 |
10 | // Modified blit to work for copying between buffers of different sizes
11 |
12 | void main(){
13 |
14 | float x = -1.0;
15 | float y = -1.0;
16 |
17 | if (Position.x > 0.001){
18 | x = 2.0 * Scale.x - 1.0;
19 | }
20 | if (Position.y > 0.001){
21 | y = 2.0 * Scale.y - 1.0;
22 | }
23 |
24 | gl_Position = vec4(x, y, 0.2, 1.0);
25 |
26 | texCoord = Position.xy / OutSize;
27 | }
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/transparency2.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D CurrentFrameSampler;
5 | uniform sampler2D PastFrameSampler;
6 | uniform vec2 OutSize;
7 |
8 | in vec2 texCoord;
9 |
10 | out vec4 fragColor;
11 |
12 | void main() {
13 | fragColor = texture(PastFrameSampler, texCoord);
14 |
15 | vec4 hmm = texture(DiffuseSampler, vec2(0.0001, 0.0001));
16 |
17 | // if detected control pixel, copy new frame onto 'render' output, otherwise, continue using last frame
18 | if (hmm.r > 0.99 && hmm.a > 0.99 && hmm.g < 0.01 && hmm.b < 0.01) {
19 | vec2 oneTexel = 1.0 / OutSize;
20 | if (texCoord.x > oneTexel.x && texCoord.y > oneTexel.y) {
21 | fragColor = texture(CurrentFrameSampler, texCoord);
22 | } else {
23 | fragColor = (texture(CurrentFrameSampler, texCoord + vec2(oneTexel.x, 0.0)) + texture(CurrentFrameSampler, texCoord + vec2(0.0, oneTexel.y))) * 0.5;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/transparency2.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "screenquad",
8 | "fragment": "transparency2",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" },
12 | { "name": "CurrentFrameSampler" },
13 | { "name": "PastFrameSampler" }
14 | ],
15 | "uniforms": [
16 | { "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 ] },
17 | { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/transparency3.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D DiffuseDepthSampler;
5 | uniform sampler2D TranslucentSampler;
6 | uniform sampler2D TranslucentDepthSampler;
7 | uniform sampler2D PastFrameSampler;
8 |
9 | in vec2 texCoord;
10 |
11 | out vec4 fragColor;
12 |
13 | #define near 0.00004882812
14 | #define far 1.0
15 |
16 | #define HOLOCLIP 0.004
17 | #define HOLOCOLOR vec4(0.1, 1.6, 1.3, 1.0)
18 |
19 | float LinearizeDepth(float depth)
20 | {
21 | return (2.0 * near * far) / (far + near - depth * (far - near));
22 | }
23 |
24 | void main() {
25 | fragColor = texture(PastFrameSampler, texCoord);
26 | vec4 hmm = texture(DiffuseSampler, vec2(0.0001, 0.0001));
27 |
28 | // if no control pixel detected, copy new frame onto 'minimap' output, otherwise keep last frame
29 | if (!(hmm.r > 0.99 && hmm.a > 0.99 && hmm.g < 0.01 && hmm.b < 0.01)) {
30 | fragColor = vec4(0.0);
31 | float tdep = LinearizeDepth(texture(TranslucentDepthSampler, texCoord).r);
32 | float dep = LinearizeDepth(texture(DiffuseDepthSampler, texCoord).r);
33 |
34 | // clip past a certain distance
35 | if (dep < HOLOCLIP || tdep < HOLOCLIP) {
36 | fragColor = texture( DiffuseSampler, texCoord );
37 | if (tdep < dep) {
38 | vec4 mSample = texture( TranslucentSampler, texCoord );
39 | fragColor = vec4(mix(fragColor.rgb, mSample.rgb, mSample.a), 1.0);
40 | }
41 | }
42 | fragColor = mix(fragColor, vec4(length(fragColor))/ 2.0, 0.5) * HOLOCOLOR;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/holo-minimap/assets/minecraft/shaders/program/transparency3.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "screenquad",
8 | "fragment": "transparency3",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" },
12 | { "name": "DiffuseDepthSampler" },
13 | { "name": "TranslucentSampler" },
14 | { "name": "TranslucentDepthSampler" },
15 | { "name": "PastFrameSampler" }
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": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/holo-minimap/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Holographic Minimap (PROOF OF CONCEPT)"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/images/center-crosshair.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/center-crosshair.png
--------------------------------------------------------------------------------
/images/extended-sky.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/extended-sky.png
--------------------------------------------------------------------------------
/images/floofy-clouds.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/floofy-clouds.png
--------------------------------------------------------------------------------
/images/holo-minimap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/holo-minimap.png
--------------------------------------------------------------------------------
/images/light-level-detect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/light-level-detect.png
--------------------------------------------------------------------------------
/images/smooth-clouds.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/smooth-clouds.png
--------------------------------------------------------------------------------
/images/sun-position.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/sun-position.gif
--------------------------------------------------------------------------------
/images/vaporwave-solid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/vaporwave-solid.png
--------------------------------------------------------------------------------
/images/vaporwave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/images/vaporwave.png
--------------------------------------------------------------------------------
/light-level-detect/assets/minecraft/shaders/include/light.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define MINECRAFT_LIGHT_POWER (0.6)
4 | #define MINECRAFT_AMBIENT_LIGHT (0.4)
5 |
6 | vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) {
7 | lightDir0 = normalize(lightDir0);
8 | lightDir1 = normalize(lightDir1);
9 | float light0 = max(0.0, dot(lightDir0, normal));
10 | float light1 = max(0.0, dot(lightDir1, normal));
11 | float lightAccum = min(1.0, (light0 + light1) * MINECRAFT_LIGHT_POWER + MINECRAFT_AMBIENT_LIGHT);
12 | return vec4(color.rgb * lightAccum, color.a);
13 | }
14 |
15 | vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) {
16 | vec4 col = texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0)));
17 | if (uv.x / 256.0 <= 7.0 / 16.0) { // light level <= 7.0
18 | col *= vec4(1.2, 0.7, 0.7, 1.0);
19 | } else {
20 | col *= vec4(0.7, 1.2, 0.7, 1.0);
21 | }
22 | return col;
23 | }
24 |
--------------------------------------------------------------------------------
/light-level-detect/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Simple Light Level Checker"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/smooth-clouds/assets/minecraft/shaders/core/position_tex_color_normal.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 vec2 texCoord0;
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec3 normal;
16 | in float yval;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0);
22 | color *= vertexColor * ColorModulator;
23 | color.rgb = mix(color.rgb, FogColor.rgb * FogColor.rgb, 0.5 * (1.0 - yval));
24 | if (color.a < 0.1) {
25 | discard;
26 | }
27 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
28 | }
29 |
--------------------------------------------------------------------------------
/smooth-clouds/assets/minecraft/shaders/core/position_tex_color_normal.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_tex_color_normal",
8 | "fragment": "position_tex_color_normal",
9 | "attributes": [
10 | "Position",
11 | "UV0",
12 | "Color",
13 | "Normal"
14 | ],
15 | "samplers": [
16 | { "name": "Sampler0" }
17 | ],
18 | "uniforms": [
19 | { "name": "ModelViewMat", "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 ] },
20 | { "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 ] },
21 | { "name": "IViewRotMat", "type": "matrix3x3", "count": 9, "values": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] },
22 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
23 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
24 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
25 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
26 | { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/smooth-clouds/assets/minecraft/shaders/core/position_tex_color_normal.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec2 UV0;
7 | in vec4 Color;
8 | in vec3 Normal;
9 |
10 | uniform mat4 ModelViewMat;
11 | uniform mat4 ProjMat;
12 | uniform mat3 IViewRotMat;
13 | uniform int FogShape;
14 |
15 | out vec2 texCoord0;
16 | out float vertexDistance;
17 | out vec4 vertexColor;
18 | out vec3 normal;
19 | out float yval;
20 |
21 | float slide(float val , float start, float end) {
22 | return clamp((val - start) / (end - start), 0.0, 1.0);
23 | }
24 |
25 | void main() {
26 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
27 |
28 | texCoord0 = UV0;
29 | vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
30 |
31 | // try the flatten the cloud shading as much as possible
32 | vec4 col = Color;
33 | float yc = mix(127.0, 174.0, slide(col.b, 178.0 / 255.0, 110.0 / 255.0));
34 | float xc = mix(153.0, 225.0, slide(col.b, 229.0 / 255.0, 142.0 / 255.0));
35 | float zc = mix(204.0, 200.0, slide(col.b, 203.0 / 255.0, 126.0 / 255.0));
36 |
37 | if (dot(Normal, vec3(0.0, -1.0, 0.0)) > 0.999) {
38 | col.rgb *= 255.0 / yc;
39 | }
40 | else if (dot(Normal, vec3(0.0, 1.0, 0.0)) > 0.999) {
41 | col.rgb *= 255.0 / 255.0;
42 | }
43 | else if (abs(dot(Normal, vec3(1.0, 0.0, 0.0))) > 0.999) {
44 | col.rgb *= 255.0 / xc;
45 | }
46 | else if (abs(dot(Normal, vec3(0.0, 0.0, 1.0))) > 0.999) {
47 | col.rgb *= 255.0 / zc;
48 | }
49 | col = min(col, 1.0);
50 |
51 | vertexColor = col;
52 | normal = Normal;
53 |
54 | yval = 0.0;
55 |
56 | int faceVert = gl_VertexID % 4;
57 | if (((faceVert == 1 || faceVert == 2) && abs(dot(normal, vec3(1.0, 0.0, 0.0))) > 0.99)
58 | ||((faceVert == 0 || faceVert == 1) && abs(dot(normal, vec3(0.0, 0.0, 1.0))) > 0.99)){
59 | yval = 1.0;
60 | }
61 |
62 | if (dot(normal, vec3(0.0, 1.0, 0.0)) > 0.99) {
63 | yval = 1.0;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/smooth-clouds/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 12,
4 | "description": "Smooth Cloud Shading"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform vec4 ColorModulator;
7 | uniform float FogStart;
8 | uniform float FogEnd;
9 | uniform vec4 FogColor;
10 | uniform vec2 ScreenSize;
11 | uniform mat4 ModelViewMat;
12 | uniform mat4 ProjMat;
13 |
14 | in mat4 ProjInv;
15 | in float isSky;
16 | in float vertexDistance;
17 |
18 | out vec4 fragColor;
19 |
20 | // at this point, the entire sky is drawable: isSky for sky, stars and void plane for everything else.
21 | // similar logic can be added in vsh to separate void plane from stars.
22 | void main() {
23 | int index = inControl(gl_FragCoord.xy, ScreenSize.x);
24 | if (index != -1) {
25 | if (isSky > 0.5) {
26 | // store ProjMat in control pixels
27 | if (index >= 5 && index <= 15) {
28 | int c = (index - 5) / 4;
29 | int r = (index - 5) - c * 4;
30 | c = (c == 0 && r == 1) ? c : c + 1;
31 | fragColor = vec4(encodeFloat(ProjMat[c][r]), 1.0);
32 | }
33 | // store ModelViewMat in control pixels
34 | else if (index >= 16 && index <= 24) {
35 | int c = (index - 16) / 3;
36 | int r = (index - 16) - c * 3;
37 | fragColor = vec4(encodeFloat(ModelViewMat[c][r]), 1.0);
38 | }
39 | // store ProjMat[0][0] and ProjMat[1][1] in control pixels
40 | else if (index >= 3 && index <= 4) {
41 | fragColor = vec4(encodeFloat(atan(ProjMat[index - 3][index - 3])), 1.0);
42 | }
43 | // store FogColor in control pixels
44 | else if (index == 25) {
45 | fragColor = FogColor;
46 | }
47 | // blackout control pixels for sunDir so sun can write to them (by default, all pixels are FogColor)
48 | else {
49 | fragColor = vec4(0.0, 0.0, 0.0, 1.0);
50 | }
51 | } else {
52 | discard;
53 | }
54 | }
55 |
56 | // not a control pixel, draw sky like normal
57 | else if (isSky > 0.5) {
58 | vec4 screenPos = gl_FragCoord;
59 | screenPos.xy = (screenPos.xy / ScreenSize - vec2(0.5)) * 2.0;
60 | screenPos.zw = vec2(1.0);
61 | vec3 view = normalize((ProjInv * screenPos).xyz);
62 | float ndusq = clamp(dot(view, vec3(0.0, 1.0, 0.0)), 0.0, 1.0);
63 | ndusq = ndusq * ndusq;
64 |
65 | fragColor = linear_fog(ColorModulator, pow(1.0 - ndusq, 8.0), 0.0, 1.0, FogColor);
66 | }
67 | else {
68 | fragColor = linear_fog(ColorModulator, vertexDistance, FogStart, FogEnd, FogColor);
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position",
8 | "fragment": "position",
9 | "attributes": [
10 | ],
11 | "samplers": [
12 | ],
13 | "uniforms": [
14 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
17 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
19 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
20 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 |
5 | uniform mat4 ModelViewMat;
6 | uniform mat4 ProjMat;
7 | uniform float FogEnd;
8 |
9 | out mat4 ProjInv;
10 | out float isSky;
11 | out float vertexDistance;
12 |
13 | #define BOTTOM -32.0
14 | #define SCALE 0.01
15 | #define SKYHEIGHT 16.0
16 | #define SKYRADIUS 512.0
17 | #define FUDGE 0.004
18 |
19 | void main() {
20 | vec3 scaledPos = Position;
21 | isSky = 0.0;
22 |
23 | // the sky is transformed so that it always covers the entire camera view. Guarantees that we can write to control pixels in fsh.
24 | // sky disk is by default 16.0 units above with radius of 512.0 around the camera at all times.
25 | if (abs(scaledPos.y - SKYHEIGHT) < FUDGE && (length(scaledPos.xz) <= FUDGE || abs(length(scaledPos.xz) - SKYRADIUS) < FUDGE)) {
26 | isSky = 1.0;
27 |
28 | // Make sky into a cone by bringing down edges of the disk.
29 | if (length(scaledPos.xz) > 1.0) {
30 | scaledPos.y = BOTTOM;
31 | }
32 |
33 | // Make it big so it does not interfere with void plane.
34 | scaledPos.xyz *= SCALE;
35 |
36 | // rotate to z axis
37 | scaledPos = scaledPos.xzy;
38 | scaledPos.z *= -1;
39 |
40 | // ignore model view so the cone follows the camera angle.
41 | gl_Position = ProjMat * vec4(scaledPos, 1.0);
42 | } else {
43 | gl_Position = ProjMat * ModelViewMat * vec4(scaledPos, 1.0);
44 | }
45 |
46 | ProjInv = inverse(ProjMat * ModelViewMat);
47 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
48 | }
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_color.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec4 vertexColor;
6 | in float isHorizon;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform vec2 ScreenSize;
10 |
11 | out vec4 fragColor;
12 |
13 | void main() {
14 | if (isHorizon > 0.5) {
15 | discardControl(gl_FragCoord.xy, ScreenSize.x);
16 | }
17 |
18 | vec4 color = vertexColor;
19 | if (color.a == 0.0) {
20 | discard;
21 | }
22 | fragColor = color * ColorModulator;
23 | }
24 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_color.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_color",
8 | "fragment": "position_color",
9 | "attributes": [
10 | "Color"
11 | ],
12 | "samplers": [
13 | ],
14 | "uniforms": [
15 | { "name": "ModelViewMat", "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": "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 ] },
17 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
18 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_color.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec4 Color;
5 |
6 | uniform mat4 ModelViewMat;
7 | uniform mat4 ProjMat;
8 |
9 | out vec4 vertexColor;
10 | out float isHorizon;
11 |
12 | #define HORIZONDIST 128
13 |
14 | void main() {
15 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
16 | isHorizon = 0.0;
17 |
18 | if ((ModelViewMat * vec4(Position, 1.0)).z > -HORIZONDIST - 10.0) {
19 | isHorizon = 1.0;
20 | }
21 |
22 | vertexColor = Color;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_tex.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D Sampler0;
6 | uniform vec4 ColorModulator;
7 | uniform vec2 ScreenSize;
8 | uniform mat4 ModelViewMat;
9 |
10 | in mat4 ProjInv;
11 | in vec3 cscale;
12 | in vec3 c1;
13 | in vec3 c2;
14 | in vec3 c3;
15 | in vec2 texCoord0;
16 | in float isSun;
17 |
18 | out vec4 fragColor;
19 |
20 | #define PRECISIONSCALE 1000.0
21 | #define MAGICSUNSIZE 3.0
22 |
23 | void main() {
24 | vec4 color = vec4(0.0);
25 |
26 | int index = inControl(gl_FragCoord.xy, ScreenSize.x);
27 | // currently in a control/message pixel
28 | if(index != -1) {
29 | // store the sun position in eye space indices [0,2]
30 | if (isSun > 0.75 && index >= 0 && index <= 2) {
31 | vec4 sunDir = ModelViewMat * vec4(normalize(c1 / cscale.x + c3 / cscale.z), 0.0);
32 | color = vec4(encodeFloat(sunDir[index]), 1.0);
33 | }
34 | else if (isSun < 0.25) {
35 | color = texture(Sampler0, texCoord0) * ColorModulator;
36 | }
37 | }
38 |
39 | // calculate screen space UV of the sun since it was transformed to cover the entire screen in vsh so texCoord0 no longer works
40 | else if(isSun > 0.75) {
41 | vec3 p1 = c1 / cscale.x;
42 | vec3 p2 = c2 / cscale.y;
43 | vec3 p3 = c3 / cscale.z;
44 | vec3 center = (p1 + p3) / (2 * PRECISIONSCALE); // scale down vector to reduce fp issues
45 |
46 | vec4 tmp = (ProjInv * vec4(2.0 * (gl_FragCoord.xy / ScreenSize - 0.5), 1.0, 1.0));
47 | vec3 planepos = tmp.xyz / tmp.w;
48 | float lookingat = dot(planepos, center);
49 | planepos = planepos / lookingat;
50 | vec2 uv = vec2(dot(p2 - p1, planepos - center), dot(p3 - p2, planepos - center));
51 | uv = uv / PRECISIONSCALE * MAGICSUNSIZE + vec2(0.5);
52 |
53 | // only draw one sun lol
54 | if (lookingat > 0.0 && all(greaterThanEqual(uv, vec2(0.0))) && all(lessThanEqual(uv, vec2(1.0)))) {
55 | color = texture(Sampler0, uv) * ColorModulator;
56 | }
57 | } else {
58 | color = texture(Sampler0, texCoord0) * ColorModulator;
59 | }
60 |
61 | if (color.a == 0.0) {
62 | discard;
63 | }
64 | fragColor = color;
65 | }
66 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_tex.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_tex",
8 | "fragment": "position_tex",
9 | "attributes": [
10 | "Position",
11 | "UV0"
12 | ],
13 | "samplers": [
14 | { "name": "Sampler0" }
15 | ],
16 | "uniforms": [
17 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
20 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_tex.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec2 UV0;
5 |
6 | uniform sampler2D Sampler0;
7 | uniform mat4 ModelViewMat;
8 | uniform mat4 ProjMat;
9 |
10 | out mat4 ProjInv;
11 | out vec3 cscale;
12 | out vec3 c1;
13 | out vec3 c2;
14 | out vec3 c3;
15 | out vec2 texCoord0;
16 | out float isSun;
17 |
18 | #define SUNSIZE 60
19 | #define SUNDIST 110
20 | #define OVERLAYSCALE 2.0
21 |
22 | void main() {
23 | vec4 candidate = ProjMat * ModelViewMat * vec4(Position, 1.0);
24 | ProjInv = mat4(0.0);
25 | cscale = vec3(0.0);
26 | c1 = vec3(0.0);
27 | c2 = vec3(0.0);
28 | c3 = vec3(0.0);
29 | isSun = 0.0;
30 | vec2 tsize = textureSize(Sampler0, 0);
31 |
32 | // test if sun or moon. Position.y limit excludes worldborder.
33 | if (Position.y < SUNDIST && Position.y > -SUNDIST && (ModelViewMat * vec4(Position, 1.0)).z > -SUNDIST) {
34 |
35 | // only the sun has a square texture
36 | if (tsize.x == tsize.y) {
37 | isSun = 1.0;
38 | candidate = vec4(-2.0 * OVERLAYSCALE, -OVERLAYSCALE, 0.0, 1.0);
39 |
40 | // modify position of sun so that it covers the entire screen and store c1, c2, c3 so player space position of sun can be extracted in fsh.
41 | // this is the key to get everything working since it guarantees that we can access sun info in the control pixels in fsh.
42 | if (UV0.x < 0.5) {
43 | c1 = Position;
44 | cscale.x = 1.0;
45 | } else {
46 | candidate.x = OVERLAYSCALE;
47 | if (UV0.y < 0.5) {
48 | c2 = Position;
49 | cscale.y = 1.0;
50 | } else {
51 | candidate.y = 2.0 * OVERLAYSCALE;
52 | c3 = Position;
53 | cscale.z = 1.0;
54 | }
55 | }
56 | ProjInv = inverse(ProjMat * ModelViewMat);
57 | } else {
58 | isSun = 0.5;
59 | }
60 | }
61 |
62 | gl_Position = candidate;
63 | texCoord0 = UV0;
64 | }
65 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_tex_color.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D Sampler0;
6 |
7 | uniform vec4 ColorModulator;
8 | uniform vec2 ScreenSize;
9 |
10 | in vec2 texCoord0;
11 | in vec4 vertexColor;
12 |
13 | out vec4 fragColor;
14 |
15 | void main() {
16 | int index = inControl(gl_FragCoord.xy, ScreenSize.x);
17 | if (index != -1) {
18 | fragColor = vec4(0.0, 0.0, 0.0, 1.0);
19 | } else {
20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor;
21 | if (color.a < 0.1) {
22 | discard;
23 | }
24 | fragColor = color * ColorModulator;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_tex_color.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_tex_color",
8 | "fragment": "position_tex_color",
9 | "attributes": [
10 | "Position",
11 | "UV0",
12 | "Color"
13 | ],
14 | "samplers": [
15 | { "name": "Sampler0" }
16 | ],
17 | "uniforms": [
18 | { "name": "ModelViewMat", "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": "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 ] },
20 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
21 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/position_tex_color.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec2 UV0;
5 | in vec4 Color;
6 |
7 | uniform mat4 ModelViewMat;
8 | uniform mat4 ProjMat;
9 |
10 | out vec2 texCoord0;
11 | out vec4 vertexColor;
12 |
13 | void main() {
14 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
15 |
16 | texCoord0 = UV0;
17 | vertexColor = Color;
18 | }
19 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 | uniform sampler2D Sampler1;
8 |
9 | uniform vec4 ColorModulator;
10 | uniform float FogStart;
11 | uniform float FogEnd;
12 | uniform vec4 FogColor;
13 |
14 | in float vertexDistance;
15 | in vec4 vertexColor;
16 | in vec2 texCoord0;
17 | in vec2 texCoord1;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 | if (color.a < 0.1) {
27 | discard;
28 | }
29 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
30 | }
31 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_armor_cutout_no_cull",
8 | "fragment": "rendertype_armor_cutout_no_cull",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in vec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 |
17 | uniform vec3 Light0_Direction;
18 | uniform vec3 Light1_Direction;
19 |
20 | out float vertexDistance;
21 | out vec4 vertexColor;
22 | out vec2 texCoord0;
23 | out vec2 texCoord1;
24 | out vec4 normal;
25 | out vec4 glpos;
26 |
27 | void main() {
28 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
29 |
30 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
31 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0);
32 | texCoord0 = UV0;
33 | texCoord1 = UV1;
34 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
35 | glpos = gl_Position;
36 | }
37 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D Sampler0;
6 | uniform sampler2D Sampler2;
7 |
8 | uniform vec4 ColorModulator;
9 |
10 | in vec4 vertexColor;
11 | in vec2 texCoord0;
12 | in vec2 texCoord2;
13 | in vec4 normal;
14 | in vec4 glpos;
15 |
16 | out vec4 fragColor;
17 |
18 | void main() {
19 | discardControlGLPos(gl_FragCoord.xy, glpos);
20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor;
21 | fragColor = color * ColorModulator;
22 | }
23 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_beacon_beam.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_beacon_beam",
8 | "fragment": "rendertype_beacon_beam",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_beacon_beam.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec4 Color;
5 | in vec2 UV0;
6 | in vec2 UV2;
7 | in vec3 Normal;
8 |
9 | uniform mat4 ModelViewMat;
10 | uniform mat4 ProjMat;
11 |
12 | out vec4 vertexColor;
13 | out vec2 texCoord0;
14 | out vec2 texCoord2;
15 | out vec4 normal;
16 | out vec4 glpos;
17 |
18 | void main() {
19 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
20 |
21 | vertexColor = Color;
22 | texCoord0 = UV0;
23 | texCoord2 = UV2;
24 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
25 | glpos = gl_Position;
26 | }
27 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_cutout.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform vec4 FogColor;
10 | uniform float FogStart;
11 | uniform float FogEnd;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 | in vec4 glpos;
18 |
19 | out vec4 fragColor;
20 |
21 | void main() {
22 | discardControlGLPos(gl_FragCoord.xy, glpos);
23 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
24 | if (color.a < 0.1) {
25 | discard;
26 | }
27 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
28 | }
29 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_cutout.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout",
8 | "fragment": "rendertype_cutout",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_cutout.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV2;
9 | in vec3 Normal;
10 |
11 | uniform sampler2D Sampler2;
12 |
13 | uniform mat4 ModelViewMat;
14 | uniform mat4 ProjMat;
15 | uniform vec3 ChunkOffset;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec4 normal;
21 | out vec4 glpos;
22 |
23 | void main() {
24 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
25 |
26 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
27 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2);
28 | texCoord0 = UV0;
29 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
30 | glpos = gl_Position;
31 | }
32 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 | in vec4 glpos;
18 |
19 | out vec4 fragColor;
20 |
21 | void main() {
22 | discardControlGLPos(gl_FragCoord.xy, glpos);
23 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
24 | if (color.a < 0.5) {
25 | discard;
26 | }
27 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
28 | }
29 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_cutout_mipped.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout_mipped",
8 | "fragment": "rendertype_cutout_mipped",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV2;
9 | in vec3 Normal;
10 |
11 | uniform sampler2D Sampler2;
12 |
13 | uniform mat4 ModelViewMat;
14 | uniform mat4 ProjMat;
15 | uniform vec3 ChunkOffset;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec4 normal;
21 | out vec4 glpos;
22 |
23 | void main() {
24 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
25 |
26 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
27 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2);
28 | texCoord0 = UV0;
29 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
30 | glpos = gl_Position;
31 | }
32 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_end_gateway.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_end_portal",
8 | "fragment": "rendertype_end_portal",
9 | "attributes": [],
10 | "samplers": [
11 | { "name": "Sampler0" },
12 | { "name": "Sampler1" }
13 | ],
14 | "uniforms": [
15 | { "name": "ModelViewMat", "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": "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 ] },
17 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
18 | { "name": "EndPortalLayers", "type": "int", "count": 1, "values": [ 16 ] }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_end_portal.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 | uniform sampler2D Sampler1;
8 |
9 | uniform float GameTime;
10 | uniform int EndPortalLayers;
11 |
12 | in vec4 texProj0;
13 | in vec4 glpos;
14 |
15 | const vec3[] COLORS = vec3[](
16 | vec3(0.022087, 0.098399, 0.110818),
17 | vec3(0.011892, 0.095924, 0.089485),
18 | vec3(0.027636, 0.101689, 0.100326),
19 | vec3(0.046564, 0.109883, 0.114838),
20 | vec3(0.064901, 0.117696, 0.097189),
21 | vec3(0.063761, 0.086895, 0.123646),
22 | vec3(0.084817, 0.111994, 0.166380),
23 | vec3(0.097489, 0.154120, 0.091064),
24 | vec3(0.106152, 0.131144, 0.195191),
25 | vec3(0.097721, 0.110188, 0.187229),
26 | vec3(0.133516, 0.138278, 0.148582),
27 | vec3(0.070006, 0.243332, 0.235792),
28 | vec3(0.196766, 0.142899, 0.214696),
29 | vec3(0.047281, 0.315338, 0.321970),
30 | vec3(0.204675, 0.390010, 0.302066),
31 | vec3(0.080955, 0.314821, 0.661491)
32 | );
33 |
34 | const mat4 SCALE_TRANSLATE = mat4(
35 | 0.5, 0.0, 0.0, 0.25,
36 | 0.0, 0.5, 0.0, 0.25,
37 | 0.0, 0.0, 1.0, 0.0,
38 | 0.0, 0.0, 0.0, 1.0
39 | );
40 |
41 | mat4 end_portal_layer(float layer) {
42 | mat4 translate = mat4(
43 | 1.0, 0.0, 0.0, 17.0 / layer,
44 | 0.0, 1.0, 0.0, (2.0 + layer / 1.5) * (GameTime * 1.5),
45 | 0.0, 0.0, 1.0, 0.0,
46 | 0.0, 0.0, 0.0, 1.0
47 | );
48 |
49 | mat2 rotate = mat2_rotate_z(radians((layer * layer * 4321.0 + layer * 9.0) * 2.0));
50 |
51 | mat2 scale = mat2((4.5 - layer / 4.0) * 2.0);
52 |
53 | return mat4(scale * rotate) * translate * SCALE_TRANSLATE;
54 | }
55 |
56 | out vec4 fragColor;
57 |
58 | void main() {
59 | discardControlGLPos(gl_FragCoord.xy, glpos);
60 | vec3 color = textureProj(Sampler0, texProj0).rgb * COLORS[0];
61 | for (int i = 0; i < EndPortalLayers; i++) {
62 | color += textureProj(Sampler1, texProj0 * end_portal_layer(float(i + 1))).rgb * COLORS[i];
63 | }
64 | fragColor = vec4(color, 1.0);
65 | }
66 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_end_portal.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_end_portal",
8 | "fragment": "rendertype_end_portal",
9 | "attributes": [],
10 | "samplers": [
11 | { "name": "Sampler0" },
12 | { "name": "Sampler1" }
13 | ],
14 | "uniforms": [
15 | { "name": "ModelViewMat", "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": "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 ] },
17 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
18 | { "name": "EndPortalLayers", "type": "int", "count": 1, "values": [ 15 ] }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_end_portal.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 |
7 | uniform mat4 ModelViewMat;
8 | uniform mat4 ProjMat;
9 |
10 | out vec4 texProj0;
11 | out vec4 glpos;
12 |
13 | void main() {
14 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
15 |
16 | texProj0 = projection_from_position(gl_Position);
17 | glpos = gl_Position;
18 | }
19 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_energy_swirl.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D Sampler0;
6 | uniform sampler2D Sampler1;
7 | uniform sampler2D Sampler2;
8 |
9 | uniform vec4 ColorModulator;
10 |
11 | in vec4 vertexColor;
12 | in vec2 texCoord0;
13 | in vec4 normal;
14 | in vec4 glpos;
15 |
16 | out vec4 fragColor;
17 |
18 | void main() {
19 | discardControlGLPos(gl_FragCoord.xy, glpos);
20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor;
21 | if (color.a < 0.1) {
22 | discard;
23 | }
24 | fragColor = color * ColorModulator;
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_energy_swirl.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_energy_swirl",
8 | "fragment": "rendertype_energy_swirl",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "TextureMat", "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 ] },
26 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_energy_swirl.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec4 Color;
5 | in vec2 UV0;
6 | in vec2 UV1;
7 | in vec2 UV2;
8 | in vec3 Normal;
9 |
10 | uniform mat4 ModelViewMat;
11 | uniform mat4 ProjMat;
12 | uniform mat4 TextureMat;
13 |
14 | out vec4 vertexColor;
15 | out vec2 texCoord0;
16 | out vec4 normal;
17 | out vec4 glpos;
18 |
19 | void main() {
20 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
21 |
22 | vertexColor = Color;
23 | texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy;
24 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
25 | glpos = gl_Position;
26 | }
27 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 | uniform mat4 ProjMat;
13 | uniform mat4 ModelViewMat;
14 |
15 | in float vertexDistance;
16 | in vec4 vertexColor;
17 | in vec4 lightMapColor;
18 | in vec4 overlayColor;
19 | in vec2 texCoord0;
20 | in vec4 normal;
21 | in vec4 glpos;
22 |
23 | out vec4 fragColor;
24 |
25 | void main() {
26 | if (vertexDistance < FogEnd) discardControlGLPos(gl_FragCoord.xy, glpos);
27 | vec4 color = texture(Sampler0, texCoord0);
28 | if (color.a < 0.1) {
29 | discard;
30 | }
31 | color *= vertexColor * ColorModulator;
32 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
33 | color *= lightMapColor;
34 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
35 | }
36 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_cutout",
8 | "fragment": "rendertype_entity_cutout",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler1;
13 | uniform sampler2D Sampler2;
14 |
15 | uniform mat4 ModelViewMat;
16 | uniform mat4 ProjMat;
17 |
18 | uniform vec3 Light0_Direction;
19 | uniform vec3 Light1_Direction;
20 |
21 | out float vertexDistance;
22 | out vec4 vertexColor;
23 | out vec4 lightMapColor;
24 | out vec4 overlayColor;
25 | out vec2 texCoord0;
26 | out vec4 normal;
27 | out vec4 glpos;
28 |
29 | void main() {
30 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
31 |
32 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
33 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
34 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
35 | overlayColor = texelFetch(Sampler1, UV1, 0);
36 | texCoord0 = UV0;
37 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
38 | glpos = gl_Position;
39 | }
40 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec4 lightMapColor;
16 | in vec4 overlayColor;
17 | in vec2 texCoord0;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0);
26 | if (color.a < 0.1) {
27 | discard;
28 | }
29 | color *= vertexColor * ColorModulator;
30 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
31 | color *= lightMapColor;
32 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33 | }
34 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_cutout_no_cull",
8 | "fragment": "rendertype_entity_cutout_no_cull",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler1;
13 | uniform sampler2D Sampler2;
14 |
15 | uniform mat4 ModelViewMat;
16 | uniform mat4 ProjMat;
17 |
18 | uniform vec3 Light0_Direction;
19 | uniform vec3 Light1_Direction;
20 |
21 | out float vertexDistance;
22 | out vec4 vertexColor;
23 | out vec4 lightMapColor;
24 | out vec4 overlayColor;
25 | out vec2 texCoord0;
26 | out vec4 normal;
27 | out vec4 glpos;
28 |
29 | void main() {
30 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
31 |
32 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
33 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
34 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
35 | overlayColor = texelFetch(Sampler1, UV1, 0);
36 | texCoord0 = UV0;
37 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
38 | glpos = gl_Position;
39 | }
40 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec4 lightMapColor;
16 | in vec4 overlayColor;
17 | in vec2 texCoord0;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | if (vertexDistance < FogEnd) discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0);
26 | if (color.a < 0.1) {
27 | discard;
28 | }
29 | color *= vertexColor * ColorModulator;
30 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
31 | color *= lightMapColor;
32 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33 | }
34 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_cutout_no_cull_z_offset",
8 | "fragment": "rendertype_entity_cutout_no_cull_z_offset",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler1;
13 | uniform sampler2D Sampler2;
14 |
15 | uniform mat4 ModelViewMat;
16 | uniform mat4 ProjMat;
17 |
18 | uniform vec3 Light0_Direction;
19 | uniform vec3 Light1_Direction;
20 |
21 | out float vertexDistance;
22 | out vec4 vertexColor;
23 | out vec4 lightMapColor;
24 | out vec4 overlayColor;
25 | out vec2 texCoord0;
26 | out vec4 normal;
27 | out vec4 glpos;
28 |
29 | void main() {
30 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
31 |
32 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
33 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
34 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
35 | overlayColor = texelFetch(Sampler1, UV1, 0);
36 | texCoord0 = UV0;
37 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
38 | glpos = gl_Position;
39 | }
40 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 | in vec4 glpos;
18 |
19 | out vec4 fragColor;
20 |
21 | void main() {
22 | if (vertexDistance < FogEnd) discardControlGLPos(gl_FragCoord.xy, glpos);
23 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_no_outline.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_no_outline",
8 | "fragment": "rendertype_entity_no_outline",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
24 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
25 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV2;
9 | in vec3 Normal;
10 |
11 | uniform sampler2D Sampler2;
12 |
13 | uniform mat4 ModelViewMat;
14 | uniform mat4 ProjMat;
15 |
16 | uniform vec3 Light0_Direction;
17 | uniform vec3 Light1_Direction;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec4 glpos;
24 |
25 | void main() {
26 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
27 |
28 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
29 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0);
30 | texCoord0 = UV0;
31 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
32 | glpos = gl_Position;
33 | }
34 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_shadow.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 glpos;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | discardControlGLPos(gl_FragCoord.xy, glpos);
22 | vec4 color = texture(Sampler0, clamp(texCoord0, 0.0, 1.0));
23 | color *= vertexColor * ColorModulator;
24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_shadow.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_shadow",
8 | "fragment": "rendertype_entity_shadow",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0"
13 | ],
14 | "samplers": [
15 | { "name": "Sampler0" }
16 | ],
17 | "uniforms": [
18 | { "name": "ModelViewMat", "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": "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 ] },
20 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
21 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
22 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
23 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_shadow.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec4 Color;
5 | in vec2 UV0;
6 |
7 | uniform mat4 ModelViewMat;
8 | uniform mat4 ProjMat;
9 |
10 | out float vertexDistance;
11 | out vec4 vertexColor;
12 | out vec2 texCoord0;
13 | out vec4 glpos;
14 |
15 | void main() {
16 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
17 |
18 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
19 | vertexColor = Color;
20 | texCoord0 = UV0;
21 | glpos = gl_Position;
22 | }
23 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec4 lightMapColor;
16 | in vec4 overlayColor;
17 | in vec2 texCoord0;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0);
26 | if (color.a < 0.1) {
27 | discard;
28 | }
29 | color *= vertexColor * ColorModulator;
30 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
31 | color *= lightMapColor;
32 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33 | }
34 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_smooth_cutout",
8 | "fragment": "rendertype_entity_smooth_cutout",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_smooth_cutout.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler1;
13 | uniform sampler2D Sampler2;
14 |
15 | uniform mat4 ModelViewMat;
16 | uniform mat4 ProjMat;
17 |
18 | uniform vec3 Light0_Direction;
19 | uniform vec3 Light1_Direction;
20 |
21 | out float vertexDistance;
22 | out vec4 vertexColor;
23 | out vec4 lightMapColor;
24 | out vec4 overlayColor;
25 | out vec2 texCoord0;
26 | out vec4 normal;
27 | out vec4 glpos;
28 |
29 | void main() {
30 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
31 |
32 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
33 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
34 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
35 | overlayColor = texelFetch(Sampler1, UV1, 0);
36 | texCoord0 = UV0;
37 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
38 | glpos = gl_Position;
39 | }
40 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_solid.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 | uniform sampler2D Sampler1;
8 |
9 | uniform vec4 ColorModulator;
10 | uniform float FogStart;
11 | uniform float FogEnd;
12 | uniform vec4 FogColor;
13 |
14 | in float vertexDistance;
15 | in vec4 vertexColor;
16 | in vec2 texCoord0;
17 | in vec2 texCoord1;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | if (vertexDistance < FogEnd) discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
27 | }
28 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_solid.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_solid",
8 | "fragment": "rendertype_entity_solid",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_solid.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in vec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 |
17 | uniform vec3 Light0_Direction;
18 | uniform vec3 Light1_Direction;
19 |
20 | out float vertexDistance;
21 | out vec4 vertexColor;
22 | out vec2 texCoord0;
23 | out vec2 texCoord1;
24 | out vec4 normal;
25 | out vec4 glpos;
26 |
27 | void main() {
28 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
29 |
30 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
31 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0);
32 | texCoord0 = UV0;
33 | texCoord1 = UV1;
34 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
35 | glpos = gl_Position;
36 | }
37 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec4 lightMapColor;
16 | in vec4 overlayColor;
17 | in vec2 texCoord0;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0);
26 | if (color.a < 0.1) {
27 | discard;
28 | }
29 | color *= vertexColor * ColorModulator;
30 | color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
31 | color *= lightMapColor;
32 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33 | }
34 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_translucent.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_translucent",
8 | "fragment": "rendertype_entity_translucent",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler1;
13 | uniform sampler2D Sampler2;
14 |
15 | uniform mat4 ModelViewMat;
16 | uniform mat4 ProjMat;
17 |
18 | uniform vec3 Light0_Direction;
19 | uniform vec3 Light1_Direction;
20 |
21 | out float vertexDistance;
22 | out vec4 vertexColor;
23 | out vec4 lightMapColor;
24 | out vec4 overlayColor;
25 | out vec2 texCoord0;
26 | out vec4 normal;
27 | out vec4 glpos;
28 |
29 | void main() {
30 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
31 |
32 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
33 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
34 | lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
35 | overlayColor = texelFetch(Sampler1, UV1, 0);
36 | texCoord0 = UV0;
37 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
38 | glpos = gl_Position;
39 | }
40 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 | uniform sampler2D Sampler1;
8 |
9 | uniform vec4 ColorModulator;
10 | uniform float FogStart;
11 | uniform float FogEnd;
12 | uniform vec4 FogColor;
13 |
14 | in float vertexDistance;
15 | in vec4 vertexColor;
16 | in vec2 texCoord0;
17 | in vec2 texCoord1;
18 | in vec4 normal;
19 | in vec4 glpos;
20 |
21 | out vec4 fragColor;
22 |
23 | void main() {
24 | if (vertexDistance < FogEnd) discardControlGLPos(gl_FragCoord.xy, glpos);
25 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 | if (color.a < 0.1) {
27 | discard;
28 | }
29 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
30 | }
31 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_entity_translucent_cull",
8 | "fragment": "rendertype_entity_translucent_cull",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
26 | { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
27 | { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
29 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
30 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in vec2 UV1;
9 | in ivec2 UV2;
10 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 |
17 | uniform vec3 Light0_Direction;
18 | uniform vec3 Light1_Direction;
19 |
20 | out float vertexDistance;
21 | out vec4 vertexColor;
22 | out vec2 texCoord0;
23 | out vec2 texCoord1;
24 | out vec2 texCoord2;
25 | out vec4 normal;
26 | out vec4 glpos;
27 |
28 | void main() {
29 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
30 |
31 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
32 | vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0);
33 | texCoord0 = UV0;
34 | texCoord1 = UV1;
35 | texCoord2 = UV2;
36 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
37 | glpos = gl_Position;
38 | }
39 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_eyes.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform sampler2D Sampler0;
6 | uniform sampler2D Sampler1;
7 | uniform sampler2D Sampler2;
8 |
9 | uniform vec4 ColorModulator;
10 |
11 | in vec4 vertexColor;
12 | in vec2 texCoord0;
13 | in vec2 texCoord1;
14 | in vec2 texCoord2;
15 | in vec4 normal;
16 | in vec4 glpos;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | discardControlGLPos(gl_FragCoord.xy, glpos);
22 | vec4 color = texture(Sampler0, texCoord0) * vertexColor;
23 | fragColor = color * ColorModulator;
24 | }
25 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_eyes.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_eyes",
8 | "fragment": "rendertype_eyes",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV1",
14 | "UV2",
15 | "Normal"
16 | ],
17 | "samplers": [
18 | { "name": "Sampler0" },
19 | { "name": "Sampler1" },
20 | { "name": "Sampler2" }
21 | ],
22 | "uniforms": [
23 | { "name": "ModelViewMat", "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 ] },
24 | { "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 ] },
25 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_eyes.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec4 Color;
5 | in vec2 UV0;
6 | in vec2 UV1;
7 | in vec2 UV2;
8 | in vec3 Normal;
9 |
10 | uniform mat4 ModelViewMat;
11 | uniform mat4 ProjMat;
12 |
13 | out vec4 vertexColor;
14 | out vec2 texCoord0;
15 | out vec2 texCoord1;
16 | out vec2 texCoord2;
17 | out vec4 normal;
18 | out vec4 glpos;
19 |
20 | void main() {
21 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
22 |
23 | vertexColor = Color;
24 | texCoord0 = UV0;
25 | texCoord1 = UV1;
26 | texCoord2 = UV2;
27 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
28 | glpos = gl_Position;
29 | }
30 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_leash.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform float FogStart;
7 | uniform float FogEnd;
8 | uniform vec4 FogColor;
9 |
10 | in float vertexDistance;
11 | flat in vec4 vertexColor;
12 | in vec4 glpos;
13 |
14 | out vec4 fragColor;
15 |
16 | void main() {
17 | discardControlGLPos(gl_FragCoord.xy, glpos);
18 | fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor);
19 | }
20 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_leash.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_leash",
8 | "fragment": "rendertype_leash",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV2"
13 | ],
14 | "samplers": [
15 | { "name": "Sampler2" }
16 | ],
17 | "uniforms": [
18 | { "name": "ModelViewMat", "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": "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 ] },
20 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
21 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
22 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
23 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_leash.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec4 Color;
5 | in ivec2 UV2;
6 |
7 | uniform sampler2D Sampler2;
8 |
9 | uniform mat4 ModelViewMat;
10 | uniform mat4 ProjMat;
11 | uniform vec4 ColorModulator;
12 |
13 | out float vertexDistance;
14 | flat out vec4 vertexColor;
15 | out vec4 glpos;
16 |
17 | void main() {
18 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
19 |
20 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
21 | vertexColor = Color * ColorModulator * texelFetch(Sampler2, UV2 / 16, 0);
22 | glpos = gl_Position;
23 | }
24 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_solid.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 | #moj_import
5 |
6 | uniform sampler2D Sampler0;
7 |
8 | uniform vec4 ColorModulator;
9 | uniform float FogStart;
10 | uniform float FogEnd;
11 | uniform vec4 FogColor;
12 |
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec2 texCoord0;
16 | in vec4 normal;
17 | in vec4 glpos;
18 |
19 | out vec4 fragColor;
20 |
21 | void main() {
22 | discardControlGLPos(gl_FragCoord.xy, glpos);
23 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
24 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
25 | }
26 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_solid.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_solid",
8 | "fragment": "rendertype_solid",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
27 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/core/rendertype_solid.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | in vec3 Position;
6 | in vec4 Color;
7 | in vec2 UV0;
8 | in ivec2 UV2;
9 | in vec3 Normal;
10 |
11 | uniform sampler2D Sampler2;
12 |
13 | uniform mat4 ModelViewMat;
14 | uniform mat4 ProjMat;
15 | uniform vec3 ChunkOffset;
16 |
17 | out float vertexDistance;
18 | out vec4 vertexColor;
19 | out vec2 texCoord0;
20 | out vec4 normal;
21 | out vec4 glpos;
22 |
23 | void main() {
24 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
25 |
26 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
27 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2);
28 | texCoord0 = UV0;
29 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
30 | glpos = gl_Position;
31 | }
32 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/include/fog.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
4 | if (fogStart > 1.0) { // just to look nicer
5 | fogStart /= 10.0;
6 | }
7 | if (vertexDistance <= fogStart) {
8 | return inColor;
9 | }
10 |
11 | float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
12 | return vec4(mix(inColor.rgb, fogColor.rgb, fogValue * fogColor.a), inColor.a);
13 | }
14 |
15 | float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
16 | if (vertexDistance <= fogStart) {
17 | return 1.0;
18 | } else if (vertexDistance >= fogEnd) {
19 | return 0.0;
20 | }
21 |
22 | return smoothstep(fogEnd, fogStart, vertexDistance);
23 | }
24 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/include/light.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define MINECRAFT_LIGHT_POWER (0.6)
4 | #define MINECRAFT_AMBIENT_LIGHT (0.4)
5 |
6 | vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) {
7 | lightDir0 = normalize(lightDir0);
8 | lightDir1 = normalize(lightDir1);
9 | float light0 = max(0.0, dot(lightDir0, normal));
10 | float light1 = max(0.0, dot(lightDir1, normal));
11 | float lightAccum = min(1.0, (light0 + light1) * MINECRAFT_LIGHT_POWER + MINECRAFT_AMBIENT_LIGHT);
12 | return vec4(color.rgb * lightAccum, color.a);
13 | }
14 |
15 | vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) {
16 | return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0))); // x is torch, y is sun
17 | }
18 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/include/matrix.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | mat2 mat2_rotate_z(float radians) {
4 | return mat2(
5 | cos(radians), -sin(radians),
6 | sin(radians), cos(radians)
7 | );
8 | }
9 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/include/projection.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | vec4 projection_from_position(vec4 position) {
4 | vec4 projection = position * 0.5;
5 | projection.xy = vec2(projection.x + projection.w, projection.y + projection.w);
6 | projection.zw = position.zw;
7 | return projection;
8 | }
9 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/include/utils.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define NUMCONTROLS 26
4 | #define THRESH 0.5
5 | #define FPRECISION 4000000.0
6 | #define PROJNEAR 0.05
7 |
8 | /*
9 | Control Map:
10 | [0] sunDir.x
11 | [1] sunDir.y
12 | [2] sunDir.z
13 | [3] arctan(ProjMat[0][0])
14 | [4] arctan(ProjMat[1][1])
15 | [5] ProjMat[1][0]
16 | [6] ProjMat[0][1]
17 | [7] ProjMat[1][2]
18 | [8] ProjMat[1][3]
19 | [9] ProjMat[2][0]
20 | [10] ProjMat[2][1]
21 | [11] ProjMat[2][2]
22 | [12] ProjMat[2][3]
23 | [13] ProjMat[3][0]
24 | [14] ProjMat[3][1]
25 | [15] ProjMat[3][2]
26 | [16] ModelViewMat[0][0]
27 | [17] ModelViewMat[0][1]
28 | [18] ModelViewMat[0][2]
29 | [19] ModelViewMat[1][0]
30 | [20] ModelViewMat[1][1]
31 | [21] ModelViewMat[1][2]
32 | [22] ModelViewMat[2][0]
33 | [23] ModelViewMat[2][1]
34 | [24] ModelViewMat[2][2]
35 | [25] FogColor
36 | */
37 |
38 | // returns control pixel index or -1 if not control
39 | int inControl(vec2 screenCoord, float screenWidth) {
40 | if (screenCoord.y < 1.0) {
41 | float index = floor(screenWidth / 2.0) + THRESH / 2.0;
42 | index = (screenCoord.x - index) / 2.0;
43 | if (fract(index) < THRESH && index < NUMCONTROLS && index >= 0) {
44 | return int(index);
45 | }
46 | }
47 | return -1;
48 | }
49 |
50 | // discards the current pixel if it is control
51 | void discardControl(vec2 screenCoord, float screenWidth) {
52 | if (screenCoord.y < 1.0) {
53 | float index = floor(screenWidth / 2.0) + THRESH / 2.0;
54 | index = (screenCoord.x - index) / 2.0;
55 | if (fract(index) < THRESH && index < NUMCONTROLS && index >= 0) {
56 | discard;
57 | }
58 | }
59 | }
60 |
61 | // discard but for when ScreenSize is not given
62 | void discardControlGLPos(vec2 screenCoord, vec4 glpos) {
63 | if (screenCoord.y < 1.0) {
64 | float screenWidth = round(screenCoord.x * 2.0 / (glpos.x / glpos.w + 1.0));
65 | float index = floor(screenWidth / 2.0) + THRESH / 2.0;
66 | index = (screenCoord.x - index) / 2.0;
67 | if (fract(index) < THRESH && index < NUMCONTROLS && index >= 0) {
68 | discard;
69 | }
70 | }
71 | }
72 |
73 | // get screen coordinates of a particular control index
74 | vec2 getControl(int index, vec2 screenSize) {
75 | return vec2(floor(screenSize.x / 2.0) + float(index) * 2.0 + 0.5, 0.5) / screenSize;
76 | }
77 |
78 | int intmod(int i, int base) {
79 | return i - (i / base * base);
80 | }
81 |
82 | vec3 encodeInt(int i) {
83 | int s = int(i < 0) * 128;
84 | i = abs(i);
85 | int r = intmod(i, 256);
86 | i = i / 256;
87 | int g = intmod(i, 256);
88 | i = i / 256;
89 | int b = intmod(i, 128);
90 | return vec3(float(r) / 255.0, float(g) / 255.0, float(b + s) / 255.0);
91 | }
92 |
93 | int decodeInt(vec3 ivec) {
94 | ivec *= 255.0;
95 | int s = ivec.b >= 128.0 ? -1 : 1;
96 | return s * (int(ivec.r) + int(ivec.g) * 256 + (int(ivec.b) - 64 + s * 64) * 256 * 256);
97 | }
98 |
99 | vec3 encodeFloat(float i) {
100 | return encodeInt(int(i * FPRECISION));
101 | }
102 |
103 | float decodeFloat(vec3 ivec) {
104 | return decodeInt(ivec) / FPRECISION;
105 | }
106 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/post/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | "swap1",
4 | "swap2",
5 | "translucent",
6 | "itemEntity",
7 | "particles",
8 | "clouds",
9 | "weather"
10 | ],
11 | "passes": [
12 | {
13 | "name": "shading",
14 | "intarget": "minecraft:main",
15 | "outtarget": "swap1",
16 | "auxtargets": [
17 | {
18 | "name": "DiffuseDepthSampler",
19 | "id": "minecraft:main:depth"
20 | }
21 | ]
22 | },
23 | {
24 | "name": "transparency",
25 | "intarget": "swap1",
26 | "outtarget": "swap2",
27 | "auxtargets": [
28 | {
29 | "name": "DiffuseDepthSampler",
30 | "id": "minecraft:main:depth"
31 | },
32 | {
33 | "name": "TranslucentSampler",
34 | "id": "translucent"
35 | },
36 | {
37 | "name": "TranslucentDepthSampler",
38 | "id": "translucent:depth"
39 | },
40 | {
41 | "name": "ItemEntitySampler",
42 | "id": "itemEntity"
43 | },
44 | {
45 | "name": "ItemEntityDepthSampler",
46 | "id": "itemEntity:depth"
47 | },
48 | {
49 | "name": "ParticlesSampler",
50 | "id": "particles"
51 | },
52 | {
53 | "name": "ParticlesDepthSampler",
54 | "id": "particles:depth"
55 | },
56 | {
57 | "name": "CloudsSampler",
58 | "id": "clouds"
59 | },
60 | {
61 | "name": "CloudsDepthSampler",
62 | "id": "clouds:depth"
63 | },
64 | {
65 | "name": "WeatherSampler",
66 | "id": "weather"
67 | },
68 | {
69 | "name": "WeatherDepthSampler",
70 | "id": "weather:depth"
71 | }
72 | ]
73 | },
74 | {
75 | "name": "blit",
76 | "intarget": "swap2",
77 | "outtarget": "minecraft:main"
78 | }
79 | ]
80 | }
81 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/program/shading.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | uniform sampler2D DiffuseSampler;
4 | uniform sampler2D DiffuseDepthSampler;
5 | uniform vec2 OutSize;
6 |
7 | in vec2 texCoord;
8 | in vec2 oneTexel;
9 | in vec3 sunDir;
10 | in mat4 ProjInv;
11 | in float near;
12 | in float far;
13 |
14 | out vec4 fragColor;
15 |
16 | // moj_import doesn't work in post-process shaders ;_; Felix pls fix
17 | #define NUMCONTROLS 26
18 | #define THRESH 0.5
19 | #define FPRECISION 4000000.0
20 | #define PROJNEAR 0.05
21 | #define FUDGE 32.0
22 |
23 | int inControl(vec2 screenCoord, float screenWidth) {
24 | if (screenCoord.y < 1.0) {
25 | float index = floor(screenWidth / 2.0) + THRESH / 2.0;
26 | index = (screenCoord.x - index) / 2.0;
27 | if (fract(index) < THRESH && index < NUMCONTROLS && index >= 0) {
28 | return int(index);
29 | }
30 | }
31 | return -1;
32 | }
33 |
34 | vec4 getNotControl(sampler2D inSampler, vec2 coords, bool inctrl) {
35 | if (inctrl) {
36 | return (texture(inSampler, coords - vec2(oneTexel.x, 0.0)) + texture(inSampler, coords + vec2(oneTexel.x, 0.0)) + texture(inSampler, coords + vec2(0.0, oneTexel.y))) / 3.0;
37 | } else {
38 | return texture(inSampler, coords);
39 | }
40 | }
41 |
42 | // tweak lighting color here
43 | #define NOON vec3(1.3)
44 | #define NOONA vec3(0.7, 0.75, 0.9)
45 | #define EVENING vec3(1.4, 1.1, 0.7)
46 | #define EVENINGA vec3(0.7, 0.8, 1.2)
47 | #define NIGHT vec3(1.0)
48 | #define NIGHTA vec3(1.0)
49 |
50 | float LinearizeDepth(float depth)
51 | {
52 | return (2.0 * near * far) / (far + near - depth * (far - near));
53 | }
54 |
55 | float luma(vec3 color){
56 | return dot(color,vec3(0.299, 0.587, 0.114));
57 | }
58 |
59 | vec4 backProject(vec4 vec) {
60 | vec4 tmp = ProjInv * vec;
61 | return tmp / tmp.w;
62 | }
63 |
64 | void main() {
65 | bool inctrl = inControl(texCoord * OutSize, OutSize.x) > -1;
66 |
67 | fragColor = getNotControl(DiffuseSampler, texCoord, inctrl);
68 | float depth = getNotControl(DiffuseDepthSampler, texCoord, inctrl).r;
69 |
70 | // only do lighting if not sky and sunDir exists
71 | if (LinearizeDepth(depth) < far - FUDGE && length(sunDir) > 0.99) {
72 |
73 | // first calculate approximate surface normal using depth map
74 | float depth2 = getNotControl(DiffuseDepthSampler, texCoord + vec2(0.0, oneTexel.y), inctrl).r;
75 | float depth3 = getNotControl(DiffuseDepthSampler, texCoord + vec2(oneTexel.x, 0.0), inctrl).r;
76 | float depth4 = getNotControl(DiffuseDepthSampler, texCoord - vec2(0.0, oneTexel.y), inctrl).r;
77 | float depth5 = getNotControl(DiffuseDepthSampler, texCoord - vec2(oneTexel.x, 0.0), inctrl).r;
78 |
79 | vec2 scaledCoord = 2.0 * (texCoord - vec2(0.5));
80 |
81 | vec3 fragpos = backProject(vec4(scaledCoord, depth, 1.0)).xyz;
82 | vec3 p2 = backProject(vec4(scaledCoord + 2.0 * vec2(0.0, oneTexel.y), depth2, 1.0)).xyz;
83 | p2 = p2 - fragpos;
84 | vec3 p3 = backProject(vec4(scaledCoord + 2.0 * vec2(oneTexel.x, 0.0), depth3, 1.0)).xyz;
85 | p3 = p3 - fragpos;
86 | vec3 p4 = backProject(vec4(scaledCoord - 2.0 * vec2(0.0, oneTexel.y), depth4, 1.0)).xyz;
87 | p4 = p4 - fragpos;
88 | vec3 p5 = backProject(vec4(scaledCoord - 2.0 * vec2(oneTexel.x, 0.0), depth5, 1.0)).xyz;
89 | p5 = p5 - fragpos;
90 | vec3 normal = normalize(cross(p2, p3))
91 | + normalize(cross(-p4, p3))
92 | + normalize(cross(p2, -p5))
93 | + normalize(cross(-p4, -p5));
94 | normal = normal == vec3(0.0) ? vec3(0.0, 1.0, 0.0) : normalize(-normal);
95 |
96 | // use cos between sunDir to determine light and ambient colors
97 | float sdu = dot(vec3(0.0, 1.0, 0.0), sunDir);
98 | vec3 direct;
99 | vec3 ambient;
100 | if (sdu > 0.0) {
101 | direct = mix(EVENING, NOON, sdu);
102 | ambient = mix(EVENINGA, NOONA, sdu);
103 | } else {
104 | direct = mix(EVENING, NIGHT, pow(-sdu, 0.25));
105 | ambient = mix(EVENINGA, NIGHTA, pow(-sdu, 0.25));
106 | }
107 |
108 | // apply lighting color. not quite standard diffuse light equation since the blocks are already "pre-lit"
109 | fragColor.rgb *= mix(ambient, direct, clamp(dot(normal, sunDir), 0.0, 1.0));
110 |
111 | // desaturate bright pixels for more realistic feel
112 | fragColor.rgb = mix(fragColor.rgb, vec3(length(fragColor.rgb)/sqrt(3.0)), luma(fragColor.rgb) * 0.5);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/program/shading.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "shading",
8 | "fragment": "shading",
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": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/sun-position/assets/minecraft/shaders/program/shading.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec4 Position;
4 |
5 | uniform mat4 ProjMat;
6 | uniform vec2 OutSize;
7 | uniform sampler2D DiffuseSampler;
8 |
9 | out vec2 texCoord;
10 | out vec2 oneTexel;
11 | out vec3 sunDir;
12 | out mat4 ProjInv;
13 | out float near;
14 | out float far;
15 |
16 | // moj_import doesn't work in post-process shaders ;_; Felix pls fix
17 | #define FPRECISION 4000000.0
18 | #define PROJNEAR 0.05
19 |
20 | vec2 getControl(int index, vec2 screenSize) {
21 | return vec2(floor(screenSize.x / 2.0) + float(index) * 2.0 + 0.5, 0.5) / screenSize;
22 | }
23 |
24 | int intmod(int i, int base) {
25 | return i - (i / base * base);
26 | }
27 |
28 | vec3 encodeInt(int i) {
29 | int s = int(i < 0) * 128;
30 | i = abs(i);
31 | int r = intmod(i, 256);
32 | i = i / 256;
33 | int g = intmod(i, 256);
34 | i = i / 256;
35 | int b = intmod(i, 128);
36 | return vec3(float(r) / 255.0, float(g) / 255.0, float(b + s) / 255.0);
37 | }
38 |
39 | int decodeInt(vec3 ivec) {
40 | ivec *= 255.0;
41 | int s = ivec.b >= 128.0 ? -1 : 1;
42 | return s * (int(ivec.r) + int(ivec.g) * 256 + (int(ivec.b) - 64 + s * 64) * 256 * 256);
43 | }
44 |
45 | vec3 encodeFloat(float i) {
46 | return encodeInt(int(i * FPRECISION));
47 | }
48 |
49 | float decodeFloat(vec3 ivec) {
50 | return decodeInt(ivec) / FPRECISION;
51 | }
52 |
53 | void main() {
54 | vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
55 | gl_Position = vec4(outPos.xy, 0.2, 1.0);
56 | texCoord = Position.xy / OutSize;
57 | oneTexel = 1.0 / OutSize;
58 |
59 | //simply decoding all the control data and constructing the sunDir, ProjMat, ModelViewMat
60 |
61 | vec2 start = getControl(0, OutSize);
62 | vec2 inc = vec2(2.0 / OutSize.x, 0.0);
63 |
64 |
65 | // ProjMat constructed assuming no translation or rotation matrices applied (aka no view bobbing).
66 | mat4 ProjMat = mat4(tan(decodeFloat(texture(DiffuseSampler, start + 3.0 * inc).xyz)), decodeFloat(texture(DiffuseSampler, start + 6.0 * inc).xyz), 0.0, 0.0,
67 | decodeFloat(texture(DiffuseSampler, start + 5.0 * inc).xyz), tan(decodeFloat(texture(DiffuseSampler, start + 4.0 * inc).xyz)), decodeFloat(texture(DiffuseSampler, start + 7.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 8.0 * inc).xyz),
68 | decodeFloat(texture(DiffuseSampler, start + 9.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 10.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 11.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 12.0 * inc).xyz),
69 | decodeFloat(texture(DiffuseSampler, start + 13.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 14.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 15.0 * inc).xyz), 0.0);
70 |
71 | mat4 ModeViewMat = mat4(decodeFloat(texture(DiffuseSampler, start + 16.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 17.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 18.0 * inc).xyz), 0.0,
72 | decodeFloat(texture(DiffuseSampler, start + 19.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 20.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 21.0 * inc).xyz), 0.0,
73 | decodeFloat(texture(DiffuseSampler, start + 22.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 23.0 * inc).xyz), decodeFloat(texture(DiffuseSampler, start + 24.0 * inc).xyz), 0.0,
74 | 0.0, 0.0, 0.0, 1.0);
75 |
76 | near = PROJNEAR;
77 | far = ProjMat[3][2] * PROJNEAR / (ProjMat[3][2] + 2.0 * PROJNEAR);
78 |
79 | sunDir = normalize((inverse(ModeViewMat) * vec4(decodeFloat(texture(DiffuseSampler, start).xyz),
80 | decodeFloat(texture(DiffuseSampler, start + inc).xyz),
81 | decodeFloat(texture(DiffuseSampler, start + 2.0 * inc).xyz),
82 | 1.0)).xyz);
83 |
84 | ProjInv = inverse(ProjMat * ModeViewMat);
85 | }
86 |
--------------------------------------------------------------------------------
/sun-position/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "Sun Position Shader"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/position.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform vec4 ColorModulator;
6 | uniform float FogStart;
7 | uniform float FogEnd;
8 | uniform vec4 FogColor;
9 | uniform vec2 ScreenSize;
10 |
11 | in mat4 ProjInv;
12 | in float isSky;
13 | in float vertexDistance;
14 |
15 | out vec4 fragColor;
16 |
17 | #define GRIDOFFSET 0.078
18 | #define GRIDDENSITY 10.0
19 |
20 | void main() {
21 | // get player space view vector
22 | vec4 screenPos = gl_FragCoord;
23 | screenPos.xy = (screenPos.xy / ScreenSize - vec2(0.5)) * 2.0;
24 | screenPos.zw = vec2(1.0);
25 | vec3 view = normalize((ProjInv * screenPos).xyz);
26 |
27 | float vdn = dot(view, vec3(0.0, 1.0, 0.0));
28 | float vdt = dot(view, vec3(1.0, 0.0, 0.0));
29 | float vdb = dot(view, vec3(0.0, 0.0, 1.0));
30 |
31 | // custom fog calculation if sky because sky disk is no longer above the head
32 | if (isSky > 0.5) {
33 | float ndusq = clamp(dot(view, vec3(0.0, 1.0, 0.0)), 0.0, 1.0);
34 | ndusq = ndusq * ndusq;
35 |
36 | fragColor = linear_fog(length(ColorModulator.rgb) / sqrt(3.0) * DPURPLE, pow(1.0 - ndusq, 8.0), 0.0, 1.0, FogColor);
37 | }
38 | // default shading for void plane and stars
39 | else {
40 | fragColor = linear_fog(ColorModulator + length(ColorModulator) * CYAN * 0.5, vertexDistance, FogStart, FogEnd, FogColor);
41 | }
42 |
43 | // drawing the grid
44 | if (fract(vdn * GRIDDENSITY + GRIDOFFSET) < 0.015
45 | || fract(vdt * GRIDDENSITY + GRIDOFFSET) < 0.015
46 | || fract(vdb * GRIDDENSITY + GRIDOFFSET) < 0.015) {
47 | fragColor = PURPLE;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/position.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position",
8 | "fragment": "position",
9 | "attributes": [
10 | ],
11 | "samplers": [
12 | ],
13 | "uniforms": [
14 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
17 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
19 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
20 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
21 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/position.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 |
5 | uniform vec4 ColorModulator;
6 | uniform mat4 ModelViewMat;
7 | uniform mat4 ProjMat;
8 | uniform float FogEnd;
9 |
10 | out mat4 ProjInv;
11 | out float isSky;
12 | out float vertexDistance;
13 |
14 | #define BOTTOM -32.0
15 | #define SCALE 0.01
16 | #define SKYHEIGHT 16.0
17 | #define SKYRADIUS 512.0
18 | #define FUDGE 0.004
19 |
20 | void main() {
21 | vec3 scaledPos = Position;
22 | ProjInv = inverse(ProjMat * ModelViewMat);
23 | isSky = 0.0;
24 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
25 |
26 | // sky disk is by default 16.0 units above with radius of 512.0 around the camera at all times.
27 | if (abs(scaledPos.y - SKYHEIGHT) < FUDGE && (length(scaledPos.xz) <= FUDGE || abs(scaledPos.y - SKYHEIGHT) < FUDGE && abs(length(scaledPos.xz) - SKYRADIUS) < FUDGE)) {
28 | isSky = 1.0;
29 |
30 | // Make sky into a cone by bringing down edges of the disk.
31 | if (length(scaledPos.xz) > 1.0) {
32 | scaledPos.y = BOTTOM;
33 | }
34 |
35 | // Make it big so it does not interfere with void plane.
36 | scaledPos.xyz *= SCALE;
37 |
38 | // rotate to z axis
39 | scaledPos = scaledPos.xzy;
40 | scaledPos.z *= -1;
41 |
42 | // ignore model view so the cone follows the camera angle.
43 | gl_Position = ProjMat * vec4(scaledPos, 1.0);
44 | } else {
45 | gl_Position = ProjMat * ModelViewMat * vec4(scaledPos, 1.0);
46 | }
47 | }
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/position_tex_color_normal.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 vec2 texCoord0;
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec4 normal;
16 |
17 | out vec4 fragColor;
18 |
19 | void main() {
20 |
21 | // slightly colored clouds
22 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * length(ColorModulator.rgb) / sqrt(3.0) * CYAN;
23 | if (color.a < 0.1) {
24 | discard;
25 | }
26 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
27 | fragColor.a /= 2.0;
28 | }
29 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/position_tex_color_normal.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_tex_color_normal",
8 | "fragment": "position_tex_color_normal",
9 | "attributes": [
10 | "Position",
11 | "UV0",
12 | "Color",
13 | "Normal"
14 | ],
15 | "samplers": [
16 | { "name": "Sampler0" }
17 | ],
18 | "uniforms": [
19 | { "name": "ModelViewMat", "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 ] },
20 | { "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 ] },
21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
22 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
23 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
24 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/position_tex_color_normal.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec2 UV0;
5 | in vec4 Color;
6 | in vec3 Normal;
7 |
8 | uniform mat4 ModelViewMat;
9 | uniform mat4 ProjMat;
10 |
11 | out vec2 texCoord0;
12 | out float vertexDistance;
13 | out vec4 vertexColor;
14 | out vec4 normal;
15 |
16 | void main() {
17 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
18 |
19 | texCoord0 = UV0;
20 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
21 | vertexColor = Color;
22 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
23 | }
24 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_cutout.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 vec4 normal;
16 |
17 | out vec4 fragColor;
18 |
19 | void main() {
20 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator;
21 | if (color.a < 0.1) {
22 | discard;
23 | }
24 | fragColor = linear_fog(vertexColor * length(color) / 1.2, vertexDistance, FogStart, FogEnd, FogColor);
25 | }
26 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_cutout.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout",
8 | "fragment": "rendertype_cutout",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_cutout.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 |
24 | void main() {
25 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
26 |
27 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
28 | vertexColor = generateSpectrum();
29 | // color pulse
30 | vertexColor.rgb += (sin(mod((Position.z + Position.x + Position.y) * PI / 8.0 + GameTime * 750, 2 * PI)) + 1.0) * vec3(0.1);
31 | vertexColor.rgb *= length(Color) / 2.0;
32 | texCoord0 = UV0;
33 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
34 | }
35 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_cutout_mipped.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 vec4 normal;
16 | in vec3 barycentric;
17 | in float colLength;
18 |
19 | out vec4 fragColor;
20 |
21 | void main() {
22 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator;
23 | vec4 mutableVertexColor = vertexColor;
24 | if (color.a < 0.5) {
25 | discard;
26 | }
27 | if (color.a > 0.999 && min(min(barycentric.x, barycentric.y), barycentric.z) > 0.03) {
28 | mutableVertexColor = mix(PURPLE, vertexColor, 0.25) * length(color) * colLength;
29 | }
30 | fragColor = linear_fog(mutableVertexColor, vertexDistance, FogStart, FogEnd, FogColor);
31 | }
32 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_cutout_mipped.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout_mipped",
8 | "fragment": "rendertype_cutout_mipped",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_cutout_mipped.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec3 barycentric;
24 | out float colLength;
25 |
26 | void main() {
27 | barycentric = generateBarycentric();
28 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
29 |
30 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
31 | vertexColor = generateSpectrum();
32 | // color pulse
33 | vertexColor.rgb += (sin(mod((Position.z + Position.x + Position.y) * PI / 8.0 + GameTime * 750, 2 * PI)) + 1.0) * vec3(0.1);
34 | colLength = length(Color) / 2.0;
35 | texCoord0 = UV0;
36 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
37 | }
38 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_solid.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 vec4 normal;
16 | in vec3 barycentric;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * ColorModulator;
22 | vec4 mutableVertexColor = vertexColor;
23 | if (min(min(barycentric.x, barycentric.y), barycentric.z) > 0.03) {
24 | mutableVertexColor = PURPLE;
25 | color = mutableVertexColor * length(color) / 2.0;
26 | } else {
27 | color = mutableVertexColor;
28 | }
29 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_solid.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_solid",
8 | "fragment": "rendertype_solid",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_solid.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec3 barycentric;
24 |
25 | void main() {
26 | barycentric = generateBarycentric();
27 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
28 |
29 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
30 | vertexColor = CYAN;
31 |
32 | // color pulse
33 | vertexColor.rgb += (sin(mod((Position.z + Position.x + Position.y) * PI / 8.0 + GameTime * 750, 2 * PI)) + 1.0) * vec3(0.1);
34 | vertexColor.rgb *= length(Color) / 2.0;
35 | texCoord0 = UV0;
36 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
37 | }
38 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_translucent.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 vec4 normal;
16 | in vec3 barycentric;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 | color.a *= 1.3;
23 | //cutout middle of block
24 | if (min(min(barycentric.x, barycentric.y), barycentric.z) > 0.03) {
25 | color.rgb = mix(vertexColor.rgb * length(color.rgb), color.rgb, 0.1);
26 | color.a *= 0.5;
27 | }
28 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
29 | }
30 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_translucent.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_translucent",
8 | "fragment": "rendertype_translucent",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/core/rendertype_translucent.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec3 barycentric;
24 |
25 | void main() {
26 | barycentric = generateBarycentric();
27 | vec3 transformedPos = Position;
28 | vertexColor = MAGENTA;
29 |
30 | //water waves and color pulse
31 | if (abs(mod(Position.y * 16, 16) - 14.2) < 0.05) {
32 | transformedPos.y += sin(mod(Position.x * PI / 8.0 + GameTime * 1500, 2 * PI)) / 16.0;
33 | vertexColor.rgb += (sin(mod(Position.z * PI / 4.0 + GameTime * 1000, 2 * PI)) + 1.0) * vec3(0.1);
34 | }
35 |
36 | gl_Position = ProjMat * ModelViewMat * vec4(transformedPos + ChunkOffset, 1.0);
37 |
38 | vertexDistance = length((ModelViewMat * vec4(transformedPos + ChunkOffset, 1.0)).xyz);
39 | vertexColor.rgb *= length(Color) / 1.5;
40 | texCoord0 = UV0;
41 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42 | }
43 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/include/fog.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define CYAN vec4(0.2, 1.0, 1.0, 1.0)
4 | #define MAGENTA vec4(1.0, 0.2, 1.0, 1.0)
5 | #define PURPLE vec4(0.5, 0.2, 0.5, 1.0)
6 | #define DPURPLE vec4(0.25, 0.0, 0.3, 1.0)
7 |
8 | vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
9 | if (fogStart > 1.0) { // just to look nicer
10 | fogStart /= 10.0;
11 | }
12 | if (vertexDistance <= fogStart) {
13 | return inColor;
14 | }
15 |
16 | float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
17 |
18 | // modified fog color to purple
19 | return vec4(mix(inColor.rgb, PURPLE.rgb * length(fogColor.rgb) / sqrt(3.0), fogValue * fogColor.a), inColor.a);
20 | }
21 |
22 | float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
23 | if (vertexDistance <= fogStart) {
24 | return 1.0;
25 | } else if (vertexDistance >= fogEnd) {
26 | return 0.0;
27 | }
28 |
29 | return smoothstep(fogEnd, fogStart, vertexDistance);
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/include/light.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define MINECRAFT_LIGHT_POWER (0.6)
4 | #define MINECRAFT_AMBIENT_LIGHT (0.4)
5 |
6 | vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) {
7 | lightDir0 = normalize(lightDir0);
8 | lightDir1 = normalize(lightDir1);
9 | float light0 = max(0.0, dot(lightDir0, normal));
10 | float light1 = max(0.0, dot(lightDir1, normal));
11 | float lightAccum = min(1.0, (light0 + light1) * MINECRAFT_LIGHT_POWER + MINECRAFT_AMBIENT_LIGHT);
12 | return vec4(color.rgb * lightAccum, color.a);
13 | }
14 |
15 | vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) {
16 | return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0))); // x is torch, y is sun
17 | }
18 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/include/utils.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define NUMCONTROLS 26
4 | #define THRESH 0.5
5 | #define FPRECISION 4000000.0
6 | #define PROJNEAR 0.05
7 | #define PI 3.1415926538
8 |
9 | #define CYAN vec4(0.2, 1.0, 1.0, 1.0)
10 | #define MAGENTA vec4(1.0, 0.2, 1.0, 1.0)
11 | #define PURPLE vec4(0.5, 0.2, 0.5, 1.0)
12 | #define DPURPLE vec4(0.25, 0.0, 0.3, 1.0)
13 |
14 | int intmod(int i, int base) {
15 | return i - (i / base * base);
16 | }
17 |
18 | vec3 generateBarycentric() {
19 | if (intmod(gl_VertexID, 4) == 0) {
20 | return vec3(1.0, 0.0, 0.0);
21 | }
22 | else if (intmod(gl_VertexID, 4) == 1) {
23 | return vec3(0.0, 0.0, 1.0);
24 | }
25 | else if (intmod(gl_VertexID, 4) == 2) {
26 | return vec3(0.0, 1.0, 0.0);
27 | }
28 | else {
29 | return vec3(0.0, 0.0, 1.0);
30 | }
31 | }
32 |
33 | vec4 generateSpectrum() {
34 | if (intmod(gl_VertexID, 4) == 0) {
35 | return CYAN;
36 | }
37 | else if (intmod(gl_VertexID, 4) == 1) {
38 | return MAGENTA;
39 | }
40 | else if (intmod(gl_VertexID, 4) == 2) {
41 | return CYAN;
42 | }
43 | else {
44 | return MAGENTA;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/post/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | "swap",
4 | "translucent",
5 | "itemEntity",
6 | "particles",
7 | "clouds",
8 | "weather"
9 | ],
10 | "passes": [
11 | {
12 | "name": "transparency",
13 | "intarget": "minecraft:main",
14 | "outtarget": "swap",
15 | "auxtargets": [
16 | {
17 | "name": "DiffuseDepthSampler",
18 | "id": "minecraft:main:depth"
19 | },
20 | {
21 | "name": "TranslucentSampler",
22 | "id": "translucent"
23 | },
24 | {
25 | "name": "TranslucentDepthSampler",
26 | "id": "translucent:depth"
27 | },
28 | {
29 | "name": "ItemEntitySampler",
30 | "id": "itemEntity"
31 | },
32 | {
33 | "name": "ItemEntityDepthSampler",
34 | "id": "itemEntity:depth"
35 | },
36 | {
37 | "name": "ParticlesSampler",
38 | "id": "particles"
39 | },
40 | {
41 | "name": "ParticlesDepthSampler",
42 | "id": "particles:depth"
43 | },
44 | {
45 | "name": "CloudsSampler",
46 | "id": "clouds"
47 | },
48 | {
49 | "name": "CloudsDepthSampler",
50 | "id": "clouds:depth"
51 | },
52 | {
53 | "name": "WeatherSampler",
54 | "id": "weather"
55 | },
56 | {
57 | "name": "WeatherDepthSampler",
58 | "id": "weather:depth"
59 | }
60 | ]
61 | },
62 | {
63 | "name": "bloom",
64 | "intarget": "swap",
65 | "outtarget": "minecraft:main"
66 | }
67 | ]
68 | }
69 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/program/bloom.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "bloom",
8 | "fragment": "bloom",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" }
12 | ],
13 | "uniforms": [
14 | { "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 ] },
15 | { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/shaders/program/bloom.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 float aspectRatio;
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 | aspectRatio = InSize.x / InSize.y;
16 | texCoord = outPos.xy * 0.5 + 0.5;
17 | }
18 |
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/textures/environment/moon_phases.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/vaporwave-solid/assets/minecraft/textures/environment/moon_phases.png
--------------------------------------------------------------------------------
/vaporwave-solid/assets/minecraft/textures/environment/sun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/vaporwave-solid/assets/minecraft/textures/environment/sun.png
--------------------------------------------------------------------------------
/vaporwave-solid/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "V A P O R W A V E"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/position.fsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #moj_import
4 |
5 | uniform vec4 ColorModulator;
6 | uniform float FogStart;
7 | uniform float FogEnd;
8 | uniform vec4 FogColor;
9 | uniform vec2 ScreenSize;
10 |
11 | in mat4 ProjInv;
12 | in float isSky;
13 | in float vertexDistance;
14 |
15 | out vec4 fragColor;
16 |
17 | #define GRIDOFFSET 0.078
18 | #define GRIDDENSITY 10.0
19 |
20 | void main() {
21 | // get player space view vector
22 | vec4 screenPos = gl_FragCoord;
23 | screenPos.xy = (screenPos.xy / ScreenSize - vec2(0.5)) * 2.0;
24 | screenPos.zw = vec2(1.0);
25 | vec3 view = normalize((ProjInv * screenPos).xyz);
26 |
27 | float vdn = dot(view, vec3(0.0, 1.0, 0.0));
28 | float vdt = dot(view, vec3(1.0, 0.0, 0.0));
29 | float vdb = dot(view, vec3(0.0, 0.0, 1.0));
30 |
31 | // custom fog calculation if sky because sky disk is no longer above the head
32 | if (isSky > 0.5) {
33 | float ndusq = clamp(dot(view, vec3(0.0, 1.0, 0.0)), 0.0, 1.0);
34 | ndusq = ndusq * ndusq;
35 |
36 | fragColor = linear_fog(length(ColorModulator.rgb) / sqrt(3.0) * DPURPLE, pow(1.0 - ndusq, 8.0), 0.0, 1.0, FogColor);
37 | }
38 | // default shading for void plane and stars
39 | else {
40 | fragColor = linear_fog(ColorModulator + length(ColorModulator) * CYAN * 0.5, vertexDistance, FogStart, FogEnd, FogColor);
41 | }
42 |
43 | // drawing the grid
44 | if (fract(vdn * GRIDDENSITY + GRIDOFFSET) < 0.015
45 | || fract(vdt * GRIDDENSITY + GRIDOFFSET) < 0.015
46 | || fract(vdb * GRIDDENSITY + GRIDOFFSET) < 0.015) {
47 | fragColor = PURPLE;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/position.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position",
8 | "fragment": "position",
9 | "attributes": [
10 | ],
11 | "samplers": [
12 | ],
13 | "uniforms": [
14 | { "name": "ModelViewMat", "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 ] },
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": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
17 | { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
19 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
20 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
21 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/position.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 |
5 | uniform vec4 ColorModulator;
6 | uniform mat4 ModelViewMat;
7 | uniform mat4 ProjMat;
8 | uniform float FogEnd;
9 |
10 | out mat4 ProjInv;
11 | out float isSky;
12 | out float vertexDistance;
13 |
14 | #define BOTTOM -32.0
15 | #define SCALE 0.01
16 | #define SKYHEIGHT 16.0
17 | #define SKYRADIUS 512.0
18 | #define FUDGE 0.004
19 |
20 | void main() {
21 | vec3 scaledPos = Position;
22 | ProjInv = inverse(ProjMat * ModelViewMat);
23 | isSky = 0.0;
24 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
25 |
26 | // sky disk is by default 16.0 units above with radius of 512.0 around the camera at all times.
27 | if (abs(scaledPos.y - SKYHEIGHT) < FUDGE && (length(scaledPos.xz) <= FUDGE || abs(scaledPos.y - SKYHEIGHT) < FUDGE && abs(length(scaledPos.xz) - SKYRADIUS) < FUDGE)) {
28 | isSky = 1.0;
29 |
30 | // Make sky into a cone by bringing down edges of the disk.
31 | if (length(scaledPos.xz) > 1.0) {
32 | scaledPos.y = BOTTOM;
33 | }
34 |
35 | // Make it big so it does not interfere with void plane.
36 | scaledPos.xyz *= SCALE;
37 |
38 | // rotate to z axis
39 | scaledPos = scaledPos.xzy;
40 | scaledPos.z *= -1;
41 |
42 | // ignore model view so the cone follows the camera angle.
43 | gl_Position = ProjMat * vec4(scaledPos, 1.0);
44 | } else {
45 | gl_Position = ProjMat * ModelViewMat * vec4(scaledPos, 1.0);
46 | }
47 | }
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/position_tex_color_normal.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 vec2 texCoord0;
13 | in float vertexDistance;
14 | in vec4 vertexColor;
15 | in vec4 normal;
16 |
17 | out vec4 fragColor;
18 |
19 | void main() {
20 |
21 | // slightly colored clouds
22 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * length(ColorModulator.rgb) / sqrt(3.0) * CYAN;
23 | if (color.a < 0.1) {
24 | discard;
25 | }
26 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
27 | fragColor.a /= 2.0;
28 | }
29 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/position_tex_color_normal.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "position_tex_color_normal",
8 | "fragment": "position_tex_color_normal",
9 | "attributes": [
10 | "Position",
11 | "UV0",
12 | "Color",
13 | "Normal"
14 | ],
15 | "samplers": [
16 | { "name": "Sampler0" }
17 | ],
18 | "uniforms": [
19 | { "name": "ModelViewMat", "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 ] },
20 | { "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 ] },
21 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
22 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
23 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
24 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/position_tex_color_normal.vsh:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | in vec3 Position;
4 | in vec2 UV0;
5 | in vec4 Color;
6 | in vec3 Normal;
7 |
8 | uniform mat4 ModelViewMat;
9 | uniform mat4 ProjMat;
10 |
11 | out vec2 texCoord0;
12 | out float vertexDistance;
13 | out vec4 vertexColor;
14 | out vec4 normal;
15 |
16 | void main() {
17 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
18 |
19 | texCoord0 = UV0;
20 | vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
21 | vertexColor = Color;
22 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
23 | }
24 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_cutout.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 vec4 normal;
16 |
17 | out vec4 fragColor;
18 |
19 | void main() {
20 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
21 | if (color.a < 0.1) {
22 | discard;
23 | }
24 | fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor);
25 | }
26 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_cutout.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout",
8 | "fragment": "rendertype_cutout",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_cutout.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 |
24 | void main() {
25 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
26 |
27 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
28 | vertexColor = generateSpectrum();
29 | // color pulse
30 | vertexColor.rgb += (sin(mod((Position.z + Position.x + Position.y) * PI / 8.0 + GameTime * 750, 2 * PI)) + 1.0) * vec3(0.1);
31 | vertexColor.rgb *= length(Color) / 2.0;
32 | texCoord0 = UV0;
33 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
34 | }
35 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_cutout_mipped.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 vec4 normal;
16 | in vec3 barycentric;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 | if (color.a < 0.5) {
23 | discard;
24 | }
25 | if (color.a > 0.999 && min(min(barycentric.x, barycentric.y), barycentric.z) > 0.05) {
26 | discard;
27 | }
28 | fragColor = linear_fog(vertexColor, vertexDistance, FogStart, FogEnd, FogColor);
29 | }
30 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_cutout_mipped.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_cutout_mipped",
8 | "fragment": "rendertype_cutout_mipped",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_cutout_mipped.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec3 barycentric;
24 |
25 | void main() {
26 | barycentric = generateBarycentric();
27 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
28 |
29 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
30 | vertexColor = generateSpectrum();
31 | // color pulse
32 | vertexColor.rgb += (sin(mod((Position.z + Position.x + Position.y) * PI / 8.0 + GameTime * 750, 2 * PI)) + 1.0) * vec3(0.1);
33 | vertexColor.rgb *= length(Color) / 2.0;
34 | texCoord0 = UV0;
35 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
36 | }
37 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_solid.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 vec4 normal;
16 | in vec3 barycentric;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | if (min(min(barycentric.x, barycentric.y), barycentric.z) > 0.05) {
22 | discard;
23 | }
24 | vec4 color = vertexColor;
25 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
26 | }
27 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_solid.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_solid",
8 | "fragment": "rendertype_solid",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_solid.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec3 barycentric;
24 |
25 | void main() {
26 | barycentric = generateBarycentric();
27 | gl_Position = ProjMat * ModelViewMat * vec4(Position + ChunkOffset, 1.0);
28 |
29 | vertexDistance = length((ModelViewMat * vec4(Position + ChunkOffset, 1.0)).xyz);
30 | vertexColor = CYAN;
31 |
32 | // color pulse
33 | vertexColor.rgb += (sin(mod((Position.z + Position.x + Position.y) * PI / 8.0 + GameTime * 750, 2 * PI)) + 1.0) * vec3(0.1);
34 | vertexColor.rgb *= length(Color) / 2.0;
35 | texCoord0 = UV0;
36 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
37 | }
38 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_translucent.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 vec4 normal;
16 | in vec3 barycentric;
17 |
18 | out vec4 fragColor;
19 |
20 | void main() {
21 | vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 | color.rgb = vertexColor.rgb;
23 | //cutout middle of block
24 | if (min(min(barycentric.x, barycentric.y), barycentric.z) > 0.05) {
25 | color.a *= 0.5;
26 | }
27 | fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
28 | }
29 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_translucent.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "srcalpha",
5 | "dstrgb": "1-srcalpha"
6 | },
7 | "vertex": "rendertype_translucent",
8 | "fragment": "rendertype_translucent",
9 | "attributes": [
10 | "Position",
11 | "Color",
12 | "UV0",
13 | "UV2",
14 | "Normal"
15 | ],
16 | "samplers": [
17 | { "name": "Sampler0" },
18 | { "name": "Sampler2" }
19 | ],
20 | "uniforms": [
21 | { "name": "ModelViewMat", "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 ] },
22 | { "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 ] },
23 | { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
24 | { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
25 | { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
26 | { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
27 | { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
28 | { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/core/rendertype_translucent.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 | in vec3 Normal;
11 |
12 | uniform sampler2D Sampler2;
13 |
14 | uniform mat4 ModelViewMat;
15 | uniform mat4 ProjMat;
16 | uniform vec3 ChunkOffset;
17 | uniform float GameTime;
18 |
19 | out float vertexDistance;
20 | out vec4 vertexColor;
21 | out vec2 texCoord0;
22 | out vec4 normal;
23 | out vec3 barycentric;
24 |
25 | void main() {
26 | barycentric = generateBarycentric();
27 | vec3 transformedPos = Position;
28 | vertexColor = MAGENTA;
29 |
30 | //water waves and color pulse
31 | if (abs(mod(Position.y * 16, 16) - 14.2) < 0.05) {
32 | transformedPos.y += sin(mod(Position.x * PI / 8.0 + GameTime * 1500, 2 * PI)) / 16.0;
33 | vertexColor.rgb += (sin(mod(Position.z * PI / 4.0 + GameTime * 1000, 2 * PI)) + 1.0) * vec3(0.1);
34 | }
35 |
36 | gl_Position = ProjMat * ModelViewMat * vec4(transformedPos + ChunkOffset, 1.0);
37 |
38 | vertexDistance = length((ModelViewMat * vec4(transformedPos + ChunkOffset, 1.0)).xyz);
39 | vertexColor.rgb *= length(Color) / 1.5;
40 | texCoord0 = UV0;
41 | normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42 | }
43 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/include/fog.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define CYAN vec4(0.2, 1.0, 1.0, 1.0)
4 | #define MAGENTA vec4(1.0, 0.2, 1.0, 1.0)
5 | #define PURPLE vec4(0.5, 0.2, 0.5, 1.0)
6 | #define DPURPLE vec4(0.25, 0.0, 0.3, 1.0)
7 |
8 | vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
9 | if (fogStart > 1.0) { // just to look nicer
10 | fogStart /= 10.0;
11 | }
12 | if (vertexDistance <= fogStart) {
13 | return inColor;
14 | }
15 |
16 | float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
17 |
18 | // modified fog color to purple
19 | return vec4(mix(inColor.rgb, PURPLE.rgb * length(fogColor.rgb) / sqrt(3.0), fogValue * fogColor.a), inColor.a);
20 | }
21 |
22 | float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
23 | if (vertexDistance <= fogStart) {
24 | return 1.0;
25 | } else if (vertexDistance >= fogEnd) {
26 | return 0.0;
27 | }
28 |
29 | return smoothstep(fogEnd, fogStart, vertexDistance);
30 | }
31 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/include/light.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define MINECRAFT_LIGHT_POWER (0.6)
4 | #define MINECRAFT_AMBIENT_LIGHT (0.4)
5 |
6 | vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) {
7 | lightDir0 = normalize(lightDir0);
8 | lightDir1 = normalize(lightDir1);
9 | float light0 = max(0.0, dot(lightDir0, normal));
10 | float light1 = max(0.0, dot(lightDir1, normal));
11 | float lightAccum = min(1.0, (light0 + light1) * MINECRAFT_LIGHT_POWER + MINECRAFT_AMBIENT_LIGHT);
12 | return vec4(color.rgb * lightAccum, color.a);
13 | }
14 |
15 | vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) {
16 | return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0))); // x is torch, y is sun
17 | }
18 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/include/utils.glsl:
--------------------------------------------------------------------------------
1 | #version 150
2 |
3 | #define NUMCONTROLS 26
4 | #define THRESH 0.5
5 | #define FPRECISION 4000000.0
6 | #define PROJNEAR 0.05
7 | #define PI 3.1415926538
8 |
9 | #define CYAN vec4(0.2, 1.0, 1.0, 1.0)
10 | #define MAGENTA vec4(1.0, 0.2, 1.0, 1.0)
11 | #define PURPLE vec4(0.5, 0.2, 0.5, 1.0)
12 | #define DPURPLE vec4(0.25, 0.0, 0.3, 1.0)
13 |
14 | int intmod(int i, int base) {
15 | return i - (i / base * base);
16 | }
17 |
18 | vec3 generateBarycentric() {
19 | if (intmod(gl_VertexID, 4) == 0) {
20 | return vec3(1.0, 0.0, 0.0);
21 | }
22 | else if (intmod(gl_VertexID, 4) == 1) {
23 | return vec3(0.0, 0.0, 1.0);
24 | }
25 | else if (intmod(gl_VertexID, 4) == 2) {
26 | return vec3(0.0, 1.0, 0.0);
27 | }
28 | else {
29 | return vec3(0.0, 0.0, 1.0);
30 | }
31 | }
32 |
33 | vec4 generateSpectrum() {
34 | if (intmod(gl_VertexID, 4) == 0) {
35 | return CYAN;
36 | }
37 | else if (intmod(gl_VertexID, 4) == 1) {
38 | return MAGENTA;
39 | }
40 | else if (intmod(gl_VertexID, 4) == 2) {
41 | return CYAN;
42 | }
43 | else {
44 | return MAGENTA;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/post/transparency.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | "swap",
4 | "translucent",
5 | "itemEntity",
6 | "particles",
7 | "clouds",
8 | "weather"
9 | ],
10 | "passes": [
11 | {
12 | "name": "transparency",
13 | "intarget": "minecraft:main",
14 | "outtarget": "swap",
15 | "auxtargets": [
16 | {
17 | "name": "DiffuseDepthSampler",
18 | "id": "minecraft:main:depth"
19 | },
20 | {
21 | "name": "TranslucentSampler",
22 | "id": "translucent"
23 | },
24 | {
25 | "name": "TranslucentDepthSampler",
26 | "id": "translucent:depth"
27 | },
28 | {
29 | "name": "ItemEntitySampler",
30 | "id": "itemEntity"
31 | },
32 | {
33 | "name": "ItemEntityDepthSampler",
34 | "id": "itemEntity:depth"
35 | },
36 | {
37 | "name": "ParticlesSampler",
38 | "id": "particles"
39 | },
40 | {
41 | "name": "ParticlesDepthSampler",
42 | "id": "particles:depth"
43 | },
44 | {
45 | "name": "CloudsSampler",
46 | "id": "clouds"
47 | },
48 | {
49 | "name": "CloudsDepthSampler",
50 | "id": "clouds:depth"
51 | },
52 | {
53 | "name": "WeatherSampler",
54 | "id": "weather"
55 | },
56 | {
57 | "name": "WeatherDepthSampler",
58 | "id": "weather:depth"
59 | }
60 | ]
61 | },
62 | {
63 | "name": "bloom",
64 | "intarget": "swap",
65 | "outtarget": "minecraft:main"
66 | }
67 | ]
68 | }
69 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/program/bloom.json:
--------------------------------------------------------------------------------
1 | {
2 | "blend": {
3 | "func": "add",
4 | "srcrgb": "one",
5 | "dstrgb": "zero"
6 | },
7 | "vertex": "bloom",
8 | "fragment": "bloom",
9 | "attributes": [ "Position" ],
10 | "samplers": [
11 | { "name": "DiffuseSampler" }
12 | ],
13 | "uniforms": [
14 | { "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 ] },
15 | { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/shaders/program/bloom.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 float aspectRatio;
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 | aspectRatio = InSize.x / InSize.y;
16 | texCoord = outPos.xy * 0.5 + 0.5;
17 | }
18 |
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/textures/environment/moon_phases.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/vaporwave/assets/minecraft/textures/environment/moon_phases.png
--------------------------------------------------------------------------------
/vaporwave/assets/minecraft/textures/environment/sun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bradleyq/shader-toolkit/5c0163e63f918d273d1e9170f96f39bf48158d70/vaporwave/assets/minecraft/textures/environment/sun.png
--------------------------------------------------------------------------------
/vaporwave/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "pack_format": 7,
4 | "description": "V A P O R W A V E"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------