Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Update resource pack to work with the 1.20.5 fog_distance() #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/armor.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ out vec4 normal;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
lightColor = minecraft_sample_lightmap(Sampler2, UV2);
texCoord0 = UV0;
Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/clouds.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

texCoord0 = UV0;
vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
vertexDistance = fog_distance(Position, FogShape);
vertexColor = Color;
normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/end_crystal_beam.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ out vec4 overlayColor;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
lightColor = minecraft_sample_lightmap(Sampler2, UV2);
overlayColor = texelFetch(Sampler1, UV1, 0);
Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/energy_swirl.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ out vec2 texCoord0;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
vertexDistance = fog_distance(Position, FogShape);
vertexColor = Color;
texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/eyes.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ out vec2 texCoord0;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = Color;
texCoord0 = UV0;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/glint_armor.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ out vec2 texCoord0;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
vertexDistance = fog_distance(Position, FogShape);
texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/glint_item.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ out vec2 texCoord0;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/leash.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ out vec4 lightColor;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = Color * ColorModulator * minecraft_sample_lightmap(Sampler2, UV2);
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/lightning.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ out vec4 vertexColor;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = Color;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/lines.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ void main() {
gl_Position = vec4((ndc1 - vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
}

vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
vertexDistance = fog_distance(Position, FogShape);
vertexColor = Color;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/particle.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ out vec2 texCoord0;

void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
vertexDistance = fog_distance(Position, FogShape);
texCoord0 = UV0;
vertexColor = Color;
lightColor = minecraft_sample_lightmap(Sampler2, UV2);
Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/shadow.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ out vec2 texCoord0;

void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = Color;
texCoord0 = UV0;
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/render/text.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ out vec2 texCoord0;

void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = Color;
lightColor = minecraft_sample_lightmap(Sampler2, UV2);
texCoord0 = UV0;
Expand Down
8 changes: 4 additions & 4 deletions assets/minecraft/shaders/include/fog.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
return smoothstep(fogEnd, fogStart, vertexDistance);
}

float fog_distance(mat4 modelViewMat, vec3 pos, int shape) {
float fog_distance(vec3 pos, int shape) {
if (shape == 0) {
return length((modelViewMat * vec4(pos, 1.0)).xyz);
return length(pos);
} else {
float distXZ = length((modelViewMat * vec4(pos.x, 0.0, pos.z, 1.0)).xyz);
float distY = length((modelViewMat * vec4(0.0, pos.y, 0.0, 1.0)).xyz);
float distXZ = length(pos.xz);
float distY = abs(pos.y);
return max(distXZ, distY);
}
}
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/include/render/block.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void main() {
vec3 pos = Position + ChunkOffset;
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);

vertexDistance = fog_distance(ModelViewMat, pos, FogShape);
vertexDistance = fog_distance(pos, FogShape);
vertexColor = Color;
lightColor = minecraft_sample_lightmap(Sampler2, UV2);
texCoord0 = UV0;
Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/include/render/entity.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ out vec4 overlayColor;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
vertexDistance = fog_distance(IViewRotMat * Position, FogShape);
vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
lightColor = minecraft_sample_lightmap(Sampler2, UV2);
#ifdef OVERLAY
Expand Down