first commit

This commit is contained in:
Leonid Pershin
2026-05-07 21:38:27 +03:00
commit 84fb173ea8
3949 changed files with 564326 additions and 0 deletions
@@ -0,0 +1 @@
#include "/lib/materials/specificMaterials/entities/itemFrame.glsl"
@@ -0,0 +1 @@
noSmoothLighting = true;
@@ -0,0 +1,36 @@
// SpacEagle17's custom skin indicator
#if defined GBUFFERS_ENTITIES || defined GBUFFERS_BLOCK
#define TEXCOORD_FOR_SPACEAGLE17 texCoord
if (CheckForColor(texelFetch(tex, ivec2(0, 0), 0).rgb, vec3(233, 41, 209))) {
#else
#define TEXCOORD_FOR_SPACEAGLE17 quadTexCoord
#endif
vec3 hsv = rgb2hsv(colorP.rgb);
float luminance = GetLuminance(colorP.rgb);
if (TEXCOORD_FOR_SPACEAGLE17.y < 0.25) { // Head
float blinkPhase = mod(frameTimeCounter, 7.0);
float blink = 1.0 - smoothstep(0.08, 0.0, abs(blinkPhase - 0.04));
if (hsv.g > 0.06) { // Eyes
emission = 7 * luminance * blink;
color.rgb = mix(vec3(luminance), color.rgb, 0.85) * blink;
}
}
#ifndef GBUFFERS_BLOCK
else {
if (TEXCOORD_FOR_SPACEAGLE17.x < 0.6 && hsv.g > 0.05) { // Legs
if (hsv.r < 0.6) { // Portal
float powVal = 1.0 + 3.0 * (cos(frameTimeCounter * 1.5) * 0.5 + 0.5);
emission = 0.25 + pow4(luminance) * 4.0 * float(colorP.b > 0.8) + 3.0 * max(pow(hsv.g, powVal), 0.15);
} else { // Lightning
emission = 1.15 + (1.0 - hsv.g) * 1.2 * sin(frameTimeCounter * 2.5 + TEXCOORD_FOR_SPACEAGLE17.y * 6.2831);
}
}
}
#endif
float emissionMask = 1.0 - step(0.001, emission);
smoothnessD = (1.0 - pow2(colorP.g)) * 0.07 * emissionMask;
smoothnessG = smoothnessD;
#if defined GBUFFERS_ENTITIES || defined GBUFFERS_BLOCK
}
#endif
@@ -0,0 +1,140 @@
#define END_PORTAL_VARIATION 0 // [0 1 3] 2 is removed on purpose
// End Portal fix by fayer3#2332 (Modified)
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
int repeat = 4;
#else
int repeat = 8;
#endif
#if END_PORTAL_VARIATION == 0 || END_PORTAL_VARIATION == 1
#if END_PORTAL_VARIATION == 0
vec3[8] colors = vec3[](
vec3(0.3472479, 0.6559956, 0.7387838) * 1.5,
vec3(0.6010780, 0.7153565, 1.060625 ),
vec3(0.4221090, 0.8135094, 0.9026056),
vec3(0.3492291, 1.0241201, 1.8612821),
vec3(0.7543085, 0.8238697, 0.6803233),
vec3(0.4144472, 0.5648165, 0.8037 ),
vec3(0.508905 , 0.6719649, 0.9982805),
vec3(0.5361914, 0.4476583, 0.8008522));
color.rgb = vec3(0.421, 0.7, 1.6) * 0.14;
#else
vec3[3] colors = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0));
color.rgb = vec3(0.4214321, 0.4722309, 1.9922364) * 0.08;
#endif
float dismult = 0.5;
for (int j = 0; j < repeat; j++) {
float add = float(j + dither) * 0.0625 / float(repeat);
for (int i = 1; i <= 8; i++) {
vec2 offset = vec2(0.0, 1.0/(3600.0/24.0)) * pow(16.0 - i, 2.0) * 0.004;
vec2 wind = fract((frameTimeCounter + 984.0) * (i + 8) * 0.125 * offset);
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos * (i * dismult + 1), 1.0)).xyz);
if (abs(NdotU) > 0.9) {
wpos.xz /= wpos.y;
wpos.xz *= 0.06 * sign(- playerPos.y);
wpos.xz *= abs(playerPos.y) + i * dismult + add;
wpos.xz -= cameraPosition.xz * 0.05;
} else {
vec3 absPos = abs(playerPos);
if (abs(dot(normal, eastVec)) > 0.9) {
wpos.xz = wpos.yz / wpos.x;
wpos.xz *= 0.06 * sign(- playerPos.x);
wpos.xz *= abs(playerPos.x) + i * dismult + add;
wpos.xz -= cameraPosition.yz * 0.05;
} else {
wpos.xz = wpos.yx / wpos.z;
wpos.xz *= 0.06 * sign(- playerPos.z);
wpos.xz *= abs(playerPos.z) + i * dismult + add;
wpos.xz -= cameraPosition.yx * 0.05;
}
}
vec2 pos = wpos.xz;
#if END_PORTAL_VARIATION == 0
float colormult = 0.9/(30.0+i);
float rotation = (i - 0.1 * i + 0.71 * i - 11 * i + 21) * 0.01 + i * 0.01;
float Cos = cos(radians(rotation));
float Sin = sin(radians(rotation));
vec2 coord = mat2(Cos, Sin, -Sin, Cos) * pos + wind;
if (mod(float(i), 4) < 1.5) coord = coord.yx + vec2(-1.0, 1.0) * wind.y;
vec3 psample = pow(texture2D(tex, coord).rgb, vec3(0.85)) * colors[i-1] * colormult;
color.rgb += psample * length(psample.rgb) * (3000.0 / repeat);
#else
float noisePortal = texture2DLod(noisetex, pos * 0.5, 0.0).g;
color.rgb += texture2DLod(noisetex, vec2(noisePortal, noisePortal) + wind * 2.0, 0.0).g * colors[i % 3] * 0.1;
#endif
}
}
color.rgb *= vec3(0.09, 0.086, 0.06) * 0.9;
emission = 10.0;
#elif END_PORTAL_VARIATION == 3 // Thanks to WoMspace
float portalEffectSpeed = 3.0;
vec3 roundedCoords = floor((playerPos - vec3(0.001) + cameraPosition) * 16.0); // not perfect yet, portal shifts when moving up or down
float pixelPortalEffect = 0.0;
for (int i = 0; i < 5; i++){
float currentTime = floor(frameTimeCounter * portalEffectSpeed + float(i));
float nextTime = floor(frameTimeCounter * portalEffectSpeed + 1.0 + float(i));
// float currentFrame = hash14(vec4(roundedCoords, floor(worldPos.y * 16.0), currentTime));
float currentFrame = hash13(vec3(roundedCoords + currentTime));
// float nextFrame = hash14(vec4(roundedCoords, floor(worldPos.y * 16.0), nextTime));
float nextFrame = hash13(vec3(roundedCoords + nextTime));
pixelPortalEffect += mix(currentFrame, nextFrame, fract(frameTimeCounter * portalEffectSpeed));
}
pixelPortalEffect /= 5.0;
color.rgb = vec3(0.37, 0.5, 0.8) * pow(pixelPortalEffect, 5.0) * 10.0;
emission = pow(pixelPortalEffect, 5.0) * 2.0;
lmCoordM.x = 0.0;
#endif
noDirectionalShading = true;
#ifdef COATED_TEXTURES
noiseFactor = 0.0;
#endif
#ifdef PORTAL_EDGE_EFFECT
//vec3 voxelPos = SceneToVoxel(mix(playerPos, vec3(0.0), -0.02)); // Fixes weird parallax offset
vec3 voxelPos = SceneToVoxel(playerPos);
if (CheckInsideVoxelVolume(voxelPos)) {
float portalOffset = 0.08333 * dither;
vec3[4] portalOffsets = vec3[](
vec3( portalOffset, 0, portalOffset),
vec3( portalOffset, 0,-portalOffset),
vec3(-portalOffset, 0, portalOffset),
vec3(-portalOffset, 0,-portalOffset)
);
float edge = 0.0;
for (int i = 0; i < 4; i++) {
int voxel = int(GetVoxelVolume(ivec3(voxelPos + portalOffsets[i])));
if (voxel == 58 || voxel == 255) { // End Portal Frame or Bedrock
edge = 1.0; break;
}
}
#ifdef END
// No edge effect in the middle of the return fountain
vec2 var1 = abs(playerPos.xz + cameraPosition.xz - 0.5);
float var2 = max(var1.x, var1.y);
if (var2 > 1.0)
#endif
{
vec4 edgeColor = vec4(vec3(0.18, 0.5, 0.45), 1.0);
#if END_PORTAL_VARIATION == 3
edgeColor = vec4(vec3(0.2431, 0.2588, 0.7294), 1.0);
#endif
color = mix(color, edgeColor, edge);
emission = mix(emission, 5.0, edge);
}
}
#endif
@@ -0,0 +1,9 @@
color = vec4(0.5, 0.55, 0.7, 1.0);
#ifndef GBUFFERS_LIGHTNING
color.rgb *= 2.0;
lmCoordM = vec2(0.0);
shadowMult = vec3(0.0);
emission = 0.5;
#endif
@@ -0,0 +1,15 @@
normalM = upVec;
highlightMult = 0.0;
shadowMult = vec3(0.0);
#if MC_VERSION >= 11700
if (lmCoord.x > 0.99) { // Glowing Sign Text
lmCoordM = vec2(0.0);
emission = 1.0;
color.rgb *= length(color.rgb) + 0.5;
} else // Normal Sign Text
#endif
color.rgb *= 5.0;
@@ -0,0 +1,4 @@
smoothnessG = color.g;
smoothnessD = color.g;
emission = min(max0(dot(color.rgb, color.rgb) - 1.0) * 6.0, 1.0);
@@ -0,0 +1,6 @@
smoothnessG = pow2(pow2(color.r)) * 0.45;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.5;
#endif
@@ -0,0 +1,2 @@
smoothnessG = color.r * 0.3;
smoothnessD = color.r * 0.25;
@@ -0,0 +1,6 @@
smoothnessG = pow2(pow2(color.g)) * 0.55;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,6 @@
smoothnessG = pow2(pow2(color.g)) * 0.5;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,6 @@
smoothnessG = pow2(color.r) * 0.5;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.77;
#endif
@@ -0,0 +1,6 @@
smoothnessG = dot(color.rgb, vec3(0.2));
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,7 @@
smoothnessG = pow2(pow2(pow2(color.g))) * 12.0;
smoothnessG = min1(smoothnessG);
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,3 @@
smoothnessG = pow2(color.r) * 0.5;
smoothnessG = min1(smoothnessG);
smoothnessD = smoothnessG;
@@ -0,0 +1,6 @@
smoothnessG = pow2(dot(color.rgb, color.rgb)) * 0.105;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.77;
#endif
@@ -0,0 +1,6 @@
smoothnessG = pow2(color.g) * 0.22;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,6 @@
smoothnessG = pow2(dot(color.rgb, vec3(0.3)));
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,6 @@
smoothnessG = pow2(color.g) * 0.5;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.77;
#endif
@@ -0,0 +1,5 @@
materialMask = OSIEBCA; // Intense Fresnel
float factor = pow2(color.r);
smoothnessG = 0.8 - factor * 0.3;
highlightMult = factor * 3.0;
smoothnessD = factor;
@@ -0,0 +1,6 @@
smoothnessG = color.r;
smoothnessD = color.r;
#ifdef COATED_TEXTURES
noiseFactor = 0.33;
#endif
@@ -0,0 +1,17 @@
float epsilon = 0.00001;
vec2 absMidCoordPosM = absMidCoordPos - epsilon;
vec3 avgBorderColor = vec3(0.0);
avgBorderColor += texture2D(tex, midCoord + vec2( absMidCoordPosM.x, absMidCoordPosM.y)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2(-absMidCoordPosM.x, absMidCoordPosM.y)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2( absMidCoordPosM.x,-absMidCoordPosM.y)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2(-absMidCoordPosM.x,-absMidCoordPosM.y)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2(epsilon, absMidCoordPosM.y)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2(epsilon,-absMidCoordPosM.y)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2( absMidCoordPosM.x, epsilon)).rgb;
avgBorderColor += texture2D(tex, midCoord + vec2(-absMidCoordPosM.x, epsilon)).rgb;
avgBorderColor *= 0.125;
vec3 colorDif = abs(avgBorderColor - color.rgb);
emission = max(colorDif.r, max(colorDif.g, colorDif.b));
emission = pow2(emission * 2.5 - 0.15);
@@ -0,0 +1,2 @@
smoothnessG = color.r;
smoothnessD = color.r * 0.65;
@@ -0,0 +1,8 @@
noSmoothLighting = true;
color.rgb *= 1.0 + 0.7 * pow2(max(-signMidCoordPos.y + 0.6, float(NdotU > 0.9) * 1.6));
#ifdef SNOWY_WORLD
snowFactor = 0.0;
#endif
overlayNoiseIntensity = 0.3;
@@ -0,0 +1,3 @@
smoothnessG = dot(color.rgb, color.rgb) * 0.17;
smoothnessD = smoothnessG;
smoothnessG = max(smoothnessG, 0.3 * color.g * float(color.g > color.b * 1.5));
@@ -0,0 +1,10 @@
materialMask = OSIEBCA * 2.0; // Copper Fresnel
smoothnessG = pow2(pow2(color.r)) + pow2(max0(color.g - color.r * 0.5)) * 0.3;
smoothnessG = min1(smoothnessG);
smoothnessD = smoothnessG;
color.rgb *= min1(0.6 + 0.7 * GetLuminance(color.rgb));
#ifdef COATED_TEXTURES
noiseFactor = 0.5;
#endif
@@ -0,0 +1,20 @@
noSmoothLighting = true, overlayNoiseIntensity = 0.5;
vec3 hsvColor = rgb2hsv(color.rgb);
if (abs(hsvColor.r - 0.09722) < 0.04305 && hsvColor.b > 0.7) { // Active Light Part
smoothnessG = 0.75;
smoothnessD = 0.35;
float blockRes = absMidCoordPos.x * atlasSize.x;
vec2 signMidCoordPosM = (floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0;
float dotsignMidCoordPos = dot(signMidCoordPosM, signMidCoordPosM);
float lBlockPosM = pow2(max0(1.0 - 1.7 * pow2(pow2(dotsignMidCoordPos))));
emission = pow2(lmCoordM.x) + 0.3 * color.r;
emission *= (0.7 + 2.0 * pow2(lBlockPosM));
} else if (color.r > 2.5 * (color.g + color.b)) { // Middle Redstone Part
emission = 4.0;
color.rgb *= color.rgb;
} else { // Copper Base
#include "/lib/materials/specificMaterials/terrain/copperBlock.glsl"
}
@@ -0,0 +1,7 @@
float lColor = length(color.rgb);
smoothnessG = lColor * 0.2;
smoothnessD = lColor * 0.15;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,19 @@
#include "/lib/materials/specificMaterials/terrain/obsidian.glsl"
highlightMult *= 0.5;
float factor0 = sqrt2(max0(color.b - color.g * 6.0));
float factor1 = pow2(color.b);
emission = 1.35 + pow2(pow2(factor1)) * 7.5;
emission *= factor0;
color.r *= 1.15;
maRecolor = vec3(factor0 * min(max0(factor1 * 0.7 - 0.1) * 1.3, 0.5));
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
float luminance = GetLuminance(color.rgb);
color.rgb = mix(color.rgb, vec3(luminance), 0.88);
color.rgb = normalize(netherColor) * luminance * 2.0;
#endif
overlayNoiseIntensity = 0.65;
overlayNoiseEmission = 0.6;
@@ -0,0 +1,5 @@
smoothnessG = pow(color.g, 1.5) * 0.55;
smoothnessG = smoothnessG;
smoothnessD = smoothnessG;
materialMask = OSIEBCA; // Intense Fresnel
@@ -0,0 +1,25 @@
materialMask = OSIEBCA; // Intense Fresnel
float factor = max(color.g, 0.8);
float factor2 = pow2(factor);
#ifdef GBUFFERS_TERRAIN
float factor4 = pow2(factor2);
#else
float factor4 = factor2;
#endif
smoothnessG = factor - pow2(pow2(color.g)) * 0.4;
highlightMult = 3.0 * max(pow2(factor4), 0.2);
smoothnessD = factor4 * 0.75;
#if MC_VERSION < 11300
highlightMult *= 2.0;
smoothnessD /= 0.75;
#endif
color.rgb *= 0.7 + 0.4 * GetLuminance(color.rgb);
#ifdef COATED_TEXTURES
noiseFactor = 0.5;
#endif
@@ -0,0 +1 @@
smoothnessG = color.r * 0.1 + 0.1;
@@ -0,0 +1,14 @@
materialMask = OSIEBCA; // Intense Fresnel
float factor = pow2(sqrt2(GetLuminance(color.rgb)));
float factor2 = pow2(factor);
float factor4 = pow2(factor2);
smoothnessG = factor - factor4 * 0.4;
highlightMult = 3.0 * factor4;
smoothnessD = factor4 * 0.75;
#ifdef COATED_TEXTURES
noiseFactor = 0.5;
#endif
@@ -0,0 +1,3 @@
// End Portal Frame:Green Parts
smoothnessG = 0.25;
smoothnessD = 0.45;
@@ -0,0 +1,34 @@
//#define OBSIDIAN_ENDSTONE
#ifdef OBSIDIAN_ENDSTONE
#ifdef GBUFFERS_TERRAIN
vec3 worldPos = cameraPosition + playerPos;
color.rgb *= mix(vec3(0.1686, 0.1216, 0.302), vec3(0.0, 0.0, 0.0), float(hash33(floor(mod(worldPos, vec3(100.0)) * 16 + 0.01) * 16)) * 0.5);
if (color.r < 0.18) color.rgb *= vec3(0.3843, 0.3294, 0.5176);
if (color.r < 0.05) color.rgb *= 0.2;
#else
color.rgb *= vec3(0.0941, 0.0314, 0.149);
#endif
materialMask = OSIEBCA; // Intense Fresnel
float factor = max0(0.3 - abs(color.r - 0.3)) * 1.5;
smoothnessG = factor;
highlightMult = 2.0 + min1(smoothnessG * 2.0) * 1.5;
smoothnessG = min1(smoothnessG);
smoothnessD = min1(factor + 0.07);
#ifdef COATED_TEXTURES
noiseFactor = 1.25;
#endif
#else
float factor = pow2(pow2(color.r));
smoothnessG = factor * 0.65;
smoothnessD = smoothnessG * 0.6;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
#endif
@@ -0,0 +1,23 @@
noSmoothLighting = true; noDirectionalShading = true;
lmCoordM = vec2(1.0, 0.0);
#ifndef IPBR_COMPAT_MODE
#ifndef DURING_WORLDSPACE_REF
float blockRes = absMidCoordPos.x * atlasSize.x;
vec2 signMidCoordPosM = abs((floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0);
#else
vec2 signMidCoordPosM = signMidCoordPos;
#endif
float value = 1.0 - max(signMidCoordPosM.x, signMidCoordPosM.y);
#else
float value = 0.3;
#endif
color.rgb = pow(color.rgb, vec3(FROGLIGHT_SATURATION));
emission = 0.3 + value + pow(dot(color.rgb, color.rgb) * 0.33, frogPow);
emission *= 1.7;
#ifdef DISTANT_LIGHT_BOKEH
DoDistantLightBokehMaterial(emission, 2.0, lViewPos);
#endif
color.rgb = pow2(color.rgb);
@@ -0,0 +1,20 @@
materialMask = OSIEBCA * 3.0; // Gold Fresnel
#ifdef GBUFFERS_TERRAIN
float colorG2 = pow2(color.g);
#else
float colorG2 = color.g;
#endif
float colorG4 = pow2(colorG2);
float factor = max(color.g, 0.8);
smoothnessG = min1(factor - colorG4 * 0.5);
highlightMult = 3.5 * max(colorG4, 0.2);
smoothnessD = colorG4;
color.rgb *= 0.5 + 0.4 * GetLuminance(color.rgb);
#ifdef COATED_TEXTURES
noiseFactor = 0.33;
#endif
@@ -0,0 +1,14 @@
#ifdef GBUFFERS_TERRAIN
smoothnessG = pow2(pow2(color.r));
#else
smoothnessG = pow2(color.r);
#endif
highlightMult = smoothnessG * 3.0;
smoothnessD = smoothnessG;
materialMask = OSIEBCA; // Intense Fresnel
color.rgb *= 0.6 + 0.5 * GetLuminance(color.rgb);
#ifdef COATED_TEXTURES
noiseFactor = 0.33;
#endif
@@ -0,0 +1,6 @@
smoothnessG = color.b;
smoothnessD = color.b;
#ifdef COATED_TEXTURES
noiseFactor = 0.66;
#endif
@@ -0,0 +1,6 @@
smoothnessG = pow2(color.b) * 0.8;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.5;
#endif
@@ -0,0 +1,62 @@
#if !defined IPBR_COMPAT_MODE && defined GBUFFERS_TERRAIN && !defined GBUFFERS_COLORWHEEL
// Tweak to prevent the animation of lava causing brightness pulsing
vec3 avgColor = vec3(0.0);
ivec2 itexCoordC = ivec2(midCoord * atlasSize + 0.0001);
for (int x = -8; x < 8; x += 2) {
for (int y = -8; y < 8; y += 2) {
avgColor += texelFetch(tex, itexCoordC + ivec2(x, y), 0).rgb;
}
}
color.rgb /= max(GetLuminance(avgColor) * 0.0390625, 0.001);
#else
color.rgb *= 0.86;
#endif
noDirectionalShading = true;
lmCoordM = vec2(0.0);
emission = GetLuminance(color.rgb) * 7.48 + 0.5;
vec3 worldPos = playerPos + cameraPosition;
vec2 lavaPos = (floor(worldPos.xz * 16.0) + worldPos.y * 32.0) * 0.000666;
vec2 wind = vec2(frameTimeCounter * 0.012, 0.0);
#ifdef NETHER
float noiseSample = texture2DLod(noisetex, lavaPos + wind, 0.0).g;
noiseSample = noiseSample - 0.5;
noiseSample *= 0.1;
color.rgb = pow(color.rgb, vec3(1.0 + noiseSample));
#endif
vec3 previousLavaColor = color.rgb;
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
color.rgb = mix(color.rgb, (color.rgb - 0.5) * 1.35 + 0.5, inSoulValley); // increase contrast
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 2.5, colorEndBreath * 1.4, 1.0);
color.rgb = (color.rgb - 0.5) * 1.3 + 0.5;
#endif
vec3 lavaNoiseColor = color.rgb;
#if LAVA_VARIATION > 0
if (BLOCK_LAVA_DEFINE) { // Lava
#include "/lib/materials/specificMaterials/terrain/lavaNoise.glsl"
color.rgb = lavaNoiseColor;
}
#else
maRecolor = vec3(clamp(pow2(pow2(pow2(smoothstep1(emission * 0.28)))), 0.12, 0.4) * 1.3) * vec3(0.25, vec2(0.175));
if (LAVA_TEMPERATURE != 0.0) maRecolor += LAVA_TEMPERATURE * 0.5 - 0.2;
lavaNoiseColor *= 1.3;
#endif
vec3 maxLavaColor = max(previousLavaColor, lavaNoiseColor);
vec3 minLavaColor = min(previousLavaColor, lavaNoiseColor);
#if RAIN_PUDDLES >= 1
noPuddles = 1.0;
#endif
#include "/lib/materials/specificMaterials/terrain/lavaEdge.glsl"
emission *= LAVA_EMISSION;
@@ -0,0 +1,62 @@
#if LAVA_EDGE_EFFECT > 0 && defined GBUFFERS_TERRAIN && !defined WORLD_CURVATURE
if (mat == 10068){
vec3 voxelPos = SceneToVoxel(playerPos);
if (CheckInsideVoxelVolume(voxelPos)) {
mat2 isSurroundingLava = mat2(0,0,0,0); // Thanks to gri for the help!
ivec3 coordsLava = ivec3(floor(vec3(voxelPos)));
ivec3 coords = ivec3(floor(vec3(voxelPos.x - 0.5, voxelPos.y - 0.3, voxelPos.z - 0.5))); // shift coords to the center of the block
uint lavaVoxel = texelFetch(voxel_sampler, ivec3(coordsLava + ivec3(0, 1, 0)), 0).r; // coords for block above
if (lavaVoxel != uint(13)){ // check if the above block is not lava, to only have the edge effect on the top most lava layer
for (int i = 0; i < 2; i++){ // check if the surrounding blocks are lava or not, 1 at the center of a non-lava block, 0 at the center of a lava block
for ( int j = 0; j < 2; j++){
uint voxel = texelFetch(voxel_sampler, ivec3(coords + ivec3(i, 0, j)), 0).r;
isSurroundingLava[i][j] = voxel != uint(13) ? 1 : 0;
}
}
}
float edge = mix(
mix(isSurroundingLava[0][0],
isSurroundingLava[0][1],
fract(voxelPos.z + 0.5)),
mix(isSurroundingLava[1][0],
isSurroundingLava[1][1],
fract(voxelPos.z + 0.5)),
fract(voxelPos.x + 0.5)
);
float easeAmount = 1.5;
vec3 edgeColor = maxLavaColor;
#if LAVA_EDGE_EFFECT == 2
easeAmount = 1.3;
edgeColor = minLavaColor;
#endif
edge = 1.0 - cos((edge * pi) / easeAmount); // ease in towards the centre of the block to create a better shape
edge *= clamp01(blockUV.y - 0.3) * 10/7; // Gradient towards the bottom, so 0.3 is now 0
edgeColor = mix(vec3(0.4, 0.2, 0.1), edgeColor, 0.9); // make the color vary depending on the lava noise
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
edgeColor = changeColorFunction(edgeColor, 3.0, colorSoul, inSoulValley);
#elif defined PURPLE_END_FIRE_INTERNAL
edgeColor = changeColorFunction(sqrt1(edgeColor), 4.0, colorEndBreath, 1.0);
#endif
edgeColor *= 3.0;
float edgeEmission = 1.3 + emission * 1.1;
#if LAVA_EDGE_EFFECT == 2
edgeColor *= 0.1;
edgeEmission = 0.5;
#endif
vec3 absPlayerPos = abs(playerPos);
float maxPlayerPos = max(absPlayerPos.x, max(absPlayerPos.y * 2.0, absPlayerPos.z));
float edgeDecider = pow2(min1(maxPlayerPos / min(effectiveACTdistance, far) * 2.0)); // this is to make the effect fade at the edge of ACT range
color.rgb = mix(color.rgb, edgeColor, edge * (1.0 - edgeDecider));
emission = mix(emission, min(edgeEmission, 3.5), edge * (1.0 - edgeDecider));
}
}
#endif
@@ -0,0 +1,86 @@
#if defined GBUFFERS_TERRAIN || defined DH_TERRAIN
float noise = -1.0 * LAVA_NOISE_AMOUNT;
float lavaNoiseEmission = emission;
float dhLavaSides = 0.0;
#ifdef DH_TERRAIN
dhLavaSides = 1.0 - clamp01(dot(worldGeoNormal, ViewToPlayer(upVec)));
#endif
if (mat == 10070
#ifdef DH_TERRAIN
|| dhLavaSides > 0.5 // vertical lava columns
#endif
) { // Flowing Lava
lavaPos += wind.x * 0.75;
}
#if LAVA_VARIATION == 1 // Adaptive Noise
lavaNoiseColor += min(pow2(pow2(lavaNoiseEmission * 0.50)), 0.2) * LAVA_TEMPERATURE * 0.65 + 0.1;
#ifdef NETHER
#ifdef DH_TERRAIN
if ((worldPos.y > 30 && worldPos.y < 32.3 || (worldPos.y > 35 && worldPos.y < 37.3) && dhLavaSides < 0.5) && BLOCK_LAVA_STILL_DEFINE) { // lava lakes in the nether
#else
if ((worldPos.y > 30 && worldPos.y < 32.3 || (worldPos.y > 35 && worldPos.y < 37.3)) && BLOCK_LAVA_STILL_DEFINE) {
#endif
noise += texture2DLod(noisetex, lavaPos * 0.3 + wind * 0.1, 0.0).r;
noise -= texture2DLod(noisetex, lavaPos * 10.1 + wind * 0.05, 0.0).g * 0.3;
noise += texture2DLod(noisetex, lavaPos * 0.9 + wind * 0.04, 0.0).r * 0.5;
noise *= texture2DLod(noisetex, lavaPos * 0.1 + wind * 0.02, 0.0).r * 0.5;
lavaNoiseEmission *= 1.6;
lavaNoiseColor *= smoothstep(0.00, 0.40, noise);
lavaNoiseColor.r *= 1.2;
} else {
noise += texture2DLod(noisetex, lavaPos * 2.5 + wind * 0.01, 0.0).g;
noise -= texture2DLod(noisetex, lavaPos * 10.1 + wind * 0.05, 0.0).g * 0.3;
noise += texture2DLod(noisetex, lavaPos * 2.1, 0.0).g * 0.3;
lavaNoiseColor *= smoothstep(0.0, 0.90, noise);
lavaNoiseColor.r *= 1.25;
lavaNoiseEmission *= 1.1;
}
#else
if (worldPos.y > -56 && worldPos.y < -53.7 && BLOCK_LAVA_STILL_DEFINE) { // lava lakes in the Overworld, End not affected because no negative coords
noise += texture2DLod(noisetex, lavaPos * 0.2 + wind * 0.1, 0.0).r;
noise += texture2DLod(noisetex, lavaPos * 0.8 + wind * 0.04, 0.0).r * 0.5;
noise *= texture2DLod(noisetex, lavaPos * 0.1 + wind * 0.02, 0.0).r * 0.5;
lavaNoiseEmission *= 1.6;
lavaNoiseColor *= smoothstep(0.00, 0.45, noise);
lavaNoiseColor.r *= 1.2;
} else {
noise += texture2DLod(noisetex, lavaPos * 2.5 + wind * 0.01, 0.0).g;
noise -= texture2DLod(noisetex, lavaPos * 10.1 + wind * 0.05, 0.0).g * 0.3;
noise += texture2DLod(noisetex, lavaPos * 2.1, 0.0).g * 0.3;
lavaNoiseColor *= smoothstep(0.0, 0.90, noise);
lavaNoiseIntensity *= 0.5;
lavaNoiseColor.r *= 1.25;
lavaNoiseEmission *= 1.1;
}
#endif
#elif LAVA_VARIATION == 2 // Blushing Hotness
noise += texture2DLod(noisetex, lavaPos * 0.05 + wind * 0.1, 0.0).r;
lavaNoiseColor -= vec3(0.03) * noise * 8.0;
lavaNoiseColor += min(pow2(pow2(lavaNoiseEmission * 0.50)), 0.2) * LAVA_TEMPERATURE * 0.65 - 0.05;
#elif LAVA_VARIATION == 3 // Molten Cheese
lavaNoiseColor += vec3(min(pow2(pow2(pow2(smoothstep1(lavaNoiseEmission * 0.5)))), 0.25)) * LAVA_TEMPERATURE * 0.65 + 0.1;
noise += texture2DLod(noisetex, lavaPos * 0.01 + wind * 0.01, 0.0).g;
noise -= texture2DLod(noisetex, lavaPos * 2.0 + wind * 0.05, 0.0).g * 0.3;
noise += texture2DLod(noisetex, lavaPos * 0.1, 0.0).g * 0.3;
lavaNoiseColor *= smoothstep(0.00, 0.70, noise);
#elif LAVA_VARIATION == 4 // Dark Islands
lavaNoiseColor += vec3(min(pow2(pow2(pow2(smoothstep1(lavaNoiseEmission * 0.5)))), 0.25)) * LAVA_TEMPERATURE * 0.65 + 0.1;
noise += texture2DLod(noisetex, lavaPos * 0.01 + wind * 0.01, 0.0).r;
noise -= texture2DLod(noisetex, lavaPos * 1.1 + wind * 0.05, 0.0).r * 0.3;
noise += texture2DLod(noisetex, lavaPos * 0.1, 0.0).r * 0.7;
lavaNoiseColor *= smoothstep(0.00, 0.70, noise);
#elif LAVA_VARIATION == 5 // Chaotic Flow
lavaNoiseColor += min(pow2(pow2(lavaNoiseEmission * 0.50)), 0.2) * LAVA_TEMPERATURE * 0.65 + 0.1;
noise += texture2DLod(noisetex, lavaPos * 1.0 + wind * 0.01, 0.0).g;
noise -= texture2DLod(noisetex, lavaPos * 10.1 + wind * 0.05, 0.0).g * 0.3;
noise += texture2DLod(noisetex, lavaPos * 2.1, 0.0).g * 0.3;
lavaNoiseColor *= smoothstep(0.5, 0.70, noise);
lavaNoiseColor.r *= 1.25;
lavaNoiseEmission *= 1.1;
#endif
lavaNoiseColor = max(vec3(0.01), lavaNoiseColor); // prevent going too dark
lavaNoiseColor = mix(color.rgb, lavaNoiseColor, lavaNoiseIntensity);
emission = mix(emission, lavaNoiseEmission, lavaNoiseIntensity);
#endif
@@ -0,0 +1,31 @@
subsurfaceMode = 2, isFoliage = true;
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
#ifdef GBUFFERS_TERRAIN
materialMask = OSIEBCA * 253.0; // Reduced Edge TAA
#ifdef COATED_TEXTURES
doTileRandomisation = false;
#endif
#endif
#ifdef IPBR
float factor = min1(pow2(color.g - 0.15 * (color.r + color.b)) * 2.5);
smoothnessG = factor * 0.4;
highlightMult = factor * 4.0 + 2.0;
#ifdef GBUFFERS_TERRAIN
float fresnel = clamp(1.0 + dot(normalM, normalize(viewPos)), 0.0, 1.0);
highlightMult *= 1.0 - pow2(pow2(fresnel));
#else
highlightMult *= 0.5;
#endif
#endif
#ifdef SNOWY_WORLD
snowMinNdotU = min(pow2(pow2(color.g)), 0.1);
color.rgb = color.rgb * 0.5 + 0.5 * (color.rgb / glColor.rgb);
#endif
#if SHADOW_QUALITY > -1 && SHADOW_QUALITY < 3 && defined OVERWORLD
shadowMult = vec3(sqrt1(max0(max(lmCoordM.y, min1(lmCoordM.x * 2.0)) - 0.95) * 20.0));
#endif
@@ -0,0 +1,8 @@
smoothnessG = pow2(color.r * 2.0);
smoothnessG = min1(smoothnessG);
highlightMult = smoothnessG * 2.0;
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.33;
#endif
@@ -0,0 +1,7 @@
#if MC_VERSION >= 11300
smoothnessG = pow2(color.r) * 1.5;
smoothnessG = min1(smoothnessG);
#else
smoothnessG = color.r * 0.4 + 0.2;
#endif
smoothnessD = smoothnessG;
@@ -0,0 +1,3 @@
smoothnessG = pow2(pow2(color.g)) * 2.5;
smoothnessG = min1(smoothnessG);
smoothnessD = smoothnessG;
@@ -0,0 +1,13 @@
materialMask = OSIEBCA; // Intense Fresnel
float factor = max0(0.3 - abs(color.r - 0.3)) * 1.5;
smoothnessG = factor;
highlightMult = 2.0 + min1(smoothnessG * 2.0) * 1.5;
smoothnessG = min1(smoothnessG);
smoothnessD = min1(factor + 0.07);
#ifdef COATED_TEXTURES
noiseFactor = 1.25;
#endif
@@ -0,0 +1,15 @@
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true;
#ifdef GBUFFERS_TERRAIN
DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, viewPos, nViewPos, lViewPos, dither);
#ifdef COATED_TEXTURES
doTileRandomisation = false;
#endif
#endif
if (color.r > 0.7 && color.r > color.g * 1.2 && color.g > color.b * 2.0) { // Emissive Part
lmCoordM.x = 0.5;
emission = 5.0 * color.g;
color.rgb *= color.rgb;
}
@@ -0,0 +1,2 @@
smoothnessD = pow2(color.g) * 0.7;
smoothnessG = smoothnessD;
@@ -0,0 +1 @@
smoothnessG = color.g * 0.25;
@@ -0,0 +1,19 @@
materialMask = OSIEBCA; // Intense Fresnel
float factor = color.g;
float factor2 = pow2(factor);
float factor4 = pow2(factor2);
float factor8 = pow2(factor4);
smoothnessG = factor - factor8 * 0.5;
highlightMult = 3.5 * factor8;
smoothnessD = factor8;
#ifdef GBUFFERS_TERRAIN
DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult);
#endif
#ifdef COATED_TEXTURES
noiseFactor = 0.5;
#endif
@@ -0,0 +1,4 @@
materialMask = OSIEBCA * 2.0; // Copper Fresnel
smoothnessG = pow2(color.r + color.g * 0.25) * 0.4;
smoothnessG = min1(smoothnessG);
smoothnessD = min1(smoothnessG * smoothnessG * 2.0);
@@ -0,0 +1,3 @@
materialMask = OSIEBCA * 3.0; // Gold Fresnel
smoothnessG = pow2(pow2(color.g));
smoothnessD = 0.5 * (smoothnessG + color.b);
@@ -0,0 +1,3 @@
materialMask = OSIEBCA; // Intense Fresnel
smoothnessG = pow2(pow2(color.r)) * 0.7;
smoothnessD = smoothnessG * 0.6;
@@ -0,0 +1,11 @@
materialMask = OSIEBCA * 5.0; // Redstone Fresnel
float factor = pow2(color.r);
smoothnessG = 0.4;
highlightMult = factor + 0.2;
smoothnessD = factor * 0.5 + 0.1;
#ifdef COATED_TEXTURES
noiseFactor = 0.77;
#endif
@@ -0,0 +1,16 @@
if (color.r > 0.65 && abs(color.g - color.b) < 0.1) {
emission = (3.5 - 2.25 * color.g) * 0.97;
color.rgb *= color.rgb;
#if MC_VERSION >= 12102 // redstone torch model got changed in 1.21.2
color.gb = max(color.gb * vec2(0.75, 0.5), pow2(color.gb));
#endif
} else if (color.r > color.g * 2.0) {
materialMask = OSIEBCA * 5.0; // Redstone Fresnel
float factor = pow2(color.r);
smoothnessG = 0.4;
highlightMult = factor + 0.4;
smoothnessD = factor * 0.7 + 0.3;
}
@@ -0,0 +1,17 @@
smoothnessG = (1.0 - pow(color.g, 64.0) * 0.3) * 0.4;
highlightMult = 2.0;
smoothnessD = smoothnessG;
#ifdef GBUFFERS_TERRAIN
DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult);
#endif
#if RAIN_PUDDLES >= 1
noPuddles = 1.0;
#endif
#ifdef SSS_SNOW_ICE
subsurfaceMode = 3, noSmoothLighting = true, noDirectionalShading = true;
color.rgb *= mix(vec3(1), vec3(0.76, 0.8, 0.84), sunVisibility);
#endif
@@ -0,0 +1,7 @@
smoothnessG = pow2(pow2(color.g)) * 2.0;
smoothnessG = min1(smoothnessG);
smoothnessD = smoothnessG;
#ifdef COATED_TEXTURES
noiseFactor = 0.77;
#endif
@@ -0,0 +1,19 @@
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true;
#ifdef GBUFFERS_TERRAIN
DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, viewPos, nViewPos, lViewPos, dither);
#ifdef COATED_TEXTURES
doTileRandomisation = false;
#endif
#endif
#if defined GBUFFERS_TERRAIN && !defined IPBR_COMPAT_MODE
emission = (1.0 - abs(signMidCoordPos.x)) * max0(0.7 - abs(signMidCoordPos.y + 0.7));
emission = pow1_5(emission) * 2.5;
#else
if (color.r + color.g > color.b + 1.1) emission = 0.8;
else if (color.r > color.g + color.b) emission = 0.2;
#endif
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
@@ -0,0 +1,24 @@
if (min(color.a, texture2DLod(tex, texCoord, 0).a) > 0.001) {
smoothnessG = 1.0;
highlightMult = 3.5;
reflectMult = 0.5;
translucentMultCalculated = true;
translucentMult = vec4(0.0, 0.0, 0.0, 1.0);
}
#ifdef FANCY_GLASS
else {
smoothnessG = 0.5;
highlightMult = 2.5;
reflectMult = 1.0;
color.rgb = vec3(0.75, 0.8, 0.85);
translucentMultCalculated = true;
translucentMult.a = 0.0;
color.a = max(color.a, GLASS_OPACITY);
DoTranslucentTweaks(color, fresnelM, reflectMult, lViewPos);
}
#endif
@@ -0,0 +1,133 @@
#define NETHER_PORTAL_VARIATION 1 //[1 2]
//#define NETHER_PORTAL_NOISE
#if NETHER_PORTAL_VARIATION == 1
lmCoordM = vec2(0.0);
color = vec4(0.0);
int sampleCount = 8;
float multiplier = 0.4 / (-viewVector.z * sampleCount);
vec2 interval = viewVector.xy * multiplier;
vec2 coord = signMidCoordPos * 0.5 + 0.5;
vec2 absMidCoordPos2 = absMidCoordPos * 2.0;
vec2 midCoord = texCoord - absMidCoordPos * signMidCoordPos;
vec2 minimumMidCoordPos = midCoord - absMidCoordPos;
for (int i = 0; i < sampleCount; i++) {
float portalStep = (i + dither) / sampleCount;
coord += interval * portalStep;
vec2 sampleCoord = fract(coord) * absMidCoordPos2 + minimumMidCoordPos;
vec4 psample = texture2DLod(tex, sampleCoord, 0);
float factor = 1.0 - portalStep;
psample *= pow(factor, 0.1);
emission = max(emission, psample.r);
color += psample;
}
color /= sampleCount;
color.rgb *= color.rgb * vec3(1.25, 1.0, 0.65);
color.a = sqrt1(color.a) * 0.8;
emission *= emission;
emission *= emission;
emission *= emission;
emission = clamp(emission * 120.0, 0.03, 1.2) * 8.0;
#else
#ifdef GENERATED_NORMALS
noGeneratedNormals = true;
#endif
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos * 1000.0, 1.0)).xyz);
wpos.xz /= wpos.y;
vec2 wind = vec2(0.0, frameTimeCounter * 0.03);
float noise = texture2DLod(noisetex, wpos.xz * 0.20 + wind * 0.2, 0.0).r * 0.01;
noise+= texture2DLod(noisetex, wpos.xz * 0.15 + wind * 0.15, 0.0).r * 0.02;
noise+= texture2DLod(noisetex, wpos.xz * 0.10 + wind * 0.10, 0.0).r * 0.06;
noise+= texture2DLod(noisetex, wpos.xz * 0.05 + wind * 0.05, 0.0).r * 0.12;
color.rgb = vec3(0.4431, 0.102, 0.6118) * noise * 3.0;
color.rgb *= color.rgb * 24.0;
float fogFactor = smoothstep(0.0, 1.0, 0.03 / -wpos.y);
fogFactor += smoothstep(0.0, 1.0, 0.03 / wpos.y);
vec3 fogColor = vec3(0.3373, 0.0431, 0.1176) * 25.0;
color.rgb = mix(color.rgb, fogColor, fogFactor);
color.a = 0.7;
#endif
#ifdef NETHER_PORTAL_NOISE
vec2 portalUV;
if (abs(worldGeoNormal.x) > 0.5) {
portalUV = worldPos.yz;
} else {
portalUV = worldPos.yx;
}
float baseNoise = texture2DLod(noisetex, portalUV * 0.03 + frameTimeCounter * 0.01, 0.0).b;
vec2 timeWaves = vec2(
sin(frameTimeCounter * 0.7 + portalUV.x * 2.0),
cos(frameTimeCounter * 0.5 + portalUV.y * 2.0)
);
vec2 warpedUV = portalUV * 0.1 + baseNoise * 0.05 * timeWaves + frameTimeCounter * 0.0083;
float portalNoise = 1.0 - texture2DLod(noisetex, warpedUV, 0.0).g;
color.rgb = mix(color.rgb * 0.66, color.rgb * 0.66 + pow2(vec3(portalNoise * 1.2)), portalNoise);
emission = mix(0, emission, portalNoise);
noGeneratedNormals = portalNoise > 0.25;
#endif
#define PORTAL_REDUCE_CLOSEUP
#ifdef PORTAL_REDUCE_CLOSEUP
color.a *= min1(lViewPos - 0.2);
if (color.a < 0.101) {
if (color.a < 0.101 * dither) discard;
else color.a = 0.101;
}
#endif
#ifdef PORTAL_EDGE_EFFECT
vec3 playerPosCurved = playerPos;
#ifdef WORLD_CURVATURE
playerPosCurved.y += doWorldCurvature(playerPosCurved.xz);
#endif
vec3 voxelPos = SceneToVoxel(playerPosCurved);
if (CheckInsideVoxelVolume(voxelPos)) {
float portalOffset = 0.0625 * dither;
vec3[6] portalOffsets = vec3[](
vec3( portalOffset, 0, 0),
vec3(-portalOffset, 0, 0),
vec3( 0, portalOffset, 0),
vec3( 0,-portalOffset, 0),
vec3( 0, 0, portalOffset),
vec3( 0, 0,-portalOffset)
);
float edge = 0.0;
for (int i = 0; i < 6; i++) {
uint voxel = GetVoxelVolume(ivec3(voxelPos + portalOffsets[i]));
if (voxel != uint(25)) {
edge = 1.0; break;
}
}
vec4 edgeColor = vec4(normalize(color.rgb), 1.0);
edgeColor.b *= 0.8;
color = mix(color, edgeColor, edge);
emission = mix(emission, 5.0, edge);
}
#endif
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
color.rgb = normalize(netherColor) * GetLuminance(color.rgb) * 2.5;
#endif
// color.rgb = vec3(0);
// emission = 0;
@@ -0,0 +1,5 @@
smoothnessG = 0.5;
highlightMult = 1.5;
reflectMult = 1.0;
DoTranslucentTweaks(color, fresnelM, reflectMult, lViewPos);
@@ -0,0 +1,313 @@
// ============================== Step 1: Color Prep ============================== //
#include "/lib/shaderSettings/water.glsl"
vec3 glColorM = vec3(0.43, 0.6, 0.8);
#if MC_VERSION >= 11300
#if WATERCOLOR_MODE >= 2
glColorM = glColor.rgb;
#if WATERCOLOR_MODE >= 3
glColorM.g = max(glColorM.g, 0.39);
#endif
#ifdef GBUFFERS_WATER
translucentMultCalculated = true;
translucentMult.rgb = normalize(sqrt2(glColor.rgb));
translucentMult.g *= 0.88;
#endif
#ifdef COMP_WATER_TWEAKS
glColorM = sqrt1(glColorM) * vec3(1.0, 0.85, 0.8);
#endif
#endif
#endif
#if PIXEL_WATER > 0 && (defined GBUFFERS_TERRAIN || defined GBUFFERS_WATER || defined DH_WATER)
const float water_scroll_speed = 0.002;
vec3 worldPosPixel = playerPos + cameraPosition;
vec3 waterPosPixel = worldPosPixel + (vec3(frameTimeCounter) * water_scroll_speed);
vec3 waterMask = waterMaskFunc(waterPosPixel, water_scroll_speed, glColorM, mat, normalM);
vec3 colorOriginal = colorP.rgb;
if (abs(NdotU) > 0.01) colorP.rgb = waterMask;
#endif
#if MC_VERSION >= 11300
#if WATER_STYLE < 3 || PIXEL_WATER == 1
vec3 colorPM = pow2(colorP.rgb);
color.rgb = colorPM * glColorM;
#else
vec3 colorPM = vec3(0.25);
color.rgb = 0.375 * glColorM;
#endif
#else
#if WATER_STYLE < 3 || PIXEL_WATER == 1
color.rgb = mix(color.rgb, vec3(GetLuminance(color.rgb)), 0.88);
color.rgb = pow2(color.rgb) * vec3(2.3, 3.5, 3.1) * 0.9;
#else
color.rgb = vec3(0.13, 0.2, 0.27);
#endif
#endif
#ifdef WATERCOLOR_CHANGED
color.rgb *= vec3(WATERCOLOR_RM, WATERCOLOR_GM, WATERCOLOR_BM);
#endif
// ============================== End of Step 1 ============================== //
#define PHYSICS_OCEAN_INJECTION
#if defined GENERATED_NORMALS && (WATER_STYLE >= 2 || defined PHYSICS_OCEAN || !defined WATER_GENERATED_NORMALS || PIXEL_WATER == 1) && !defined DH_WATER
noGeneratedNormals = true;
#endif
#ifdef WATER_GENERATED_NORMALS
#endif
#if defined GBUFFERS_WATER || defined DH_WATER
SSBLAlpha = 0.0;
lmCoordM.y = min(lmCoord.y * 1.07, 1.0); // Iris/Sodium skylight inconsistency workaround
float fresnel2 = pow2(fresnel);
float fresnel4 = pow2(fresnel2);
// ============================== Step 2: Water Normals ============================== //
reflectMult = 1.0;
float waterBumpNoise = 1.0;
#if WATER_MAT_QUALITY >= 3
materialMask = OSIEBCA * 241.0; // Water
#endif
#if WATER_MAT_QUALITY >= 2 || WATER_STYLE >= 2
#define WATER_SPEED_MULT_M WATER_SPEED_MULT * 0.018
float rawWind = frameTimeCounter * WATER_SPEED_MULT_M;
vec2 wind = vec2(0.0, -rawWind);
vec3 worldPos = playerPos + cameraPosition;
vec2 waterPos = worldPos.xz;
#if WATER_STYLE < 3 && defined GBUFFERS_WATER
float blockRes = absMidCoordPos.x * atlasSize.x * 2.0;
waterPos = floor(waterPos * blockRes) / blockRes;
#endif
waterPos = 0.032 * (waterPos + worldPos.y * 2.0);
#ifdef CLEAR_WATER_SPOTS
waterBumpNoise = 1 - clamp01((1 - smoothstep(0.0, 0.5, texture2DLod(noisetex, waterPos.x * 0.045 + waterPos * 0.042 + wind * 0.006, 0.0).g)) * 2) * 0.85;
#endif
#endif
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2
vec3 normalMap = vec3(0.0, 0.0, 1.0);
#if WATER_STYLE >= 2
vec2 waterPosM = waterPos;
#if WATER_SIZE_MULT != 100
#define WATER_SIZE_MULT_M WATER_SIZE_MULT * 0.01
waterPosM *= WATER_SIZE_MULT_M;
#endif
#define WATER_BUMPINESS_M WATER_BUMPINESS * 0.8
#if WATER_STYLE >= 2
waterPosM *= 2.5; wind *= 2.5;
#if WATER_MAT_QUALITY >= 2
vec2 parallaxMult = -0.01 * viewVector.xy / viewVector.z;
for (int i = 0; i < 4; i++) {
waterPosM += parallaxMult * texture2D(gaux4, waterPosM - wind).a;
waterPosM += parallaxMult * texture2D(gaux4, waterPosM * 0.25 - 0.5 * wind).a;
}
#endif
vec2 normalMed = texture2D(gaux4, waterPosM + wind).rg - 0.5;
vec2 normalSmall = texture2D(gaux4, waterPosM * 4.0 - 2.0 * wind).rg - 0.5;
vec2 normalBig = texture2D(gaux4, waterPosM * 0.25 - 0.5 * wind).rg - 0.5;
normalBig += texture2D(gaux4, waterPosM * 0.05 - 0.05 * wind).rg - 0.5;
normalMap.xy = normalMed * WATER_BUMP_MED + normalSmall * WATER_BUMP_SMALL + normalBig * WATER_BUMP_BIG;
normalMap.xy *= 6.0 * (1.0 - 0.7 * fresnel) * WATER_BUMPINESS_M * waterBumpNoise;
#endif
normalMap.xy *= 0.03 * lmCoordM.y + 0.01;
#else
float pNormalMult = 0.02 * rainFactor * inRainy * pow2(lmCoordM.y);
if (pNormalMult > 0.0005) {
vec2 puddlePos = floor((playerPos.xz + cameraPosition.xz) * 16.0) * 0.00625;
vec2 puddleWind = vec2(frameTimeCounter) * 0.015;
vec2 pNormalCoord1 = puddlePos + vec2(puddleWind.x, puddleWind.y);
vec2 pNormalCoord2 = puddlePos + vec2(puddleWind.x * -1.5, puddleWind.y * -1.0);
vec3 pNormalNoise1 = texture2DLod(noisetex, pNormalCoord1, 0.0).rgb;
vec3 pNormalNoise2 = texture2DLod(noisetex, pNormalCoord2, 0.0).rgb;
normalMap.xy = (pNormalNoise1.xy + pNormalNoise2.yx - vec2(1.0)) * pNormalMult;
normalMap.xy *= 2.0 - 1.8 * fresnel2;
#endif
normalMap.z = sqrt(1.0 - (pow2(normalMap.x) + pow2(normalMap.y)));
normalM = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0));
#if WATER_STYLE == 1
}
#endif
#if WATER_STYLE >= 2
vec3 vector = reflect(nViewPos, normalize(normalM));
float norMix = pow2(pow2(pow2(1.0 - max0(dot(normal, vector))))) * 0.5;
normalM = mix(normalM, normal, norMix); // Fixes normals pointing inside water
float fresnelP = fresnel;
fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
#endif
#endif
// color.rgb = vec3(waterBumpNoise);
// ============================== End of Step 2 ============================== //
// ============================== Step 3: Water Material Features ============================== //
#if WATER_MAT_QUALITY >= 2
if (isEyeInWater != 1) {
// Noise Coloring //
float noise = texture2DLod(noisetex, (waterPos + wind) * 0.25, 0.0).g;
noise = noise - 0.5;
noise *= 0.25;
color.rgb = pow(color.rgb, vec3(1.0 + noise));
// Water Alpha //
#ifdef GBUFFERS_WATER
float depthT = texelFetch(depthtex1, texelCoord, 0).r;
#elif defined DH_WATER
float depthT = texelFetch(dhDepthTex1, texelCoord, 0).r;
#endif
vec3 screenPosT = vec3(screenPos.xy, depthT);
#ifdef TAA
vec3 viewPosT = ScreenToView(vec3(TAAJitter(screenPosT.xy, -0.5), screenPosT.z));
#else
vec3 viewPosT = ScreenToView(screenPosT);
#endif
float lViewPosT = length(viewPosT);
float lViewPosDifM = lViewPos - lViewPosT;
#if WATER_STYLE < 3 || PIXEL_WATER == 1
color.a = sqrt1(color.a);
#else
color.a = 0.98;
#endif
#ifdef DISTANT_HORIZONS
if (depthT == 1.0) color.a *= smoothstep(far, far * 0.9, lViewPos);
#endif
#if WATER_FOG_MULT != 100
#define WATER_FOG_MULT_M WATER_FOG_MULT * 0.01;
lViewPosDifM *= WATER_FOG_MULT_M;
#endif
float waterFog = max0(1.0 - exp(lViewPosDifM * 0.075));
color.a *= 0.25 + 0.75 * waterFog;
#if defined BRIGHT_CAVE_WATER && WATER_ALPHA_MULT < 200
// For better water visibility in caves and some extra color pop outdoors
color.rgb *= 2.5 - sqrt2(waterFog) - 0.5 * lmCoordM.y;
#endif
#if WATER_ALPHA_MULT != 100
#define WATER_ALPHA_MULT_M 100.0 / WATER_ALPHA_MULT
color.a = pow(color.a, WATER_ALPHA_MULT_M);
#endif
////
// Water Foam //
#if WATER_FOAM_I > 0 && defined GBUFFERS_WATER && !(defined MIRROR_DIMENSION || defined WORLD_CURVATURE)
if (NdotU > 0.99) {
vec3 matrixM = vec3(
gbufferModelViewInverse[0].y,
gbufferModelViewInverse[1].y,
gbufferModelViewInverse[2].y
);
float playerPosTY = dot(matrixM, viewPosT) + gbufferModelViewInverse[3].y;
float yPosDif = playerPosTY - playerPos.y;
#if (WATER_STYLE < 3 || PIXEL_WATER > 0) && MC_VERSION >= 11300
#if PIXEL_WATER > 0
float dotColorPM = dot(waterMask, pow1_5(colorOriginal));
#else
float dotColorPM = dot(colorPM, colorPM);
#endif
float foamThreshold = min(pow2(dotColorPM) * 1.6, 1.2);
#else
float foamThreshold = pow2(texture2DLod(noisetex, waterPos * 4.0 + wind * 0.5, 0.0).g) * 1.6;
#endif
float foam = pow2(clamp((foamThreshold + yPosDif) / foamThreshold, 0.0, 1.0));
#ifndef END
foam *= 0.4 + 0.25 * lmCoord.y;
#else
foam *= 0.6;
#endif
foam *= clamp((fract(worldPos.y) - 0.7) * 10.0, 0.0, 1.0);
vec3 foamColor3 = vec3(0.9, 0.95, 1.05);
#if PIXEL_WATER > 0
foamColor3 *= 2.0;
#endif
vec4 foamColor = vec4(foamColor3, 1.0);
#define WATER_FOAM_IM WATER_FOAM_I * 0.01
#if WATER_FOAM_I < 100
foam *= WATER_FOAM_IM;
#elif WATER_FOAM_I > 100
foamColor *= WATER_FOAM_IM;
#endif
color = mix(color, foamColor, foam);
reflectMult = 1.0 - foam;
}
#endif
////
} else { // Underwater
noDirectionalShading = true;
reflectMult = 0.5;
#if MC_VERSION < 11300 && WATER_STYLE >= 3 && PIXEL_WATER == 0
color.a = 0.7;
#endif
#ifdef GBUFFERS_WATER
#if WATER_STYLE == 1 || PIXEL_WATER == 1
translucentMult.rgb *= 1.0 - fresnel4;
#else
translucentMult.rgb *= 1.0 - 0.9 * max(0.5 * sqrt(fresnel4), fresnel4);
#endif
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
reflectMult = 1.0 / color.a;
fresnelM = 1.0;
#endif
reflectMult = clamp01(reflectMult * FRESNEL_MULTIPLIER);
}
#else
shadowMult = vec3(0.0);
#endif
// ============================== End of Step 3 ============================== //
// ============================== Step 4: Final Tweaks ============================== //
reflectMult *= 0.5 + 0.5 * NdotUmax0;
color.a = mix(color.a, 1.0, fresnel4);
#ifdef GBUFFERS_WATER
#if WATER_STYLE == 3 || WATER_STYLE == 2 && SUN_MOON_STYLE >= 2
smoothnessG = 1.0;
const float WATER_BUMPINESS_M2 = min(WATER_BUMP_MED * WATER_BUMP_SMALL * WATER_BUMPINESS * 0.65, 1.0);
vec2 lightNormalP = WATER_BUMPINESS_M2 * (normalMed + 0.5 * normalSmall) * waterBumpNoise;
vec3 lightNormal = normalize(vec3(lightNormalP, 1.0) * tbnMatrix);
highlightMult = dot(lightNormal, lightVec);
highlightMult = max0(highlightMult) / max(dot(normal, lightVec), 0.17);
highlightMult = mix(pow2(pow2(highlightMult * 1.1)), 1.0, min1(sqrt(miplevel) * 0.45)) * 0.24;
#else
smoothnessG = 0.5;
highlightMult = min(pow2(pow2(dot(colorP.rgb, colorP.rgb) * 0.4)), 0.5);
highlightMult *= (16.0 - 15.0 * fresnel2) * (sunVisibility > 0.5 ? 0.85 : 0.425);
#endif
#endif
// ============================== End of Step 4 ============================== //
#endif