Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit ccaa5e4

Browse files
committed
fix clouds and fog for translucent
1 parent 41f2998 commit ccaa5e4

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

assets/minecraft/shaders/core/render/clouds.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ void main() {
2424
color *= vertexColor * ColorModulator * vec4(1,1,1,0.6);
2525
color.rgb = mix(color.rgb, pow(FogColor.rgb, vec3(2)), 0.5 * (1.0 - yval));
2626
if (color.a < 0.1) discard;
27-
fragColor = linear_fog_translucent(color, fogDistance, clamp(FogStart*0.8, 0, 256-64), clamp(FogEnd*1.5, 16, 512-64), FogColor);
27+
fragColor = linear_fog_translucent(color, fogDistance, 24, 32, FogColor);
2828
}

assets/minecraft/shaders/core/render/clouds.vsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void main() {
2727
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
2828

2929
texCoord0 = UV0;
30-
fogDistance = fog_distance(pos, FogShape);
30+
fogDistance = fog_distance(pos, 2);
3131

3232
// try the flatten the cloud shading as much as possible
3333
vec4 col = Color;

assets/minecraft/shaders/core/position_tex_color_normal.json renamed to assets/minecraft/shaders/core/rendertype_clouds.json

File renamed without changes.

assets/minecraft/shaders/include/fog.glsl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ float linear_fog_fade(float fogDistance, float fogStart, float fogEnd) {
3636
}
3737

3838
float fog_distance(vec3 pos, int shape) {
39-
if (shape == 0) {
40-
return length(pos);
41-
} else {
42-
float distXZ = length(pos.xz);
43-
float distY = abs(pos.y);
44-
return max(distXZ, distY);
39+
switch (shape) {
40+
case 0:
41+
return length(pos);
42+
case 1:
43+
float distXZ = length(pos.xz);
44+
float distY = abs(pos.y);
45+
return max(distXZ, distY);
46+
case 2:
47+
return length(pos.xz);
4548
}
4649
}
4750

assets/minecraft/shaders/include/render/block.fsh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ else {
3636
if (color.a < 0.1) discard;
3737
color = color * vertexColor * ColorModulator;
3838
color = emissive(color, lightColor, Distance);
39+
40+
#ifdef TRANSLUCENT
41+
fragColor = linear_fog_translucent(color, fogDistance, FogStart, FogEnd, FogColor);
42+
#else
3943
fragColor = linear_fog(color, fogDistance, FogStart, FogEnd, FogColor);
44+
#endif
4045
}
4146
}

changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
v++
2+
3.3
3+
Shaders:
4+
+Fix clouds shader
5+
+Fix fog for translucent blocks
6+
7+
8+
29
3.2
310
+Update to 1.21
411

0 commit comments

Comments
 (0)