Skip to content

Commit d45e638

Browse files
committed
Reimagined r2.0.3
1 parent 13b5df2 commit d45e638

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

shaders/lib/atmospherics/volumetricLight.glsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ vec4 DistortShadow(vec4 shadowpos, float distortFactor) {
2121
vec4 GetVolumetricLight(inout float vlFactor, vec3 translucentMult, float lViewPos, vec3 nViewPos, float VdotL, float VdotU, vec2 texCoord, float z0, float z1, float dither) {
2222
if (max(blindness, darknessFactor) > 0.1) return vec4(0.0);
2323
vec4 volumetricLight = vec4(0.0);
24+
vec3 vlColorReducer = vec3(1.0);
2425

2526
#ifdef OVERWORLD
2627
vec3 vlColor = lightColor;
@@ -33,10 +34,10 @@ vec4 GetVolumetricLight(inout float vlFactor, vec3 translucentMult, float lViewP
3334
vlMult = 0.6 + 0.4 * max0(far - lViewPos) / far;
3435
vlColor = normalize(pow(vlColor, vec3(1.0 - max0(1.0 - 1.5 * nightFactor))));
3536
vlColor *= 0.0766 + 0.0766 * vsBrightness;
37+
} else {
38+
vlColorReducer = 1.0 / sqrt(vlColor);
3639
}
3740

38-
vec3 vlColorReducer = 1.0 / sqrt(vlColor);
39-
4041
float VdotLM = max((VdotL + 1.0) / 2.0, 0.0);
4142
float VdotUM = mix(pow2(1.0 - max(VdotU, 0.0)), 1.0, 0.5 * vlSceneIntensity);
4243
VdotUM = smoothstep1(VdotUM);

shaders/lib/materials/materialHandling/terrainMaterials.glsl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,23 +1436,24 @@ if (mat < 10512) {
14361436
noSmoothLighting = true;
14371437
lmCoordM.x = 0.77;
14381438

1439-
if (color.r < color.b) { // Lantern:Metal Part
1440-
#include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl"
1441-
} else { // Lantern:Emissive Part
1442-
emission = pow2(color.g) * 5.0 + 1.0;
1439+
#include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl"
14431440

1444-
color.gb *= vec2(0.8, 0.7);
1445-
}
1441+
emission = 3.0 * max0(color.r - color.b);
1442+
emission += min(pow2(pow2(0.75 * dot(color.rgb, color.rgb))), 5.0);
1443+
color.gb *= pow(vec2(0.8, 0.7), vec2(sqrt(emission) * 0.5));
1444+
1445+
#ifdef SNOWY_WORLD
1446+
snowFactor = 0.0;
1447+
#endif
14461448
}
14471449
else /*if (mat == 10564)*/ { // Soul Lantern
14481450
noSmoothLighting = true;
14491451
lmCoordM.x = min(lmCoordM.x, 0.77); // consistency748523
14501452

1451-
if (min1(color.r * 3.0) >= color.g + 0.25) { // Soul Lantern:Metal Part
1452-
#include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl"
1453-
} else { // Soul Lantern:Emissive Part
1454-
emission = color.r * 3.0 + 0.5;
1455-
}
1453+
#include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl"
1454+
1455+
emission = 0.9 * max0(color.g - color.r * 2.0);
1456+
emission += min(pow2(pow2(0.55 * dot(color.rgb, color.rgb))), 3.5);
14561457

14571458
#ifdef SNOWY_WORLD
14581459
snowFactor = 0.0;

shaders/lib/materials/specificMaterials/terrain/lava.glsl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
// Tweak to revent the animation of lava causing brightness pulsing
2-
color.rgb /= (max(GetLuminance(texture2DLod(texture, texCoord, 100.0).rgb) * 2.5, 0.001));
1+
// Tweak to prevent the animation of lava causing brightness pulsing
2+
vec3 avgColor = vec3(0.0);
3+
ivec2 itexCoordC = ivec2(midCoord * atlasSize + 0.0001);
4+
for (int x = -8; x < 8; x += 2) {
5+
for (int y = -8; y < 8; y += 2) {
6+
avgColor += texelFetch(texture, itexCoordC + ivec2(x, y), 0).rgb;
7+
}
8+
}
9+
color.rgb /= (max(GetLuminance(avgColor) * 0.0390625, 0.001));
310

411
#ifdef NETHER
512
vec3 worldPos = playerPos + cameraPosition;

shaders/lib/materials/specificMaterials/translucents/water.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ glColorM = sqrt1(glColorM) * vec3(1.0, 0.85, 0.8);
1717
#endif
1818

1919
#define PHYSICS_OCEAN_INJECTION
20-
#if defined GENERATED_NORMALS && WATER_STYLE >= 3 || defined PHYSICS_OCEAN
20+
#if defined GENERATED_NORMALS && (WATER_STYLE >= 3 || defined PHYSICS_OCEAN)
2121
noGeneratedNormals = true;
2222
#endif
2323

shaders/program/gbuffers_terrain.glsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ in vec2 texCoord;
1414
in vec2 lmCoord;
1515
in vec2 signMidCoordPos;
1616
flat in vec2 absMidCoordPos;
17+
flat in vec2 midCoord;
1718

1819
flat in vec3 upVec, sunVec, northVec, eastVec;
1920
in vec3 normal;
@@ -342,6 +343,7 @@ out vec2 texCoord;
342343
out vec2 lmCoord;
343344
out vec2 signMidCoordPos;
344345
flat out vec2 absMidCoordPos;
346+
flat out vec2 midCoord;
345347

346348
flat out vec3 upVec, sunVec, northVec, eastVec;
347349
out vec3 normal;
@@ -400,7 +402,7 @@ void main() {
400402
northVec = normalize(gbufferModelView[2].xyz);
401403
sunVec = GetSunVector();
402404

403-
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
405+
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
404406
vec2 texMinMidCoord = texCoord - midCoord;
405407
signMidCoordPos = sign(texMinMidCoord);
406408
absMidCoordPos = abs(texMinMidCoord);

0 commit comments

Comments
 (0)