This commit is contained in:
lucasdpt
2026-06-14 02:07:47 +02:00
parent 398e1e6ddf
commit 0129d81bd4
2475 changed files with 553889 additions and 553884 deletions
@@ -1,252 +1,252 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#define ROUGHNESS_MULTIPLIER 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
#define ROUGHNESS_INTENSITY 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
in vec3 sunVec;
#ifdef END
in float vlFactor;
#endif
//Pipeline Constants//
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float farMinusNear = far - near;
float z0;
float z1;
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#include "/lib/colors/skyColors.glsl"
#include "/lib/colors/lightAndAmbientColors.glsl"
#include "/lib/materials/materialMethods/reflections.glsl"
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
//Program//
void main() {
ivec2 texelCoord = ivec2(texCoord * view);
vec4 color = texelFetch(colortex0, texelCoord, 0);
vec4 texture4 = texelFetch(colortex4, texelCoord, 0);
z0 = texelFetch(depthtex0, texelCoord, 0).r;
z1 = texelFetch(depthtex1, texelCoord, 0).r;
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
vec4 reflectOutput = vec4(0.0);
if (
z0 < 1.0
#if WORLD_SPACE_REFLECTIONS_INTERNAL == -1 || WATER_REFLECT_QUALITY <= 0
&& z0 == z1
#endif
) {
vec3 texture6 = texelFetch(colortex6, texelCoord, 0).rgb;
vec3 normalM = mat3(gbufferModelView) * texture4.rgb;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos);
vec3 nViewPos = normalize(viewPos.xyz);
vec3 playerPos = ViewToPlayer(viewPos.xyz);
bool entityOrParticle = z0 < 0.56;
float dither = texture2DLod(noisetex, gl_FragCoord.xy / 128.0, 0.0).b;
#if defined TAA || defined PBR_REFLECTIONS
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
int materialMaskInt = int(texture6.g * 255.1);
float skyLightFactor = texture6.b;
float smoothnessD = texture6.r;
float fresnelM = texture4.a;
float intenseFresnel = 0.0;
float ssao = 1.0;
vec3 reflectColor = vec3(1.0);
#ifdef IRIS_FEATURE_FADE_VARIABLE
if (skyLightFactor > 0.50001) skyLightFactor = eyeBrightnessM;
else skyLightFactor *= 1.9999;
#endif
#include "/lib/materials/materialHandling/deferredMaterials.glsl"
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
if (fresnelM > 0.0) {
#ifdef TAA
float noiseMult = 0.3;
#else
float noiseMult = 0.3;
#endif
#ifdef PBR_REFLECTIONS
bool opaqueSurface = z0 == z1;
float minBlendFactor = 0.035 + 0.09 * pow2(pow2(pow2(smoothnessD)));
if (entityOrParticle) {
noiseMult *= 0.125;
minBlendFactor = 0.125;
if (!opaqueSurface) reflectColor = vec3(0.0);
}
#endif
float smoothnessDM = smoothnessD * ROUGHNESS_MULTIPLIER;
noiseMult *= pow2(1.0 - smoothnessDM) * ROUGHNESS_INTENSITY;
vec2 roughCoord = gl_FragCoord.xy / 128.0;
vec3 roughNoise = vec3(
texture2DLod(noisetex, roughCoord, 0.0).r,
texture2DLod(noisetex, roughCoord + 0.09375, 0.0).r,
texture2DLod(noisetex, roughCoord + 0.1875, 0.0).r
);
roughNoise = fract(roughNoise + vec3(dither, dither * goldenRatio, dither * pow2(goldenRatio)));
roughNoise = noiseMult * (roughNoise - vec3(0.5));
vec3 refNormal = normalM + roughNoise;
float enderDragonDead = 1.0 - texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
vec4 reflection = GetReflection(refNormal, viewPos.xyz, nViewPos, playerPos, lViewPos, z0,
depthtex1, dither, skyLightFactor, fresnel,
smoothnessDM, vec3(0.0), vec3(0.0), vec3(0.0), 0.0, enderDragonDead, vec2(0.0));
reflection.rgb *= reflectColor;
reflectOutput = reflection;
#ifdef PBR_REFLECTIONS
if (opaqueSurface) {
refDist = min(refDist, far - lViewPos);
vec4 virtualRefPos = vec4(viewPos.xyz + refDist * nViewPos, 1.0);
vec4 playerVirtualRefPos = gbufferModelViewInverse * virtualRefPos; // note: don't need to do perspective division with model view matrix
vec4 virtualPrevRefPos = playerVirtualRefPos;
virtualPrevRefPos.xyz -= previousCameraPosition - cameraPosition;
virtualPrevRefPos = gbufferPreviousProjection * (gbufferPreviousModelView * virtualPrevRefPos);
virtualPrevRefPos.xyz = 0.5 * virtualPrevRefPos.xyz / virtualPrevRefPos.w + 0.5;
virtualPrevRefPos.z = min(1, virtualPrevRefPos.z);
if (virtualPrevRefPos.xyz == clamp01(virtualPrevRefPos.xyz)) {
vec4 prevPos = gbufferProjection * (
gbufferModelView * vec4(
playerPos + (cameraPosition - previousCameraPosition) +
gbufferModelViewInverse[3].xyz - transpose(mat3(gbufferPreviousModelView)) * gbufferPreviousModelView[3].xyz
, 1.0
)
);
prevPos.xyz = 0.5 * prevPos.xyz / prevPos.w + 0.5;
virtualPrevRefPos.xy *= view;
virtualPrevRefPos.xy = (
smoothstep(0, 1, smoothstep(0, 1, fract(virtualPrevRefPos.xy - 0.5))) +
floor(virtualPrevRefPos.xy - 0.5) +
0.5
) / view;
float linearZ1 = GetLinearDepth(z1);
vec2 pixelMovement = view * (prevPos.xy - texCoord);
vec3 prevNormalM = mat3(gbufferModelView) * texture2D(colortex1, virtualPrevRefPos.xy).rgb;
vec4 prevRefCurrentPosHeuristic = playerVirtualRefPos;
prevRefCurrentPosHeuristic.xyz += normalize(previousCameraPosition - cameraPosition - playerVirtualRefPos.xyz) * refDist;
prevRefCurrentPosHeuristic = gbufferProjection * (gbufferModelView * prevRefCurrentPosHeuristic);
prevRefCurrentPosHeuristic.xyz = 0.5 * prevRefCurrentPosHeuristic.xyz / prevRefCurrentPosHeuristic.w + 0.5;
vec4 prevRef = texture2D(colortex7, virtualPrevRefPos.xy);
float prevValid = exp(
- 0.03 * length(view * (virtualPrevRefPos.xy - texCoord))
- min(0.75, 10.0 * sqrt(length(cameraPosition - previousCameraPosition)))
- 0.003 * length(pixelMovement)
- 12.0 * length(normalM - prevNormalM)
- abs(prevRef.a - linearZ1) * far / 1.0
- 10 * length(prevRefCurrentPosHeuristic.xy - clamp01(prevRefCurrentPosHeuristic.xy))
);
reflectOutput.rgb = mix(prevRef.rgb, reflectOutput.rgb, min1(minBlendFactor / prevValid));
reflectOutput.a = linearZ1;
}
}
#endif
}
}
/* DRAWBUFFERS:7 */
gl_FragData[0] = reflectOutput;
// same check as #ifdef PBR_REFLECTIONS but for Optifine to understand:
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:71 */
gl_FragData[1] = vec4(texture4.rgb, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
out vec3 sunVec;
#ifdef END
out float vlFactor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
sunVec = GetSunVector();
#ifdef END
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#define ROUGHNESS_MULTIPLIER 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
#define ROUGHNESS_INTENSITY 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
in vec3 sunVec;
#ifdef END
in float vlFactor;
#endif
//Pipeline Constants//
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float farMinusNear = far - near;
float z0;
float z1;
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#include "/lib/colors/skyColors.glsl"
#include "/lib/colors/lightAndAmbientColors.glsl"
#include "/lib/materials/materialMethods/reflections.glsl"
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
//Program//
void main() {
ivec2 texelCoord = ivec2(texCoord * view);
vec4 color = texelFetch(colortex0, texelCoord, 0);
vec4 texture4 = texelFetch(colortex4, texelCoord, 0);
z0 = texelFetch(depthtex0, texelCoord, 0).r;
z1 = texelFetch(depthtex1, texelCoord, 0).r;
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
vec4 reflectOutput = vec4(0.0);
if (
z0 < 1.0
#if WORLD_SPACE_REFLECTIONS_INTERNAL == -1 || WATER_REFLECT_QUALITY <= 0
&& z0 == z1
#endif
) {
vec3 texture6 = texelFetch(colortex6, texelCoord, 0).rgb;
vec3 normalM = mat3(gbufferModelView) * texture4.rgb;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos);
vec3 nViewPos = normalize(viewPos.xyz);
vec3 playerPos = ViewToPlayer(viewPos.xyz);
bool entityOrParticle = z0 < 0.56;
float dither = texture2DLod(noisetex, gl_FragCoord.xy / 128.0, 0.0).b;
#if defined TAA || defined PBR_REFLECTIONS
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
int materialMaskInt = int(texture6.g * 255.1);
float skyLightFactor = texture6.b;
float smoothnessD = texture6.r;
float fresnelM = texture4.a;
float intenseFresnel = 0.0;
float ssao = 1.0;
vec3 reflectColor = vec3(1.0);
#ifdef IRIS_FEATURE_FADE_VARIABLE
if (skyLightFactor > 0.50001) skyLightFactor = eyeBrightnessM;
else skyLightFactor *= 1.9999;
#endif
#include "/lib/materials/materialHandling/deferredMaterials.glsl"
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
if (fresnelM > 0.0) {
#ifdef TAA
float noiseMult = 0.3;
#else
float noiseMult = 0.3;
#endif
#ifdef PBR_REFLECTIONS
bool opaqueSurface = z0 == z1;
float minBlendFactor = 0.035 + 0.09 * pow2(pow2(pow2(smoothnessD)));
if (entityOrParticle) {
noiseMult *= 0.125;
minBlendFactor = 0.125;
if (!opaqueSurface) reflectColor = vec3(0.0);
}
#endif
float smoothnessDM = smoothnessD * ROUGHNESS_MULTIPLIER;
noiseMult *= pow2(1.0 - smoothnessDM) * ROUGHNESS_INTENSITY;
vec2 roughCoord = gl_FragCoord.xy / 128.0;
vec3 roughNoise = vec3(
texture2DLod(noisetex, roughCoord, 0.0).r,
texture2DLod(noisetex, roughCoord + 0.09375, 0.0).r,
texture2DLod(noisetex, roughCoord + 0.1875, 0.0).r
);
roughNoise = fract(roughNoise + vec3(dither, dither * goldenRatio, dither * pow2(goldenRatio)));
roughNoise = noiseMult * (roughNoise - vec3(0.5));
vec3 refNormal = normalM + roughNoise;
float enderDragonDead = 1.0 - texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
vec4 reflection = GetReflection(refNormal, viewPos.xyz, nViewPos, playerPos, lViewPos, z0,
depthtex1, dither, skyLightFactor, fresnel,
smoothnessDM, vec3(0.0), vec3(0.0), vec3(0.0), 0.0, enderDragonDead, vec2(0.0));
reflection.rgb *= reflectColor;
reflectOutput = reflection;
#ifdef PBR_REFLECTIONS
if (opaqueSurface) {
refDist = min(refDist, far - lViewPos);
vec4 virtualRefPos = vec4(viewPos.xyz + refDist * nViewPos, 1.0);
vec4 playerVirtualRefPos = gbufferModelViewInverse * virtualRefPos; // note: don't need to do perspective division with model view matrix
vec4 virtualPrevRefPos = playerVirtualRefPos;
virtualPrevRefPos.xyz -= previousCameraPosition - cameraPosition;
virtualPrevRefPos = gbufferPreviousProjection * (gbufferPreviousModelView * virtualPrevRefPos);
virtualPrevRefPos.xyz = 0.5 * virtualPrevRefPos.xyz / virtualPrevRefPos.w + 0.5;
virtualPrevRefPos.z = min(1, virtualPrevRefPos.z);
if (virtualPrevRefPos.xyz == clamp01(virtualPrevRefPos.xyz)) {
vec4 prevPos = gbufferProjection * (
gbufferModelView * vec4(
playerPos + (cameraPosition - previousCameraPosition) +
gbufferModelViewInverse[3].xyz - transpose(mat3(gbufferPreviousModelView)) * gbufferPreviousModelView[3].xyz
, 1.0
)
);
prevPos.xyz = 0.5 * prevPos.xyz / prevPos.w + 0.5;
virtualPrevRefPos.xy *= view;
virtualPrevRefPos.xy = (
smoothstep(0, 1, smoothstep(0, 1, fract(virtualPrevRefPos.xy - 0.5))) +
floor(virtualPrevRefPos.xy - 0.5) +
0.5
) / view;
float linearZ1 = GetLinearDepth(z1);
vec2 pixelMovement = view * (prevPos.xy - texCoord);
vec3 prevNormalM = mat3(gbufferModelView) * texture2D(colortex1, virtualPrevRefPos.xy).rgb;
vec4 prevRefCurrentPosHeuristic = playerVirtualRefPos;
prevRefCurrentPosHeuristic.xyz += normalize(previousCameraPosition - cameraPosition - playerVirtualRefPos.xyz) * refDist;
prevRefCurrentPosHeuristic = gbufferProjection * (gbufferModelView * prevRefCurrentPosHeuristic);
prevRefCurrentPosHeuristic.xyz = 0.5 * prevRefCurrentPosHeuristic.xyz / prevRefCurrentPosHeuristic.w + 0.5;
vec4 prevRef = texture2D(colortex7, virtualPrevRefPos.xy);
float prevValid = exp(
- 0.03 * length(view * (virtualPrevRefPos.xy - texCoord))
- min(0.75, 10.0 * sqrt(length(cameraPosition - previousCameraPosition)))
- 0.003 * length(pixelMovement)
- 12.0 * length(normalM - prevNormalM)
- abs(prevRef.a - linearZ1) * far / 1.0
- 10 * length(prevRefCurrentPosHeuristic.xy - clamp01(prevRefCurrentPosHeuristic.xy))
);
reflectOutput.rgb = mix(prevRef.rgb, reflectOutput.rgb, min1(minBlendFactor / prevValid));
reflectOutput.a = linearZ1;
}
}
#endif
}
}
/* DRAWBUFFERS:7 */
gl_FragData[0] = reflectOutput;
// same check as #ifdef PBR_REFLECTIONS but for Optifine to understand:
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:71 */
gl_FragData[1] = vec4(texture4.rgb, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
out vec3 sunVec;
#ifdef END
out float vlFactor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
sunVec = GetSunVector();
#ifdef END
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#endif
}
#endif
@@ -1,430 +1,430 @@
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite1.glsl"
#include "/lib/shaderSettings/endBeams.glsl"
#include "/lib/shaderSettings/overworldBeams.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
#define NETHER_STORM
#define NETHER_STORM_LOWER_ALT 28 //[-296 -292 -288 -284 -280 -276 -272 -268 -264 -260 -256 -252 -248 -244 -240 -236 -232 -228 -224 -220 -216 -212 -208 -204 -200 -196 -192 -188 -184 -180 -176 -172 -168 -164 -160 -156 -152 -148 -144 -140 -136 -132 -128 -124 -120 -116 -112 -108 -104 -100 -96 -92 -88 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 22 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300]
#define NETHER_STORM_HEIGHT 200 //[25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 220 240 260 280 300 325 350 375 400 425 450 475 500 550 600 650 700 750 800 850 900]
#define NETHER_STORM_I 0.40 //[0.05 0.06 0.07 0.08 0.09 0.10 0.12 0.14 0.16 0.18 0.22 0.26 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50]
#ifndef NETHER
#undef NETHER_STORM
#endif
#define COLORED_LIGHT_FOG_RAIN_I 0 //[0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]
#ifdef COLORED_LIGHT_FOG_RAIN_I
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec;
#ifdef LIGHTSHAFTS_ACTIVE
flat in float vlFactor;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
vec2 view = vec2(viewWidth, viewHeight);
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#ifdef LIGHTSHAFTS_ACTIVE
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float vlTime = min(abs(SdotU) - 0.05, 0.15) / 0.15;
#endif
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/atmospherics/fog/waterFog.glsl"
#include "/lib/atmospherics/fog/caveFactor.glsl"
#if defined PBR_REFLECTIONS || WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0
#include "/lib/materials/materialMethods/reflectionBlurFilter.glsl"
#endif
#ifdef BLOOM_FOG_COMPOSITE1
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#ifdef LIGHTSHAFTS_ACTIVE
#if defined END && defined END_BEAMS
#include "/lib/atmospherics/enderBeams.glsl"
#elif defined OVERWORLD && defined OVERWORLD_BEAMS
#include "/lib/atmospherics/overworldBeams.glsl"
#endif
#include "/lib/atmospherics/volumetricLight.glsl"
#endif
#if WATER_MAT_QUALITY >= 3 || defined NETHER_STORM || defined COLORED_LIGHT_FOG || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || (defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900)
#include "/lib/util/spaceConversion.glsl"
#endif
#if WATER_MAT_QUALITY >= 3
#include "/lib/materials/materialMethods/refraction.glsl"
#endif
#ifdef NETHER_STORM
#include "/lib/atmospherics/netherStorm.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#if RAINBOWS > 0 && defined OVERWORLD
#include "/lib/atmospherics/rainbow.glsl"
#endif
#ifdef COLORED_LIGHT_FOG
#include "/lib/voxelization/lightVoxelization.glsl"
#include "/lib/atmospherics/fog/coloredLightFog.glsl"
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
#include "/lib/atmospherics/endCrystalVortex.glsl"
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
#include "/lib/atmospherics/endPortalBeam.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
#if defined DISTANT_HORIZONS && !defined OVERWORLD
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
/* TM5723: The "1.0 - translucentMult" trick is done because of the default color attachment
value being vec3(0.0). This makes it vec3(1.0) to avoid issues especially on improved glass */
vec3 translucentMult = 1.0 - texelFetch(colortex3, texelCoord, 0).rgb; //TM5723
vec4 volumetricEffect = vec4(0.0);
vec2 texCoordM = texCoord;
#if WATER_MAT_QUALITY >= 3
texCoordM = DoRefraction(color, z0, z1, viewPos.xyz, lViewPos);
#endif
#if defined PBR_REFLECTIONS || WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0
if (z0 < 1.0) {
vec4 compositeReflection = texture2D(colortex7, texCoord);
// Partial fix for half resolution WSR-only reflections having a lot of sky gaps
#if WORLD_SPACE_REF_MODE == 1
if (REFLECTION_RES < 0.6) {
vec2 refOffsets[4] = vec2[4](
vec2( 1.0, 1.0),
vec2(-1.0, 1.0),
vec2( 1.0,-1.0),
vec2(-1.0,-1.0)
);
for (int i = 0; i < 4; i++) {
vec4 compositeRefSample = texture2D(colortex7, texCoord + refOffsets[i] * 1.5 / view);
if (compositeRefSample.a > compositeReflection.a * 1.01) compositeReflection = compositeRefSample;
}
}
#endif
float fresnelM = pow2(texture2D(colortex4, texCoord).a); // including attenuation through fog and clouds
if (abs(fresnelM - 0.5) < 0.5) { // 0.0 fresnel doesnt need ref calculations, and 1.0 fresnel basically means error
if (z0 == z1 || z0 <= 0.56) { // Solids
#ifdef PBR_REFLECTIONS
if (fresnelM > 0.00001) {
compositeReflection = sampleBlurFilteredReflection(compositeReflection, dither, z0);
compositeReflection.rgb = max(compositeReflection.rgb, vec3(0.0)); // We seem to have some negative values for some reason
// This physically doesn't make sense but fits Minecraft
const float texturePreservation = 0.7;
compositeReflection.rgb = mix(compositeReflection.rgb, max(color, compositeReflection.rgb), texturePreservation);
color = mix(color, compositeReflection.rgb, fresnelM);
}
#endif
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
else { // Translucents
vec4 ssrReflection = texture2D(colortex8, texCoordM);
color = max(color - ssrReflection.rgb, vec3(0.0));
compositeReflection.rgb *= fresnelM;
compositeReflection = mix(compositeReflection, ssrReflection, float(ssrReflection.a > 0.999));
vec3 combinedRef = mix(ssrReflection.rgb, compositeReflection.rgb, compositeReflection.a);
color += combinedRef;
}
#endif
}
}
#endif
vec4 screenPos1 = vec4(texCoord, z1, 1.0);
vec4 viewPos1 = gbufferProjectionInverse * (screenPos1 * 2.0 - 1.0);
viewPos1 /= viewPos1.w;
float lViewPos1 = length(viewPos1.xyz);
#if defined DISTANT_HORIZONS && !defined OVERWORLD
float z1DH = texelFetch(dhDepthTex1, texelCoord, 0).r;
vec4 screenPos1DH = vec4(texCoord, z1DH, 1.0);
vec4 viewPos1DH = dhProjectionInverse * (screenPos1DH * 2.0 - 1.0);
viewPos1DH /= viewPos1DH.w;
lViewPos1 = min(lViewPos1, length(viewPos1DH.xyz));
#endif
#if defined LIGHTSHAFTS_ACTIVE || RAINBOWS > 0 && defined OVERWORLD
vec3 nViewPos = normalize(viewPos1.xyz);
float VdotL = dot(nViewPos, lightVec);
float VdotU = dot(nViewPos, upVec);
#endif
#if defined NETHER_STORM || defined COLORED_LIGHT_FOG || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || (defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900)
vec3 playerPos = ViewToPlayer(viewPos1.xyz);
vec3 nPlayerPos = normalize(playerPos);
#endif
#if RAINBOWS > 0 && defined OVERWORLD
color += GetRainbow(translucentMult, nViewPos, z0, z1, lViewPos, lViewPos1, VdotL, VdotU, dither);
#endif
float vlFactorM = 0.0;
#ifdef LIGHTSHAFTS_ACTIVE
vlFactorM = vlFactor;
volumetricEffect = GetVolumetricLight(color, vlFactorM, translucentMult, lViewPos, lViewPos1, nViewPos, VdotL, VdotU, texCoord, z0, z1, dither);
#endif
float lightFogLength = 0.0;
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
vec4 endCrystalVortex = pow2(EndCrystalVortices(vec3(0.0), playerPos, dither));
volumetricEffect = sqrt(pow2(volumetricEffect) + endCrystalVortex);
lightFogLength = sqrt(pow2(lightFogLength) + length(endCrystalVortex.rgb));
#endif
#ifdef NETHER_STORM
volumetricEffect = GetNetherStorm(color, translucentMult, nPlayerPos, playerPos, lViewPos, lViewPos1, dither);
#endif
#ifdef ATM_COLOR_MULTS
volumetricEffect.rgb *= GetAtmColorMult();
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
volumetricEffect.rgb *= moonPhaseInfluence;
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
vec4 endPortalBeam = pow2(GetEndPortalBeam(vec3(0.0), playerPos));
volumetricEffect = sqrt(pow2(volumetricEffect) + endPortalBeam);
lightFogLength = sqrt(pow2(lightFogLength) + length(endPortalBeam.rgb));
#endif
#ifdef NETHER_STORM
color = mix(color, volumetricEffect.rgb, volumetricEffect.a);
#endif
#ifdef COLORED_LIGHT_FOG
vec3 lightFog = GetColoredLightFog(nPlayerPos, translucentMult, lViewPos, lViewPos1, dither, vlFactorM);
float lightFogMult = COLORED_LIGHT_FOG_I;
lightFogLength += length(lightFog);
//if (heldItemId == 40000 && heldItemId2 != 40000) lightFogMult = 0.0; // Hold spider eye to disable light fog
#ifdef OVERWORLD
#if COLORED_LIGHT_FOG_RAIN_I > 0
lightFogMult = mix(lightFogMult, COLORED_LIGHT_FOG_RAIN_I * 0.01, rainFactor * inRainy);
#endif
lightFogMult *= 0.2 + 0.6 * mix(1.0, 1.0 - sunFactor * invRainFactor, eyeBrightnessM);
#endif
#endif
if (isEyeInWater == 1) {
if (z0 == 1.0) color.rgb = waterFogColor;
vec3 underwaterMult = vec3(0.80, 0.87, 0.97);
#if DARKER_DEPTH_OCEANS > 0
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
float renderDistanceFade = lViewPos * 20.0 / far;
float lightSourceFactor = pow3(1.0 - texture6.a);
lightSourceFactor += renderDistanceFade;
lightSourceFactor = clamp01(lightSourceFactor);
float heldLight = max(heldBlockLightValue, heldBlockLightValue2);
if (heldLight > 0){
if (heldItemId == 45032 || heldItemId2 == 45032) heldLight = 15; // Lava Bucket
heldLight = clamp(heldLight, 0.0, 15.0);
heldLight = sqrt2(heldLight / 15.0) * -1.0 + 1.0; // Normalize and invert
heldLight = mix(heldLight, 1.0, clamp01((lViewPos) * 35.0 / far)); // Only do it around the player
} else {
heldLight = 1.0;
}
float mixFactor = heldLight * lightSourceFactor * (1.0 - nightVision);
float waterDepthStart = waterAltitude + 10;
float depthFactor = clamp01(10.0 / abs(min(cameraPosition.y, waterDepthStart + 0.001) - waterDepthStart));
float depthDarkness = clamp(abs(1.0 - (1.0 - depthFactor) * (1.0 - depthFactor)), DARKER_DEPTH_OCEANS * 0.05, 1.0);
underwaterMult *= mix(1.0, depthDarkness, mixFactor);
#endif
color.rgb *= underwaterMult * 0.85;
volumetricEffect.rgb *= pow2(underwaterMult * 0.71);
#ifdef COLORED_LIGHT_FOG
lightFog *= underwaterMult;
#endif
} else if (isEyeInWater == 2) {
if (z1 == 1.0) color.rgb = fogColor * 5.0;
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 1.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 1.0, colorEndBreath, 1.0);
#endif
volumetricEffect.rgb *= 0.0;
#ifdef COLORED_LIGHT_FOG
lightFog *= 0.0;
#endif
}
#ifdef COLORED_LIGHT_FOG
color /= 1.0 + pow2(GetLuminance(lightFog)) * lightFogMult * 2.0;
lightFog = lightFog * lightFogMult * 0.5;
#ifdef TAA
// TAA neighbourhood clamping causes light fog to go too bandy. Extra dither fixes it.
lightFog = max(vec3(0.0), lightFog + (dither - 0.5) * 0.02);
#endif
color += lightFog;
#endif
color = pow(color, vec3(2.2));
#if defined LIGHTSHAFTS_ACTIVE || defined END_PORTAL_BEAM_INTERNAL
#ifdef END
volumetricEffect.rgb *= volumetricEffect.rgb;
#endif
color += volumetricEffect.rgb;
#endif
#ifdef BLOOM_FOG_COMPOSITE1
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-2-3
#endif
#if RETRO_LOOK == 1
color.rgb *= vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.5 * RETRO_LOOK_I;
#elif RETRO_LOOK == 2
color.rgb *= mix(vec3(1.0), vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.5, nightVision) * RETRO_LOOK_I;
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
#if LIGHTSHAFT_QUALI_DEFINE > 0 && LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 && defined OVERWORLD || defined END || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || defined COLORED_LIGHT_FOG
vec4 texture5 = vec4(0.0);
#if LENSFLARE_MODE > 0 || defined ENTITY_TAA_NOISY_CLOUD_FIX || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || defined COLORED_LIGHT_FOG
texture5 = texelFetch(colortex5, texelCoord, 0);
if (viewWidth + viewHeight - gl_FragCoord.x - gl_FragCoord.y > 1.5)
vlFactorM = texture5.a;
#endif
texture5.r = sqrt(pow2(texture5.r) + lightFogLength);
/* DRAWBUFFERS:05 */
gl_FragData[1] = vec4(texture5.r, 0.0, 0.0, vlFactorM);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
flat out vec3 upVec, sunVec;
#ifdef LIGHTSHAFTS_ACTIVE
flat out float vlFactor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#ifdef LIGHTSHAFTS_ACTIVE
#if LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#else
#if LIGHTSHAFT_BEHAVIOUR == 2
vlFactor = 0.0;
#elif LIGHTSHAFT_BEHAVIOUR == 3
vlFactor = 1.0;
#endif
#endif
#endif
}
#endif
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite1.glsl"
#include "/lib/shaderSettings/endBeams.glsl"
#include "/lib/shaderSettings/overworldBeams.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
#define NETHER_STORM
#define NETHER_STORM_LOWER_ALT 28 //[-296 -292 -288 -284 -280 -276 -272 -268 -264 -260 -256 -252 -248 -244 -240 -236 -232 -228 -224 -220 -216 -212 -208 -204 -200 -196 -192 -188 -184 -180 -176 -172 -168 -164 -160 -156 -152 -148 -144 -140 -136 -132 -128 -124 -120 -116 -112 -108 -104 -100 -96 -92 -88 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 22 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300]
#define NETHER_STORM_HEIGHT 200 //[25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 220 240 260 280 300 325 350 375 400 425 450 475 500 550 600 650 700 750 800 850 900]
#define NETHER_STORM_I 0.40 //[0.05 0.06 0.07 0.08 0.09 0.10 0.12 0.14 0.16 0.18 0.22 0.26 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50]
#ifndef NETHER
#undef NETHER_STORM
#endif
#define COLORED_LIGHT_FOG_RAIN_I 0 //[0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]
#ifdef COLORED_LIGHT_FOG_RAIN_I
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec;
#ifdef LIGHTSHAFTS_ACTIVE
flat in float vlFactor;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
vec2 view = vec2(viewWidth, viewHeight);
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#ifdef LIGHTSHAFTS_ACTIVE
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float vlTime = min(abs(SdotU) - 0.05, 0.15) / 0.15;
#endif
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/atmospherics/fog/waterFog.glsl"
#include "/lib/atmospherics/fog/caveFactor.glsl"
#if defined PBR_REFLECTIONS || WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0
#include "/lib/materials/materialMethods/reflectionBlurFilter.glsl"
#endif
#ifdef BLOOM_FOG_COMPOSITE1
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#ifdef LIGHTSHAFTS_ACTIVE
#if defined END && defined END_BEAMS
#include "/lib/atmospherics/enderBeams.glsl"
#elif defined OVERWORLD && defined OVERWORLD_BEAMS
#include "/lib/atmospherics/overworldBeams.glsl"
#endif
#include "/lib/atmospherics/volumetricLight.glsl"
#endif
#if WATER_MAT_QUALITY >= 3 || defined NETHER_STORM || defined COLORED_LIGHT_FOG || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || (defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900)
#include "/lib/util/spaceConversion.glsl"
#endif
#if WATER_MAT_QUALITY >= 3
#include "/lib/materials/materialMethods/refraction.glsl"
#endif
#ifdef NETHER_STORM
#include "/lib/atmospherics/netherStorm.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#if RAINBOWS > 0 && defined OVERWORLD
#include "/lib/atmospherics/rainbow.glsl"
#endif
#ifdef COLORED_LIGHT_FOG
#include "/lib/voxelization/lightVoxelization.glsl"
#include "/lib/atmospherics/fog/coloredLightFog.glsl"
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
#include "/lib/atmospherics/endCrystalVortex.glsl"
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
#include "/lib/atmospherics/endPortalBeam.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
#if defined DISTANT_HORIZONS && !defined OVERWORLD
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
/* TM5723: The "1.0 - translucentMult" trick is done because of the default color attachment
value being vec3(0.0). This makes it vec3(1.0) to avoid issues especially on improved glass */
vec3 translucentMult = 1.0 - texelFetch(colortex3, texelCoord, 0).rgb; //TM5723
vec4 volumetricEffect = vec4(0.0);
vec2 texCoordM = texCoord;
#if WATER_MAT_QUALITY >= 3
texCoordM = DoRefraction(color, z0, z1, viewPos.xyz, lViewPos);
#endif
#if defined PBR_REFLECTIONS || WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0
if (z0 < 1.0) {
vec4 compositeReflection = texture2D(colortex7, texCoord);
// Partial fix for half resolution WSR-only reflections having a lot of sky gaps
#if WORLD_SPACE_REF_MODE == 1
if (REFLECTION_RES < 0.6) {
vec2 refOffsets[4] = vec2[4](
vec2( 1.0, 1.0),
vec2(-1.0, 1.0),
vec2( 1.0,-1.0),
vec2(-1.0,-1.0)
);
for (int i = 0; i < 4; i++) {
vec4 compositeRefSample = texture2D(colortex7, texCoord + refOffsets[i] * 1.5 / view);
if (compositeRefSample.a > compositeReflection.a * 1.01) compositeReflection = compositeRefSample;
}
}
#endif
float fresnelM = pow2(texture2D(colortex4, texCoord).a); // including attenuation through fog and clouds
if (abs(fresnelM - 0.5) < 0.5) { // 0.0 fresnel doesnt need ref calculations, and 1.0 fresnel basically means error
if (z0 == z1 || z0 <= 0.56) { // Solids
#ifdef PBR_REFLECTIONS
if (fresnelM > 0.00001) {
compositeReflection = sampleBlurFilteredReflection(compositeReflection, dither, z0);
compositeReflection.rgb = max(compositeReflection.rgb, vec3(0.0)); // We seem to have some negative values for some reason
// This physically doesn't make sense but fits Minecraft
const float texturePreservation = 0.7;
compositeReflection.rgb = mix(compositeReflection.rgb, max(color, compositeReflection.rgb), texturePreservation);
color = mix(color, compositeReflection.rgb, fresnelM);
}
#endif
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
else { // Translucents
vec4 ssrReflection = texture2D(colortex8, texCoordM);
color = max(color - ssrReflection.rgb, vec3(0.0));
compositeReflection.rgb *= fresnelM;
compositeReflection = mix(compositeReflection, ssrReflection, float(ssrReflection.a > 0.999));
vec3 combinedRef = mix(ssrReflection.rgb, compositeReflection.rgb, compositeReflection.a);
color += combinedRef;
}
#endif
}
}
#endif
vec4 screenPos1 = vec4(texCoord, z1, 1.0);
vec4 viewPos1 = gbufferProjectionInverse * (screenPos1 * 2.0 - 1.0);
viewPos1 /= viewPos1.w;
float lViewPos1 = length(viewPos1.xyz);
#if defined DISTANT_HORIZONS && !defined OVERWORLD
float z1DH = texelFetch(dhDepthTex1, texelCoord, 0).r;
vec4 screenPos1DH = vec4(texCoord, z1DH, 1.0);
vec4 viewPos1DH = dhProjectionInverse * (screenPos1DH * 2.0 - 1.0);
viewPos1DH /= viewPos1DH.w;
lViewPos1 = min(lViewPos1, length(viewPos1DH.xyz));
#endif
#if defined LIGHTSHAFTS_ACTIVE || RAINBOWS > 0 && defined OVERWORLD
vec3 nViewPos = normalize(viewPos1.xyz);
float VdotL = dot(nViewPos, lightVec);
float VdotU = dot(nViewPos, upVec);
#endif
#if defined NETHER_STORM || defined COLORED_LIGHT_FOG || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || (defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900)
vec3 playerPos = ViewToPlayer(viewPos1.xyz);
vec3 nPlayerPos = normalize(playerPos);
#endif
#if RAINBOWS > 0 && defined OVERWORLD
color += GetRainbow(translucentMult, nViewPos, z0, z1, lViewPos, lViewPos1, VdotL, VdotU, dither);
#endif
float vlFactorM = 0.0;
#ifdef LIGHTSHAFTS_ACTIVE
vlFactorM = vlFactor;
volumetricEffect = GetVolumetricLight(color, vlFactorM, translucentMult, lViewPos, lViewPos1, nViewPos, VdotL, VdotU, texCoord, z0, z1, dither);
#endif
float lightFogLength = 0.0;
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
vec4 endCrystalVortex = pow2(EndCrystalVortices(vec3(0.0), playerPos, dither));
volumetricEffect = sqrt(pow2(volumetricEffect) + endCrystalVortex);
lightFogLength = sqrt(pow2(lightFogLength) + length(endCrystalVortex.rgb));
#endif
#ifdef NETHER_STORM
volumetricEffect = GetNetherStorm(color, translucentMult, nPlayerPos, playerPos, lViewPos, lViewPos1, dither);
#endif
#ifdef ATM_COLOR_MULTS
volumetricEffect.rgb *= GetAtmColorMult();
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
volumetricEffect.rgb *= moonPhaseInfluence;
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
vec4 endPortalBeam = pow2(GetEndPortalBeam(vec3(0.0), playerPos));
volumetricEffect = sqrt(pow2(volumetricEffect) + endPortalBeam);
lightFogLength = sqrt(pow2(lightFogLength) + length(endPortalBeam.rgb));
#endif
#ifdef NETHER_STORM
color = mix(color, volumetricEffect.rgb, volumetricEffect.a);
#endif
#ifdef COLORED_LIGHT_FOG
vec3 lightFog = GetColoredLightFog(nPlayerPos, translucentMult, lViewPos, lViewPos1, dither, vlFactorM);
float lightFogMult = COLORED_LIGHT_FOG_I;
lightFogLength += length(lightFog);
//if (heldItemId == 40000 && heldItemId2 != 40000) lightFogMult = 0.0; // Hold spider eye to disable light fog
#ifdef OVERWORLD
#if COLORED_LIGHT_FOG_RAIN_I > 0
lightFogMult = mix(lightFogMult, COLORED_LIGHT_FOG_RAIN_I * 0.01, rainFactor * inRainy);
#endif
lightFogMult *= 0.2 + 0.6 * mix(1.0, 1.0 - sunFactor * invRainFactor, eyeBrightnessM);
#endif
#endif
if (isEyeInWater == 1) {
if (z0 == 1.0) color.rgb = waterFogColor;
vec3 underwaterMult = vec3(0.80, 0.87, 0.97);
#if DARKER_DEPTH_OCEANS > 0
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
float renderDistanceFade = lViewPos * 20.0 / far;
float lightSourceFactor = pow3(1.0 - texture6.a);
lightSourceFactor += renderDistanceFade;
lightSourceFactor = clamp01(lightSourceFactor);
float heldLight = max(heldBlockLightValue, heldBlockLightValue2);
if (heldLight > 0){
if (heldItemId == 45032 || heldItemId2 == 45032) heldLight = 15; // Lava Bucket
heldLight = clamp(heldLight, 0.0, 15.0);
heldLight = sqrt2(heldLight / 15.0) * -1.0 + 1.0; // Normalize and invert
heldLight = mix(heldLight, 1.0, clamp01((lViewPos) * 35.0 / far)); // Only do it around the player
} else {
heldLight = 1.0;
}
float mixFactor = heldLight * lightSourceFactor * (1.0 - nightVision);
float waterDepthStart = waterAltitude + 10;
float depthFactor = clamp01(10.0 / abs(min(cameraPosition.y, waterDepthStart + 0.001) - waterDepthStart));
float depthDarkness = clamp(abs(1.0 - (1.0 - depthFactor) * (1.0 - depthFactor)), DARKER_DEPTH_OCEANS * 0.05, 1.0);
underwaterMult *= mix(1.0, depthDarkness, mixFactor);
#endif
color.rgb *= underwaterMult * 0.85;
volumetricEffect.rgb *= pow2(underwaterMult * 0.71);
#ifdef COLORED_LIGHT_FOG
lightFog *= underwaterMult;
#endif
} else if (isEyeInWater == 2) {
if (z1 == 1.0) color.rgb = fogColor * 5.0;
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 1.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 1.0, colorEndBreath, 1.0);
#endif
volumetricEffect.rgb *= 0.0;
#ifdef COLORED_LIGHT_FOG
lightFog *= 0.0;
#endif
}
#ifdef COLORED_LIGHT_FOG
color /= 1.0 + pow2(GetLuminance(lightFog)) * lightFogMult * 2.0;
lightFog = lightFog * lightFogMult * 0.5;
#ifdef TAA
// TAA neighbourhood clamping causes light fog to go too bandy. Extra dither fixes it.
lightFog = max(vec3(0.0), lightFog + (dither - 0.5) * 0.02);
#endif
color += lightFog;
#endif
color = pow(color, vec3(2.2));
#if defined LIGHTSHAFTS_ACTIVE || defined END_PORTAL_BEAM_INTERNAL
#ifdef END
volumetricEffect.rgb *= volumetricEffect.rgb;
#endif
color += volumetricEffect.rgb;
#endif
#ifdef BLOOM_FOG_COMPOSITE1
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-2-3
#endif
#if RETRO_LOOK == 1
color.rgb *= vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.5 * RETRO_LOOK_I;
#elif RETRO_LOOK == 2
color.rgb *= mix(vec3(1.0), vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.5, nightVision) * RETRO_LOOK_I;
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
#if LIGHTSHAFT_QUALI_DEFINE > 0 && LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 && defined OVERWORLD || defined END || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || defined COLORED_LIGHT_FOG
vec4 texture5 = vec4(0.0);
#if LENSFLARE_MODE > 0 || defined ENTITY_TAA_NOISY_CLOUD_FIX || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || defined COLORED_LIGHT_FOG
texture5 = texelFetch(colortex5, texelCoord, 0);
if (viewWidth + viewHeight - gl_FragCoord.x - gl_FragCoord.y > 1.5)
vlFactorM = texture5.a;
#endif
texture5.r = sqrt(pow2(texture5.r) + lightFogLength);
/* DRAWBUFFERS:05 */
gl_FragData[1] = vec4(texture5.r, 0.0, 0.0, vlFactorM);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
flat out vec3 upVec, sunVec;
#ifdef LIGHTSHAFTS_ACTIVE
flat out float vlFactor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#ifdef LIGHTSHAFTS_ACTIVE
#if LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#else
#if LIGHTSHAFT_BEHAVIOUR == 2
vlFactor = 0.0;
#elif LIGHTSHAFT_BEHAVIOUR == 3
vlFactor = 1.0;
#endif
#endif
#endif
}
#endif
@@ -1,137 +1,137 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite2.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
//Common Variables//
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
#ifdef SS_BLOCKLIGHT
#include "/lib/misc/reprojection.glsl"
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
vec2 OffsetDist(float x) {
float n = fract(x * 16.2) * 2 * pi;
return vec2(cos(n), sin(n)) * x;
}
vec4 GetMultiColoredBlocklight(vec4 lightAlbedo, vec2 coord, float z, float dither) {
vec3 cameraOffset = cameraPosition - previousCameraPosition;
cameraOffset *= float(z * 2.0 - 1.0 > 0.56);
vec2 prevCoord = Reprojection(vec3(coord, z), cameraOffset);
float lz = GetLinearDepth(z);
float distScale = clamp((far - near) * lz + near, 4.0, 128.0);
float fovScale = gbufferProjection[1][1] / 1.37;
vec2 blurstr = vec2(1.0 / (viewWidth / viewHeight), 1.0) * fovScale / distScale;
vec4 previousColoredLight = vec4(0.0);
float mask = clamp(2.0 - 2.0 * max(abs(prevCoord.x - 0.5), abs(prevCoord.y - 0.5)), 0.0, 1.0);
vec2 offset = OffsetDist(dither) * blurstr;
vec2 sampleZPos = coord + offset;
float sampleZ0 = texture2D(depthtex0, sampleZPos).r;
float sampleZ1 = texture2D(depthtex1, sampleZPos).r;
float linearSampleZ = GetLinearDepth(sampleZ1 >= 1.0 ? sampleZ0 : sampleZ1);
float sampleWeight = clamp(abs(lz - linearSampleZ) * far / 16.0, 0.0, 1.0);
sampleWeight = 1.0 - sampleWeight * sampleWeight;
previousColoredLight += texture2D(colortex10, prevCoord.xy + offset) * sampleWeight;
previousColoredLight *= previousColoredLight * mask;
lightAlbedo = clamp01(lightAlbedo);
if (lightAlbedo.g + lightAlbedo.b < 0.05) lightAlbedo.r *= 0.45; // red color reduction to prevent redstone from overpowering everything
return sqrt(max(vec4(0.0), mix(previousColoredLight, lightAlbedo * lightAlbedo / clamp(previousColoredLight.r + previousColoredLight.g + previousColoredLight.b, 0.01, 1.0), 0.01)));
}
#endif
//Includes//
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
#if defined SS_BLOCKLIGHT
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
float z = texture2D(depthtex1, texCoord).x;
float dither;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
#endif
// SS_BLOCKLIGHT code
#ifdef SS_BLOCKLIGHT
vec4 lightAlbedo = texture2D(colortex9, texCoord);
dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ENTITIES_ARE_LIGHT
int heldBlockLight = 0;
heldBlockLight = (viewPos.x > 0.0 ^^ isRightHanded) ? heldBlockLightValue2 : heldBlockLightValue;
if (heldBlockLight > 0) {
lightAlbedo.a *= 30;
}
#endif
float lightZ = z >= 1.0 ? z0 : z;
vec4 coloredLight = GetMultiColoredBlocklight(lightAlbedo, texCoord, lightZ, dither);
#endif
#ifdef SS_BLOCKLIGHT
/* RENDERTARGETS: 0,10 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(coloredLight);
#else
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite2.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
//Common Variables//
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
#ifdef SS_BLOCKLIGHT
#include "/lib/misc/reprojection.glsl"
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
vec2 OffsetDist(float x) {
float n = fract(x * 16.2) * 2 * pi;
return vec2(cos(n), sin(n)) * x;
}
vec4 GetMultiColoredBlocklight(vec4 lightAlbedo, vec2 coord, float z, float dither) {
vec3 cameraOffset = cameraPosition - previousCameraPosition;
cameraOffset *= float(z * 2.0 - 1.0 > 0.56);
vec2 prevCoord = Reprojection(vec3(coord, z), cameraOffset);
float lz = GetLinearDepth(z);
float distScale = clamp((far - near) * lz + near, 4.0, 128.0);
float fovScale = gbufferProjection[1][1] / 1.37;
vec2 blurstr = vec2(1.0 / (viewWidth / viewHeight), 1.0) * fovScale / distScale;
vec4 previousColoredLight = vec4(0.0);
float mask = clamp(2.0 - 2.0 * max(abs(prevCoord.x - 0.5), abs(prevCoord.y - 0.5)), 0.0, 1.0);
vec2 offset = OffsetDist(dither) * blurstr;
vec2 sampleZPos = coord + offset;
float sampleZ0 = texture2D(depthtex0, sampleZPos).r;
float sampleZ1 = texture2D(depthtex1, sampleZPos).r;
float linearSampleZ = GetLinearDepth(sampleZ1 >= 1.0 ? sampleZ0 : sampleZ1);
float sampleWeight = clamp(abs(lz - linearSampleZ) * far / 16.0, 0.0, 1.0);
sampleWeight = 1.0 - sampleWeight * sampleWeight;
previousColoredLight += texture2D(colortex10, prevCoord.xy + offset) * sampleWeight;
previousColoredLight *= previousColoredLight * mask;
lightAlbedo = clamp01(lightAlbedo);
if (lightAlbedo.g + lightAlbedo.b < 0.05) lightAlbedo.r *= 0.45; // red color reduction to prevent redstone from overpowering everything
return sqrt(max(vec4(0.0), mix(previousColoredLight, lightAlbedo * lightAlbedo / clamp(previousColoredLight.r + previousColoredLight.g + previousColoredLight.b, 0.01, 1.0), 0.01)));
}
#endif
//Includes//
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
#if defined SS_BLOCKLIGHT
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
float z = texture2D(depthtex1, texCoord).x;
float dither;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
#endif
// SS_BLOCKLIGHT code
#ifdef SS_BLOCKLIGHT
vec4 lightAlbedo = texture2D(colortex9, texCoord);
dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ENTITIES_ARE_LIGHT
int heldBlockLight = 0;
heldBlockLight = (viewPos.x > 0.0 ^^ isRightHanded) ? heldBlockLightValue2 : heldBlockLightValue;
if (heldBlockLight > 0) {
lightAlbedo.a *= 30;
}
#endif
float lightZ = z >= 1.0 ? z0 : z;
vec4 coloredLight = GetMultiColoredBlocklight(lightAlbedo, texCoord, lightZ, dither);
#endif
#ifdef SS_BLOCKLIGHT
/* RENDERTARGETS: 0,10 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(coloredLight);
#else
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
@@ -1,287 +1,287 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite3.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
const bool colortex0MipmapEnabled = true;
#endif
//Common Variables//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
#if (WORLD_BLUR == 2 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0) && WB_DOF_FOCUS >= 0
#if WB_DOF_FOCUS == 0
uniform float centerDepthSmooth;
#else
float centerDepthSmooth = (far * (WB_DOF_FOCUS - near)) / (WB_DOF_FOCUS * (far - near));
#endif
#endif
#endif
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float DoFSneaking = isSneaking * float(heldItemId == 45014 || heldItemId2 == 45014);
bool isDoFGUI = hideGUI == 0 && (heldItemId == 45014 || heldItemId2 == 45014); // while holding a spyglass
vec2 dofOffsets[18] = vec2[18](
vec2( 0.0 , 0.25 ),
vec2(-0.2165 , 0.125 ),
vec2(-0.2165 , -0.125 ),
vec2( 0 , -0.25 ),
vec2( 0.2165 , -0.125 ),
vec2( 0.2165 , 0.125 ),
vec2( 0 , 0.5 ),
vec2(-0.25 , 0.433 ),
vec2(-0.433 , 0.25 ),
vec2(-0.5 , 0 ),
vec2(-0.433 , -0.25 ),
vec2(-0.25 , -0.433 ),
vec2( 0 , -0.5 ),
vec2( 0.25 , -0.433 ),
vec2( 0.433 , -0.2 ),
vec2( 0.5 , 0 ),
vec2( 0.433 , 0.25 ),
vec2( 0.25 , 0.433 )
);
#endif
vec2 getPolygonOffset(float angle, int sides, float radius) { // based on the hexablur function by halcy from https://www.shadertoy.com/view/4tK3WK
float rotationRadians = DOF_SHAPE_ROTATION_DEGREES * (pi / 180.0);
// Calculate regular polygon coordinates
float segmentAngle = 2.0 * pi / float(sides);
float r = cos(pi / float(sides)) / cos(mod(angle, segmentAngle) - pi / float(sides));
r *= radius;
vec2 baseCoord = vec2(sin(angle), cos(angle)) * r;
return rotate(rotationRadians) * baseCoord;
}
//Common Functions//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
void DoWorldBlur(inout vec3 color, float z1, float lViewPos0) {
if (z1 < 0.56) return;
vec3 dof = vec3(0.0);
vec3 cocColor = vec3(1, 0, 0.8) * 10.0;
vec2 dofScale = vec2(1.0, aspectRatio);
#if WORLD_BLUR == 1 // Distance Blur
#ifdef OVERWORLD
float dbMult;
if (isEyeInWater == 0) {
dbMult = mix(WB_DB_NIGHT_I, WB_DB_DAY_I, sunFactor * eyeBrightnessM);
dbMult = mix(dbMult, WB_DB_RAIN_I, rainFactor * eyeBrightnessM);
} else dbMult = WB_DB_WATER_I;
#elif defined NETHER
float dbMult = WB_DB_NETHER_I;
#elif defined END
float dbMult = WB_DB_END_I;
#endif
float coc = clamp(lViewPos0 * 0.001, 0.0, 0.1) * dbMult * 0.03;
#elif WORLD_BLUR == 2 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0 // Depth Of Field
#if TILT_SHIFT != 0
float tiltOffset = texCoord.y * 2.0 - 1.0;
tiltOffset *= 0.0007 * TILT_SHIFT;
#else
float tiltOffset = 0.0;
#endif
#if TILT_SHIFT2 != 0
float shiftOffset = texCoord.x * 2.0 - 1.0;
shiftOffset *= 0.0007 * TILT_SHIFT2;
#else
float shiftOffset = 0.0;
#endif
#if WB_DOF_FOCUS >= 0
float coc = max(abs(z1 - centerDepthSmooth + tiltOffset + shiftOffset) * 0.125 * WB_DOF_I - 0.0001, 0.0);
#elif WB_DOF_FOCUS == -1
float coc = clamp(abs(lViewPos0 * 0.005 - pow2(vsBrightness) + tiltOffset + shiftOffset), 0.0, 0.1) * WB_DOF_I * 0.03;
#endif
#endif
#ifdef DOF_VIEW_FOCUS_NEW2
float cocView = float(coc < 0.005 + 0.001 * abs(max(float(TILT_SHIFT), float(TILT_SHIFT2))) && coc > 0 && isDoFGUI);
#endif
#if TILT_SHIFT == 0 && TILT_SHIFT2 == 0
coc = coc / sqrt(coc * coc + 0.1);
#endif
#ifdef WB_FOV_SCALED
coc *= gbufferProjection[1][1] * 0.8;
#endif
#ifdef WB_CHROMATIC
float midDistX = texCoord.x - 0.5;
float midDistY = texCoord.y - 0.5;
vec2 chromaticScale = vec2(midDistX, midDistY);
chromaticScale = sign(chromaticScale) * sqrt(abs(chromaticScale));
chromaticScale *= vec2(1.0, viewHeight / viewWidth);
vec2 aberration = (15.0 / vec2(viewWidth, viewHeight)) * chromaticScale * coc;
#endif
#if DOF_SHAPE == 0 // Original mode
#ifdef WB_ANAMORPHIC
dofScale *= vec2(0.5, 1.5);
#endif
#endif
if (coc * 0.5 > 1.0 / max(viewWidth, viewHeight)) {
#if DOF_SHAPE == 0 // Original implementation
for (int i = 0; i < 18; i++) {
vec2 offset = dofOffsets[i] * coc * 0.0085 * dofScale;
float lod = log2(viewHeight * aspectRatio * coc * 0.75 / 320.0);
#ifndef WB_CHROMATIC
dof += texture2DLod(colortex0, texCoord + offset, lod).rgb;
#else
dof += vec3(texture2DLod(colortex0, texCoord + offset + aberration, lod).r,
texture2DLod(colortex0, texCoord + offset , lod).g,
texture2DLod(colortex0, texCoord + offset - aberration, lod).b);
#endif
}
dof /= 18.0;
#elif DOF_SHAPE >= 3 && DOF_SHAPE <= 8
float totalWeight = 0.0;
float lod = log2(viewHeight * aspectRatio * coc * 0.75 / 320.0);
int polygonSamples = int(DOF_POLYGON_SAMPLES * 10);
// Sample in multiple concentric rings to fill the polygon
for (int ring = 1; ring <= DOF_POLYGON_RINGS; ring++) {
float ringFactor = float(ring) / float(DOF_POLYGON_RINGS);
// For each polygon ring, sample multiple points
for (int i = 0; i < polygonSamples; i++) {
float angle = float(i) * (2.0 * pi) / float(polygonSamples);
vec2 offset = getPolygonOffset(angle, DOF_SHAPE, ringFactor * coc * 0.01) * dofScale;
float weight = 1.0 - 0.2 * ringFactor; // Weight based on distance from center
#ifndef WB_CHROMATIC
vec3 sampleColor = texture2DLod(colortex0, texCoord + offset, lod).rgb;
dof += sampleColor * weight;
#else
dof += vec3(
texture2DLod(colortex0, texCoord + offset + aberration, lod).r,
texture2DLod(colortex0, texCoord + offset, lod).g,
texture2DLod(colortex0, texCoord + offset - aberration, lod).b
) * weight;
#endif
totalWeight += weight;
}
}
dof /= totalWeight;
#endif
#ifdef DOF_SNEAKING
color = mix(color, dof, DoFSneaking);
#else
color = dof;
#endif
}
#ifdef DOF_VIEW_FOCUS_NEW2
#ifdef DOF_SNEAKING
color = mix(color, cocColor, cocView * DoFSneaking);
#else
color = mix(color, cocColor, cocView);
#endif
#endif
}
#endif
//Includes//
#if (WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0) && defined BLOOM_FOG_COMPOSITE3
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
#if defined DISTANT_HORIZONS && defined NETHER
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
#ifdef DOF_SNEAKING
if (DoFSneaking > 0.1) {
#endif
DoWorldBlur(color, z1, lViewPos);
#ifdef DOF_SNEAKING
}
#endif
#ifdef BLOOM_FOG_COMPOSITE3
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-3
#endif
#endif
#if PIXELATED_SCREEN_SIZE > 0
if (int(texelFetch(colortex6, texelCoord, 0).g * 255.1) == 252) { // Selection Outline
color *= max(abs(100.0 - PIXELATED_SCREEN_SIZE * 2.0), 1.0);
#if SELECT_OUTLINE == 4 || SELECT_OUTLINE == 1
color *= 4;
#endif
}
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
noperspective out vec2 texCoord;
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite3.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
const bool colortex0MipmapEnabled = true;
#endif
//Common Variables//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
#if (WORLD_BLUR == 2 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0) && WB_DOF_FOCUS >= 0
#if WB_DOF_FOCUS == 0
uniform float centerDepthSmooth;
#else
float centerDepthSmooth = (far * (WB_DOF_FOCUS - near)) / (WB_DOF_FOCUS * (far - near));
#endif
#endif
#endif
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float DoFSneaking = isSneaking * float(heldItemId == 45014 || heldItemId2 == 45014);
bool isDoFGUI = hideGUI == 0 && (heldItemId == 45014 || heldItemId2 == 45014); // while holding a spyglass
vec2 dofOffsets[18] = vec2[18](
vec2( 0.0 , 0.25 ),
vec2(-0.2165 , 0.125 ),
vec2(-0.2165 , -0.125 ),
vec2( 0 , -0.25 ),
vec2( 0.2165 , -0.125 ),
vec2( 0.2165 , 0.125 ),
vec2( 0 , 0.5 ),
vec2(-0.25 , 0.433 ),
vec2(-0.433 , 0.25 ),
vec2(-0.5 , 0 ),
vec2(-0.433 , -0.25 ),
vec2(-0.25 , -0.433 ),
vec2( 0 , -0.5 ),
vec2( 0.25 , -0.433 ),
vec2( 0.433 , -0.2 ),
vec2( 0.5 , 0 ),
vec2( 0.433 , 0.25 ),
vec2( 0.25 , 0.433 )
);
#endif
vec2 getPolygonOffset(float angle, int sides, float radius) { // based on the hexablur function by halcy from https://www.shadertoy.com/view/4tK3WK
float rotationRadians = DOF_SHAPE_ROTATION_DEGREES * (pi / 180.0);
// Calculate regular polygon coordinates
float segmentAngle = 2.0 * pi / float(sides);
float r = cos(pi / float(sides)) / cos(mod(angle, segmentAngle) - pi / float(sides));
r *= radius;
vec2 baseCoord = vec2(sin(angle), cos(angle)) * r;
return rotate(rotationRadians) * baseCoord;
}
//Common Functions//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
void DoWorldBlur(inout vec3 color, float z1, float lViewPos0) {
if (z1 < 0.56) return;
vec3 dof = vec3(0.0);
vec3 cocColor = vec3(1, 0, 0.8) * 10.0;
vec2 dofScale = vec2(1.0, aspectRatio);
#if WORLD_BLUR == 1 // Distance Blur
#ifdef OVERWORLD
float dbMult;
if (isEyeInWater == 0) {
dbMult = mix(WB_DB_NIGHT_I, WB_DB_DAY_I, sunFactor * eyeBrightnessM);
dbMult = mix(dbMult, WB_DB_RAIN_I, rainFactor * eyeBrightnessM);
} else dbMult = WB_DB_WATER_I;
#elif defined NETHER
float dbMult = WB_DB_NETHER_I;
#elif defined END
float dbMult = WB_DB_END_I;
#endif
float coc = clamp(lViewPos0 * 0.001, 0.0, 0.1) * dbMult * 0.03;
#elif WORLD_BLUR == 2 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0 // Depth Of Field
#if TILT_SHIFT != 0
float tiltOffset = texCoord.y * 2.0 - 1.0;
tiltOffset *= 0.0007 * TILT_SHIFT;
#else
float tiltOffset = 0.0;
#endif
#if TILT_SHIFT2 != 0
float shiftOffset = texCoord.x * 2.0 - 1.0;
shiftOffset *= 0.0007 * TILT_SHIFT2;
#else
float shiftOffset = 0.0;
#endif
#if WB_DOF_FOCUS >= 0
float coc = max(abs(z1 - centerDepthSmooth + tiltOffset + shiftOffset) * 0.125 * WB_DOF_I - 0.0001, 0.0);
#elif WB_DOF_FOCUS == -1
float coc = clamp(abs(lViewPos0 * 0.005 - pow2(vsBrightness) + tiltOffset + shiftOffset), 0.0, 0.1) * WB_DOF_I * 0.03;
#endif
#endif
#ifdef DOF_VIEW_FOCUS_NEW2
float cocView = float(coc < 0.005 + 0.001 * abs(max(float(TILT_SHIFT), float(TILT_SHIFT2))) && coc > 0 && isDoFGUI);
#endif
#if TILT_SHIFT == 0 && TILT_SHIFT2 == 0
coc = coc / sqrt(coc * coc + 0.1);
#endif
#ifdef WB_FOV_SCALED
coc *= gbufferProjection[1][1] * 0.8;
#endif
#ifdef WB_CHROMATIC
float midDistX = texCoord.x - 0.5;
float midDistY = texCoord.y - 0.5;
vec2 chromaticScale = vec2(midDistX, midDistY);
chromaticScale = sign(chromaticScale) * sqrt(abs(chromaticScale));
chromaticScale *= vec2(1.0, viewHeight / viewWidth);
vec2 aberration = (15.0 / vec2(viewWidth, viewHeight)) * chromaticScale * coc;
#endif
#if DOF_SHAPE == 0 // Original mode
#ifdef WB_ANAMORPHIC
dofScale *= vec2(0.5, 1.5);
#endif
#endif
if (coc * 0.5 > 1.0 / max(viewWidth, viewHeight)) {
#if DOF_SHAPE == 0 // Original implementation
for (int i = 0; i < 18; i++) {
vec2 offset = dofOffsets[i] * coc * 0.0085 * dofScale;
float lod = log2(viewHeight * aspectRatio * coc * 0.75 / 320.0);
#ifndef WB_CHROMATIC
dof += texture2DLod(colortex0, texCoord + offset, lod).rgb;
#else
dof += vec3(texture2DLod(colortex0, texCoord + offset + aberration, lod).r,
texture2DLod(colortex0, texCoord + offset , lod).g,
texture2DLod(colortex0, texCoord + offset - aberration, lod).b);
#endif
}
dof /= 18.0;
#elif DOF_SHAPE >= 3 && DOF_SHAPE <= 8
float totalWeight = 0.0;
float lod = log2(viewHeight * aspectRatio * coc * 0.75 / 320.0);
int polygonSamples = int(DOF_POLYGON_SAMPLES * 10);
// Sample in multiple concentric rings to fill the polygon
for (int ring = 1; ring <= DOF_POLYGON_RINGS; ring++) {
float ringFactor = float(ring) / float(DOF_POLYGON_RINGS);
// For each polygon ring, sample multiple points
for (int i = 0; i < polygonSamples; i++) {
float angle = float(i) * (2.0 * pi) / float(polygonSamples);
vec2 offset = getPolygonOffset(angle, DOF_SHAPE, ringFactor * coc * 0.01) * dofScale;
float weight = 1.0 - 0.2 * ringFactor; // Weight based on distance from center
#ifndef WB_CHROMATIC
vec3 sampleColor = texture2DLod(colortex0, texCoord + offset, lod).rgb;
dof += sampleColor * weight;
#else
dof += vec3(
texture2DLod(colortex0, texCoord + offset + aberration, lod).r,
texture2DLod(colortex0, texCoord + offset, lod).g,
texture2DLod(colortex0, texCoord + offset - aberration, lod).b
) * weight;
#endif
totalWeight += weight;
}
}
dof /= totalWeight;
#endif
#ifdef DOF_SNEAKING
color = mix(color, dof, DoFSneaking);
#else
color = dof;
#endif
}
#ifdef DOF_VIEW_FOCUS_NEW2
#ifdef DOF_SNEAKING
color = mix(color, cocColor, cocView * DoFSneaking);
#else
color = mix(color, cocColor, cocView);
#endif
#endif
}
#endif
//Includes//
#if (WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0) && defined BLOOM_FOG_COMPOSITE3
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
#if defined DISTANT_HORIZONS && defined NETHER
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
#ifdef DOF_SNEAKING
if (DoFSneaking > 0.1) {
#endif
DoWorldBlur(color, z1, lViewPos);
#ifdef DOF_SNEAKING
}
#endif
#ifdef BLOOM_FOG_COMPOSITE3
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-3
#endif
#endif
#if PIXELATED_SCREEN_SIZE > 0
if (int(texelFetch(colortex6, texelCoord, 0).g * 255.1) == 252) { // Selection Outline
color *= max(abs(100.0 - PIXELATED_SCREEN_SIZE * 2.0), 1.0);
#if SELECT_OUTLINE == 4 || SELECT_OUTLINE == 1
color *= 4;
#endif
}
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
noperspective out vec2 texCoord;
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
@@ -1,195 +1,195 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/bloom.glsl"
#include "/lib/shaderSettings/worldMotionBlur.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
const bool colortex0MipmapEnabled = true;
//Common Variables//
float weight[7] = float[7](1.0, 6.0, 15.0, 20.0, 15.0, 6.0, 1.0);
vec2 view = vec2(viewWidth, viewHeight);
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
#endif
//Common Functions//
vec3 BloomTile(float lod, vec2 offset, vec2 scaledCoord) {
vec3 bloom = vec3(0.0);
float scale = exp2(lod);
vec2 coord = (scaledCoord - offset) * scale;
float padding = 0.5 + 0.005 * scale;
if (abs(coord.x - 0.5) < padding && abs(coord.y - 0.5) < padding) {
for (int i = -3; i <= 3; i++) {
for (int j = -3; j <= 3; j++) {
float wg = weight[i + 3] * weight[j + 3];
vec2 pixelOffset = vec2(i, j) / view;
vec2 bloomCoord = (scaledCoord - offset + pixelOffset) * scale;
bloom += texture2D(colortex0, bloomCoord).rgb * wg;
}
}
bloom /= 4096.0;
}
return pow(bloom / 128.0, vec3(0.25));
}
//Includes//
#if MOTION_BLUR_EFFECT == 1
#include "/lib/util/dither.glsl"
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#endif
//Program//
void main() {
vec3 blur = vec3(0.0);
#if BLOOM_ENABLED == 1
vec2 scaledCoord = texCoord * max(vec2(viewWidth, viewHeight) / vec2(1920.0, 1080.0), vec2(1.0));
#if defined OVERWORLD || defined END
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), scaledCoord);
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), scaledCoord);
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), scaledCoord);
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), scaledCoord) * 0.8;
blur += BloomTile(6.0, vec2(0.135 , 0.3325), scaledCoord) * 0.8;
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), scaledCoord) * 0.6;
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), scaledCoord) * 0.4;
#else
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), scaledCoord);
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), scaledCoord);
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), scaledCoord);
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), scaledCoord);
blur += BloomTile(6.0, vec2(0.135 , 0.3325), scaledCoord);
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), scaledCoord);
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), scaledCoord) * 0.6;
#endif
#endif
#if MOTION_BLUR_EFFECT == 1
vec3 color = vec3(0.0);
float z = texture2D(depthtex1, texCoord).x;
float dither = Bayer64(gl_FragCoord.xy);
if (z <= 0.56) {
color = texelFetch(colortex0, texelCoord, 0).rgb;
} else {
float mbwg = 0.0;
vec2 doublePixel = 2.0 / vec2(viewWidth, viewHeight);
vec4 currentPosition = vec4(texCoord, z, 1.0) * 2.0 - 1.0;
vec4 viewPos = gbufferProjectionInverse * currentPosition;
viewPos = gbufferModelViewInverse * viewPos;
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
vec3 cameraOffset = cameraPosition - previousCameraPosition;
vec4 previousPosition = viewPos + vec4(cameraOffset, 0.0);
previousPosition = gbufferPreviousModelView * previousPosition;
previousPosition = gbufferPreviousProjection * previousPosition;
previousPosition /= previousPosition.w;
vec2 velocity = (currentPosition - previousPosition).xy;
velocity = velocity / (1.0 + length(velocity)) * MOTION_BLURRING_STRENGTH;
#ifndef LOW_QUALITY_MOTION_BLUR
int sampleCount = 9;
velocity *= 0.02;
#else
int sampleCount = 3;
velocity *= 0.06;
#endif
vec2 coord = texCoord - velocity * (float(sampleCount) / 2.0 - 1.0 + dither);
for (int i = 0; i < sampleCount; i++, coord += velocity) {
vec2 coordb = clamp(coord, doublePixel, 1.0 - doublePixel);
vec3 sampleb = texture2DLod(colortex0, coordb, 0).rgb;
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
float z1 = texture2D(depthtex1, coordb).r;
vec4 screenPos = vec4(coordb, z1, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
// Remove bloom fog from mb samples or else we get edge artifacts
sampleb /= GetBloomFog(lViewPos);
#endif
color += sampleb;
mbwg += 1.0;
}
color /= mbwg;
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
// Reapply bloom fog because we removed it from our samples
color *= GetBloomFog(lViewPos);
#endif
}
#endif
/* DRAWBUFFERS:3 */
gl_FragData[0] = vec4(blur, 1.0);
#if MOTION_BLUR_EFFECT == 1
/* DRAWBUFFERS:30 */
gl_FragData[1] = vec4(color, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = gl_MultiTexCoord0.xy;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/bloom.glsl"
#include "/lib/shaderSettings/worldMotionBlur.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
const bool colortex0MipmapEnabled = true;
//Common Variables//
float weight[7] = float[7](1.0, 6.0, 15.0, 20.0, 15.0, 6.0, 1.0);
vec2 view = vec2(viewWidth, viewHeight);
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
#endif
//Common Functions//
vec3 BloomTile(float lod, vec2 offset, vec2 scaledCoord) {
vec3 bloom = vec3(0.0);
float scale = exp2(lod);
vec2 coord = (scaledCoord - offset) * scale;
float padding = 0.5 + 0.005 * scale;
if (abs(coord.x - 0.5) < padding && abs(coord.y - 0.5) < padding) {
for (int i = -3; i <= 3; i++) {
for (int j = -3; j <= 3; j++) {
float wg = weight[i + 3] * weight[j + 3];
vec2 pixelOffset = vec2(i, j) / view;
vec2 bloomCoord = (scaledCoord - offset + pixelOffset) * scale;
bloom += texture2D(colortex0, bloomCoord).rgb * wg;
}
}
bloom /= 4096.0;
}
return pow(bloom / 128.0, vec3(0.25));
}
//Includes//
#if MOTION_BLUR_EFFECT == 1
#include "/lib/util/dither.glsl"
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#endif
//Program//
void main() {
vec3 blur = vec3(0.0);
#if BLOOM_ENABLED == 1
vec2 scaledCoord = texCoord * max(vec2(viewWidth, viewHeight) / vec2(1920.0, 1080.0), vec2(1.0));
#if defined OVERWORLD || defined END
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), scaledCoord);
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), scaledCoord);
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), scaledCoord);
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), scaledCoord) * 0.8;
blur += BloomTile(6.0, vec2(0.135 , 0.3325), scaledCoord) * 0.8;
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), scaledCoord) * 0.6;
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), scaledCoord) * 0.4;
#else
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), scaledCoord);
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), scaledCoord);
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), scaledCoord);
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), scaledCoord);
blur += BloomTile(6.0, vec2(0.135 , 0.3325), scaledCoord);
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), scaledCoord);
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), scaledCoord) * 0.6;
#endif
#endif
#if MOTION_BLUR_EFFECT == 1
vec3 color = vec3(0.0);
float z = texture2D(depthtex1, texCoord).x;
float dither = Bayer64(gl_FragCoord.xy);
if (z <= 0.56) {
color = texelFetch(colortex0, texelCoord, 0).rgb;
} else {
float mbwg = 0.0;
vec2 doublePixel = 2.0 / vec2(viewWidth, viewHeight);
vec4 currentPosition = vec4(texCoord, z, 1.0) * 2.0 - 1.0;
vec4 viewPos = gbufferProjectionInverse * currentPosition;
viewPos = gbufferModelViewInverse * viewPos;
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
vec3 cameraOffset = cameraPosition - previousCameraPosition;
vec4 previousPosition = viewPos + vec4(cameraOffset, 0.0);
previousPosition = gbufferPreviousModelView * previousPosition;
previousPosition = gbufferPreviousProjection * previousPosition;
previousPosition /= previousPosition.w;
vec2 velocity = (currentPosition - previousPosition).xy;
velocity = velocity / (1.0 + length(velocity)) * MOTION_BLURRING_STRENGTH;
#ifndef LOW_QUALITY_MOTION_BLUR
int sampleCount = 9;
velocity *= 0.02;
#else
int sampleCount = 3;
velocity *= 0.06;
#endif
vec2 coord = texCoord - velocity * (float(sampleCount) / 2.0 - 1.0 + dither);
for (int i = 0; i < sampleCount; i++, coord += velocity) {
vec2 coordb = clamp(coord, doublePixel, 1.0 - doublePixel);
vec3 sampleb = texture2DLod(colortex0, coordb, 0).rgb;
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
float z1 = texture2D(depthtex1, coordb).r;
vec4 screenPos = vec4(coordb, z1, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
// Remove bloom fog from mb samples or else we get edge artifacts
sampleb /= GetBloomFog(lViewPos);
#endif
color += sampleb;
mbwg += 1.0;
}
color /= mbwg;
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
// Reapply bloom fog because we removed it from our samples
color *= GetBloomFog(lViewPos);
#endif
}
#endif
/* DRAWBUFFERS:3 */
gl_FragData[0] = vec4(blur, 1.0);
#if MOTION_BLUR_EFFECT == 1
/* DRAWBUFFERS:30 */
gl_FragData[1] = vec4(color, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = gl_MultiTexCoord0.xy;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
@@ -1,355 +1,355 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite5.glsl"
#include "/lib/shaderSettings/blueScreen.glsl"
#include "/lib/shaderSettings/bloom.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
//Common Variables//
float pw = 1.0 / viewWidth;
float ph = 1.0 / viewHeight;
vec2 view = vec2(viewWidth, viewHeight);
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
#endif
//Common Functions//
#include "/lib/colors/tonemaps.glsl"
void DoBSLColorSaturation(inout vec3 color) {
float saturationFactor = T_SATURATION + 0.07;
float grayVibrance = (color.r + color.g + color.b) / 3.0;
float graySaturation = grayVibrance;
if (saturationFactor < 1.00) graySaturation = dot(color, vec3(0.299, 0.587, 0.114));
float mn = min(color.r, min(color.g, color.b));
float mx = max(color.r, max(color.g, color.b));
float sat = (1.0 - (mx - mn)) * (1.0 - mx) * grayVibrance * 5.0;
vec3 lightness = vec3((mn + mx) * 0.5);
color = mix(color, mix(color, lightness, 1.0 - T_VIBRANCE), sat);
color = mix(color, lightness, (1.0 - lightness) * (2.0 - T_VIBRANCE) / 2.0 * abs(T_VIBRANCE - 1.0));
color = color * saturationFactor - graySaturation * (saturationFactor - 1.0);
}
#if BLOOM_ENABLED == 1
vec2 rescale = max(vec2(viewWidth, viewHeight) / vec2(1920.0, 1080.0), vec2(1.0));
vec3 GetBloomTile(float lod, vec2 coord, vec2 offset) {
float scale = exp2(lod);
vec2 bloomCoord = coord / scale + offset;
bloomCoord = clamp(bloomCoord, offset, 1.0 / scale + offset);
vec3 bloom = texture2D(colortex3, bloomCoord / rescale).rgb;
bloom *= bloom;
bloom *= bloom;
return bloom * 128.0;
}
void DoBloom(inout vec3 color, vec2 coord, float dither, float lViewPos) {
vec3 blur1 = GetBloomTile(2.0, coord, vec2(0.0 , 0.0 ));
vec3 blur2 = GetBloomTile(3.0, coord, vec2(0.0 , 0.26 ));
vec3 blur3 = GetBloomTile(4.0, coord, vec2(0.135 , 0.26 ));
vec3 blur4 = GetBloomTile(5.0, coord, vec2(0.2075 , 0.26 ));
vec3 blur5 = GetBloomTile(6.0, coord, vec2(0.135 , 0.3325));
vec3 blur6 = GetBloomTile(7.0, coord, vec2(0.160625 , 0.3325));
vec3 blur7 = GetBloomTile(8.0, coord, vec2(0.1784375, 0.3325));
vec3 blur = (blur1 + blur2 + blur3 + blur4 + blur5 + blur6 + blur7) * 0.14;
float bloomStrength = BLOOM_STRENGTH + 0.2 * darknessFactor;
#if defined BLOOM_FOG && defined NETHER && defined BORDER_FOG
float farM = min(renderDistance, NETHER_VIEW_LIMIT); // consistency9023HFUE85JG
float netherBloom = lViewPos / clamp(farM, 96.0, 256.0);
netherBloom *= netherBloom;
netherBloom *= netherBloom;
netherBloom = 1.0 - exp(-8.0 * netherBloom);
netherBloom *= 1.0 - maxBlindnessDarkness;
bloomStrength = mix(bloomStrength * 0.7, bloomStrength * 1.8, netherBloom);
#endif
color = mix(color, blur, bloomStrength);
//color += blur * bloomStrength * (ditherFactor.x + ditherFactor.y);
}
#endif
#include "/lib/util/colorConversion.glsl"
// #if COLORED_LIGHTING_INTERNAL > 0
// #include "/lib/voxelization/lightVoxelization.glsl"
// #endif
// http://www.diva-portal.org/smash/get/diva2:24136/FULLTEXT01.pdf
// The MIT License
// Copyright © 2024 Benjamin Stott "sixthsurge"
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vec3 purkinjeShift(vec3 rgb, vec4 texture6, vec3 playerPos, float lViewPos, float purkinjeOverwrite, float z0, float fogValue) {
float interiorFactorM = 0;
#ifdef NETHER
float nightDesaturationIntensity = NIGHT_DESATURATION_NETHER;
float renderdistanceFade = PURKINJE_RENDER_DISTANCE_FADE_NETHER;
interiorFactorM = 1.0;
#elif defined END
float nightDesaturationIntensity = NIGHT_DESATURATION_END;
nightFactor = 1.0;
float renderdistanceFade = 0.1;
interiorFactorM = -10000.0;
#else
float renderdistanceFade = PURKINJE_RENDER_DISTANCE_FADE;
#ifdef MOON_PHASE_INF_PURKINJE
float nightDesaturationIntensity = moonPhase == 0 ? MOON_PHASE_FULL_PURKINJE : moonPhase != 4 ? MOON_PHASE_PARTIAL_PURKINJE : MOON_PHASE_DARK_PURKINJE;
#else
float nightDesaturationIntensity = NIGHT_DESATURATION_OW;
#endif
#endif
float lightFogFactor = smoothstep(-0.5, 1.0, fogValue);
float renderDistanceFade = mix(0, lViewPos * 2.5 / far, renderdistanceFade * (1.0 - lightFogFactor));
if (isEyeInWater == 1) renderDistanceFade = lViewPos * 7.0 / far;
float nightCaveDesaturation = NIGHT_CAVE_DESATURATION * 0.1;
float skyLightFactor = texture6.b;
#ifdef IRIS_FEATURE_FADE_VARIABLE
if (skyLightFactor > 0.50001) skyLightFactor = eyeBrightnessM;
else skyLightFactor *= 1.9999;
#endif
float interiorFactor = isEyeInWater == 1 ? 0.0 : pow2(1.0 - skyLightFactor * (1.0 - lightFogFactor));
interiorFactor = mix(interiorFactor, interiorFactorM, renderDistanceFade);
interiorFactor -= sqrt2(eyeBrightnessM) * 0.66;
interiorFactor = smoothstep(0.0, 1.0, clamp01(interiorFactor));
// interiorFactor = 0.0;
// return vec3(interiorFactor);
float lightSourceFactor = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_NEAR_LIGHTS
lightSourceFactor = pow3(1.0 - texture6.a * (1.0 - lightFogFactor));
lightSourceFactor += renderDistanceFade;
lightSourceFactor = clamp01(lightSourceFactor);
#endif
float heldLight = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_LIGHTS_IN_HAND
heldLight = max(heldBlockLightValue, heldBlockLightValue2);
if (heldItemId == 45032 || heldItemId2 == 45032) heldLight = 15; // Lava Bucket
if (heldLight > 0){
heldLight = clamp(heldLight, 0.0, 15.0);
heldLight = sqrt2(heldLight / 15.0) * -1.0 + 1.0; // Normalize and invert
heldLight = mix(heldLight, 1.0, clamp01(lViewPos * 15 / far)); // Only do it around the player
} else {
heldLight = 1.0;
}
#endif
float nightVisionFactor = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_NIGHT_VISION
nightVisionFactor = nightVision * -1.0 + 1.0;
#endif
float purkinjeIntensity = 0.004 * purkinjeOverwrite * nightDesaturationIntensity;
purkinjeIntensity = purkinjeIntensity * fuzzyOr(interiorFactor, sqrt3(nightFactor - 0.1)); // No purkinje shift in daylight
purkinjeIntensity *= lightSourceFactor; // Reduce purkinje intensity in blocklight
purkinjeIntensity *= (1.0 - lightFogFactor);
purkinjeIntensity *= clamp01(nightCaveDesaturation + (1.0 - nightCaveDesaturation) * pow3(1.0 - interiorFactor)); // Reduce purkinje intensity underground
purkinjeIntensity *= clamp01(heldLight); // Reduce purkinje intensity when holding light sources
purkinjeIntensity *= nightVisionFactor * (1.0 - isLightningActive()); // Reduce purkinje intensity when using night vision or during lightning
purkinjeIntensity = clamp(purkinjeIntensity, 0.01, 1.0); // prevent it going to 0 to avoid NaNs
if (nightDesaturationIntensity < 300) {
float blueDominance = rgb.b / max(max(rgb.r, rgb.g), 0.01);
float blueReduction = smoothstep(0.9, 2.3, blueDominance);
// Create a darker tint for blue colors
vec3 purkinjeTint = vec3(0.5, 0.7, 1.0);
purkinjeTint *= mix(vec3(1.0), vec3(0.6, 0.7, 0.65), blueReduction * 0.7);
purkinjeTint *= rec709ToRec2020;
const vec3 rodResponse = vec3(7.15e-5, 4.81e-1, 3.28e-1) * rec709ToRec2020;
vec3 xyz = rgb * rec2020ToXyz;
vec3 scotopicLuminance = xyz * (1.33 * (1.0 + (xyz.y + xyz.z) / xyz.x) - 0.5);
float purkinje = dot(rodResponse, scotopicLuminance * xyzToRec2020) * 0.45;
float purkinjeFactor = exp2(-rcp(purkinjeIntensity) * purkinje) * (1.0 - blueReduction * 0.5);
rgb = mix(rgb, purkinje * purkinjeTint, purkinjeFactor);
} else {
rgb = mix(rgb, vec3(GetLuminance(rgb) * 0.9), clamp01(purkinjeIntensity));
}
// return vec3(purkinjeIntensity);
return max0(rgb);
}
//Includes//
#ifdef BLOOM_FOG
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#if BLOOM_ENABLED == 1
#include "/lib/util/dither.glsl"
#endif
#if LENSFLARE_MODE > 0 && defined OVERWORLD
#include "/lib/misc/lensFlare.glsl"
#endif
#include "/lib/util/spaceConversion.glsl"
//Program//
void main() {
vec3 color = texture2D(colortex0, texCoord).rgb;
vec4 texture5 = texelFetch(colortex5, texelCoord, 0);
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD || defined NIGHT_DESATURATION
float z0 = texture2D(depthtex0, texCoord).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
vec3 playerPos = ViewToPlayer(viewPos.xyz);
#else
float lViewPos = 0.0;
#endif
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
#if defined DISTANT_HORIZONS && defined NETHER
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef BLOOM_FOG
color /= GetBloomFog(lViewPos);
#endif
#if BLOOM_ENABLED == 1
DoBloom(color, texCoord, dither, lViewPos);
#endif
#ifdef COLORGRADING
color =
pow(color.r, GR_RC) * vec3(GR_RR, GR_RG, GR_RB) +
pow(color.g, GR_GC) * vec3(GR_GR, GR_GG, GR_GB) +
pow(color.b, GR_BC) * vec3(GR_BR, GR_BG, GR_BB);
color *= 0.01;
#endif
#ifdef TONEMAP_COMPARISON
color = texCoord.x < mix(0.5, 0.0, isSneaking) ? tonemap_left(color) : tonemap_right(color); // Thanks to SixthSurge
#else
color = tonemap(color);
#endif
color = clamp01(color);
#if defined GREEN_SCREEN_LIME || defined BLUE_SCREEN || SELECT_OUTLINE == 4 || defined NIGHT_DESATURATION
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
int materialMaskInt = int(texture6.g * 255.1);
#endif
float purkinjeOverwrite = 1.0;
#ifdef GREEN_SCREEN_LIME
if (materialMaskInt == 240) { // Green Screen Lime Blocks
color = vec3(0.0, 1.0, 0.0);
purkinjeOverwrite = 0.0;
}
#endif
#ifdef BLUE_SCREEN
if (materialMaskInt == 239) { // Blue Screen Blue Blocks
color = vec3(0.0, 0.0, 1.0);
purkinjeOverwrite = 0.0;
}
#endif
#if SELECT_OUTLINE == 4 || defined NIGHT_DESATURATION
if (materialMaskInt == 252) { // Selection Outline
#if SELECT_OUTLINE == 4 // Versatile Selection Outline
float colorMF = 1.0 - dot(color, vec3(0.25, 0.45, 0.1));
colorMF = smoothstep1(smoothstep1(smoothstep1(smoothstep1(smoothstep1(colorMF)))));
color = mix(color, 3.0 * (color + 0.2) * vec3(colorMF * SELECT_OUTLINE_I), 0.3);
#endif
purkinjeOverwrite = 0.0;
}
#endif
#if LENSFLARE_MODE > 0 && defined OVERWORLD
DoLensFlare(color, viewPos.xyz, dither);
#endif
DoBSLColorSaturation(color);
#ifdef NIGHT_DESATURATION
color.rgb = purkinjeShift(color.rgb, texture6, playerPos, lViewPos, purkinjeOverwrite, z0, texture5.r);
#endif
/* DRAWBUFFERS:35 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(vec3(0), texture5.a);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite5.glsl"
#include "/lib/shaderSettings/blueScreen.glsl"
#include "/lib/shaderSettings/bloom.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
//Common Variables//
float pw = 1.0 / viewWidth;
float ph = 1.0 / viewHeight;
vec2 view = vec2(viewWidth, viewHeight);
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
#endif
//Common Functions//
#include "/lib/colors/tonemaps.glsl"
void DoBSLColorSaturation(inout vec3 color) {
float saturationFactor = T_SATURATION + 0.07;
float grayVibrance = (color.r + color.g + color.b) / 3.0;
float graySaturation = grayVibrance;
if (saturationFactor < 1.00) graySaturation = dot(color, vec3(0.299, 0.587, 0.114));
float mn = min(color.r, min(color.g, color.b));
float mx = max(color.r, max(color.g, color.b));
float sat = (1.0 - (mx - mn)) * (1.0 - mx) * grayVibrance * 5.0;
vec3 lightness = vec3((mn + mx) * 0.5);
color = mix(color, mix(color, lightness, 1.0 - T_VIBRANCE), sat);
color = mix(color, lightness, (1.0 - lightness) * (2.0 - T_VIBRANCE) / 2.0 * abs(T_VIBRANCE - 1.0));
color = color * saturationFactor - graySaturation * (saturationFactor - 1.0);
}
#if BLOOM_ENABLED == 1
vec2 rescale = max(vec2(viewWidth, viewHeight) / vec2(1920.0, 1080.0), vec2(1.0));
vec3 GetBloomTile(float lod, vec2 coord, vec2 offset) {
float scale = exp2(lod);
vec2 bloomCoord = coord / scale + offset;
bloomCoord = clamp(bloomCoord, offset, 1.0 / scale + offset);
vec3 bloom = texture2D(colortex3, bloomCoord / rescale).rgb;
bloom *= bloom;
bloom *= bloom;
return bloom * 128.0;
}
void DoBloom(inout vec3 color, vec2 coord, float dither, float lViewPos) {
vec3 blur1 = GetBloomTile(2.0, coord, vec2(0.0 , 0.0 ));
vec3 blur2 = GetBloomTile(3.0, coord, vec2(0.0 , 0.26 ));
vec3 blur3 = GetBloomTile(4.0, coord, vec2(0.135 , 0.26 ));
vec3 blur4 = GetBloomTile(5.0, coord, vec2(0.2075 , 0.26 ));
vec3 blur5 = GetBloomTile(6.0, coord, vec2(0.135 , 0.3325));
vec3 blur6 = GetBloomTile(7.0, coord, vec2(0.160625 , 0.3325));
vec3 blur7 = GetBloomTile(8.0, coord, vec2(0.1784375, 0.3325));
vec3 blur = (blur1 + blur2 + blur3 + blur4 + blur5 + blur6 + blur7) * 0.14;
float bloomStrength = BLOOM_STRENGTH + 0.2 * darknessFactor;
#if defined BLOOM_FOG && defined NETHER && defined BORDER_FOG
float farM = min(renderDistance, NETHER_VIEW_LIMIT); // consistency9023HFUE85JG
float netherBloom = lViewPos / clamp(farM, 96.0, 256.0);
netherBloom *= netherBloom;
netherBloom *= netherBloom;
netherBloom = 1.0 - exp(-8.0 * netherBloom);
netherBloom *= 1.0 - maxBlindnessDarkness;
bloomStrength = mix(bloomStrength * 0.7, bloomStrength * 1.8, netherBloom);
#endif
color = mix(color, blur, bloomStrength);
//color += blur * bloomStrength * (ditherFactor.x + ditherFactor.y);
}
#endif
#include "/lib/util/colorConversion.glsl"
// #if COLORED_LIGHTING_INTERNAL > 0
// #include "/lib/voxelization/lightVoxelization.glsl"
// #endif
// http://www.diva-portal.org/smash/get/diva2:24136/FULLTEXT01.pdf
// The MIT License
// Copyright © 2024 Benjamin Stott "sixthsurge"
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vec3 purkinjeShift(vec3 rgb, vec4 texture6, vec3 playerPos, float lViewPos, float purkinjeOverwrite, float z0, float fogValue) {
float interiorFactorM = 0;
#ifdef NETHER
float nightDesaturationIntensity = NIGHT_DESATURATION_NETHER;
float renderdistanceFade = PURKINJE_RENDER_DISTANCE_FADE_NETHER;
interiorFactorM = 1.0;
#elif defined END
float nightDesaturationIntensity = NIGHT_DESATURATION_END;
nightFactor = 1.0;
float renderdistanceFade = 0.1;
interiorFactorM = -10000.0;
#else
float renderdistanceFade = PURKINJE_RENDER_DISTANCE_FADE;
#ifdef MOON_PHASE_INF_PURKINJE
float nightDesaturationIntensity = moonPhase == 0 ? MOON_PHASE_FULL_PURKINJE : moonPhase != 4 ? MOON_PHASE_PARTIAL_PURKINJE : MOON_PHASE_DARK_PURKINJE;
#else
float nightDesaturationIntensity = NIGHT_DESATURATION_OW;
#endif
#endif
float lightFogFactor = smoothstep(-0.5, 1.0, fogValue);
float renderDistanceFade = mix(0, lViewPos * 2.5 / far, renderdistanceFade * (1.0 - lightFogFactor));
if (isEyeInWater == 1) renderDistanceFade = lViewPos * 7.0 / far;
float nightCaveDesaturation = NIGHT_CAVE_DESATURATION * 0.1;
float skyLightFactor = texture6.b;
#ifdef IRIS_FEATURE_FADE_VARIABLE
if (skyLightFactor > 0.50001) skyLightFactor = eyeBrightnessM;
else skyLightFactor *= 1.9999;
#endif
float interiorFactor = isEyeInWater == 1 ? 0.0 : pow2(1.0 - skyLightFactor * (1.0 - lightFogFactor));
interiorFactor = mix(interiorFactor, interiorFactorM, renderDistanceFade);
interiorFactor -= sqrt2(eyeBrightnessM) * 0.66;
interiorFactor = smoothstep(0.0, 1.0, clamp01(interiorFactor));
// interiorFactor = 0.0;
// return vec3(interiorFactor);
float lightSourceFactor = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_NEAR_LIGHTS
lightSourceFactor = pow3(1.0 - texture6.a * (1.0 - lightFogFactor));
lightSourceFactor += renderDistanceFade;
lightSourceFactor = clamp01(lightSourceFactor);
#endif
float heldLight = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_LIGHTS_IN_HAND
heldLight = max(heldBlockLightValue, heldBlockLightValue2);
if (heldItemId == 45032 || heldItemId2 == 45032) heldLight = 15; // Lava Bucket
if (heldLight > 0){
heldLight = clamp(heldLight, 0.0, 15.0);
heldLight = sqrt2(heldLight / 15.0) * -1.0 + 1.0; // Normalize and invert
heldLight = mix(heldLight, 1.0, clamp01(lViewPos * 15 / far)); // Only do it around the player
} else {
heldLight = 1.0;
}
#endif
float nightVisionFactor = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_NIGHT_VISION
nightVisionFactor = nightVision * -1.0 + 1.0;
#endif
float purkinjeIntensity = 0.004 * purkinjeOverwrite * nightDesaturationIntensity;
purkinjeIntensity = purkinjeIntensity * fuzzyOr(interiorFactor, sqrt3(nightFactor - 0.1)); // No purkinje shift in daylight
purkinjeIntensity *= lightSourceFactor; // Reduce purkinje intensity in blocklight
purkinjeIntensity *= (1.0 - lightFogFactor);
purkinjeIntensity *= clamp01(nightCaveDesaturation + (1.0 - nightCaveDesaturation) * pow3(1.0 - interiorFactor)); // Reduce purkinje intensity underground
purkinjeIntensity *= clamp01(heldLight); // Reduce purkinje intensity when holding light sources
purkinjeIntensity *= nightVisionFactor * (1.0 - isLightningActive()); // Reduce purkinje intensity when using night vision or during lightning
purkinjeIntensity = clamp(purkinjeIntensity, 0.01, 1.0); // prevent it going to 0 to avoid NaNs
if (nightDesaturationIntensity < 300) {
float blueDominance = rgb.b / max(max(rgb.r, rgb.g), 0.01);
float blueReduction = smoothstep(0.9, 2.3, blueDominance);
// Create a darker tint for blue colors
vec3 purkinjeTint = vec3(0.5, 0.7, 1.0);
purkinjeTint *= mix(vec3(1.0), vec3(0.6, 0.7, 0.65), blueReduction * 0.7);
purkinjeTint *= rec709ToRec2020;
const vec3 rodResponse = vec3(7.15e-5, 4.81e-1, 3.28e-1) * rec709ToRec2020;
vec3 xyz = rgb * rec2020ToXyz;
vec3 scotopicLuminance = xyz * (1.33 * (1.0 + (xyz.y + xyz.z) / xyz.x) - 0.5);
float purkinje = dot(rodResponse, scotopicLuminance * xyzToRec2020) * 0.45;
float purkinjeFactor = exp2(-rcp(purkinjeIntensity) * purkinje) * (1.0 - blueReduction * 0.5);
rgb = mix(rgb, purkinje * purkinjeTint, purkinjeFactor);
} else {
rgb = mix(rgb, vec3(GetLuminance(rgb) * 0.9), clamp01(purkinjeIntensity));
}
// return vec3(purkinjeIntensity);
return max0(rgb);
}
//Includes//
#ifdef BLOOM_FOG
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#if BLOOM_ENABLED == 1
#include "/lib/util/dither.glsl"
#endif
#if LENSFLARE_MODE > 0 && defined OVERWORLD
#include "/lib/misc/lensFlare.glsl"
#endif
#include "/lib/util/spaceConversion.glsl"
//Program//
void main() {
vec3 color = texture2D(colortex0, texCoord).rgb;
vec4 texture5 = texelFetch(colortex5, texelCoord, 0);
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD || defined NIGHT_DESATURATION
float z0 = texture2D(depthtex0, texCoord).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
vec3 playerPos = ViewToPlayer(viewPos.xyz);
#else
float lViewPos = 0.0;
#endif
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
#if defined DISTANT_HORIZONS && defined NETHER
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef BLOOM_FOG
color /= GetBloomFog(lViewPos);
#endif
#if BLOOM_ENABLED == 1
DoBloom(color, texCoord, dither, lViewPos);
#endif
#ifdef COLORGRADING
color =
pow(color.r, GR_RC) * vec3(GR_RR, GR_RG, GR_RB) +
pow(color.g, GR_GC) * vec3(GR_GR, GR_GG, GR_GB) +
pow(color.b, GR_BC) * vec3(GR_BR, GR_BG, GR_BB);
color *= 0.01;
#endif
#ifdef TONEMAP_COMPARISON
color = texCoord.x < mix(0.5, 0.0, isSneaking) ? tonemap_left(color) : tonemap_right(color); // Thanks to SixthSurge
#else
color = tonemap(color);
#endif
color = clamp01(color);
#if defined GREEN_SCREEN_LIME || defined BLUE_SCREEN || SELECT_OUTLINE == 4 || defined NIGHT_DESATURATION
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
int materialMaskInt = int(texture6.g * 255.1);
#endif
float purkinjeOverwrite = 1.0;
#ifdef GREEN_SCREEN_LIME
if (materialMaskInt == 240) { // Green Screen Lime Blocks
color = vec3(0.0, 1.0, 0.0);
purkinjeOverwrite = 0.0;
}
#endif
#ifdef BLUE_SCREEN
if (materialMaskInt == 239) { // Blue Screen Blue Blocks
color = vec3(0.0, 0.0, 1.0);
purkinjeOverwrite = 0.0;
}
#endif
#if SELECT_OUTLINE == 4 || defined NIGHT_DESATURATION
if (materialMaskInt == 252) { // Selection Outline
#if SELECT_OUTLINE == 4 // Versatile Selection Outline
float colorMF = 1.0 - dot(color, vec3(0.25, 0.45, 0.1));
colorMF = smoothstep1(smoothstep1(smoothstep1(smoothstep1(smoothstep1(colorMF)))));
color = mix(color, 3.0 * (color + 0.2) * vec3(colorMF * SELECT_OUTLINE_I), 0.3);
#endif
purkinjeOverwrite = 0.0;
}
#endif
#if LENSFLARE_MODE > 0 && defined OVERWORLD
DoLensFlare(color, viewPos.xyz, dither);
#endif
DoBSLColorSaturation(color);
#ifdef NIGHT_DESATURATION
color.rgb = purkinjeShift(color.rgb, texture6, playerPos, lViewPos, purkinjeOverwrite, z0, texture5.r);
#endif
/* DRAWBUFFERS:35 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(vec3(0), texture5.a);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
@@ -1,87 +1,87 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
#include "/lib/pipelineSettings.glsl"
const bool colortex3MipmapEnabled = true;
//Common Variables//
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#ifdef TAA
#include "/lib/antialiasing/taa.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex3, texelCoord, 0).rgb;
vec4 texture2 = texture2D(colortex2, texCoord);
vec3 temp = vec3(0.0);
float z1 = 0.0;
#ifdef RENKO_CUT
temp.g = texelFetch(colortex2, texelCoord, 0).g;
#else
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
#endif
#ifdef TAA
z1 = texelFetch(depthtex1, texelCoord, 0).r;
DoTAA(color, temp, z1);
#endif
#if LONG_EXPOSURE > 0
}
if (hideGUI == 1 && !isViewMoving()) { // GUI not visible AND not moving
temp = texture2.rgb;
}
#endif
#endif
/* DRAWBUFFERS:32 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(temp, 0.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
#include "/lib/pipelineSettings.glsl"
const bool colortex3MipmapEnabled = true;
//Common Variables//
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#ifdef TAA
#include "/lib/antialiasing/taa.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex3, texelCoord, 0).rgb;
vec4 texture2 = texture2D(colortex2, texCoord);
vec3 temp = vec3(0.0);
float z1 = 0.0;
#ifdef RENKO_CUT
temp.g = texelFetch(colortex2, texelCoord, 0).g;
#else
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
#endif
#ifdef TAA
z1 = texelFetch(depthtex1, texelCoord, 0).r;
DoTAA(color, temp, z1);
#endif
#if LONG_EXPOSURE > 0
}
if (hideGUI == 1 && !isViewMoving()) { // GUI not visible AND not moving
temp = texture2.rgb;
}
#endif
#endif
/* DRAWBUFFERS:32 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(temp, 0.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
@@ -1,70 +1,70 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
//Common Variables//
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#if FXAA_DEFINE == 1 && FXAA_STRENGTH > 1
#include "/lib/antialiasing/fxaa.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex3, texelCoord, 0).rgb;
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
#endif
#if FXAA_DEFINE == 1 && FXAA_STRENGTH > 1
// Apply FXAA only when GUI is hidden or view is moving
FXAA311(color);
#endif
#if LONG_EXPOSURE > 0
}
#endif
/* DRAWBUFFERS:3 */
gl_FragData[0] = vec4(color, 1.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
//Common Variables//
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#if FXAA_DEFINE == 1 && FXAA_STRENGTH > 1
#include "/lib/antialiasing/fxaa.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex3, texelCoord, 0).rgb;
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
#endif
#if FXAA_DEFINE == 1 && FXAA_STRENGTH > 1
// Apply FXAA only when GUI is hidden or view is moving
FXAA311(color);
#endif
#if LONG_EXPOSURE > 0
}
#endif
/* DRAWBUFFERS:3 */
gl_FragData[0] = vec4(color, 1.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
@@ -1,189 +1,189 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
#include "/lib/common.glsl"
#ifdef RENKO_CUT
#ifdef FRAGMENT_SHADER
in vec2 knifePos;
in vec2 knifeDir;
in float isKnifeDown;
in vec2 texelPos;
in float healing;
void drawKnife(inout vec3 color, vec2 uv, vec2 pos, vec2 dir, float scale) {
vec2 localUV = mat2(vec2(1, -1) * dir, dir.yx) * (uv - pos) / scale;
const float knifeRot0 = 0.3;
const vec2 knifeOffset = vec2(0.3, -0.05);
const mat2 knifeRotMat0 = mat2(cos(knifeRot0), sin(knifeRot0), -sin(knifeRot0), cos(knifeRot0));
localUV = knifeRotMat0 * localUV + knifeOffset;
float bladeLen0 = length(localUV * vec2(1, 2) - vec2(0.2, 0.5));
float bladeLen1 = length(localUV - vec2(0.9, 1.5));
float bladeLen2 = length(localUV - vec2(-0.8, 6.0));
if (bladeLen0 < 0.6 && bladeLen1 > 1.3 && bladeLen2 > 5.8) {
color = vec3(0.7);
if (bladeLen0 > 0.5) color = vec3(0.9);
}
vec2 handleMidCoord = vec2(-0.6, 0.13);
vec2 handleScale = vec2(2.0, 5.0);
float handleDist = length(pow(abs(localUV - handleMidCoord) * handleScale, vec2(3)));
if (handleDist < 1.0) {
color = vec3(0.6,0.2,0.0);
color += 0.1 * (localUV.y * handleScale.y - handleMidCoord.y + 0.5);
}
}
void main() {
vec4 cutData = texelFetch(colortex2, texelCoord, 0);
vec4 color = texelFetch(colortex3, texelCoord, 0);
vec2 relPos = texelPos - knifePos;
float projW = dot(relPos, knifeDir);
float error = length(relPos - projW * knifeDir);
if (isKnifeDown > 0.5 && error < 0.01 * (0.6 - 70.0 * projW * projW)) {
cutData.g = 1.0;
} else if (healing > 0.5) {
float aroundHealthy = 0;
for (int k = 0; k < 4; k++) {
ivec2 offset = (k/2*2-1) * ivec2(k%2, (k+1)%2);
aroundHealthy += texelFetch(colortex2, texelCoord + offset, 0).g;
}
if (aroundHealthy < 3.5) cutData.g = 0.0;
}
if (cutData.g > 0.5) {
color = vec4(0, 0, 0, 1);
}
drawKnife(color.rgb, texelPos, knifePos, -knifeDir, 0.2);
if (frameCounter < 10) {
cutData.g = 0.0;
}
/* DRAWBUFFERS:32 */
gl_FragData[0] = color;
gl_FragData[1] = cutData;
}
#endif
#ifdef VERTEX_SHADER
out vec2 knifePos;
out vec2 knifeDir;
out float isKnifeDown;
out vec2 texelPos;
out float healing;
vec3 knifePosList[84] = vec3[84](
vec3(0.1, 0.7, 1),
vec3(0.1, 0.5, 1),
vec3(0.1, 0.3, 1),
vec3(0.15, 0.3, 1),
vec3(0.15, 0.45, 1),
vec3(0.2, 0.45, 1),
vec3(0.27, 0.3, 1),
vec3(0.32, 0.3, 1),
vec3(0.25, 0.47, 1),
vec3(0.3, 0.55, 1),
vec3(0.3, 0.62, 1),
vec3(0.25, 0.7, 1),
vec3(0.1, 0.7, 0),
vec3(0.4, 0.7, 1),
vec3(0.4, 0.5, 1),
vec3(0.4, 0.3, 1),
vec3(0.53, 0.3, 1),
vec3(0.65, 0.3, 1),
vec3(0.65, 0.35, 1),
vec3(0.45, 0.35, 1),
vec3(0.45, 0.475, 1),
vec3(0.6, 0.475, 1),
vec3(0.6, 0.525, 1),
vec3(0.45, 0.525, 1),
vec3(0.45, 0.65, 1),
vec3(0.65, 0.65, 1),
vec3(0.65, 0.7, 1),
vec3(0.4, 0.7, 0),
vec3(0.7, 0.7, 1),
vec3(0.7, 0.5, 1),
vec3(0.7, 0.3, 1),
vec3(0.75, 0.3, 1),
vec3(0.75, 0.45, 1),
vec3(0.75, 0.6, 1),
vec3(0.825, 0.45, 1),
vec3(0.9, 0.3, 1),
vec3(0.95, 0.3, 1),
vec3(0.95, 0.5, 1),
vec3(0.95, 0.7, 1),
vec3(0.9, 0.7, 1),
vec3(0.9, 0.55, 1),
vec3(0.9, 0.4, 1),
vec3(0.825, 0.55, 1),
vec3(0.75, 0.7, 1),
vec3(0.7, 0.7, 0),
vec3(1.0, 0.7, 1),
vec3(1.0, 0.5, 1),
vec3(1.0, 0.3, 1),
vec3(1.05, 0.3, 1),
vec3(1.05, 0.5, 1),
vec3(1.15, 0.4, 1),
vec3(1.23, 0.3, 1),
vec3(1.29, 0.3, 1),
vec3(1.2, 0.42, 1),
vec3(1.13, 0.48, 1),
vec3(1.2, 0.59, 1),
vec3(1.28, 0.7, 1),
vec3(1.22, 0.7, 1),
vec3(1.15, 0.61, 1),
vec3(1.1, 0.56, 1),
vec3(1.05, 0.6, 1),
vec3(1.05, 0.7, 1),
vec3(1.0, 0.7, 0),
vec3(1.35, 0.6, 1),
vec3(1.35, 0.4, 1),
vec3(1.43, 0.3, 1),
vec3(1.52, 0.3, 1),
vec3(1.6, 0.4, 1),
vec3(1.6, 0.6, 1),
vec3(1.52, 0.7, 1),
vec3(1.43, 0.7, 1),
vec3(1.35, 0.6, 0),
vec3(1.4, 0.55, 1),
vec3(1.4, 0.45, 1),
vec3(1.475, 0.38, 1),
vec3(1.55, 0.45, 1),
vec3(1.55, 0.55, 1),
vec3(1.475, 0.62, 1),
vec3(1.4, 0.55, 0),
vec3(1.2, 0.7, 0),
vec3(0.8, 0.8, 0),
vec3(0.5, 0.8, 0),
vec3(0.2, 0.75, 0),
vec3(0.1, 0.7, 0)
);
void main() {
gl_Position = ftransform();
texelPos = 0.5 * gl_Position.xy + 0.5;
texelPos.x *= aspectRatio;
float cutProgress = max(0, frameTimeCounter * 2 - 40.0);
int thisIndex = int(cutProgress) % knifePosList.length();
healing = float(thisIndex > knifePosList.length() - 5);
int nextIndex = (thisIndex+1) % knifePosList.length();
knifePos = mix(
knifePosList[thisIndex].xy,
knifePosList[nextIndex].xy,
mod(cutProgress, float(knifePosList.length())) - thisIndex);
knifeDir = normalize(knifePosList[nextIndex].xy - knifePosList[thisIndex].xy);
isKnifeDown = knifePosList[thisIndex].z;
}
#endif
#else
#ifdef FRAGMENT_SHADER
void main() {
/* DRAWBUFFERS:3 */
gl_FragData[0] = texelFetch(colortex3, texelCoord, 0);
}
#endif
#ifdef VERTEX_SHADER
void main() {
gl_Position = ftransform();
}
#endif
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
#include "/lib/common.glsl"
#ifdef RENKO_CUT
#ifdef FRAGMENT_SHADER
in vec2 knifePos;
in vec2 knifeDir;
in float isKnifeDown;
in vec2 texelPos;
in float healing;
void drawKnife(inout vec3 color, vec2 uv, vec2 pos, vec2 dir, float scale) {
vec2 localUV = mat2(vec2(1, -1) * dir, dir.yx) * (uv - pos) / scale;
const float knifeRot0 = 0.3;
const vec2 knifeOffset = vec2(0.3, -0.05);
const mat2 knifeRotMat0 = mat2(cos(knifeRot0), sin(knifeRot0), -sin(knifeRot0), cos(knifeRot0));
localUV = knifeRotMat0 * localUV + knifeOffset;
float bladeLen0 = length(localUV * vec2(1, 2) - vec2(0.2, 0.5));
float bladeLen1 = length(localUV - vec2(0.9, 1.5));
float bladeLen2 = length(localUV - vec2(-0.8, 6.0));
if (bladeLen0 < 0.6 && bladeLen1 > 1.3 && bladeLen2 > 5.8) {
color = vec3(0.7);
if (bladeLen0 > 0.5) color = vec3(0.9);
}
vec2 handleMidCoord = vec2(-0.6, 0.13);
vec2 handleScale = vec2(2.0, 5.0);
float handleDist = length(pow(abs(localUV - handleMidCoord) * handleScale, vec2(3)));
if (handleDist < 1.0) {
color = vec3(0.6,0.2,0.0);
color += 0.1 * (localUV.y * handleScale.y - handleMidCoord.y + 0.5);
}
}
void main() {
vec4 cutData = texelFetch(colortex2, texelCoord, 0);
vec4 color = texelFetch(colortex3, texelCoord, 0);
vec2 relPos = texelPos - knifePos;
float projW = dot(relPos, knifeDir);
float error = length(relPos - projW * knifeDir);
if (isKnifeDown > 0.5 && error < 0.01 * (0.6 - 70.0 * projW * projW)) {
cutData.g = 1.0;
} else if (healing > 0.5) {
float aroundHealthy = 0;
for (int k = 0; k < 4; k++) {
ivec2 offset = (k/2*2-1) * ivec2(k%2, (k+1)%2);
aroundHealthy += texelFetch(colortex2, texelCoord + offset, 0).g;
}
if (aroundHealthy < 3.5) cutData.g = 0.0;
}
if (cutData.g > 0.5) {
color = vec4(0, 0, 0, 1);
}
drawKnife(color.rgb, texelPos, knifePos, -knifeDir, 0.2);
if (frameCounter < 10) {
cutData.g = 0.0;
}
/* DRAWBUFFERS:32 */
gl_FragData[0] = color;
gl_FragData[1] = cutData;
}
#endif
#ifdef VERTEX_SHADER
out vec2 knifePos;
out vec2 knifeDir;
out float isKnifeDown;
out vec2 texelPos;
out float healing;
vec3 knifePosList[84] = vec3[84](
vec3(0.1, 0.7, 1),
vec3(0.1, 0.5, 1),
vec3(0.1, 0.3, 1),
vec3(0.15, 0.3, 1),
vec3(0.15, 0.45, 1),
vec3(0.2, 0.45, 1),
vec3(0.27, 0.3, 1),
vec3(0.32, 0.3, 1),
vec3(0.25, 0.47, 1),
vec3(0.3, 0.55, 1),
vec3(0.3, 0.62, 1),
vec3(0.25, 0.7, 1),
vec3(0.1, 0.7, 0),
vec3(0.4, 0.7, 1),
vec3(0.4, 0.5, 1),
vec3(0.4, 0.3, 1),
vec3(0.53, 0.3, 1),
vec3(0.65, 0.3, 1),
vec3(0.65, 0.35, 1),
vec3(0.45, 0.35, 1),
vec3(0.45, 0.475, 1),
vec3(0.6, 0.475, 1),
vec3(0.6, 0.525, 1),
vec3(0.45, 0.525, 1),
vec3(0.45, 0.65, 1),
vec3(0.65, 0.65, 1),
vec3(0.65, 0.7, 1),
vec3(0.4, 0.7, 0),
vec3(0.7, 0.7, 1),
vec3(0.7, 0.5, 1),
vec3(0.7, 0.3, 1),
vec3(0.75, 0.3, 1),
vec3(0.75, 0.45, 1),
vec3(0.75, 0.6, 1),
vec3(0.825, 0.45, 1),
vec3(0.9, 0.3, 1),
vec3(0.95, 0.3, 1),
vec3(0.95, 0.5, 1),
vec3(0.95, 0.7, 1),
vec3(0.9, 0.7, 1),
vec3(0.9, 0.55, 1),
vec3(0.9, 0.4, 1),
vec3(0.825, 0.55, 1),
vec3(0.75, 0.7, 1),
vec3(0.7, 0.7, 0),
vec3(1.0, 0.7, 1),
vec3(1.0, 0.5, 1),
vec3(1.0, 0.3, 1),
vec3(1.05, 0.3, 1),
vec3(1.05, 0.5, 1),
vec3(1.15, 0.4, 1),
vec3(1.23, 0.3, 1),
vec3(1.29, 0.3, 1),
vec3(1.2, 0.42, 1),
vec3(1.13, 0.48, 1),
vec3(1.2, 0.59, 1),
vec3(1.28, 0.7, 1),
vec3(1.22, 0.7, 1),
vec3(1.15, 0.61, 1),
vec3(1.1, 0.56, 1),
vec3(1.05, 0.6, 1),
vec3(1.05, 0.7, 1),
vec3(1.0, 0.7, 0),
vec3(1.35, 0.6, 1),
vec3(1.35, 0.4, 1),
vec3(1.43, 0.3, 1),
vec3(1.52, 0.3, 1),
vec3(1.6, 0.4, 1),
vec3(1.6, 0.6, 1),
vec3(1.52, 0.7, 1),
vec3(1.43, 0.7, 1),
vec3(1.35, 0.6, 0),
vec3(1.4, 0.55, 1),
vec3(1.4, 0.45, 1),
vec3(1.475, 0.38, 1),
vec3(1.55, 0.45, 1),
vec3(1.55, 0.55, 1),
vec3(1.475, 0.62, 1),
vec3(1.4, 0.55, 0),
vec3(1.2, 0.7, 0),
vec3(0.8, 0.8, 0),
vec3(0.5, 0.8, 0),
vec3(0.2, 0.75, 0),
vec3(0.1, 0.7, 0)
);
void main() {
gl_Position = ftransform();
texelPos = 0.5 * gl_Position.xy + 0.5;
texelPos.x *= aspectRatio;
float cutProgress = max(0, frameTimeCounter * 2 - 40.0);
int thisIndex = int(cutProgress) % knifePosList.length();
healing = float(thisIndex > knifePosList.length() - 5);
int nextIndex = (thisIndex+1) % knifePosList.length();
knifePos = mix(
knifePosList[thisIndex].xy,
knifePosList[nextIndex].xy,
mod(cutProgress, float(knifePosList.length())) - thisIndex);
knifeDir = normalize(knifePosList[nextIndex].xy - knifePosList[thisIndex].xy);
isKnifeDown = knifePosList[thisIndex].z;
}
#endif
#else
#ifdef FRAGMENT_SHADER
void main() {
/* DRAWBUFFERS:3 */
gl_FragData[0] = texelFetch(colortex3, texelCoord, 0);
}
#endif
#ifdef VERTEX_SHADER
void main() {
gl_Position = ftransform();
}
#endif
#endif
@@ -1,77 +1,77 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
#if LONG_EXPOSURE > 0
vec4 color = vec4(0.0);
vec4 previousFrame = texture2D(colortex2, texCoord);
float counter = texture2D(colortex2, ivec2(0)).g;
counter += 0.00001;
if(hideGUI == 0 || isViewMoving()) counter = 0.0; // reset counter when GUI visible OR when moving
if (hideGUI == 1 && !isViewMoving()) { // accumulate ONLY when GUI hidden AND not moving otherwise use colortex2 as normal
vec4 currentFrame = texture2D(colortex3, texCoord);
if (counter <= 0.0001) previousFrame = currentFrame; // to fix the first frame as it still has info from colortex2 from deferred1
#if LONG_EXPOSURE == 1
color = max(currentFrame, previousFrame);
#else
float luma = dot(currentFrame.rgb, vec3(3.0)); // do luma weighting to preserve bright pixels for longer
float mixAmount = 1.0 / (counter * 100000.0 + 1.0);
color = mix(previousFrame, currentFrame, mixAmount * luma);
#endif
} else {
color = previousFrame;
}
/* DRAWBUFFERS:2 */
gl_FragData[0] = vec4(color.r, ivec2(texCoord * vec2(viewWidth, viewHeight)) == ivec2(0) ? counter : color.g, color.ba);
#else
/* DRAWBUFFERS:3 */
gl_FragData[0] = texelFetch(colortex3, texelCoord, 0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
#if LONG_EXPOSURE > 0
vec4 color = vec4(0.0);
vec4 previousFrame = texture2D(colortex2, texCoord);
float counter = texture2D(colortex2, ivec2(0)).g;
counter += 0.00001;
if(hideGUI == 0 || isViewMoving()) counter = 0.0; // reset counter when GUI visible OR when moving
if (hideGUI == 1 && !isViewMoving()) { // accumulate ONLY when GUI hidden AND not moving otherwise use colortex2 as normal
vec4 currentFrame = texture2D(colortex3, texCoord);
if (counter <= 0.0001) previousFrame = currentFrame; // to fix the first frame as it still has info from colortex2 from deferred1
#if LONG_EXPOSURE == 1
color = max(currentFrame, previousFrame);
#else
float luma = dot(currentFrame.rgb, vec3(3.0)); // do luma weighting to preserve bright pixels for longer
float mixAmount = 1.0 / (counter * 100000.0 + 1.0);
color = mix(previousFrame, currentFrame, mixAmount * luma);
#endif
} else {
color = previousFrame;
}
/* DRAWBUFFERS:2 */
gl_FragData[0] = vec4(color.r, ivec2(texCoord * vec2(viewWidth, viewHeight)) == ivec2(0) ? counter : color.g, color.ba);
#else
/* DRAWBUFFERS:3 */
gl_FragData[0] = texelFetch(colortex3, texelCoord, 0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif
@@ -1,276 +1,276 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/materials.glsl"
#include "/lib/shaderSettings/SSAO.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 playerPos;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
vec2 lmCoordM = lmCoord;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#define GBUFFERS_TERRAIN
#include "/lib/lighting/mainLighting.glsl"
#undef GBUFFERS_TERRAIN
#ifdef SNOWY_WORLD
#include "/lib/materials/materialMethods/snowyWorld.glsl"
#endif
#if SEASONS > 0 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoise.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = vec4(glColor.rgb, 1.0);
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(playerPos);
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
vec3 worldPos = playerPos + cameraPosition;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false;
int subsurfaceMode = 0;
float smoothnessG = 0.0, smoothnessD = 0.0, highlightMult = 1.0, emission = 0.0, snowFactor = 1.0, snowMinNdotU = 0.0, noPuddles = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0), maRecolor = vec3(0.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float overlayNoiseEmission = 1.0;
float IPBRMult = 1.0;
bool isFoliage = false;
vec3 dhColor = color.rgb;
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
float lavaNoiseIntensity = LAVA_NOISE_INTENSITY;
float dhSSAOBrightnessBoost = 1.05;
if (mat == DH_BLOCK_LEAVES) {
#include "/lib/materials/specificMaterials/terrain/leaves.glsl"
dhSSAOBrightnessBoost = 1.35; // make brighter to compensate SSAO
} else if (mat == DH_BLOCK_GRASS) {
smoothnessG = pow2(color.g) * 0.85;
dhSSAOBrightnessBoost = mix(1.0, 1.2, 1.0 - clamp01(dot(worldGeoNormal, ViewToPlayer(upVec)))); // only make brighter on the sides
} else if (mat == DH_BLOCK_SNOW) {
#include "/lib/materials/specificMaterials/terrain/snow.glsl"
dhSSAOBrightnessBoost = 1.19;
} else if (mat == DH_BLOCK_LAVA) {
#include "/lib/materials/specificMaterials/terrain/lava.glsl"
#ifndef NETHER
color.rgb *= 0.75;
#else
color.rgb *= 0.89;
#endif
dhSSAOBrightnessBoost = 0.9;
} else if (mat == DH_BLOCK_ILLUMINATED) {
emission = 2.5;
snowNoiseIntensity = 0.0;
sandNoiseIntensity = 0.2;
mossNoiseIntensity = 0.2;
dhSSAOBrightnessBoost = 1.2;
}
#if SSAO_QUALI > 0
color.rgb *= dhSSAOBrightnessBoost;
#endif
#ifdef SNOWY_WORLD
DoSnowyWorld(color, smoothnessG, highlightMult, smoothnessD, emission,
playerPos, lmCoord, snowFactor, snowMinNdotU, NdotU, subsurfaceMode);
#endif
vec3 playerPosAlt = ViewToPlayer(viewPos); // AMD has problems with vertex playerPos and DH
float lengthCylinder = max(length(playerPosAlt.xz), abs(playerPosAlt.y));
highlightMult *= 0.5 + 0.5 * pow2(1.0 - smoothstep(far, far * 1.5, lengthCylinder));
color.a *= smoothstep(far * 0.5, far * 0.7, lengthCylinder);
if (color.a < min(dither, 1.0)) discard;
vec3 noisePos = floor((playerPos + cameraPosition) * 4.0 + 0.001) / 32.0;
float noiseTexture = Noise3D(noisePos) + 0.5;
float noiseFactor = max0(1.0 - 0.3 * dot(color.rgb, color.rgb));
color.rgb *= pow(noiseTexture, 0.6 * noiseFactor);
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#define GBUFFERS_TERRAIN
#include "/lib/materials/overlayNoiseApply.glsl"
#undef GBUFFERS_TERRAIN
#endif
#if SEASONS > 0
#define GBUFFERS_TERRAIN
#include "/lib/materials/seasons.glsl"
#undef GBUFFERS_TERRAIN
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead);
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = gl_FragData[1] = vec4(smoothnessG, 0.0, 0.0, lmCoordM.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 playerPos;
out vec4 glColor;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
mat = dhMaterialId;
lmCoord = GetLightMapCoordinates();
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/materials.glsl"
#include "/lib/shaderSettings/SSAO.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 playerPos;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
vec2 lmCoordM = lmCoord;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#define GBUFFERS_TERRAIN
#include "/lib/lighting/mainLighting.glsl"
#undef GBUFFERS_TERRAIN
#ifdef SNOWY_WORLD
#include "/lib/materials/materialMethods/snowyWorld.glsl"
#endif
#if SEASONS > 0 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoise.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = vec4(glColor.rgb, 1.0);
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(playerPos);
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
vec3 worldPos = playerPos + cameraPosition;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false;
int subsurfaceMode = 0;
float smoothnessG = 0.0, smoothnessD = 0.0, highlightMult = 1.0, emission = 0.0, snowFactor = 1.0, snowMinNdotU = 0.0, noPuddles = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0), maRecolor = vec3(0.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float overlayNoiseEmission = 1.0;
float IPBRMult = 1.0;
bool isFoliage = false;
vec3 dhColor = color.rgb;
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
float lavaNoiseIntensity = LAVA_NOISE_INTENSITY;
float dhSSAOBrightnessBoost = 1.05;
if (mat == DH_BLOCK_LEAVES) {
#include "/lib/materials/specificMaterials/terrain/leaves.glsl"
dhSSAOBrightnessBoost = 1.35; // make brighter to compensate SSAO
} else if (mat == DH_BLOCK_GRASS) {
smoothnessG = pow2(color.g) * 0.85;
dhSSAOBrightnessBoost = mix(1.0, 1.2, 1.0 - clamp01(dot(worldGeoNormal, ViewToPlayer(upVec)))); // only make brighter on the sides
} else if (mat == DH_BLOCK_SNOW) {
#include "/lib/materials/specificMaterials/terrain/snow.glsl"
dhSSAOBrightnessBoost = 1.19;
} else if (mat == DH_BLOCK_LAVA) {
#include "/lib/materials/specificMaterials/terrain/lava.glsl"
#ifndef NETHER
color.rgb *= 0.75;
#else
color.rgb *= 0.89;
#endif
dhSSAOBrightnessBoost = 0.9;
} else if (mat == DH_BLOCK_ILLUMINATED) {
emission = 2.5;
snowNoiseIntensity = 0.0;
sandNoiseIntensity = 0.2;
mossNoiseIntensity = 0.2;
dhSSAOBrightnessBoost = 1.2;
}
#if SSAO_QUALI > 0
color.rgb *= dhSSAOBrightnessBoost;
#endif
#ifdef SNOWY_WORLD
DoSnowyWorld(color, smoothnessG, highlightMult, smoothnessD, emission,
playerPos, lmCoord, snowFactor, snowMinNdotU, NdotU, subsurfaceMode);
#endif
vec3 playerPosAlt = ViewToPlayer(viewPos); // AMD has problems with vertex playerPos and DH
float lengthCylinder = max(length(playerPosAlt.xz), abs(playerPosAlt.y));
highlightMult *= 0.5 + 0.5 * pow2(1.0 - smoothstep(far, far * 1.5, lengthCylinder));
color.a *= smoothstep(far * 0.5, far * 0.7, lengthCylinder);
if (color.a < min(dither, 1.0)) discard;
vec3 noisePos = floor((playerPos + cameraPosition) * 4.0 + 0.001) / 32.0;
float noiseTexture = Noise3D(noisePos) + 0.5;
float noiseFactor = max0(1.0 - 0.3 * dot(color.rgb, color.rgb));
color.rgb *= pow(noiseTexture, 0.6 * noiseFactor);
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#define GBUFFERS_TERRAIN
#include "/lib/materials/overlayNoiseApply.glsl"
#undef GBUFFERS_TERRAIN
#endif
#if SEASONS > 0
#define GBUFFERS_TERRAIN
#include "/lib/materials/seasons.glsl"
#undef GBUFFERS_TERRAIN
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead);
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = gl_FragData[1] = vec4(smoothnessG, 0.0, 0.0, lmCoordM.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 playerPos;
out vec4 glColor;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
mat = dhMaterialId;
lmCoord = GetLightMapCoordinates();
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,311 +1,311 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
#include "/lib/shaderSettings/water.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 playerPos;
in vec3 viewVector;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
vec2 lmCoordM = lmCoord;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
eastVec.x, northVec.x, normal.x,
eastVec.y, northVec.y, normal.y,
eastVec.z, northVec.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
float vlFactor = 0.0;
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#endif
#if AURORA_STYLE > 0 && defined OVERWORLD
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0
#if defined SKY_EFFECT_REFLECTION && defined OVERWORLD
#include "/lib/atmospherics/stars.glsl"
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#endif
#ifdef VL_CLOUDS_ACTIVE
#include "/lib/atmospherics/clouds/mainClouds.glsl"
#endif
#endif
#include "/lib/materials/materialMethods/reflections.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#if PIXEL_WATER > 0
#include "/lib/materials/materialMethods/waterProcedureTexture.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 colorP = vec4(vec3(0.85), glColor.a);
vec4 color = glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
if (texture2D(depthtex1, screenPos.xy).r < 1.0) discard;
float lViewPos = length(playerPos);
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
#ifdef VL_CLOUDS_ACTIVE
float cloudLinearDepth = texelFetch(gaux2, texelCoord, 0).a;
if (pow2(cloudLinearDepth + OSIEBCA * dither) * renderDistance < min(lViewPos, renderDistance)) discard;
#endif
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false;
#ifdef GENERATED_NORMALS
bool noGeneratedNormals = false;
#endif
int subsurfaceMode = 0;
float smoothnessG = 0.0, highlightMult = 0.0, emission = 0.0, materialMask = 0.0, reflectMult = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
float SSBLAlpha = 1.0;
if (mat == DH_BLOCK_WATER) {
#ifdef SHADER_WATER
#include "/lib/materials/specificMaterials/translucents/water.glsl"
#endif
color.rgb *= 1.2; // compensates for lack of texture and material reflections
}
float fresnelM = (pow3(fresnel) * 0.85 + 0.15) * reflectMult;
float lengthCylinder = max(length(playerPos.xz), abs(playerPos.y) * 2.0);
color.a *= smoothstep(far * 0.5, far * 0.7, lengthCylinder);
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
bool isLightSource = lmCoord.x > 0.99;
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
vec3 normalizedColor = normalize(color.rgb);
vec3 lightAlbedo = normalizedColor * step(0.6, lmCoord.x);
#endif
// Reflections
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#if WATER_REFLECT_QUALITY >= 0
#ifdef LIGHT_COLOR_MULTS
highlightColor *= lightColorMult;
#endif
#ifdef MOON_PHASE_INF_REFLECTION
highlightColor *= pow2(moonPhaseInfluence);
#endif
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, -1.0,
dhDepthTex1, dither, skyLightFactor, fresnel,
smoothnessG, geoNormal, color.rgb, shadowMult, highlightMult, 0.0, vec2(0.0));
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
#endif
////
float sky = 0.0;
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
float fogAlpha = color.a;
color.a = prevAlpha * (1.0 - sky);
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessG, 0.0, skyLightFactor, lmCoordM.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, SSBLAlpha);
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:06948 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[4] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
#else
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:0648 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[3] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 playerPos;
out vec3 viewVector;
out vec4 glColor;
//Attributes//
attribute vec4 at_tangent;
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
mat = dhMaterialId;
lmCoord = GetLightMapCoordinates();
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
mat3 tbnMatrix = mat3(
eastVec.x, northVec.x, normal.x,
eastVec.y, northVec.y, normal.y,
eastVec.z, northVec.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
#include "/lib/shaderSettings/water.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 playerPos;
in vec3 viewVector;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
vec2 lmCoordM = lmCoord;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
eastVec.x, northVec.x, normal.x,
eastVec.y, northVec.y, normal.y,
eastVec.z, northVec.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
float vlFactor = 0.0;
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#endif
#if AURORA_STYLE > 0 && defined OVERWORLD
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0
#if defined SKY_EFFECT_REFLECTION && defined OVERWORLD
#include "/lib/atmospherics/stars.glsl"
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#endif
#ifdef VL_CLOUDS_ACTIVE
#include "/lib/atmospherics/clouds/mainClouds.glsl"
#endif
#endif
#include "/lib/materials/materialMethods/reflections.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#if PIXEL_WATER > 0
#include "/lib/materials/materialMethods/waterProcedureTexture.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 colorP = vec4(vec3(0.85), glColor.a);
vec4 color = glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
if (texture2D(depthtex1, screenPos.xy).r < 1.0) discard;
float lViewPos = length(playerPos);
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
#ifdef VL_CLOUDS_ACTIVE
float cloudLinearDepth = texelFetch(gaux2, texelCoord, 0).a;
if (pow2(cloudLinearDepth + OSIEBCA * dither) * renderDistance < min(lViewPos, renderDistance)) discard;
#endif
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false;
#ifdef GENERATED_NORMALS
bool noGeneratedNormals = false;
#endif
int subsurfaceMode = 0;
float smoothnessG = 0.0, highlightMult = 0.0, emission = 0.0, materialMask = 0.0, reflectMult = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
float SSBLAlpha = 1.0;
if (mat == DH_BLOCK_WATER) {
#ifdef SHADER_WATER
#include "/lib/materials/specificMaterials/translucents/water.glsl"
#endif
color.rgb *= 1.2; // compensates for lack of texture and material reflections
}
float fresnelM = (pow3(fresnel) * 0.85 + 0.15) * reflectMult;
float lengthCylinder = max(length(playerPos.xz), abs(playerPos.y) * 2.0);
color.a *= smoothstep(far * 0.5, far * 0.7, lengthCylinder);
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
bool isLightSource = lmCoord.x > 0.99;
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
vec3 normalizedColor = normalize(color.rgb);
vec3 lightAlbedo = normalizedColor * step(0.6, lmCoord.x);
#endif
// Reflections
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#if WATER_REFLECT_QUALITY >= 0
#ifdef LIGHT_COLOR_MULTS
highlightColor *= lightColorMult;
#endif
#ifdef MOON_PHASE_INF_REFLECTION
highlightColor *= pow2(moonPhaseInfluence);
#endif
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, -1.0,
dhDepthTex1, dither, skyLightFactor, fresnel,
smoothnessG, geoNormal, color.rgb, shadowMult, highlightMult, 0.0, vec2(0.0));
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
#endif
////
float sky = 0.0;
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
float fogAlpha = color.a;
color.a = prevAlpha * (1.0 - sky);
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessG, 0.0, skyLightFactor, lmCoordM.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, SSBLAlpha);
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:06948 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[4] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
#else
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:0648 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[3] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 playerPos;
out vec3 viewVector;
out vec4 glColor;
//Attributes//
attribute vec4 at_tangent;
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
mat = dhMaterialId;
lmCoord = GetLightMapCoordinates();
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
mat3 tbnMatrix = mat3(
eastVec.x, northVec.x, normal.x,
eastVec.y, northVec.y, normal.y,
eastVec.z, northVec.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,106 +1,106 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color *= glColor;
color.rgb *= glColor.a; // Needed for Minecraft's "Glint Strength" apparently
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(texelFetch(colortex6, texelCoord, 0).rgb, 1.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if HAND_SWAYING > 0
if (gl_ProjectionMatrix[2][2] > -0.5) {
#include "/lib/misc/handSway.glsl"
}
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
if (gl_ProjectionMatrix[2][2] < -0.5) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
}
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color *= glColor;
color.rgb *= glColor.a; // Needed for Minecraft's "Glint Strength" apparently
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(texelFetch(colortex6, texelCoord, 0).rgb, 1.0);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if HAND_SWAYING > 0
if (gl_ProjectionMatrix[2][2] > -0.5) {
#include "/lib/misc/handSway.glsl"
}
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
if (gl_ProjectionMatrix[2][2] < -0.5) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
}
#endif
}
#endif
@@ -1,223 +1,223 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float materialMask = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0, emission = 0.0, enderDragonDead = 1.0;
#ifndef GBUFFERS_LINE
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoord, false, false, false,
false, 0, 0.0, 0.0, 0.0, purkinjeOverwrite, false,
enderDragonDead);
#endif
if (abs(color.a - 0.4) + dot(color.rgb, color.rgb) < 0.01) {
#if SELECT_OUTLINE == 0
discard;
#elif SELECT_OUTLINE == 2 // Rainbow
float posFactor = playerPos.x + playerPos.y + playerPos.z + cameraPosition.x + cameraPosition.y + cameraPosition.z;
color.rgb = clamp(abs(mod(fract(frameTimeCounter*0.25 + posFactor*0.2) * 6.0 + vec3(0.0,4.0,2.0), 6.0) - 3.0) - 1.0,
0.0, 1.0) * vec3(3.0, 2.0, 3.0) * SELECT_OUTLINE_I;
#elif SELECT_OUTLINE == 3 // Select Color
color.rgb = vec3(SELECT_OUTLINE_R, SELECT_OUTLINE_G, SELECT_OUTLINE_B) * SELECT_OUTLINE_I;
#elif SELECT_OUTLINE == 4 // Versatile
color.a = 0.1;
#endif
materialMask = OSIEBCA * 252.0; // Selection Outline
#ifdef SELECT_OUTLINE_AUTO_HIDE
if (heldItemId == 40008 && (
heldItemId2 == 40008 ||
heldItemId2 == 45060 ||
heldItemId2 == 45108 ||
heldItemId2 >= 44000 &&
heldItemId2 < 45000)) {
// Both hands hold nothing or only a light/totem/shield in off-hand
discard;
}
#endif
}
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#if COLORED_LIGHTING_INTERNAL > 0 && defined NETHER
if (gl_FragCoord.x < 0.0)
color = shadow2D(shadowtex0, vec3(0.5)); // To Activate Shadowmap in Nether
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL == 1 && !defined GBUFFERS_LINE
if (color.a == 1.0 && GetLuminance(color.rgb) > 0.9999 && color.g > 0.9999 && color.b > 0.9999) {
discard;
}
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(0.0, 0.0, 0.0, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
flat out vec4 glColor;
//Attributes//
#ifdef WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
#ifndef GBUFFERS_LINE
gl_Position = ftransform();
#else
float lineWidth = 2.0;
vec2 screenSize = vec2(viewWidth, viewHeight);
const mat4 VIEW_SCALE = mat4(mat3(1.0 - (1.0 / 256.0)));
vec4 linePosStart = projectionMatrix * VIEW_SCALE * modelViewMatrix * vec4(vaPosition, 1.0);
vec4 linePosEnd = projectionMatrix * VIEW_SCALE * modelViewMatrix * (vec4(vaPosition + vaNormal, 1.0));
vec3 ndc1 = linePosStart.xyz / linePosStart.w;
vec3 ndc2 = linePosEnd.xyz / linePosEnd.w;
vec2 lineScreenDirection = normalize((ndc2.xy - ndc1.xy) * screenSize);
vec2 lineOffset = vec2(-lineScreenDirection.y, lineScreenDirection.x) * lineWidth / screenSize;
if (lineOffset.x < 0.0)
lineOffset *= -1.0;
if (gl_VertexID % 2 == 0)
gl_Position = vec4((ndc1 + vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
else
gl_Position = vec4((ndc1 - vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
#endif
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#if !defined GBUFFERS_LINE && (defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING)
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float materialMask = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0, emission = 0.0, enderDragonDead = 1.0;
#ifndef GBUFFERS_LINE
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoord, false, false, false,
false, 0, 0.0, 0.0, 0.0, purkinjeOverwrite, false,
enderDragonDead);
#endif
if (abs(color.a - 0.4) + dot(color.rgb, color.rgb) < 0.01) {
#if SELECT_OUTLINE == 0
discard;
#elif SELECT_OUTLINE == 2 // Rainbow
float posFactor = playerPos.x + playerPos.y + playerPos.z + cameraPosition.x + cameraPosition.y + cameraPosition.z;
color.rgb = clamp(abs(mod(fract(frameTimeCounter*0.25 + posFactor*0.2) * 6.0 + vec3(0.0,4.0,2.0), 6.0) - 3.0) - 1.0,
0.0, 1.0) * vec3(3.0, 2.0, 3.0) * SELECT_OUTLINE_I;
#elif SELECT_OUTLINE == 3 // Select Color
color.rgb = vec3(SELECT_OUTLINE_R, SELECT_OUTLINE_G, SELECT_OUTLINE_B) * SELECT_OUTLINE_I;
#elif SELECT_OUTLINE == 4 // Versatile
color.a = 0.1;
#endif
materialMask = OSIEBCA * 252.0; // Selection Outline
#ifdef SELECT_OUTLINE_AUTO_HIDE
if (heldItemId == 40008 && (
heldItemId2 == 40008 ||
heldItemId2 == 45060 ||
heldItemId2 == 45108 ||
heldItemId2 >= 44000 &&
heldItemId2 < 45000)) {
// Both hands hold nothing or only a light/totem/shield in off-hand
discard;
}
#endif
}
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#if COLORED_LIGHTING_INTERNAL > 0 && defined NETHER
if (gl_FragCoord.x < 0.0)
color = shadow2D(shadowtex0, vec3(0.5)); // To Activate Shadowmap in Nether
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL == 1 && !defined GBUFFERS_LINE
if (color.a == 1.0 && GetLuminance(color.rgb) > 0.9999 && color.g > 0.9999 && color.b > 0.9999) {
discard;
}
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(0.0, 0.0, 0.0, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
flat out vec4 glColor;
//Attributes//
#ifdef WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
#ifndef GBUFFERS_LINE
gl_Position = ftransform();
#else
float lineWidth = 2.0;
vec2 screenSize = vec2(viewWidth, viewHeight);
const mat4 VIEW_SCALE = mat4(mat3(1.0 - (1.0 / 256.0)));
vec4 linePosStart = projectionMatrix * VIEW_SCALE * modelViewMatrix * vec4(vaPosition, 1.0);
vec4 linePosEnd = projectionMatrix * VIEW_SCALE * modelViewMatrix * (vec4(vaPosition + vaNormal, 1.0));
vec3 ndc1 = linePosStart.xyz / linePosStart.w;
vec3 ndc2 = linePosEnd.xyz / linePosEnd.w;
vec2 lineScreenDirection = normalize((ndc2.xy - ndc1.xy) * screenSize);
vec2 lineOffset = vec2(-lineScreenDirection.y, lineScreenDirection.x) * lineWidth / screenSize;
if (lineOffset.x < 0.0)
lineOffset *= -1.0;
if (gl_VertexID % 2 == 0)
gl_Position = vec4((ndc1 + vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
else
gl_Position = vec4((ndc1 - vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
#endif
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#if !defined GBUFFERS_LINE && (defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING)
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
}
#endif
@@ -1,203 +1,203 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#define BEACON_BEAM_EMISSION 1.0 //[0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec3 colorP = color.rgb;
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
#ifdef DISTANT_HORIZONS
vec3 screenPosDH = vec3(screenPos.xy, texture2D(dhDepthTex, screenPos.xy).r);
#ifdef TAA
vec3 viewPosDH = ScreenToViewDH(vec3(TAAJitter(screenPosDH.xy, -0.5), screenPosDH.z));
#else
vec3 viewPosDH = ScreenToViewDH(screenPosDH);
#endif
if (viewPos.z < viewPosDH.z)
discard;
#endif
float lViewPos = length(viewPos);
vec3 nViewPos = normalize(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
#endif
float emission = 1.0;
#ifdef IPBR
emission = dot(colorP, colorP);
if (0.5 > color.a && color.a > 0.01) {
color.a = 0.101;
emission = pow2(pow2(emission)) * 0.1;
}
emission *= BEACON_BEAM_EMISSION;
color.rgb *= color.rgb * emission * 1.75;
color.rgb += emission * 0.05;
#else
color.rgb *= color.rgb * 4.0 * BEACON_BEAM_EMISSION;
#endif
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#endif
color.rgb *= 0.5 + 0.5 * exp(-lViewPos * 0.04);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
// We do fog here as well because the outer layer of the beam has broken depth in later programs
float sky = 0.0;
#ifndef NETHER
if (playerPos.y > 0.0) {
playerPos.y = pow(playerPos.y / far, 0.15) * far;
}
#endif
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
color.a = prevAlpha * (1.0 - sky);
if (color.a < 0.2 * dither) discard;
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 1);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
glColor = gl_Color;
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#define BEACON_BEAM_EMISSION 1.0 //[0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec3 colorP = color.rgb;
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
#ifdef DISTANT_HORIZONS
vec3 screenPosDH = vec3(screenPos.xy, texture2D(dhDepthTex, screenPos.xy).r);
#ifdef TAA
vec3 viewPosDH = ScreenToViewDH(vec3(TAAJitter(screenPosDH.xy, -0.5), screenPosDH.z));
#else
vec3 viewPosDH = ScreenToViewDH(screenPosDH);
#endif
if (viewPos.z < viewPosDH.z)
discard;
#endif
float lViewPos = length(viewPos);
vec3 nViewPos = normalize(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
#endif
float emission = 1.0;
#ifdef IPBR
emission = dot(colorP, colorP);
if (0.5 > color.a && color.a > 0.01) {
color.a = 0.101;
emission = pow2(pow2(emission)) * 0.1;
}
emission *= BEACON_BEAM_EMISSION;
color.rgb *= color.rgb * emission * 1.75;
color.rgb += emission * 0.05;
#else
color.rgb *= color.rgb * 4.0 * BEACON_BEAM_EMISSION;
#endif
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#endif
color.rgb *= 0.5 + 0.5 * exp(-lViewPos * 0.04);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
// We do fog here as well because the outer layer of the beam has broken depth in later programs
float sky = 0.0;
#ifndef NETHER
if (playerPos.y > 0.0) {
playerPos.y = pow(playerPos.y / far, 0.15) * far;
}
#endif
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
color.a = prevAlpha * (1.0 - sky);
if (color.a < 0.2 * dither) discard;
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 1);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
glColor = gl_Color;
}
#endif
@@ -1,467 +1,467 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
#extension GL_ARB_derivative_control : enable
#ifdef GL_ARB_derivative_control
#define USE_FINE_DERIVATIVES
#endif
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
//#define NIGHT_DESATURATION
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in int mat;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 atMidBlock;
in vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat in ivec2 pixelTexSize;
// #endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/lighting/mainLighting.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#if SEASONS > 0 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoise.glsl"
#endif
#ifdef PORTAL_EDGE_EFFECT
#include "/lib/voxelization/lightVoxelization.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
//Program//
void main() {
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
vec3 nViewPos = normalize(viewPos);
float VdotN = dot(nViewPos, normal);
vec3 worldPos = playerPos + cameraPosition;
#if SHOCKWAVE > 0
vec4 color = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
vec4 color = texture2D(tex, texCoord);
#endif
vec3 colorP = color.rgb;
color *= glColor;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef DISTANT_HORIZONS
if (getDHFadeFactor(playerPos) < dither) {
discard;
}
#endif
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float IPBRMult = 1.0;
int subsurfaceMode = 0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
bool noSmoothLighting = false, noDirectionalShading = false;
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = 0.0, enderDragonDead = 1.0;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0;
vec2 lmCoordM = lmCoord;
vec3 normalM = VdotN > 0.0 ? -normal : normal; // Inverted Normal Workaround
vec3 geoNormal = normalM, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0;
if (lmCoord.x > 0.99) { // Mod support for light level 15 (and all light levels with iris 1.7) light sources
if (blockEntityId == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, 1.0, 15, 0.0);
}
overlayNoiseIntensity = 0.0;
}
if (blockEntityId < 21025 && blockEntityId > 20999){
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, 1.0, 15, 1.0);
}
if (blockEntityId == 5017) { // Player Head
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
#ifdef IPBR
#include "/lib/materials/materialHandling/blockEntityIPBR.glsl"
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (blockEntityId == 5024) { // End Portal, End Gateway
#ifdef SPECIAL_PORTAL_EFFECTS
#include "/lib/materials/specificMaterials/others/endPortalEffect.glsl"
#endif
overlayNoiseIntensity = 0.0;
} else if (blockEntityId == 5004) { // Signs
noSmoothLighting = true;
if (glColor.r + glColor.g + glColor.b <= 2.99 || lmCoord.x > 0.999) { // Sign Text
#include "/lib/materials/specificMaterials/others/signText.glsl"
}
} else if (blockEntityId == 5020) { // Conduit
overlayNoiseIntensity = 0.3;
} else if (blockEntityId == 5012) { // Ender Chest
overlayNoiseIntensity = 0.5;
} else {
noSmoothLighting = true;
}
#endif
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoiseApply.glsl"
#endif
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef GENERATED_NORMALS
GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, false,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
if (blockEntityId == 5004) lightAlbedo = vec3(0.0); // fix glowing sign text affecting blocklight color
#endif
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, blockEntityId);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
/* DRAWBUFFERS:036 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult, 1.0);
gl_FragData[2] = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE != 0
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, 0.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#ifdef END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
layout(r32i) uniform iimage2D endcrystal_img;
#endif
out vec2 texCoord;
out vec2 lmCoord;
flat out int mat;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 atMidBlock;
out vec4 glColor;
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat out ivec2 pixelTexSize;
// #endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
attribute vec4 mc_Entity;
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.1, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
mat = int(mc_Entity.x + 0.5);
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
atMidBlock = at_midBlock.xyz;
if (normal != normal) normal = -upVec; // Mod Fix: Fixes Better Nether Fireflies
#ifdef END_PORTAL_BEAM_INTERNAL
if (blockEntityId == 5024 && length((gl_ModelViewMatrix * gl_Vertex).xyz) < 28) // end portal
imageStore(endcrystal_img, ivec2(35, 4), ivec4(1));
#endif
#ifdef IPBR
/*if (blockEntityId == 5024) { // End Portal, End Gateway
gl_Position.z -= 0.002;
}*/
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
if (blockEntityId == 5008) { // Chest
float fractWorldPosY = fract((gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).y + cameraPosition.y);
if (fractWorldPosY > 0.56 && 0.57 > fractWorldPosY) gl_Position.z -= 0.0001;
}
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// ivec2 pixelTexSize = ivec2(absMidCoordPos * 2.0 * atlasSize);
// #endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
#extension GL_ARB_derivative_control : enable
#ifdef GL_ARB_derivative_control
#define USE_FINE_DERIVATIVES
#endif
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
//#define NIGHT_DESATURATION
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in int mat;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 atMidBlock;
in vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat in ivec2 pixelTexSize;
// #endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/lighting/mainLighting.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#if SEASONS > 0 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoise.glsl"
#endif
#ifdef PORTAL_EDGE_EFFECT
#include "/lib/voxelization/lightVoxelization.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
//Program//
void main() {
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
vec3 nViewPos = normalize(viewPos);
float VdotN = dot(nViewPos, normal);
vec3 worldPos = playerPos + cameraPosition;
#if SHOCKWAVE > 0
vec4 color = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
vec4 color = texture2D(tex, texCoord);
#endif
vec3 colorP = color.rgb;
color *= glColor;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef DISTANT_HORIZONS
if (getDHFadeFactor(playerPos) < dither) {
discard;
}
#endif
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float IPBRMult = 1.0;
int subsurfaceMode = 0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
bool noSmoothLighting = false, noDirectionalShading = false;
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = 0.0, enderDragonDead = 1.0;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0;
vec2 lmCoordM = lmCoord;
vec3 normalM = VdotN > 0.0 ? -normal : normal; // Inverted Normal Workaround
vec3 geoNormal = normalM, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0;
if (lmCoord.x > 0.99) { // Mod support for light level 15 (and all light levels with iris 1.7) light sources
if (blockEntityId == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, 1.0, 15, 0.0);
}
overlayNoiseIntensity = 0.0;
}
if (blockEntityId < 21025 && blockEntityId > 20999){
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, 1.0, 15, 1.0);
}
if (blockEntityId == 5017) { // Player Head
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
#ifdef IPBR
#include "/lib/materials/materialHandling/blockEntityIPBR.glsl"
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (blockEntityId == 5024) { // End Portal, End Gateway
#ifdef SPECIAL_PORTAL_EFFECTS
#include "/lib/materials/specificMaterials/others/endPortalEffect.glsl"
#endif
overlayNoiseIntensity = 0.0;
} else if (blockEntityId == 5004) { // Signs
noSmoothLighting = true;
if (glColor.r + glColor.g + glColor.b <= 2.99 || lmCoord.x > 0.999) { // Sign Text
#include "/lib/materials/specificMaterials/others/signText.glsl"
}
} else if (blockEntityId == 5020) { // Conduit
overlayNoiseIntensity = 0.3;
} else if (blockEntityId == 5012) { // Ender Chest
overlayNoiseIntensity = 0.5;
} else {
noSmoothLighting = true;
}
#endif
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoiseApply.glsl"
#endif
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef GENERATED_NORMALS
GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, false,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
if (blockEntityId == 5004) lightAlbedo = vec3(0.0); // fix glowing sign text affecting blocklight color
#endif
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, blockEntityId);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
/* DRAWBUFFERS:036 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult, 1.0);
gl_FragData[2] = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE != 0
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, 0.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#ifdef END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
layout(r32i) uniform iimage2D endcrystal_img;
#endif
out vec2 texCoord;
out vec2 lmCoord;
flat out int mat;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 atMidBlock;
out vec4 glColor;
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat out ivec2 pixelTexSize;
// #endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
attribute vec4 mc_Entity;
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.1, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
mat = int(mc_Entity.x + 0.5);
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
atMidBlock = at_midBlock.xyz;
if (normal != normal) normal = -upVec; // Mod Fix: Fixes Better Nether Fireflies
#ifdef END_PORTAL_BEAM_INTERNAL
if (blockEntityId == 5024 && length((gl_ModelViewMatrix * gl_Vertex).xyz) < 28) // end portal
imageStore(endcrystal_img, ivec2(35, 4), ivec4(1));
#endif
#ifdef IPBR
/*if (blockEntityId == 5024) { // End Portal, End Gateway
gl_Position.z -= 0.002;
}*/
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
if (blockEntityId == 5008) { // Chest
float fractWorldPosY = fract((gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).y + cameraPosition.y);
if (fractWorldPosY > 0.56 && 0.57 > fractWorldPosY) gl_Position.z -= 0.0001;
}
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// ivec2 pixelTexSize = ivec2(absMidCoordPos * 2.0 * atlasSize);
// #endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,173 +1,173 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/clouds.glsl"
#include "/lib/shaderSettings/cloudsAndLighting.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
#if CLOUD_STYLE_DEFINE == 50
// We use CLOUD_STYLE_DEFINE instead of CLOUD_STYLE in this file because Optifine can't use generated defines for pipeline stuff
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec4 glColor;
#endif
//Pipeline Constants//
//Common Variables//
#if CLOUD_STYLE_DEFINE == 50
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
#endif
//Common Functions//
//Includes//
#if CLOUD_STYLE_DEFINE == 50
#include "/lib/colors/skyColors.glsl"
#include "/lib/util/spaceConversion.glsl"
#if defined TAA && (defined BORDER_FOG || RAINBOW_CLOUD != 0 || defined AURORA_INFLUENCE)
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#endif
//Program//
void main() {
#if CLOUD_STYLE_DEFINE != 50
discard;
#else
vec4 color = texture2D(tex, texCoord) * glColor;
vec4 translucentMult = vec4(mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a), 1.0);
#if defined BORDER_FOG || RAINBOW_CLOUD != 0 || defined AURORA_INFLUENCE
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
vec3 playerPos = ViewToPlayer(viewPos);
float xzMaxDistance = max(abs(playerPos.x), abs(playerPos.z));
#if MC_VERSION < 12106
float cloudDistance = 375.0;
#else
float cloudDistance = 2000.0;
#endif
cloudDistance = clamp((cloudDistance - xzMaxDistance) / cloudDistance, 0.0, 1.0);
color.a *= clamp01(cloudDistance * 3.0);
#endif
color.a *= CLOUD_TRANSPARENCY;
#ifdef OVERWORLD
vec3 cloudLight = mix(vec3(0.8, 1.6, 1.5) * sqrt1(nightFactor), mix(dayDownSkyColor, dayMiddleSkyColor, 0.1), sunFactor);
#if RAINBOW_CLOUD != 0
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz);
wpos /= (abs(wpos.y) + length(wpos.xz));
cloudLight *= getRainbowColor(wpos.xz * rainbowCloudDistribution * 0.3, 0.05);
#endif
#ifdef AURORA_INFLUENCE
color.rgb = getAuroraAmbientColor(color.rgb, viewPos, 0.096, AURORA_CLOUD_INFLUENCE_INTENSITY, 0.7);
#endif
color.rgb *= sqrt(cloudLight) * (1.2 + 0.4 * noonFactor * invRainFactor);
#if CLOUD_R != 100 || CLOUD_G != 100 || CLOUD_B != 100
color.rgb *= vec3(CLOUD_R, CLOUD_G, CLOUD_B) * 0.01;
#endif
#ifdef ATM_COLOR_MULTS
color.rgb *= sqrt(GetAtmColorMult()); // C72380KD - Reduced atmColorMult impact on things
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
color.rgb *= moonPhaseInfluence;
#endif
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:063 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);
gl_FragData[2] = vec4(1.0 - translucentMult.rgb, translucentMult.a);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#if CLOUD_STYLE_DEFINE == 50
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec4 glColor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
#if CLOUD_STYLE_DEFINE == 50
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#endif
//Program//
void main() {
#if CLOUD_STYLE_DEFINE != 50
gl_Position = vec4(-1.0);
#else
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
glColor = gl_Color;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/clouds.glsl"
#include "/lib/shaderSettings/cloudsAndLighting.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
#if CLOUD_STYLE_DEFINE == 50
// We use CLOUD_STYLE_DEFINE instead of CLOUD_STYLE in this file because Optifine can't use generated defines for pipeline stuff
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec4 glColor;
#endif
//Pipeline Constants//
//Common Variables//
#if CLOUD_STYLE_DEFINE == 50
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
#endif
//Common Functions//
//Includes//
#if CLOUD_STYLE_DEFINE == 50
#include "/lib/colors/skyColors.glsl"
#include "/lib/util/spaceConversion.glsl"
#if defined TAA && (defined BORDER_FOG || RAINBOW_CLOUD != 0 || defined AURORA_INFLUENCE)
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#endif
//Program//
void main() {
#if CLOUD_STYLE_DEFINE != 50
discard;
#else
vec4 color = texture2D(tex, texCoord) * glColor;
vec4 translucentMult = vec4(mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a), 1.0);
#if defined BORDER_FOG || RAINBOW_CLOUD != 0 || defined AURORA_INFLUENCE
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
vec3 playerPos = ViewToPlayer(viewPos);
float xzMaxDistance = max(abs(playerPos.x), abs(playerPos.z));
#if MC_VERSION < 12106
float cloudDistance = 375.0;
#else
float cloudDistance = 2000.0;
#endif
cloudDistance = clamp((cloudDistance - xzMaxDistance) / cloudDistance, 0.0, 1.0);
color.a *= clamp01(cloudDistance * 3.0);
#endif
color.a *= CLOUD_TRANSPARENCY;
#ifdef OVERWORLD
vec3 cloudLight = mix(vec3(0.8, 1.6, 1.5) * sqrt1(nightFactor), mix(dayDownSkyColor, dayMiddleSkyColor, 0.1), sunFactor);
#if RAINBOW_CLOUD != 0
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz);
wpos /= (abs(wpos.y) + length(wpos.xz));
cloudLight *= getRainbowColor(wpos.xz * rainbowCloudDistribution * 0.3, 0.05);
#endif
#ifdef AURORA_INFLUENCE
color.rgb = getAuroraAmbientColor(color.rgb, viewPos, 0.096, AURORA_CLOUD_INFLUENCE_INTENSITY, 0.7);
#endif
color.rgb *= sqrt(cloudLight) * (1.2 + 0.4 * noonFactor * invRainFactor);
#if CLOUD_R != 100 || CLOUD_G != 100 || CLOUD_B != 100
color.rgb *= vec3(CLOUD_R, CLOUD_G, CLOUD_B) * 0.01;
#endif
#ifdef ATM_COLOR_MULTS
color.rgb *= sqrt(GetAtmColorMult()); // C72380KD - Reduced atmColorMult impact on things
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
color.rgb *= moonPhaseInfluence;
#endif
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:063 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);
gl_FragData[2] = vec4(1.0 - translucentMult.rgb, translucentMult.a);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#if CLOUD_STYLE_DEFINE == 50
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec4 glColor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
#if CLOUD_STYLE_DEFINE == 50
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#endif
//Program//
void main() {
#if CLOUD_STYLE_DEFINE != 50
gl_Position = vec4(-1.0);
#else
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
glColor = gl_Color;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#endif
}
#endif
@@ -1,93 +1,93 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color.rgb *= glColor.rgb;
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color.rgb *= glColor.rgb;
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,465 +1,465 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/entities.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
//#define NIGHT_DESATURATION
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
flat in vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float skyLightCheck = 0.0;
float entitySSBLMask = 1.0;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
//Program//
void main() {
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
vec3 viewPos = ScreenToView(screenPos);
vec3 nViewPos = normalize(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float lViewPos = length(viewPos);
float purkinjeOverwrite = 0.0, emission = 0.0, emissionOld = 0.0;
if (glColor.a < 0.0) discard;
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
#if SHOCKWAVE > 0
vec4 color = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
vec4 color = texture2D(tex, texCoord);
#endif
vec3 colorP = color.rgb;
color *= glColor;
float smoothnessD = 0.0, enderDragonDead = 1.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(1.0);
vec3 lightAlbedo = vec3(0.0);
float alphaCheck = color.a;
#ifdef DO_PIXELATION_EFFECTS
// Fixes artifacts on fragment edges with non-nvidia gpus
if (entityId != 50112) alphaCheck = max(fwidth(color.a), alphaCheck); // Except for nametags as that causes issues
#endif
if (alphaCheck > 0.001) {
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseEmission = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
bool noSmoothLighting = atlasSize.x < 600.0; // To fix fire looking too dim
bool noGeneratedNormals = false, noDirectionalShading = false, noVanillaAO = false;
float smoothnessG = 0.0, highlightMult = 0.0, emission = 0.0, noiseFactor = 0.75;
vec3 maRecolor = vec3(0.0);
if (entityId >= 50015 && entityId <= 50017) { // Player
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
#ifdef IPBR
#if defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008
if (currentRenderedItemId == 0) {
#include "/lib/materials/materialHandling/entityIPBR.glsl"
} else {
#include "/lib/materials/materialHandling/irisIPBR.glsl"
}
#else
#include "/lib/materials/materialHandling/entityIPBR.glsl"
#endif
if (materialMask != OSIEBCA * 254.0) materialMask += OSIEBCA * 100.0; // Entity Reflection Handling
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (entityId == 50004) { // Lightning Bolt
#include "/lib/materials/specificMaterials/others/lightningBolt.glsl"
} else if (entityId == 50008) { // Item Frame, Glow Item Frame
noSmoothLighting = true;
} else if (entityId == 50016 || entityId == 50017) { // Player
#if IRIS_VERSION >= 10800
if (entityId == 50017) entitySSBLMask = 0.0;
#else
if (length(playerPos) < 4.0) entitySSBLMask = 0.0;
#endif
} else if (entityId == 50076) { // Boats
playerPos.y += 0.38; // consistentBOAT2176
}
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
if (entityId == 50020) { // blaze
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50052) { // Magma Cube
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50088) { // Entity Flame
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50092 || entityId == 50093) { // fireball, small fireball
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
}
#endif
#endif
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
normalM = gl_FrontFacing ? normalM : -normalM; // Inverted Normal Workaround
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
#ifdef SS_BLOCKLIGHT
lightAlbedo = normalize(color.rgb) * min1(emission);
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
true, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef IPBR
color.rgb += maRecolor;
#endif
emissionOld = emission;
}
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef ENTITIES_ARE_LIGHT
entitySSBLMask = 1.0;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
/* DRAWBUFFERS:036 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult, 1.0);
gl_FragData[2] = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emissionOld));
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, entitySSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, entitySSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
flat out vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || (defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)) || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
lmCoord.x = min(lmCoord.x, 0.9);
//Fixes some servers/mods making entities insanely bright, while also slightly reducing the max blocklight on a normal entity
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#ifdef GBUFFERS_ENTITIES_GLOWING
if (glColor.a > 0.99) gl_Position.z *= 0.01;
#endif
#ifdef EMIN_BOAT
if (entityId == 50076) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
position.y += 1.25;
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
}
#endif
#ifdef FLICKERING_FIX
if (entityId == 50008 || entityId == 50012) { // Item Frame, Glow Item Frame
if (dot(normal, upVec) > 0.99) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
vec3 comPos = fract(position.xyz + cameraPosition);
comPos = abs(comPos - vec3(0.5));
if ((comPos.y > 0.437 && comPos.y < 0.438) || (comPos.y > 0.468 && comPos.y < 0.469)) {
gl_Position.z += 0.0001;
}
}
if (gl_Normal.y == 1.0) { // Maps
normal = upVec * 2.0;
}
} else if (entityId == 50084) { // Slime, Chicken
gl_Position.z -= 0.00015;
}
#if SHADOW_QUALITY == -1
#ifdef VANILLA_ENTITY_SHADOWS
if (glColor.a < 0.5) gl_Position.z -= 0.0005;
#else
if (glColor.a < 0.5) gl_Position.z += 0.0005;
#endif
#endif
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
if (entityId == 50200) {
gl_Position = vec4(-1);
}
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL == 1 && !defined IRIS_TAG_SUPPORT
if (entityId == 0 && gl_Color.a < 0.2 && abs(normal.y) < 0.2) {
glColor.a = -100000.0;
}
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/entities.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
//#define NIGHT_DESATURATION
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
flat in vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float skyLightCheck = 0.0;
float entitySSBLMask = 1.0;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
//Program//
void main() {
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
vec3 viewPos = ScreenToView(screenPos);
vec3 nViewPos = normalize(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float lViewPos = length(viewPos);
float purkinjeOverwrite = 0.0, emission = 0.0, emissionOld = 0.0;
if (glColor.a < 0.0) discard;
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
#if SHOCKWAVE > 0
vec4 color = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
vec4 color = texture2D(tex, texCoord);
#endif
vec3 colorP = color.rgb;
color *= glColor;
float smoothnessD = 0.0, enderDragonDead = 1.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(1.0);
vec3 lightAlbedo = vec3(0.0);
float alphaCheck = color.a;
#ifdef DO_PIXELATION_EFFECTS
// Fixes artifacts on fragment edges with non-nvidia gpus
if (entityId != 50112) alphaCheck = max(fwidth(color.a), alphaCheck); // Except for nametags as that causes issues
#endif
if (alphaCheck > 0.001) {
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseEmission = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
bool noSmoothLighting = atlasSize.x < 600.0; // To fix fire looking too dim
bool noGeneratedNormals = false, noDirectionalShading = false, noVanillaAO = false;
float smoothnessG = 0.0, highlightMult = 0.0, emission = 0.0, noiseFactor = 0.75;
vec3 maRecolor = vec3(0.0);
if (entityId >= 50015 && entityId <= 50017) { // Player
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
#ifdef IPBR
#if defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008
if (currentRenderedItemId == 0) {
#include "/lib/materials/materialHandling/entityIPBR.glsl"
} else {
#include "/lib/materials/materialHandling/irisIPBR.glsl"
}
#else
#include "/lib/materials/materialHandling/entityIPBR.glsl"
#endif
if (materialMask != OSIEBCA * 254.0) materialMask += OSIEBCA * 100.0; // Entity Reflection Handling
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (entityId == 50004) { // Lightning Bolt
#include "/lib/materials/specificMaterials/others/lightningBolt.glsl"
} else if (entityId == 50008) { // Item Frame, Glow Item Frame
noSmoothLighting = true;
} else if (entityId == 50016 || entityId == 50017) { // Player
#if IRIS_VERSION >= 10800
if (entityId == 50017) entitySSBLMask = 0.0;
#else
if (length(playerPos) < 4.0) entitySSBLMask = 0.0;
#endif
} else if (entityId == 50076) { // Boats
playerPos.y += 0.38; // consistentBOAT2176
}
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
if (entityId == 50020) { // blaze
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50052) { // Magma Cube
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50088) { // Entity Flame
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50092 || entityId == 50093) { // fireball, small fireball
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
}
#endif
#endif
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
normalM = gl_FrontFacing ? normalM : -normalM; // Inverted Normal Workaround
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
#ifdef SS_BLOCKLIGHT
lightAlbedo = normalize(color.rgb) * min1(emission);
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
true, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef IPBR
color.rgb += maRecolor;
#endif
emissionOld = emission;
}
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef ENTITIES_ARE_LIGHT
entitySSBLMask = 1.0;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
/* DRAWBUFFERS:036 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult, 1.0);
gl_FragData[2] = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emissionOld));
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, entitySSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, entitySSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
flat out vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || (defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)) || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
lmCoord.x = min(lmCoord.x, 0.9);
//Fixes some servers/mods making entities insanely bright, while also slightly reducing the max blocklight on a normal entity
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#ifdef GBUFFERS_ENTITIES_GLOWING
if (glColor.a > 0.99) gl_Position.z *= 0.01;
#endif
#ifdef EMIN_BOAT
if (entityId == 50076) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
position.y += 1.25;
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
}
#endif
#ifdef FLICKERING_FIX
if (entityId == 50008 || entityId == 50012) { // Item Frame, Glow Item Frame
if (dot(normal, upVec) > 0.99) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
vec3 comPos = fract(position.xyz + cameraPosition);
comPos = abs(comPos - vec3(0.5));
if ((comPos.y > 0.437 && comPos.y < 0.438) || (comPos.y > 0.468 && comPos.y < 0.469)) {
gl_Position.z += 0.0001;
}
}
if (gl_Normal.y == 1.0) { // Maps
normal = upVec * 2.0;
}
} else if (entityId == 50084) { // Slime, Chicken
gl_Position.z -= 0.00015;
}
#if SHADOW_QUALITY == -1
#ifdef VANILLA_ENTITY_SHADOWS
if (glColor.a < 0.5) gl_Position.z -= 0.0005;
#else
if (glColor.a < 0.5) gl_Position.z += 0.0005;
#endif
#endif
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
if (entityId == 50200) {
gl_Position = vec4(-1);
}
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL == 1 && !defined IRIS_TAG_SUPPORT
if (entityId == 0 && gl_Color.a < 0.2 && abs(normal.y) < 0.2) {
glColor.a = -100000.0;
}
#endif
}
#endif
@@ -1,350 +1,350 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
//#define NIGHT_DESATURATION
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
flat in vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, vec3(0.0, 1.0, 0.0)); // NdotU is different here to improve held map visibility
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float skyLightCheck = 0.0;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
//Program//
void main() {
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
vec4 color = texture2D(tex, texCoord);
float purkinjeOverwrite = 0.0, emission = 0.0;
float smoothnessD = 0.0, enderDragonDead = 1.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(0.5); // Reduced shadowMult for held items to not get too bright
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = vec3(0.0);
#endif
float alphaCheck = color.a;
#ifdef DO_PIXELATION_EFFECTS
// Fixes artifacts on fragment edges with non-nvidia gpus
alphaCheck = max(fwidth(color.a), alphaCheck);
#endif
if (alphaCheck > 0.001) {
#if defined GENERATED_NORMALS || PIXEL_WATER == 1
vec3 colorP = color.rgb;
#endif
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z + 0.38);
vec3 viewPos = ScreenToView(screenPos);
vec3 playerPos = ViewToPlayer(viewPos);
if (color.a < 0.75) materialMask = 0.0;
bool noSmoothLighting = true, noGeneratedNormals = false, noDirectionalShading = false, noVanillaAO = false;
float smoothnessG = 0.0, highlightMult = 1.0, noiseFactor = 0.6;
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
vec3 maRecolor = vec3(0.0);
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseEmission = 1.0;
bool isFoliage = false;
#ifdef IPBR
#if defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008
#include "/lib/materials/materialHandling/irisIPBR.glsl"
if (materialMask != OSIEBCA * 254.0) materialMask += OSIEBCA * 100.0; // Entity Reflection Handling
#endif
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, 0.0);
#endif
#endif
// Support for modded light sources and blockID set by the user
#if defined IS_IRIS && !defined MC_OS_MAC
if (currentRenderedItemId == 0) {
float screenWidth = viewPos.x;
float region1End = -0.1; // End of the first 2/5 region
float region2Start = 0.1; // Start of the last 2/5 region
int heldBlockLight = 0;
if (screenWidth <= region1End || screenWidth >= region2Start) {
heldBlockLight = (viewPos.x > 0.0 ^^ isRightHanded) ? heldBlockLightValue2 : heldBlockLightValue;
}
if (heldBlockLight > 0) {
bool doesNothing;
emission = DoAutomaticEmission(noSmoothLighting, doesNothing, color.rgb, 0.0, heldBlockLight, 0.0);
}
}
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, 0.0, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
lightAlbedo = normalize(color.rgb) * min1(emission) * float(heldBlockLightValue > 0 || heldBlockLightValue2 > 0 || heldItemId == 45032 || heldItemId2 == 45032);
#endif
#ifdef IPBR
color.rgb += maRecolor;
#endif
}
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
float handSSBLMask = 0.0;
#ifdef ENTITIES_ARE_LIGHT
handSSBLMask = 0.2 + isSneaking * 0.5;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
float purkinjeData = 1.0;
#if defined IS_IRIS || defined IS_ANGELICA || MC_VERSION >= 11600
purkinjeData = lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, purkinjeData);
#if BLOCK_REFLECT_QUALITY >= 2 && (RP_MODE >= 2 || defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, handSSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, handSSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA)
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
flat out vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if HAND_SWAYING > 0
#include "/lib/misc/handSway.glsl"
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
//#define NIGHT_DESATURATION
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
flat in vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, vec3(0.0, 1.0, 0.0)); // NdotU is different here to improve held map visibility
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float skyLightCheck = 0.0;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
//Program//
void main() {
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
vec4 color = texture2D(tex, texCoord);
float purkinjeOverwrite = 0.0, emission = 0.0;
float smoothnessD = 0.0, enderDragonDead = 1.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(0.5); // Reduced shadowMult for held items to not get too bright
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = vec3(0.0);
#endif
float alphaCheck = color.a;
#ifdef DO_PIXELATION_EFFECTS
// Fixes artifacts on fragment edges with non-nvidia gpus
alphaCheck = max(fwidth(color.a), alphaCheck);
#endif
if (alphaCheck > 0.001) {
#if defined GENERATED_NORMALS || PIXEL_WATER == 1
vec3 colorP = color.rgb;
#endif
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z + 0.38);
vec3 viewPos = ScreenToView(screenPos);
vec3 playerPos = ViewToPlayer(viewPos);
if (color.a < 0.75) materialMask = 0.0;
bool noSmoothLighting = true, noGeneratedNormals = false, noDirectionalShading = false, noVanillaAO = false;
float smoothnessG = 0.0, highlightMult = 1.0, noiseFactor = 0.6;
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
vec3 maRecolor = vec3(0.0);
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseEmission = 1.0;
bool isFoliage = false;
#ifdef IPBR
#if defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008
#include "/lib/materials/materialHandling/irisIPBR.glsl"
if (materialMask != OSIEBCA * 254.0) materialMask += OSIEBCA * 100.0; // Entity Reflection Handling
#endif
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, 0.0);
#endif
#endif
// Support for modded light sources and blockID set by the user
#if defined IS_IRIS && !defined MC_OS_MAC
if (currentRenderedItemId == 0) {
float screenWidth = viewPos.x;
float region1End = -0.1; // End of the first 2/5 region
float region2Start = 0.1; // Start of the last 2/5 region
int heldBlockLight = 0;
if (screenWidth <= region1End || screenWidth >= region2Start) {
heldBlockLight = (viewPos.x > 0.0 ^^ isRightHanded) ? heldBlockLightValue2 : heldBlockLightValue;
}
if (heldBlockLight > 0) {
bool doesNothing;
emission = DoAutomaticEmission(noSmoothLighting, doesNothing, color.rgb, 0.0, heldBlockLight, 0.0);
}
}
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, 0.0, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
lightAlbedo = normalize(color.rgb) * min1(emission) * float(heldBlockLightValue > 0 || heldBlockLightValue2 > 0 || heldItemId == 45032 || heldItemId2 == 45032);
#endif
#ifdef IPBR
color.rgb += maRecolor;
#endif
}
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
float handSSBLMask = 0.0;
#ifdef ENTITIES_ARE_LIGHT
handSSBLMask = 0.2 + isSneaking * 0.5;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
float purkinjeData = 1.0;
#if defined IS_IRIS || defined IS_ANGELICA || MC_VERSION >= 11600
purkinjeData = lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, purkinjeData);
#if BLOCK_REFLECT_QUALITY >= 2 && (RP_MODE >= 2 || defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, handSSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, handSSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA)
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
flat out vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008)
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if HAND_SWAYING > 0
#include "/lib/misc/handSway.glsl"
#endif
}
#endif
@@ -1,171 +1,171 @@
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/util/dither.glsl"
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec3 colorP = color.rgb;
color *= glColor;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
float materialMask = 0.0;
if (entityId == 50004
#if MC_VERSION >= 12105 && defined IS_IRIS
// Iris broken lightning bolt detection after 1.21.5
|| dot(color.rgb, color.rgb) > 0.01 && color.r < 0.45 && color.g < 0.45 && color.b < 0.5 && glColor.a == 0.0
#endif
) { // Lightning Bolt
#include "/lib/materials/specificMaterials/others/lightningBolt.glsl"
materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
} else { // Dragon Death Beams, and possibly modded effects
#ifdef END
if (dither < 0.8) discard;
color.rgb *= 15.0;
#endif
}
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb);
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 1.0, 1.0);
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(0.0, 1.0, 0.0, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, 1.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
//Pipeline Constants//
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#extension GL_ARB_shader_image_load_store : enable
#endif
//Attributes//
attribute vec4 at_midBlock;
//Common Variables//
//Common Functions//
//Includes//
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#include "/lib/voxelization/endCrystalVoxelization.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
lmCoord = GetLightMapCoordinates();
lmCoord.x = min(lmCoord.x, 0.9);
//Fixes some servers/mods making entities insanely bright, while also slightly reducing the max blocklight on a normal entity
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined FLICKERING_FIX && SHADOW_QUALITY == -1
if (glColor.a < 0.5) gl_Position.z += 0.0005;
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
if (entityId == 0 && (glColor.a < 0.2 || glColor.a == 1.0)) { // Only lightning bolts and dragon death effect run in this program, lightning has an entity ID assigned
#if DRAGON_DEATH_EFFECT_INTERNAL == 1
gl_Position = vec4(0);
#endif
SetEndDragonDeath();
}
#endif
}
#endif
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/util/dither.glsl"
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec3 colorP = color.rgb;
color *= glColor;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
float materialMask = 0.0;
if (entityId == 50004
#if MC_VERSION >= 12105 && defined IS_IRIS
// Iris broken lightning bolt detection after 1.21.5
|| dot(color.rgb, color.rgb) > 0.01 && color.r < 0.45 && color.g < 0.45 && color.b < 0.5 && glColor.a == 0.0
#endif
) { // Lightning Bolt
#include "/lib/materials/specificMaterials/others/lightningBolt.glsl"
materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
} else { // Dragon Death Beams, and possibly modded effects
#ifdef END
if (dither < 0.8) discard;
color.rgb *= 15.0;
#endif
}
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb);
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 1.0, 1.0);
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(0.0, 1.0, 0.0, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, 1.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
//Pipeline Constants//
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#extension GL_ARB_shader_image_load_store : enable
#endif
//Attributes//
attribute vec4 at_midBlock;
//Common Variables//
//Common Functions//
//Includes//
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#include "/lib/voxelization/endCrystalVoxelization.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
lmCoord = GetLightMapCoordinates();
lmCoord.x = min(lmCoord.x, 0.9);
//Fixes some servers/mods making entities insanely bright, while also slightly reducing the max blocklight on a normal entity
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined FLICKERING_FIX && SHADOW_QUALITY == -1
if (glColor.a < 0.5) gl_Position.z += 0.0005;
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
if (entityId == 0 && (glColor.a < 0.2 || glColor.a == 1.0)) { // Only lightning bolts and dragon death effect run in this program, lightning has an entity ID assigned
#if DRAGON_DEATH_EFFECT_INTERNAL == 1
gl_Position = vec4(0);
#endif
SetEndDragonDeath();
}
#endif
}
#endif
@@ -1,297 +1,297 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/tonemaps.glsl"
#include "/lib/shaderSettings/stars.glsl"
//#define SECRET_CAELUM_SUPPORT_SETTING
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec3 upVec, sunVec;
flat in vec4 glColor;
#ifdef OVERWORLD
flat in float vanillaStars;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
const int DoCompTonemap = 0;
const int DoBSLTonemap = 1;
const int ACESTonemap = 2;
const int ACESRedModified = 3;
const int BurgessTonemap = 4;
const int LottesTonemap = 5;
const int Uncharted2 = 6;
const int uncharted2_tonemap_partial = 7;
const int uncharted2_filmic = 8;
const int reinhard2 = 9;
const int filmic = 10;
const int GTTonemap = 11;
const int uchimura = 12;
const int agxTonemap = 13;
const int unreal = 14;
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#include "/lib/atmospherics/stars.glsl"
#include "/lib/atmospherics/shootingStars.glsl"
#endif
#ifdef CAVE_FOG
#include "/lib/atmospherics/fog/caveFactor.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#if SUN_MOON_STYLE >= 2
#include "/lib/util/spaceConversion.glsl"
#endif
//Program//
void main() {
vec4 color = vec4(glColor.rgb, 1.0);
float alphaColor = glColor.a;
#ifdef OVERWORLD
if (vanillaStars > 0.5) {
discard;
}
#if IRIS_VERSION >= 10800 && IRIS_VERSION < 10805
if (renderStage == MC_RENDER_STAGE_MOON) {
discard; // Fixes the vanilla sky gradient causing the sun to disappear
}
#endif
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
vec3 nViewPos = normalize(viewPos.xyz);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float dither = Bayer8(gl_FragCoord.xy);
color.rgb = GetSky(VdotU, VdotS, dither, true, false);
#ifdef SECRET_CAELUM_SUPPORT_SETTING
if (alphaColor < 1.0 && alphaColor > 0.0) color.rgb = glColor.rgb * alphaColor;
#endif
#ifdef ATM_COLOR_MULTS
color.rgb *= GetAtmColorMult();
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
color.rgb *= moonPhaseInfluence;
#endif
vec2 starCoord = GetStarCoord(viewPos.xyz, 0.5);
#if STAR_BRIGHTNESS != 3
vec3 starColor = GetStars(starCoord, VdotU, VdotS, 1.0, 0.0);
#define ADD_STAR_LAYER_OW1 (STAR_LAYER_OW == 1 || STAR_LAYER_OW == 3)
#define ADD_STAR_LAYER_OW2 (STAR_LAYER_OW == 2 || STAR_LAYER_OW == 3)
#if ADD_STAR_LAYER_OW1
starColor = max(starColor, GetStars(starCoord, VdotU, VdotS, 0.66, 0.0));
#endif
#if ADD_STAR_LAYER_OW2
starColor = max(starColor, GetStars(starCoord, VdotU, VdotS, 2.2, 0.45));
#endif
color.rgb += starColor;
#ifdef SHOOTING_STARS
color.rgb += GetShootingStars(starCoord, VdotU, VdotS);
#endif
#endif
#if SUN_MOON_STYLE >= 2
float absVdotS = abs(VdotS);
#if SUN_MOON_STYLE == 2
float sunSizeFactor1 = 0.9975;
float sunSizeFactor2 = 400.0;
float moonCrescentOffset = 0.0055;
float moonPhaseFactor1 = 2.45;
float moonPhaseFactor2 = 750.0;
#else
float sunSizeFactor1 = 0.9983;
float sunSizeFactor2 = 588.235;
float moonCrescentOffset = 0.0042;
float moonPhaseFactor1 = 2.2;
float moonPhaseFactor2 = 1000.0;
#endif
if (absVdotS > sunSizeFactor1) {
float sunMoonMixer = sqrt1(sunSizeFactor2 * (absVdotS - sunSizeFactor1));
#ifdef SUN_MOON_DURING_RAIN
sunMoonMixer *= 1.0 - 0.4 * rainFactor2;
#else
sunMoonMixer *= 1.0 - rainFactor2;
#endif
if (VdotS > 0.0) {
sunMoonMixer = pow2(sunMoonMixer) * GetHorizonFactor(SdotU);
#ifdef CAVE_FOG
sunMoonMixer *= 1.0 - 0.65 * GetCaveFactor();
#endif
float sunBrightness = 25.0;
if (tonemap == ACESTonemap) color.rgb = mix(color.rgb, vec3(1.0, 0.698, 0.5451) * sunBrightness, sunMoonMixer);
else
color.rgb = mix(color.rgb, vec3(0.9, 0.5, 0.3) * sunBrightness, sunMoonMixer);
} else {
float horizonFactor = GetHorizonFactor(-SdotU);
sunMoonMixer = max0(sunMoonMixer - 0.25) * 1.33333 * horizonFactor;
starCoord = GetStarCoord(viewPos.xyz, 1.0) * 0.5 + 0.617;
float moonNoise = texture2DLod(noisetex, starCoord, 0.0).g
+ texture2DLod(noisetex, starCoord * 2.5, 0.0).g * 0.7
+ texture2DLod(noisetex, starCoord * 5.0, 0.0).g * 0.5;
moonNoise = max0(moonNoise - 0.75) * 1.7;
vec3 moonColor = vec3(0.38, 0.4, 0.5);
#if BLOOD_MOON > 0
moonColor = mix(moonColor, vec3(0.4588, 0.149, 0.149) * 1.5, getBloodMoon(sunVisibility));
#endif
moonColor *= (1.2 - (0.2 + 0.2 * sqrt1(nightFactor)) * moonNoise);
if (moonPhase >= 1) {
float moonPhaseOffset = 0.0;
if (moonPhase != 4) {
moonPhaseOffset = moonCrescentOffset;
moonColor *= 8.5;
} else moonColor *= 10.0;
if (moonPhase > 4) {
moonPhaseOffset = -moonPhaseOffset;
}
float ang = fract(timeAngle - (0.25 + moonPhaseOffset));
ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959;
vec2 sunRotationData2 = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994));
vec3 rawSunVec2 = (gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData2) * 2000.0, 1.0)).xyz;
float moonPhaseVdosS = dot(nViewPos, normalize(rawSunVec2.xyz));
sunMoonMixer *= pow2(1.0 - min1(pow(abs(moonPhaseVdosS), moonPhaseFactor2) * moonPhaseFactor1));
} else moonColor *= 4.0;
#ifdef CAVE_FOG
sunMoonMixer *= 1.0 - 0.5 * GetCaveFactor();
#endif
color.rgb = mix(color.rgb, moonColor, sunMoonMixer);
}
}
#endif
#endif
color.rgb *= 1.0 - maxBlindnessDarkness;
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec3 upVec, sunVec;
flat out vec4 glColor;
#ifdef OVERWORLD
flat out float vanillaStars;
#endif
//Attributes//
#ifdef WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
glColor = gl_Color;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#ifdef OVERWORLD
vanillaStars = 0.0;
#if MC_VERSION >= 11605 || defined IS_ANGELICA
if (renderStage == MC_RENDER_STAGE_STARS) {
vanillaStars = 1.0;
}
#else
//Vanilla Star Dedection by Builderb0y
vanillaStars = float(glColor.r == glColor.g && glColor.g == glColor.b && glColor.r > 0.0 && glColor.r < 0.51);
#endif
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/tonemaps.glsl"
#include "/lib/shaderSettings/stars.glsl"
//#define SECRET_CAELUM_SUPPORT_SETTING
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec3 upVec, sunVec;
flat in vec4 glColor;
#ifdef OVERWORLD
flat in float vanillaStars;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
const int DoCompTonemap = 0;
const int DoBSLTonemap = 1;
const int ACESTonemap = 2;
const int ACESRedModified = 3;
const int BurgessTonemap = 4;
const int LottesTonemap = 5;
const int Uncharted2 = 6;
const int uncharted2_tonemap_partial = 7;
const int uncharted2_filmic = 8;
const int reinhard2 = 9;
const int filmic = 10;
const int GTTonemap = 11;
const int uchimura = 12;
const int agxTonemap = 13;
const int unreal = 14;
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#include "/lib/atmospherics/stars.glsl"
#include "/lib/atmospherics/shootingStars.glsl"
#endif
#ifdef CAVE_FOG
#include "/lib/atmospherics/fog/caveFactor.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#if SUN_MOON_STYLE >= 2
#include "/lib/util/spaceConversion.glsl"
#endif
//Program//
void main() {
vec4 color = vec4(glColor.rgb, 1.0);
float alphaColor = glColor.a;
#ifdef OVERWORLD
if (vanillaStars > 0.5) {
discard;
}
#if IRIS_VERSION >= 10800 && IRIS_VERSION < 10805
if (renderStage == MC_RENDER_STAGE_MOON) {
discard; // Fixes the vanilla sky gradient causing the sun to disappear
}
#endif
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
vec3 nViewPos = normalize(viewPos.xyz);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float dither = Bayer8(gl_FragCoord.xy);
color.rgb = GetSky(VdotU, VdotS, dither, true, false);
#ifdef SECRET_CAELUM_SUPPORT_SETTING
if (alphaColor < 1.0 && alphaColor > 0.0) color.rgb = glColor.rgb * alphaColor;
#endif
#ifdef ATM_COLOR_MULTS
color.rgb *= GetAtmColorMult();
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
color.rgb *= moonPhaseInfluence;
#endif
vec2 starCoord = GetStarCoord(viewPos.xyz, 0.5);
#if STAR_BRIGHTNESS != 3
vec3 starColor = GetStars(starCoord, VdotU, VdotS, 1.0, 0.0);
#define ADD_STAR_LAYER_OW1 (STAR_LAYER_OW == 1 || STAR_LAYER_OW == 3)
#define ADD_STAR_LAYER_OW2 (STAR_LAYER_OW == 2 || STAR_LAYER_OW == 3)
#if ADD_STAR_LAYER_OW1
starColor = max(starColor, GetStars(starCoord, VdotU, VdotS, 0.66, 0.0));
#endif
#if ADD_STAR_LAYER_OW2
starColor = max(starColor, GetStars(starCoord, VdotU, VdotS, 2.2, 0.45));
#endif
color.rgb += starColor;
#ifdef SHOOTING_STARS
color.rgb += GetShootingStars(starCoord, VdotU, VdotS);
#endif
#endif
#if SUN_MOON_STYLE >= 2
float absVdotS = abs(VdotS);
#if SUN_MOON_STYLE == 2
float sunSizeFactor1 = 0.9975;
float sunSizeFactor2 = 400.0;
float moonCrescentOffset = 0.0055;
float moonPhaseFactor1 = 2.45;
float moonPhaseFactor2 = 750.0;
#else
float sunSizeFactor1 = 0.9983;
float sunSizeFactor2 = 588.235;
float moonCrescentOffset = 0.0042;
float moonPhaseFactor1 = 2.2;
float moonPhaseFactor2 = 1000.0;
#endif
if (absVdotS > sunSizeFactor1) {
float sunMoonMixer = sqrt1(sunSizeFactor2 * (absVdotS - sunSizeFactor1));
#ifdef SUN_MOON_DURING_RAIN
sunMoonMixer *= 1.0 - 0.4 * rainFactor2;
#else
sunMoonMixer *= 1.0 - rainFactor2;
#endif
if (VdotS > 0.0) {
sunMoonMixer = pow2(sunMoonMixer) * GetHorizonFactor(SdotU);
#ifdef CAVE_FOG
sunMoonMixer *= 1.0 - 0.65 * GetCaveFactor();
#endif
float sunBrightness = 25.0;
if (tonemap == ACESTonemap) color.rgb = mix(color.rgb, vec3(1.0, 0.698, 0.5451) * sunBrightness, sunMoonMixer);
else
color.rgb = mix(color.rgb, vec3(0.9, 0.5, 0.3) * sunBrightness, sunMoonMixer);
} else {
float horizonFactor = GetHorizonFactor(-SdotU);
sunMoonMixer = max0(sunMoonMixer - 0.25) * 1.33333 * horizonFactor;
starCoord = GetStarCoord(viewPos.xyz, 1.0) * 0.5 + 0.617;
float moonNoise = texture2DLod(noisetex, starCoord, 0.0).g
+ texture2DLod(noisetex, starCoord * 2.5, 0.0).g * 0.7
+ texture2DLod(noisetex, starCoord * 5.0, 0.0).g * 0.5;
moonNoise = max0(moonNoise - 0.75) * 1.7;
vec3 moonColor = vec3(0.38, 0.4, 0.5);
#if BLOOD_MOON > 0
moonColor = mix(moonColor, vec3(0.4588, 0.149, 0.149) * 1.5, getBloodMoon(sunVisibility));
#endif
moonColor *= (1.2 - (0.2 + 0.2 * sqrt1(nightFactor)) * moonNoise);
if (moonPhase >= 1) {
float moonPhaseOffset = 0.0;
if (moonPhase != 4) {
moonPhaseOffset = moonCrescentOffset;
moonColor *= 8.5;
} else moonColor *= 10.0;
if (moonPhase > 4) {
moonPhaseOffset = -moonPhaseOffset;
}
float ang = fract(timeAngle - (0.25 + moonPhaseOffset));
ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959;
vec2 sunRotationData2 = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994));
vec3 rawSunVec2 = (gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData2) * 2000.0, 1.0)).xyz;
float moonPhaseVdosS = dot(nViewPos, normalize(rawSunVec2.xyz));
sunMoonMixer *= pow2(1.0 - min1(pow(abs(moonPhaseVdosS), moonPhaseFactor2) * moonPhaseFactor1));
} else moonColor *= 4.0;
#ifdef CAVE_FOG
sunMoonMixer *= 1.0 - 0.5 * GetCaveFactor();
#endif
color.rgb = mix(color.rgb, moonColor, sunMoonMixer);
}
}
#endif
#endif
color.rgb *= 1.0 - maxBlindnessDarkness;
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec3 upVec, sunVec;
flat out vec4 glColor;
#ifdef OVERWORLD
flat out float vanillaStars;
#endif
//Attributes//
#ifdef WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
glColor = gl_Color;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#ifdef OVERWORLD
vanillaStars = 0.0;
#if MC_VERSION >= 11605 || defined IS_ANGELICA
if (renderStage == MC_RENDER_STAGE_STARS) {
vanillaStars = 1.0;
}
#else
//Vanilla Star Dedection by Builderb0y
vanillaStars = float(glColor.r == glColor.g && glColor.g == glColor.b && glColor.r > 0.0 && glColor.r < 0.51);
#endif
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,213 +1,213 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/tonemaps.glsl"
#define STELLAR_VIEW_SUPPORT
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
#ifdef OVERWORLD
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
//Common Variables//
#ifdef OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
#endif
const int DoCompTonemap = 0;
const int DoBSLTonemap = 1;
const int ACESTonemap = 2;
const int ACESRedModified = 3;
const int BurgessTonemap = 4;
const int LottesTonemap = 5;
const int Uncharted2 = 6;
const int uncharted2_tonemap_partial = 7;
const int uncharted2_filmic = 8;
const int reinhard2 = 9;
const int filmic = 10;
const int GTTonemap = 11;
const int uchimura = 12;
const int agxTonemap = 13;
const int unreal = 14;
//Common Functions//
//Includes//
#include "/lib/colors/lightAndAmbientColors.glsl"
#ifdef END
#include "/lib/colors/skyColors.glsl"
#endif
#ifdef CAVE_FOG
#include "/lib/atmospherics/fog/caveFactor.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
#ifdef OVERWORLD
vec2 tSize = textureSize(tex, 0);
vec4 color = texture2D(tex, texCoord);
color.rgb *= glColor.rgb;
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
vec3 nViewPos = normalize(viewPos.xyz);
float VdotS = dot(nViewPos, sunVec);
float VdotU = dot(nViewPos, upVec);
#ifdef IS_IRIS
bool sunSideCheck = VdotS > 0.95;
bool isSun = renderStage == MC_RENDER_STAGE_SUN;
bool isMoon = renderStage == MC_RENDER_STAGE_MOON;
#if IRIS_VERSION < 10902
if (sunSideCheck) isSun = true; // Workaround for sun rendering as MC_RENDER_STAGE_MOON in some Iris versions
#endif
#else
bool sunSideCheck = VdotS > 0.0;
bool tSizeCheck = abs(tSize.y - 264.0) < 248.5; //tSize.y must range from 16 to 512
bool isSun = tSizeCheck && sunSideCheck;
bool isMoon = tSizeCheck && !sunSideCheck;
#endif
if (isSun || isMoon) {
#if SUN_MOON_STYLE >= 2
discard;
#endif
if (isSun) {
float sunBrightness = 4.5;
color.rgb = vec3(pow(dot(color.rgb, color.rgb) * 0.45, 6.0 - 5.0 * rainFactor));
if (tonemap == ACESTonemap) color.rgb *= mix(vec3(1.0, 0.6275, 0.4549) * 1.2, vec3(0.35), rainFactor * 0.75) * sunBrightness * 0.5;
else color.rgb *= mix(vec3(1.1, 0.55, 0.0), vec3(0.35), rainFactor * 0.75) * sunBrightness; // all other tonemaps
color.rgb *= 0.25 + 0.75 * sunVisibility2 + 0.5 * noonFactor;
}
if (isMoon) {
// vec3 pixelGlareColor = color.rgb;
// pixelGlareColor = mix(pixelGlareColor, pixelGlareColor * vec3(0.9, 0.95, 1.1), 0.5) * 1.3;
color.rgb *= smoothstep1(min1(length(color.rgb))) * 1.3;
#if BLOOD_MOON > 0
float luminance = GetLuminance(color.rgb);
color.rgb = mix(color.rgb, pow2(luminance) * vec3(0.702, 0.0, 0.0) * 1.7, getBloodMoon(sunVisibility));
#endif
// float pixelGlareFactor = 1 - step(0.09,luminance);
// color.rgb = mix(color.rgb, pixelGlareColor, pixelGlareFactor);
}
color.rgb *= GetHorizonFactor(VdotU);
#ifdef CAVE_FOG
color.rgb *= 1.0 - 0.75 * GetCaveFactor();
#endif
} else { // Custom Sky
#if MC_VERSION >= 11300
#ifdef STELLAR_VIEW_SUPPORT
color.rgb *= mix(vec3(1.0), color.rgb * smoothstep1(sqrt1(max0(VdotU))), float(abs(VdotS) > 0.95)); // we only want it near the sun and moon
#else
color.rgb *= color.rgb * smoothstep1(sqrt1(max0(VdotU)));
#endif
#else
discard;
// Old mc custom skyboxes are weirdly broken, so we discard.
#endif
}
if (isEyeInWater == 1) color.rgb *= 0.25;
// Reduced visibility in rain
float rainFactorM = rainFactor;
#ifdef SUN_MOON_DURING_RAIN
rainFactorM *= 0.8;
#endif
color.a *= 1.0 - rainFactorM;
#ifdef STELLAR_VIEW_SUPPORT
// Complementary by default shows the sun/moon while raining. But in vanilla they have an alpha of 0 while raining.
float vanillaSunMoonMask = float(isSun || isMoon);
color.rgb *= max0(glColor.a + vanillaSunMoonMask * rainStrength); // Support fop skybox altering mods
color.a *= max(step(0.0001, glColor.a), vanillaSunMoonMask); // Based on vanilla mask we only set alpha to 0 when glColor.a is 0 and not sun/moon
#endif
#endif
#ifdef NETHER
vec4 color = vec4(0.0);
#endif
#ifdef END
vec4 color = vec4(endSkyColor, 1.0);
#endif
#if RETRO_LOOK == 1
color.rgb = GetLuminance(color.rgb) * vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.3 * RETRO_LOOK_I;
#elif RETRO_LOOK == 2
color.rgb = mix(color.rgb, GetLuminance(color.rgb) * vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.3 * RETRO_LOOK_I, nightVision);
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
#ifdef OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#ifdef OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/tonemaps.glsl"
#define STELLAR_VIEW_SUPPORT
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
#ifdef OVERWORLD
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
//Common Variables//
#ifdef OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
#endif
const int DoCompTonemap = 0;
const int DoBSLTonemap = 1;
const int ACESTonemap = 2;
const int ACESRedModified = 3;
const int BurgessTonemap = 4;
const int LottesTonemap = 5;
const int Uncharted2 = 6;
const int uncharted2_tonemap_partial = 7;
const int uncharted2_filmic = 8;
const int reinhard2 = 9;
const int filmic = 10;
const int GTTonemap = 11;
const int uchimura = 12;
const int agxTonemap = 13;
const int unreal = 14;
//Common Functions//
//Includes//
#include "/lib/colors/lightAndAmbientColors.glsl"
#ifdef END
#include "/lib/colors/skyColors.glsl"
#endif
#ifdef CAVE_FOG
#include "/lib/atmospherics/fog/caveFactor.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
#ifdef OVERWORLD
vec2 tSize = textureSize(tex, 0);
vec4 color = texture2D(tex, texCoord);
color.rgb *= glColor.rgb;
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
vec3 nViewPos = normalize(viewPos.xyz);
float VdotS = dot(nViewPos, sunVec);
float VdotU = dot(nViewPos, upVec);
#ifdef IS_IRIS
bool sunSideCheck = VdotS > 0.95;
bool isSun = renderStage == MC_RENDER_STAGE_SUN;
bool isMoon = renderStage == MC_RENDER_STAGE_MOON;
#if IRIS_VERSION < 10902
if (sunSideCheck) isSun = true; // Workaround for sun rendering as MC_RENDER_STAGE_MOON in some Iris versions
#endif
#else
bool sunSideCheck = VdotS > 0.0;
bool tSizeCheck = abs(tSize.y - 264.0) < 248.5; //tSize.y must range from 16 to 512
bool isSun = tSizeCheck && sunSideCheck;
bool isMoon = tSizeCheck && !sunSideCheck;
#endif
if (isSun || isMoon) {
#if SUN_MOON_STYLE >= 2
discard;
#endif
if (isSun) {
float sunBrightness = 4.5;
color.rgb = vec3(pow(dot(color.rgb, color.rgb) * 0.45, 6.0 - 5.0 * rainFactor));
if (tonemap == ACESTonemap) color.rgb *= mix(vec3(1.0, 0.6275, 0.4549) * 1.2, vec3(0.35), rainFactor * 0.75) * sunBrightness * 0.5;
else color.rgb *= mix(vec3(1.1, 0.55, 0.0), vec3(0.35), rainFactor * 0.75) * sunBrightness; // all other tonemaps
color.rgb *= 0.25 + 0.75 * sunVisibility2 + 0.5 * noonFactor;
}
if (isMoon) {
// vec3 pixelGlareColor = color.rgb;
// pixelGlareColor = mix(pixelGlareColor, pixelGlareColor * vec3(0.9, 0.95, 1.1), 0.5) * 1.3;
color.rgb *= smoothstep1(min1(length(color.rgb))) * 1.3;
#if BLOOD_MOON > 0
float luminance = GetLuminance(color.rgb);
color.rgb = mix(color.rgb, pow2(luminance) * vec3(0.702, 0.0, 0.0) * 1.7, getBloodMoon(sunVisibility));
#endif
// float pixelGlareFactor = 1 - step(0.09,luminance);
// color.rgb = mix(color.rgb, pixelGlareColor, pixelGlareFactor);
}
color.rgb *= GetHorizonFactor(VdotU);
#ifdef CAVE_FOG
color.rgb *= 1.0 - 0.75 * GetCaveFactor();
#endif
} else { // Custom Sky
#if MC_VERSION >= 11300
#ifdef STELLAR_VIEW_SUPPORT
color.rgb *= mix(vec3(1.0), color.rgb * smoothstep1(sqrt1(max0(VdotU))), float(abs(VdotS) > 0.95)); // we only want it near the sun and moon
#else
color.rgb *= color.rgb * smoothstep1(sqrt1(max0(VdotU)));
#endif
#else
discard;
// Old mc custom skyboxes are weirdly broken, so we discard.
#endif
}
if (isEyeInWater == 1) color.rgb *= 0.25;
// Reduced visibility in rain
float rainFactorM = rainFactor;
#ifdef SUN_MOON_DURING_RAIN
rainFactorM *= 0.8;
#endif
color.a *= 1.0 - rainFactorM;
#ifdef STELLAR_VIEW_SUPPORT
// Complementary by default shows the sun/moon while raining. But in vanilla they have an alpha of 0 while raining.
float vanillaSunMoonMask = float(isSun || isMoon);
color.rgb *= max0(glColor.a + vanillaSunMoonMask * rainStrength); // Support fop skybox altering mods
color.a *= max(step(0.0001, glColor.a), vanillaSunMoonMask); // Based on vanilla mask we only set alpha to 0 when glColor.a is 0 and not sun/moon
#endif
#endif
#ifdef NETHER
vec4 color = vec4(0.0);
#endif
#ifdef END
vec4 color = vec4(endSkyColor, 1.0);
#endif
#if RETRO_LOOK == 1
color.rgb = GetLuminance(color.rgb) * vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.3 * RETRO_LOOK_I;
#elif RETRO_LOOK == 2
color.rgb = mix(color.rgb, GetLuminance(color.rgb) * vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.3 * RETRO_LOOK_I, nightVision);
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
#ifdef OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#ifdef OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
@@ -1,115 +1,115 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//#define INTENSE_DEEP_DARK
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord) * glColor;
#ifdef INTENSE_DEEP_DARK
if (color.b > 0.1 && color.r < 0.5) { // Warden
color.rgb = mix(color.rgb, color.rgb + 0.3, darknessFactor);
}
#endif
color.rgb = pow1_5(color.rgb) * (
1.5
+ vec3(4.1, 3.0, 4.1) * max0(color.r * color.b - color.g) // Tweak for Enderman
+ 5.0 * max0(color.g * color.b - color.r) // Tweak for Warden
- 0.5 * sqrt(color.r * color.g * color.b) // Tweak for Breeze
- vec3(0.0, 0.7, 0.7) * max0(color.r * color.g - color.b) // Tweak for Copper Golem
);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0, 0, 0, 1);
#ifdef ENTITIES_ARE_LIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(1);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//#define INTENSE_DEEP_DARK
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord) * glColor;
#ifdef INTENSE_DEEP_DARK
if (color.b > 0.1 && color.r < 0.5) { // Warden
color.rgb = mix(color.rgb, color.rgb + 0.3, darknessFactor);
}
#endif
color.rgb = pow1_5(color.rgb) * (
1.5
+ vec3(4.1, 3.0, 4.1) * max0(color.r * color.b - color.g) // Tweak for Enderman
+ 5.0 * max0(color.g * color.b - color.r) // Tweak for Warden
- 0.5 * sqrt(color.r * color.g * color.b) // Tweak for Breeze
- vec3(0.0, 0.7, 0.7) * max0(color.r * color.g - color.b) // Tweak for Copper Golem
);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0, 0, 0, 1);
#ifdef ENTITIES_ARE_LIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(1);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,376 +1,376 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/raindropColor.glsl"
//#define GLOWING_COLORED_PARTICLES
#define SMOKE_PARTICLE_OPACITY 0.5 //[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/util/dither.glsl"
#if MC_VERSION >= 11500
#include "/lib/atmospherics/fog/mainFog.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#if defined BIOME_COLORED_NETHER_PORTALS && !defined BORDER_FOG
#include "/lib/colors/skyColors.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec4 colorP = color;
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
vec3 viewPos = ScreenToView(screenPos);
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float dither = texture2DLod(noisetex, gl_FragCoord.xy / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
#endif
#ifdef VL_CLOUDS_ACTIVE
float cloudLinearDepth = texelFetch(gaux2, texelCoord, 0).a;
if (cloudLinearDepth > 0.0) // Because Iris changes the pipeline position of opaque particles
if (pow2(cloudLinearDepth + OSIEBCA * dither) * renderDistance < min(lViewPos, renderDistance)) discard;
#endif
float emission = 0.0, enderDragonDead = 1.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0;
#if defined IPBR && defined IPBR_PARTICLE_FEATURES
// We don't want to detect particles from the block atlas
#if MC_VERSION >= 12000
float atlasCheck = 1100.0; // I think texture atlas got bigger in newer mc
#else
float atlasCheck = 900.0;
#endif
vec2 tSize = textureSize(tex, 0);
if (tSize.x < atlasCheck) {
if (color.b > 1.15 * (color.r + color.g) && color.g > color.r * 1.25 && color.g < 0.425 && color.b > 0.75) { // Water Particle
materialMask = OSIEBCA * 251.0; // No SSAO, Reduce Reflection
color.rgb = sqrt3(color.rgb);
color.rgb *= 0.7;
if (dither > 0.4) discard;
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
#ifdef OVERWORLD
} else if (color.b > 0.7 && color.r < 0.28 && color.g < 0.425 && color.g > color.r * 1.4) { // physics mod rain
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= rainTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + ambientColor * lmCoord.y * (0.7 + 0.35 * sunFactor));
} else if (color.rgb == vec3(1.0) && color.a < 0.765 && color.a > 0.605) { // physics mod snow (default snow opacity only)
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= snowTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + lmCoord.y * (0.7 + 0.35 * sunFactor) + ambientColor * 0.2);
#endif
} else if (color.r == 1.0 && color.b < 0.778 && color.g < 0.97) { // Fire Particle
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorEndBreath, 1.0);
#endif
emission = 2.0;
} else if (color.r == color.g && color.r - 0.5 * color.b < 0.06) { // Underwater Particle
if (isEyeInWater == 1) {
color.rgb = sqrt2(color.rgb) * 0.35;
if (fract(playerPos.y + cameraPosition.y) > 0.25) discard;
}
} else if (color.a < 0.99 && dot(color.rgb, color.rgb) < 1.0) { // Campfire Smoke
color.a *= SMOKE_PARTICLE_OPACITY;
materialMask = OSIEBCA * 251.0; // No SSAO, Reduce Reflection
} else if (max(abs(colorP.r - colorP.b), abs(colorP.b - colorP.g)) < 0.001) { // Grayscale Particles
float dotColor = dot(color.rgb, color.rgb);
if (dotColor > 0.25 && color.g < 0.5 && (color.b > color.r * 1.1 && color.r > 0.3 || color.r > (color.g + color.b) * 3.0)) {
// Ender Particle, Crying Obsidian Particle, Redstone Particle
emission = clamp(color.r * 8.0, 1.6, 5.0);
color.rgb = pow1_5(color.rgb);
lmCoordM = vec2(0.0);
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
if (color.b > color.r * color.r && color.g < 0.16 && color.r > 0.2) color.rgb = changeColorFunction(color.rgb, 10.0, netherColor, 1.0); // Nether Portal
#endif
} else if (color.r > 0.83 && color.g > 0.23 && color.b < 0.4) {
// Lava Particles
emission = 2.0;
color.b *= 0.5;
color.r *= 1.2;
color.rgb += vec3(min(pow2(pow2(emission * 0.35)), 0.4)) * LAVA_TEMPERATURE * 0.5;
emission *= LAVA_EMISSION;
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorEndBreath, 1.0);
#endif
}
}
}
bool noSmoothLighting = false;
#else
#if defined OVERWORLD && defined NO_RAIN_ABOVE_CLOUDS || defined NETHER && (defined BIOME_COLORED_NETHER_PORTALS || defined SOUL_SAND_VALLEY_OVERHAUL_INTERNAL)
if (atlasSize.x < 900.0) {
if (color.b > 1.15 * (color.r + color.g) && color.g > color.r * 1.25 && color.g < 0.425 && color.b > 0.75) { // Water Particle
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
}
#ifdef OVERWORLD
if (color.b > 0.7 && color.r < 0.28 && color.g < 0.425 && color.g > color.r * 1.4) { // physics mod rain
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= rainTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + ambientColor * lmCoord.y * (0.7 + 0.35 * sunFactor));
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
} else if (color.rgb == vec3(1.0) && color.a < 0.765 && color.a > 0.605) { // physics mod snow (default snow opacity only)
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= snowTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + lmCoord.y * (0.7 + 0.35 * sunFactor) + ambientColor * 0.2);
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
}
#endif
if (color.r == 1.0 && color.b < 0.778 && color.g < 0.97) { // Fire Particle
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorEndBreath, 1.0);
#endif
emission = 2.0;
}
if (max(abs(colorP.r - colorP.b), abs(colorP.b - colorP.g)) < 0.001) {
if (dot(color.rgb, color.rgb) > 0.25 && color.g < 0.5 && (color.b > color.r * 1.1 && color.r > 0.3 || color.r > (color.g + color.b) * 3.0)) {
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
vec3 color2 = pow1_5(color.rgb);
if (color2.b > color2.r * color2.r && color2.g < 0.16 && color2.r > 0.2) {
emission = clamp(color2.r * 8.0, 1.6, 5.0);
color.rgb = color.rgb = changeColorFunction(color.rgb, 10.0, netherColor, 1.0);
lmCoordM = vec2(0.0);
}
#endif
} else if (color.r > 0.83 && color.g > 0.23 && color.b < 0.4) {
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorEndBreath, 1.0);
#endif
}
}
}
#endif
bool noSmoothLighting = true;
#endif
#ifdef REDUCE_CLOSE_PARTICLES
if (lViewPos - 1.0 < dither) discard;
#endif
#ifdef GLOWING_COLORED_PARTICLES
if (atlasSize.x < 900.0) {
if (dot(glColor.rgb, vec3(1.0)) < 2.99) {
emission = 5.0;
}
}
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, false, true,
false, 0, 0.0, 1.0, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#if MC_VERSION >= 11500
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float sky = 0.0;
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
color.a = prevAlpha;
#endif
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
float SSBLMask = 0.0;
#ifdef ENTITIES_ARE_LIGHT
SSBLMask = 1.0;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:063 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
gl_FragData[2] = vec4(1.0 - translucentMult, 1.0);
#ifdef SS_BLOCKLIGHT
/* RENDERTARGETS: 0,6,3,9,10 */
gl_FragData[3] = vec4(0.0, 0.0, 0.0, SSBLMask);
gl_FragData[4] = vec4(0.0, 0.0, 0.0, SSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
flat out vec4 glColor;
//Attributes//
#if defined WAVE_EVERYTHING || defined ATLAS_ROTATION
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
#ifdef FLICKERING_FIX
gl_Position.z -= 0.000002;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/raindropColor.glsl"
//#define GLOWING_COLORED_PARTICLES
#define SMOKE_PARTICLE_OPACITY 0.5 //[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/util/dither.glsl"
#if MC_VERSION >= 11500
#include "/lib/atmospherics/fog/mainFog.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#if defined BIOME_COLORED_NETHER_PORTALS && !defined BORDER_FOG
#include "/lib/colors/skyColors.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec4 colorP = color;
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
vec3 viewPos = ScreenToView(screenPos);
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float dither = texture2DLod(noisetex, gl_FragCoord.xy / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
#endif
#ifdef VL_CLOUDS_ACTIVE
float cloudLinearDepth = texelFetch(gaux2, texelCoord, 0).a;
if (cloudLinearDepth > 0.0) // Because Iris changes the pipeline position of opaque particles
if (pow2(cloudLinearDepth + OSIEBCA * dither) * renderDistance < min(lViewPos, renderDistance)) discard;
#endif
float emission = 0.0, enderDragonDead = 1.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0;
#if defined IPBR && defined IPBR_PARTICLE_FEATURES
// We don't want to detect particles from the block atlas
#if MC_VERSION >= 12000
float atlasCheck = 1100.0; // I think texture atlas got bigger in newer mc
#else
float atlasCheck = 900.0;
#endif
vec2 tSize = textureSize(tex, 0);
if (tSize.x < atlasCheck) {
if (color.b > 1.15 * (color.r + color.g) && color.g > color.r * 1.25 && color.g < 0.425 && color.b > 0.75) { // Water Particle
materialMask = OSIEBCA * 251.0; // No SSAO, Reduce Reflection
color.rgb = sqrt3(color.rgb);
color.rgb *= 0.7;
if (dither > 0.4) discard;
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
#ifdef OVERWORLD
} else if (color.b > 0.7 && color.r < 0.28 && color.g < 0.425 && color.g > color.r * 1.4) { // physics mod rain
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= rainTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + ambientColor * lmCoord.y * (0.7 + 0.35 * sunFactor));
} else if (color.rgb == vec3(1.0) && color.a < 0.765 && color.a > 0.605) { // physics mod snow (default snow opacity only)
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= snowTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + lmCoord.y * (0.7 + 0.35 * sunFactor) + ambientColor * 0.2);
#endif
} else if (color.r == 1.0 && color.b < 0.778 && color.g < 0.97) { // Fire Particle
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorEndBreath, 1.0);
#endif
emission = 2.0;
} else if (color.r == color.g && color.r - 0.5 * color.b < 0.06) { // Underwater Particle
if (isEyeInWater == 1) {
color.rgb = sqrt2(color.rgb) * 0.35;
if (fract(playerPos.y + cameraPosition.y) > 0.25) discard;
}
} else if (color.a < 0.99 && dot(color.rgb, color.rgb) < 1.0) { // Campfire Smoke
color.a *= SMOKE_PARTICLE_OPACITY;
materialMask = OSIEBCA * 251.0; // No SSAO, Reduce Reflection
} else if (max(abs(colorP.r - colorP.b), abs(colorP.b - colorP.g)) < 0.001) { // Grayscale Particles
float dotColor = dot(color.rgb, color.rgb);
if (dotColor > 0.25 && color.g < 0.5 && (color.b > color.r * 1.1 && color.r > 0.3 || color.r > (color.g + color.b) * 3.0)) {
// Ender Particle, Crying Obsidian Particle, Redstone Particle
emission = clamp(color.r * 8.0, 1.6, 5.0);
color.rgb = pow1_5(color.rgb);
lmCoordM = vec2(0.0);
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
if (color.b > color.r * color.r && color.g < 0.16 && color.r > 0.2) color.rgb = changeColorFunction(color.rgb, 10.0, netherColor, 1.0); // Nether Portal
#endif
} else if (color.r > 0.83 && color.g > 0.23 && color.b < 0.4) {
// Lava Particles
emission = 2.0;
color.b *= 0.5;
color.r *= 1.2;
color.rgb += vec3(min(pow2(pow2(emission * 0.35)), 0.4)) * LAVA_TEMPERATURE * 0.5;
emission *= LAVA_EMISSION;
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorEndBreath, 1.0);
#endif
}
}
}
bool noSmoothLighting = false;
#else
#if defined OVERWORLD && defined NO_RAIN_ABOVE_CLOUDS || defined NETHER && (defined BIOME_COLORED_NETHER_PORTALS || defined SOUL_SAND_VALLEY_OVERHAUL_INTERNAL)
if (atlasSize.x < 900.0) {
if (color.b > 1.15 * (color.r + color.g) && color.g > color.r * 1.25 && color.g < 0.425 && color.b > 0.75) { // Water Particle
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
}
#ifdef OVERWORLD
if (color.b > 0.7 && color.r < 0.28 && color.g < 0.425 && color.g > color.r * 1.4) { // physics mod rain
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= rainTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + ambientColor * lmCoord.y * (0.7 + 0.35 * sunFactor));
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
} else if (color.rgb == vec3(1.0) && color.a < 0.765 && color.a > 0.605) { // physics mod snow (default snow opacity only)
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= snowTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + lmCoord.y * (0.7 + 0.35 * sunFactor) + ambientColor * 0.2);
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
}
#endif
if (color.r == 1.0 && color.b < 0.778 && color.g < 0.97) { // Fire Particle
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorEndBreath, 1.0);
#endif
emission = 2.0;
}
if (max(abs(colorP.r - colorP.b), abs(colorP.b - colorP.g)) < 0.001) {
if (dot(color.rgb, color.rgb) > 0.25 && color.g < 0.5 && (color.b > color.r * 1.1 && color.r > 0.3 || color.r > (color.g + color.b) * 3.0)) {
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS
vec3 color2 = pow1_5(color.rgb);
if (color2.b > color2.r * color2.r && color2.g < 0.16 && color2.r > 0.2) {
emission = clamp(color2.r * 8.0, 1.6, 5.0);
color.rgb = color.rgb = changeColorFunction(color.rgb, 10.0, netherColor, 1.0);
lmCoordM = vec2(0.0);
}
#endif
} else if (color.r > 0.83 && color.g > 0.23 && color.b < 0.4) {
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.5, colorEndBreath, 1.0);
#endif
}
}
}
#endif
bool noSmoothLighting = true;
#endif
#ifdef REDUCE_CLOSE_PARTICLES
if (lViewPos - 1.0 < dither) discard;
#endif
#ifdef GLOWING_COLORED_PARTICLES
if (atlasSize.x < 900.0) {
if (dot(glColor.rgb, vec3(1.0)) < 2.99) {
emission = 5.0;
}
}
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, false, true,
false, 0, 0.0, 1.0, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#if MC_VERSION >= 11500
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float sky = 0.0;
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
color.a = prevAlpha;
#endif
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
float SSBLMask = 0.0;
#ifdef ENTITIES_ARE_LIGHT
SSBLMask = 1.0;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:063 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
gl_FragData[2] = vec4(1.0 - translucentMult, 1.0);
#ifdef SS_BLOCKLIGHT
/* RENDERTARGETS: 0,6,3,9,10 */
gl_FragData[3] = vec4(0.0, 0.0, 0.0, SSBLMask);
gl_FragData[4] = vec4(0.0, 0.0, 0.0, SSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
flat out vec4 glColor;
//Attributes//
#if defined WAVE_EVERYTHING || defined ATLAS_ROTATION
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
#ifdef FLICKERING_FIX
gl_Position.z -= 0.000002;
#endif
}
#endif
@@ -1,155 +1,155 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/raindropColor.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec2 lmCoord;
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec3 playerPos;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
//Common Functions//
//Includes//
#include "/lib/colors/lightAndAmbientColors.glsl"
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color *= glColor;
if (color.a < 0.1 || isEyeInWater == 3) discard;
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.r + color.g < 1.5) color.a *= rainTexOpacity;
else color.a *= snowTexOpacity;
color.rgb = sqrt3(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + (ambientColor + 0.2 * lightColor) * lmCoord.y * (0.6 + 0.3 * sunFactor));
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
#if GLITTER_RAIN > 0
float rainbowGlitterOn = 1.0;
#if GLITTER_RAIN == 1
rainbowGlitterOn = 0.0;
float randomRainbowGlitterTime = 24000 * hash1(worldDay * 3); // Effect happens randomly throughout the day
int rainbowGlitterEffect = (int(hash1(worldDay / 2)) % (2 * 24000)) + int(randomRainbowGlitterTime);
if (worldTime > rainbowGlitterEffect && worldTime < rainbowGlitterEffect + 400) { // 400 in ticks - 20s, how long the effect will be on
rainbowGlitterOn = 1.0;
}
#endif
color.rgb = mix(color.rgb, vec3(0.752, 0.752, 0.752) * 5.0, mix(0.0, step(0.7, Noise3D((playerPos + cameraPosition) * 0.004 + frameTimeCounter * 0.02)), rainbowGlitterOn * rainFactor));
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
#ifdef PBR_REFLECTIONS
/* DRAWBUFFERS:04 */
gl_FragData[1] = vec4(0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec2 lmCoord;
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec3 playerPos;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
glColor = gl_Color;
#ifdef WAVING_RAIN
float rainWavingFactor = eyeBrightnessM2; // Prevents clipping inside interiors
position.xz += rainWavingFactor * (0.4 * position.y + 0.2) * vec2(sin(frameTimeCounter * 0.3) + 0.5, sin(frameTimeCounter * 0.5) * 0.5);
position.xz *= 1.0 - 0.08 * position.y * rainWavingFactor;
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/raindropColor.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec2 lmCoord;
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec3 playerPos;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
//Common Functions//
//Includes//
#include "/lib/colors/lightAndAmbientColors.glsl"
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color *= glColor;
if (color.a < 0.1 || isEyeInWater == 3) discard;
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.r + color.g < 1.5) color.a *= rainTexOpacity;
else color.a *= snowTexOpacity;
color.rgb = sqrt3(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + (ambientColor + 0.2 * lightColor) * lmCoord.y * (0.6 + 0.3 * sunFactor));
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
#if GLITTER_RAIN > 0
float rainbowGlitterOn = 1.0;
#if GLITTER_RAIN == 1
rainbowGlitterOn = 0.0;
float randomRainbowGlitterTime = 24000 * hash1(worldDay * 3); // Effect happens randomly throughout the day
int rainbowGlitterEffect = (int(hash1(worldDay / 2)) % (2 * 24000)) + int(randomRainbowGlitterTime);
if (worldTime > rainbowGlitterEffect && worldTime < rainbowGlitterEffect + 400) { // 400 in ticks - 20s, how long the effect will be on
rainbowGlitterOn = 1.0;
}
#endif
color.rgb = mix(color.rgb, vec3(0.752, 0.752, 0.752) * 5.0, mix(0.0, step(0.7, Noise3D((playerPos + cameraPosition) * 0.004 + frameTimeCounter * 0.02)), rainbowGlitterOn * rainFactor));
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
#ifdef PBR_REFLECTIONS
/* DRAWBUFFERS:04 */
gl_FragData[1] = vec4(0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec2 lmCoord;
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec3 playerPos;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
glColor = gl_Color;
#ifdef WAVING_RAIN
float rainWavingFactor = eyeBrightnessM2; // Prevents clipping inside interiors
position.xz += rainWavingFactor * (0.4 * position.y + 0.2) * vec2(sin(frameTimeCounter * 0.3) + 0.5, sin(frameTimeCounter * 0.5) * 0.5);
position.xz *= 1.0 - 0.08 * position.y * rainWavingFactor;
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif
@@ -1,191 +1,191 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
discard;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
//Pipeline Constants//
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
#endif
//Uniforms//
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
layout(r32i) uniform iimage2D endcrystal_img;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
vec4 position0 = ftransform();
if (position0.x < 0.0 && position0.y > 0.0) {
#if END_CRYSTAL_VORTEX_INTERNAL % 2 == 1
// update temporally stable end crystal data
for (int index = 0; index < 20; index++) {
int state = imageLoad(endcrystal_img, ivec2(index, 8)).r;
state -= max(1, int(10000 * frameTime));
if (state < 0) {
for (int i = 0; i < 5; i++) {
imageStore(endcrystal_img, ivec2(index, i+5), ivec4(0));
}
} else {
ivec4 writeData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 5)).r,
imageLoad(endcrystal_img, ivec2(index, 6)).r,
imageLoad(endcrystal_img, ivec2(index, 7)).r,
state
);
writeData.xyz += ivec3(10000 * (previousCameraPosition - cameraPosition));
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(index, i+5), ivec4(writeData[i]));
}
imageStore(endcrystal_img, ivec2(index, 9), ivec4(
imageLoad(endcrystal_img, ivec2(index, 9)).r + int(10000 * frameTime)
));
}
}
// crystals
for (int index = 0; index < 20; index++) {
ivec4 newData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 1)).r,
imageLoad(endcrystal_img, ivec2(index, 2)).r,
imageLoad(endcrystal_img, ivec2(index, 3)).r,
imageLoad(endcrystal_img, ivec2(index, 4)).r
);
if (newData.w > 0) {
vec3 pos = vec3(newData.xyz) / newData.w;
int temporalIndex = -1;
for (int k = 0; k < 20; k++) {
ivec4 temporalData = ivec4(
imageLoad(endcrystal_img, ivec2(k, 5)).r,
imageLoad(endcrystal_img, ivec2(k, 6)).r,
imageLoad(endcrystal_img, ivec2(k, 7)).r,
imageLoad(endcrystal_img, ivec2(k, 8)).r
);
vec3 temporalPos = 0.0001 * temporalData.xyz;
if (temporalData.w > 0 && length((temporalPos - pos) * vec3(1.0, 0.3, 1.0)) < 1.0) {
temporalIndex = k;
break;
}
}
if (temporalIndex == -1) {
for (int k = 0; k < 20; k++) {
int previousWeight = imageAtomicCompSwap(endcrystal_img, ivec2(k, 8), 0, -1);
if (previousWeight == 0) {
temporalIndex = k;
break;
}
}
}
if (temporalIndex >= 0) {
ivec4 storeData = ivec4(10000 * pos, 16000);
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(temporalIndex, i+5), ivec4(storeData[i]));
}
}
}
}
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
// healing beams
for (int index = 20; index < 35; index++) {
ivec4 writeData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 1)).r,
imageLoad(endcrystal_img, ivec2(index, 2)).r,
imageLoad(endcrystal_img, ivec2(index, 3)).r,
imageLoad(endcrystal_img, ivec2(index, 4)).r
);
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(index, i + 5), ivec4(writeData[i]));
}
}
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1 || DRAGON_DEATH_EFFECT_INTERNAL > 0
// dragon position
{
const int index = 35;
int isDying = imageLoad(endcrystal_img, ivec2(index, 0)).r;
// if (isDying == 0) isDying = 10000; // Helpful for debugging
ivec4 readData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 1)).r,
imageLoad(endcrystal_img, ivec2(index, 2)).r,
imageLoad(endcrystal_img, ivec2(index, 3)).r,
imageLoad(endcrystal_img, ivec2(index, 4)).r
);
ivec4 temporalData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 5)).r,
imageLoad(endcrystal_img, ivec2(index, 6)).r,
imageLoad(endcrystal_img, ivec2(index, 7)).r,
imageLoad(endcrystal_img, ivec2(index, 8)).r
);
ivec4 writeData = ivec4( // is 0 if dragon is dead, otherwise contains dragon position
isDying <= 9000 && temporalData.w > 0 ? ivec3(0.0) :
readData.w > 0 ? 10000.0 * readData.xyz / readData.w :
abs(length(vec3(readData.xyz)) - length(vec3(temporalData.xyz))) <= 0.001 ? ivec3(0.0) :
temporalData.xyz + ivec3(10000 * (previousCameraPosition - cameraPosition)),
isDying > 0 ? temporalData.w + int(10000 * frameTime) : 0
);
imageStore(endcrystal_img, ivec2(index, 0), ivec4(max(0, isDying - int(1000 * frameTime))));
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(index, i + 1), ivec4(0));
imageStore(endcrystal_img, ivec2(index, i + 5), ivec4(writeData[i]));
}
}
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
for (int k = 0; k < 4; k++) {
imageStore(
endcrystal_img,
ivec2(35, k+5),
imageLoad(endcrystal_img, ivec2(35, k))
);
}
#endif
// clear temporally unstable data
for (int index = 0; index < 36; index++) {
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
if (index == 35) {
continue;
}
#endif
for (int i = 0; i < 5; i++) {
imageStore(endcrystal_img, ivec2(index, i), ivec4(0));
}
}
}
gl_Position = vec4(-1);
#endif
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
discard;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
//Pipeline Constants//
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
#endif
//Uniforms//
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
layout(r32i) uniform iimage2D endcrystal_img;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
vec4 position0 = ftransform();
if (position0.x < 0.0 && position0.y > 0.0) {
#if END_CRYSTAL_VORTEX_INTERNAL % 2 == 1
// update temporally stable end crystal data
for (int index = 0; index < 20; index++) {
int state = imageLoad(endcrystal_img, ivec2(index, 8)).r;
state -= max(1, int(10000 * frameTime));
if (state < 0) {
for (int i = 0; i < 5; i++) {
imageStore(endcrystal_img, ivec2(index, i+5), ivec4(0));
}
} else {
ivec4 writeData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 5)).r,
imageLoad(endcrystal_img, ivec2(index, 6)).r,
imageLoad(endcrystal_img, ivec2(index, 7)).r,
state
);
writeData.xyz += ivec3(10000 * (previousCameraPosition - cameraPosition));
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(index, i+5), ivec4(writeData[i]));
}
imageStore(endcrystal_img, ivec2(index, 9), ivec4(
imageLoad(endcrystal_img, ivec2(index, 9)).r + int(10000 * frameTime)
));
}
}
// crystals
for (int index = 0; index < 20; index++) {
ivec4 newData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 1)).r,
imageLoad(endcrystal_img, ivec2(index, 2)).r,
imageLoad(endcrystal_img, ivec2(index, 3)).r,
imageLoad(endcrystal_img, ivec2(index, 4)).r
);
if (newData.w > 0) {
vec3 pos = vec3(newData.xyz) / newData.w;
int temporalIndex = -1;
for (int k = 0; k < 20; k++) {
ivec4 temporalData = ivec4(
imageLoad(endcrystal_img, ivec2(k, 5)).r,
imageLoad(endcrystal_img, ivec2(k, 6)).r,
imageLoad(endcrystal_img, ivec2(k, 7)).r,
imageLoad(endcrystal_img, ivec2(k, 8)).r
);
vec3 temporalPos = 0.0001 * temporalData.xyz;
if (temporalData.w > 0 && length((temporalPos - pos) * vec3(1.0, 0.3, 1.0)) < 1.0) {
temporalIndex = k;
break;
}
}
if (temporalIndex == -1) {
for (int k = 0; k < 20; k++) {
int previousWeight = imageAtomicCompSwap(endcrystal_img, ivec2(k, 8), 0, -1);
if (previousWeight == 0) {
temporalIndex = k;
break;
}
}
}
if (temporalIndex >= 0) {
ivec4 storeData = ivec4(10000 * pos, 16000);
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(temporalIndex, i+5), ivec4(storeData[i]));
}
}
}
}
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
// healing beams
for (int index = 20; index < 35; index++) {
ivec4 writeData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 1)).r,
imageLoad(endcrystal_img, ivec2(index, 2)).r,
imageLoad(endcrystal_img, ivec2(index, 3)).r,
imageLoad(endcrystal_img, ivec2(index, 4)).r
);
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(index, i + 5), ivec4(writeData[i]));
}
}
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1 || DRAGON_DEATH_EFFECT_INTERNAL > 0
// dragon position
{
const int index = 35;
int isDying = imageLoad(endcrystal_img, ivec2(index, 0)).r;
// if (isDying == 0) isDying = 10000; // Helpful for debugging
ivec4 readData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 1)).r,
imageLoad(endcrystal_img, ivec2(index, 2)).r,
imageLoad(endcrystal_img, ivec2(index, 3)).r,
imageLoad(endcrystal_img, ivec2(index, 4)).r
);
ivec4 temporalData = ivec4(
imageLoad(endcrystal_img, ivec2(index, 5)).r,
imageLoad(endcrystal_img, ivec2(index, 6)).r,
imageLoad(endcrystal_img, ivec2(index, 7)).r,
imageLoad(endcrystal_img, ivec2(index, 8)).r
);
ivec4 writeData = ivec4( // is 0 if dragon is dead, otherwise contains dragon position
isDying <= 9000 && temporalData.w > 0 ? ivec3(0.0) :
readData.w > 0 ? 10000.0 * readData.xyz / readData.w :
abs(length(vec3(readData.xyz)) - length(vec3(temporalData.xyz))) <= 0.001 ? ivec3(0.0) :
temporalData.xyz + ivec3(10000 * (previousCameraPosition - cameraPosition)),
isDying > 0 ? temporalData.w + int(10000 * frameTime) : 0
);
imageStore(endcrystal_img, ivec2(index, 0), ivec4(max(0, isDying - int(1000 * frameTime))));
for (int i = 0; i < 4; i++) {
imageStore(endcrystal_img, ivec2(index, i + 1), ivec4(0));
imageStore(endcrystal_img, ivec2(index, i + 5), ivec4(writeData[i]));
}
}
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
for (int k = 0; k < 4; k++) {
imageStore(
endcrystal_img,
ivec2(35, k+5),
imageLoad(endcrystal_img, ivec2(35, k))
);
}
#endif
// clear temporally unstable data
for (int index = 0; index < 36; index++) {
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
if (index == 35) {
continue;
}
#endif
for (int i = 0; i < 5; i++) {
imageStore(endcrystal_img, ivec2(index, i), ivec4(0));
}
}
}
gl_Position = vec4(-1);
#endif
}
#endif
@@ -1,417 +1,417 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/wavingBlocks.glsl"
#include "/lib/shaderSettings/shadowMainLighting.glsl"
#define SHADOW_SATURATION 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 texCoord;
flat in vec3 sunVec, upVec;
in vec4 position;
flat in vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
//Common Functions//
void DoNaturalShadowCalculation(inout vec4 color1, inout vec4 color2) {
color1.rgb *= glColor.rgb;
color1.rgb = mix(vec3(1.0), color1.rgb, pow(color1.a, (1.0 - color1.a) * 0.5) * 1.05);
color1.rgb *= 1.0 - pow(color1.a, 64.0);
color1.rgb *= 0.1; // 423HDSS: Shadow color strength is stored 10 times lower to allow for water shadows going above 1.0
color2.rgb = normalize(color1.rgb) * 0.5;
}
//Includes//
#ifdef CONNECTED_GLASS_EFFECT
#include "/lib/materials/materialMethods/connectedGlass.glsl"
#endif
//Program//
void main() {
vec4 color1 = texture2DLod(tex, texCoord, 0); // Shadow Color
#ifdef SHADOW_COLORWHEEL
vec2 lmCoord; // needed as otherwise undeclared in the function below
float ao;
vec4 overlayColor;
clrwl_computeFragment(color1, color1, lmCoord, ao, overlayColor);
#endif
#if SHADOW_QUALITY >= 1
vec4 color2 = color1; // Light Shaft Color
color2.rgb *= 0.25; // Natural Strength
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
float positionYM = position.y;
#endif
if (mat < 32008) {
if (mat < 32000) {
#if defined CONNECTED_GLASS_EFFECT || defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
if (mat == 30008 || mat >= 31000) { // Tinted Glass || Stained Glass, Stained Glass Pane
#ifdef CONNECTED_GLASS_EFFECT
DoSimpleConnectedGlass(color1);
#endif
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
positionYM = 0.0; // 86AHGA: For scene-aware light shafts to be less prone to get extreme under large glass planes
#endif
}
#endif
DoNaturalShadowCalculation(color1, color2);
} else {
if (mat == 32000) { // Water
vec3 worldPos = position.xyz + cameraPosition;
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
// For scene-aware light shafts to be more prone to get extreme near water
positionYM += 3.5;
#endif
// Water Caustics
#if WATER_CAUSTIC_STYLE < 3
#if MC_VERSION >= 11300
float wcl = pow2(GetLuminance(color1.rgb));
color1.rgb = color1.rgb * wcl * 1.2;
color1.rgb *= mix(1.0, WATER_CAUSTIC_STRENGTH, wcl);
#else
color1.rgb = mix(color1.rgb, vec3(GetLuminance(color1.rgb)), 0.88);
color1.rgb = pow2(color1.rgb) * vec3(2.5, 3.0, 3.0) * 0.96;
#endif
#else
#define WATER_SPEED_MULT_M WATER_SPEED_MULT * 0.035
vec2 causticWind = vec2(0.0, frameTimeCounter * WATER_SPEED_MULT_M);
vec2 cPos1 = worldPos.xz * 0.08 + causticWind;
vec2 cPos2 = worldPos.xz * 0.06 - causticWind;
float cMult = 14.0;
float offset = 0.001;
float caustic = 0.0;
caustic += dot(texture2D(gaux4, cPos1 + vec2(offset, 0.0)).rg, vec2(cMult))
- dot(texture2D(gaux4, cPos1 - vec2(offset, 0.0)).rg, vec2(cMult));
caustic += dot(texture2D(gaux4, cPos2 + vec2(0.0, offset)).rg, vec2(cMult))
- dot(texture2D(gaux4, cPos2 - vec2(0.0, offset)).rg, vec2(cMult));
color1.rgb = vec3(max0(min1(caustic * 0.8 + 0.35)) * 0.65 + 0.35);
#if MC_VERSION < 11300
color1.rgb *= vec3(0.3, 0.45, 0.9);
#endif
color1.rgb *= mix(1.0, WATER_CAUSTIC_STRENGTH, caustic);
#endif
#if MC_VERSION >= 11300
#if WATERCOLOR_MODE >= 2
color1.rgb *= glColor.rgb;
#else
color1.rgb *= vec3(0.3, 0.45, 0.9);
#endif
#endif
color1.rgb *= vec3(0.6, 0.8, 1.1);
color1.rgb = pow(color1.rgb, vec3(0.75)) * 0.5;
////
// Underwater Light Shafts
vec3 worldPosM = worldPos;
#if WATER_FOG_MULT > 100
#define WATER_FOG_MULT_M WATER_FOG_MULT * 0.01;
worldPosM *= WATER_FOG_MULT_M;
#endif
vec2 waterWind = vec2(syncedTime * 0.01, 0.0);
float waterNoise = texture2DLod(noisetex, worldPosM.xz * 0.012 - waterWind, 0.0).g;
waterNoise += texture2DLod(noisetex, worldPosM.xz * 0.05 + waterWind, 0.0).g;
float factor = max(2.5 - 0.025 * length(position.xz), 0.8333) * 1.3;
waterNoise = pow(waterNoise * 0.5, factor) * factor * 1.3;
#if MC_VERSION >= 11300 && WATERCOLOR_MODE >= 2
color2.rgb = normalize(sqrt1(glColor.rgb)) * vec3(0.24, 0.22, 0.26);
#else
color2.rgb = vec3(0.08, 0.12, 0.195);
#endif
color2.rgb *= waterNoise * (1.0 + sunVisibility - rainFactor);
////
#ifdef UNDERWATERCOLOR_CHANGED
color1.rgb *= vec3(UNDERWATERCOLOR_RM, UNDERWATERCOLOR_GM, UNDERWATERCOLOR_BM);
color2.rgb *= vec3(UNDERWATERCOLOR_RM, UNDERWATERCOLOR_GM, UNDERWATERCOLOR_BM);
#endif
} else /*if (mat == 32004)*/ { // Ice
color1.rgb *= color1.rgb;
color1.rgb *= color1.rgb;
color1.rgb = mix(vec3(1.0), color1.rgb, pow(color1.a, (1.0 - color1.a) * 0.5) * 1.05);
color1.rgb *= 1.0 - pow(color1.a, 64.0);
color1.rgb *= 0.14; // 423HDSS
color2.rgb = normalize(pow(color1.rgb, vec3(0.25))) * 0.5;
}
}
} else {
if (mat < 32020) { // Glass, Glass Pane, Beacon (32008, 32012, 32016)
#ifdef CONNECTED_GLASS_EFFECT
if (mat == 32008) { // Glass
DoSimpleConnectedGlass(color1);
}
if (mat == 32012) { // Glass Pane
DoSimpleConnectedGlass(color1);
}
#endif
if (color1.a > 0.5) color1 = vec4(0.0, 0.0, 0.0, 1.0);
else color1 = vec4(vec3(0.1 * (1.0 - GLASS_OPACITY)), color1.a); // 423HDSS
color2.rgb = vec3(0.3);
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
positionYM = 0.0; // 86AHGA
#endif
} else {
DoNaturalShadowCalculation(color1, color2);
}
}
#endif
#ifdef RAIN_ATMOSPHERE
if (entityId == 50004) discard; //remove lightning shadows
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(saturateColors(color1.rgb, SHADOW_SATURATION), color1.a); // Shadow Color
#if SHADOW_QUALITY >= 1
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
color2.a = 0.25 + max0(positionYM * 0.05); // consistencyMEJHRI7DG
#endif
/* DRAWBUFFERS:01 */
gl_FragData[1] = vec4(saturateColors(color2.rgb, pow(SHADOW_SATURATION, 0.8)), color2.a); // Light Shaft Color
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 texCoord;
flat out vec3 sunVec, upVec;
out vec4 position;
flat out vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
#endif
//Pipeline Constants//
#if COLORED_LIGHTING_INTERNAL > 0 || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
#endif
//Attributes//
attribute vec4 mc_Entity;
attribute vec4 mc_midTexCoord;
attribute vec4 at_midBlock;
//Common Variables//
vec2 lmCoord;
#if COLORED_LIGHTING_INTERNAL > 0
writeonly uniform uimage3D voxel_img;
#ifdef PUDDLE_VOXELIZATION
writeonly uniform uimage2D puddle_img;
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
writeonly uniform uimage3D wsr_img;
#endif
#ifdef ACT_GROUND_LEAVES_FIX
writeonly uniform uimage3D leaves_img;
#endif
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#if defined WAVING_ANYTHING_TERRAIN || defined WAVE_EVERYTHING || defined WAVING_WATER_VERTEX
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
#if COLORED_LIGHTING_INTERNAL > 0
#include "/lib/voxelization/lightVoxelization.glsl"
#ifdef PUDDLE_VOXELIZATION
#include "/lib/voxelization/puddleVoxelization.glsl"
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
#include "/lib/voxelization/reflectionVoxelization.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#include "/lib/voxelization/endCrystalVoxelization.glsl"
#endif
//Program//
void main() {
texCoord = gl_MultiTexCoord0.xy;
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
sunVec = GetSunVector();
upVec = normalize(gbufferModelView[1].xyz);
mat = int(mc_Entity.x + 0.5);
#if defined WORLD_CURVATURE || defined MIRROR_DIMENSION
position = shadowModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#else
position = shadowModelViewInverse * shadowProjectionInverse * ftransform();
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#if defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX || defined WAVE_EVERYTHING
DoWave(position.xyz, mat);
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
#endif
#ifdef CONNECTED_GLASS_EFFECT
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#ifdef PERPENDICULAR_TWEAKS
if (mat == 10003 || mat == 10005 || mat == 10015 || mat == 10017 || mat == 10019 || mat == 10029 || mat == 10039) { // Foliage
#ifndef CONNECTED_GLASS_EFFECT
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
#endif
if (texMinMidCoord.y < 0.0) {
vec3 normal = gl_NormalMatrix * gl_Normal;
position.xyz += normal * 0.35;
}
}
#endif
if (mat == 32000) { // Water
position.y += 0.015 * max0(length(position.xyz) - 50.0);
}
vec3 normal = mat3(shadowModelViewInverse) * gl_NormalMatrix * gl_Normal;
#if COLORED_LIGHTING_INTERNAL > 0
if (gl_VertexID % 4 == 0) {
UpdateVoxelMap(mat);
#ifdef PUDDLE_VOXELIZATION
UpdatePuddleVoxelMap(mat);
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
vec3 normal = mat3(shadowModelViewInverse) * gl_NormalMatrix * gl_Normal;
UpdateSceneVoxelMap(mat, normal, position.xyz);
#endif
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 && WORLD_SPACE_PLAYER_REF == 1
UpdatePlayerVertexList(position.xyz);
#endif
#ifdef ACT_GROUND_LEAVES_FIX
UpdateLeavesVoxelMap(mat);
#endif
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
if (mat == 10556 && normal.y > 0.99 && length(position.xyz) < 32) SetEndPortalLoc(position.xyz);
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
#if END_CRYSTAL_VORTEX_INTERNAL % 2 == 1
if (entityId == 50000 && abs(normal.y) > 0.5 && abs(normal.y) < 0.8) { // End Crystal
UpdateEndCrystalMap(position.xyz);
}
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
if (entityId == 50200) { // end crystal beam
UpdateBeamMap(position.xyz);
}
#endif
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1 || DRAGON_DEATH_EFFECT_INTERNAL > 0
if (entityId == 50204) { // ender dragon
UpdateDragonPos(position.xyz);
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 && WORLD_SPACE_PLAYER_REF == 1
UpdatePlayerVertexList(position.xyz);
#endif
#endif
gl_Position = shadowProjection * shadowModelView * position;
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#if MC_VERSION >= 12100
#define VALUE == 1.0
#else
#define VALUE < 0.5
#endif
if (entityId == 0 && gl_Color.a VALUE && renderStage == MC_RENDER_STAGE_ENTITIES && abs(normal.y) > 0.999 && abs(normal.y) < 1.0) {
gl_Position = vec4(0);
#ifndef IRIS_TAG_SUPPORT
SetEndDragonDeath();
#endif
}
#endif
float lVertexPos = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
float distortFactor = lVertexPos * shadowMapBias + (1.0 - shadowMapBias);
gl_Position.xy *= 1.0 / distortFactor;
gl_Position.z = gl_Position.z * 0.2;
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/wavingBlocks.glsl"
#include "/lib/shaderSettings/shadowMainLighting.glsl"
#define SHADOW_SATURATION 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 texCoord;
flat in vec3 sunVec, upVec;
in vec4 position;
flat in vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
//Common Functions//
void DoNaturalShadowCalculation(inout vec4 color1, inout vec4 color2) {
color1.rgb *= glColor.rgb;
color1.rgb = mix(vec3(1.0), color1.rgb, pow(color1.a, (1.0 - color1.a) * 0.5) * 1.05);
color1.rgb *= 1.0 - pow(color1.a, 64.0);
color1.rgb *= 0.1; // 423HDSS: Shadow color strength is stored 10 times lower to allow for water shadows going above 1.0
color2.rgb = normalize(color1.rgb) * 0.5;
}
//Includes//
#ifdef CONNECTED_GLASS_EFFECT
#include "/lib/materials/materialMethods/connectedGlass.glsl"
#endif
//Program//
void main() {
vec4 color1 = texture2DLod(tex, texCoord, 0); // Shadow Color
#ifdef SHADOW_COLORWHEEL
vec2 lmCoord; // needed as otherwise undeclared in the function below
float ao;
vec4 overlayColor;
clrwl_computeFragment(color1, color1, lmCoord, ao, overlayColor);
#endif
#if SHADOW_QUALITY >= 1
vec4 color2 = color1; // Light Shaft Color
color2.rgb *= 0.25; // Natural Strength
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
float positionYM = position.y;
#endif
if (mat < 32008) {
if (mat < 32000) {
#if defined CONNECTED_GLASS_EFFECT || defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
if (mat == 30008 || mat >= 31000) { // Tinted Glass || Stained Glass, Stained Glass Pane
#ifdef CONNECTED_GLASS_EFFECT
DoSimpleConnectedGlass(color1);
#endif
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
positionYM = 0.0; // 86AHGA: For scene-aware light shafts to be less prone to get extreme under large glass planes
#endif
}
#endif
DoNaturalShadowCalculation(color1, color2);
} else {
if (mat == 32000) { // Water
vec3 worldPos = position.xyz + cameraPosition;
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
// For scene-aware light shafts to be more prone to get extreme near water
positionYM += 3.5;
#endif
// Water Caustics
#if WATER_CAUSTIC_STYLE < 3
#if MC_VERSION >= 11300
float wcl = pow2(GetLuminance(color1.rgb));
color1.rgb = color1.rgb * wcl * 1.2;
color1.rgb *= mix(1.0, WATER_CAUSTIC_STRENGTH, wcl);
#else
color1.rgb = mix(color1.rgb, vec3(GetLuminance(color1.rgb)), 0.88);
color1.rgb = pow2(color1.rgb) * vec3(2.5, 3.0, 3.0) * 0.96;
#endif
#else
#define WATER_SPEED_MULT_M WATER_SPEED_MULT * 0.035
vec2 causticWind = vec2(0.0, frameTimeCounter * WATER_SPEED_MULT_M);
vec2 cPos1 = worldPos.xz * 0.08 + causticWind;
vec2 cPos2 = worldPos.xz * 0.06 - causticWind;
float cMult = 14.0;
float offset = 0.001;
float caustic = 0.0;
caustic += dot(texture2D(gaux4, cPos1 + vec2(offset, 0.0)).rg, vec2(cMult))
- dot(texture2D(gaux4, cPos1 - vec2(offset, 0.0)).rg, vec2(cMult));
caustic += dot(texture2D(gaux4, cPos2 + vec2(0.0, offset)).rg, vec2(cMult))
- dot(texture2D(gaux4, cPos2 - vec2(0.0, offset)).rg, vec2(cMult));
color1.rgb = vec3(max0(min1(caustic * 0.8 + 0.35)) * 0.65 + 0.35);
#if MC_VERSION < 11300
color1.rgb *= vec3(0.3, 0.45, 0.9);
#endif
color1.rgb *= mix(1.0, WATER_CAUSTIC_STRENGTH, caustic);
#endif
#if MC_VERSION >= 11300
#if WATERCOLOR_MODE >= 2
color1.rgb *= glColor.rgb;
#else
color1.rgb *= vec3(0.3, 0.45, 0.9);
#endif
#endif
color1.rgb *= vec3(0.6, 0.8, 1.1);
color1.rgb = pow(color1.rgb, vec3(0.75)) * 0.5;
////
// Underwater Light Shafts
vec3 worldPosM = worldPos;
#if WATER_FOG_MULT > 100
#define WATER_FOG_MULT_M WATER_FOG_MULT * 0.01;
worldPosM *= WATER_FOG_MULT_M;
#endif
vec2 waterWind = vec2(syncedTime * 0.01, 0.0);
float waterNoise = texture2DLod(noisetex, worldPosM.xz * 0.012 - waterWind, 0.0).g;
waterNoise += texture2DLod(noisetex, worldPosM.xz * 0.05 + waterWind, 0.0).g;
float factor = max(2.5 - 0.025 * length(position.xz), 0.8333) * 1.3;
waterNoise = pow(waterNoise * 0.5, factor) * factor * 1.3;
#if MC_VERSION >= 11300 && WATERCOLOR_MODE >= 2
color2.rgb = normalize(sqrt1(glColor.rgb)) * vec3(0.24, 0.22, 0.26);
#else
color2.rgb = vec3(0.08, 0.12, 0.195);
#endif
color2.rgb *= waterNoise * (1.0 + sunVisibility - rainFactor);
////
#ifdef UNDERWATERCOLOR_CHANGED
color1.rgb *= vec3(UNDERWATERCOLOR_RM, UNDERWATERCOLOR_GM, UNDERWATERCOLOR_BM);
color2.rgb *= vec3(UNDERWATERCOLOR_RM, UNDERWATERCOLOR_GM, UNDERWATERCOLOR_BM);
#endif
} else /*if (mat == 32004)*/ { // Ice
color1.rgb *= color1.rgb;
color1.rgb *= color1.rgb;
color1.rgb = mix(vec3(1.0), color1.rgb, pow(color1.a, (1.0 - color1.a) * 0.5) * 1.05);
color1.rgb *= 1.0 - pow(color1.a, 64.0);
color1.rgb *= 0.14; // 423HDSS
color2.rgb = normalize(pow(color1.rgb, vec3(0.25))) * 0.5;
}
}
} else {
if (mat < 32020) { // Glass, Glass Pane, Beacon (32008, 32012, 32016)
#ifdef CONNECTED_GLASS_EFFECT
if (mat == 32008) { // Glass
DoSimpleConnectedGlass(color1);
}
if (mat == 32012) { // Glass Pane
DoSimpleConnectedGlass(color1);
}
#endif
if (color1.a > 0.5) color1 = vec4(0.0, 0.0, 0.0, 1.0);
else color1 = vec4(vec3(0.1 * (1.0 - GLASS_OPACITY)), color1.a); // 423HDSS
color2.rgb = vec3(0.3);
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
positionYM = 0.0; // 86AHGA
#endif
} else {
DoNaturalShadowCalculation(color1, color2);
}
}
#endif
#ifdef RAIN_ATMOSPHERE
if (entityId == 50004) discard; //remove lightning shadows
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(saturateColors(color1.rgb, SHADOW_SATURATION), color1.a); // Shadow Color
#if SHADOW_QUALITY >= 1
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
color2.a = 0.25 + max0(positionYM * 0.05); // consistencyMEJHRI7DG
#endif
/* DRAWBUFFERS:01 */
gl_FragData[1] = vec4(saturateColors(color2.rgb, pow(SHADOW_SATURATION, 0.8)), color2.a); // Light Shaft Color
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 texCoord;
flat out vec3 sunVec, upVec;
out vec4 position;
flat out vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
#endif
//Pipeline Constants//
#if COLORED_LIGHTING_INTERNAL > 0 || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
#endif
//Attributes//
attribute vec4 mc_Entity;
attribute vec4 mc_midTexCoord;
attribute vec4 at_midBlock;
//Common Variables//
vec2 lmCoord;
#if COLORED_LIGHTING_INTERNAL > 0
writeonly uniform uimage3D voxel_img;
#ifdef PUDDLE_VOXELIZATION
writeonly uniform uimage2D puddle_img;
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
writeonly uniform uimage3D wsr_img;
#endif
#ifdef ACT_GROUND_LEAVES_FIX
writeonly uniform uimage3D leaves_img;
#endif
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#if defined WAVING_ANYTHING_TERRAIN || defined WAVE_EVERYTHING || defined WAVING_WATER_VERTEX
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
#if COLORED_LIGHTING_INTERNAL > 0
#include "/lib/voxelization/lightVoxelization.glsl"
#ifdef PUDDLE_VOXELIZATION
#include "/lib/voxelization/puddleVoxelization.glsl"
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
#include "/lib/voxelization/reflectionVoxelization.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#include "/lib/voxelization/endCrystalVoxelization.glsl"
#endif
//Program//
void main() {
texCoord = gl_MultiTexCoord0.xy;
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
sunVec = GetSunVector();
upVec = normalize(gbufferModelView[1].xyz);
mat = int(mc_Entity.x + 0.5);
#if defined WORLD_CURVATURE || defined MIRROR_DIMENSION
position = shadowModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#else
position = shadowModelViewInverse * shadowProjectionInverse * ftransform();
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#if defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX || defined WAVE_EVERYTHING
DoWave(position.xyz, mat);
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
#endif
#ifdef CONNECTED_GLASS_EFFECT
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#ifdef PERPENDICULAR_TWEAKS
if (mat == 10003 || mat == 10005 || mat == 10015 || mat == 10017 || mat == 10019 || mat == 10029 || mat == 10039) { // Foliage
#ifndef CONNECTED_GLASS_EFFECT
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
#endif
if (texMinMidCoord.y < 0.0) {
vec3 normal = gl_NormalMatrix * gl_Normal;
position.xyz += normal * 0.35;
}
}
#endif
if (mat == 32000) { // Water
position.y += 0.015 * max0(length(position.xyz) - 50.0);
}
vec3 normal = mat3(shadowModelViewInverse) * gl_NormalMatrix * gl_Normal;
#if COLORED_LIGHTING_INTERNAL > 0
if (gl_VertexID % 4 == 0) {
UpdateVoxelMap(mat);
#ifdef PUDDLE_VOXELIZATION
UpdatePuddleVoxelMap(mat);
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
vec3 normal = mat3(shadowModelViewInverse) * gl_NormalMatrix * gl_Normal;
UpdateSceneVoxelMap(mat, normal, position.xyz);
#endif
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 && WORLD_SPACE_PLAYER_REF == 1
UpdatePlayerVertexList(position.xyz);
#endif
#ifdef ACT_GROUND_LEAVES_FIX
UpdateLeavesVoxelMap(mat);
#endif
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
if (mat == 10556 && normal.y > 0.99 && length(position.xyz) < 32) SetEndPortalLoc(position.xyz);
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
#if END_CRYSTAL_VORTEX_INTERNAL % 2 == 1
if (entityId == 50000 && abs(normal.y) > 0.5 && abs(normal.y) < 0.8) { // End Crystal
UpdateEndCrystalMap(position.xyz);
}
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
if (entityId == 50200) { // end crystal beam
UpdateBeamMap(position.xyz);
}
#endif
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1 || DRAGON_DEATH_EFFECT_INTERNAL > 0
if (entityId == 50204) { // ender dragon
UpdateDragonPos(position.xyz);
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 && WORLD_SPACE_PLAYER_REF == 1
UpdatePlayerVertexList(position.xyz);
#endif
#endif
gl_Position = shadowProjection * shadowModelView * position;
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#if MC_VERSION >= 12100
#define VALUE == 1.0
#else
#define VALUE < 0.5
#endif
if (entityId == 0 && gl_Color.a VALUE && renderStage == MC_RENDER_STAGE_ENTITIES && abs(normal.y) > 0.999 && abs(normal.y) < 1.0) {
gl_Position = vec4(0);
#ifndef IRIS_TAG_SUPPORT
SetEndDragonDeath();
#endif
}
#endif
float lVertexPos = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
float distortFactor = lVertexPos * shadowMapBias + (1.0 - shadowMapBias);
gl_Position.xy *= 1.0 / distortFactor;
gl_Position.z = gl_Position.z * 0.2;
}
#endif
@@ -1,157 +1,157 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//////////Shadowcomp 1//////////Shadowcomp 1//////////Shadowcomp 1//////////
#ifdef SHADOWCOMP
#define OPTIMIZATION_ACT_BEHIND_PLAYER
#define OPTIMIZATION_ACT_HALF_RATE_SPREADING
//#define OPTIMIZATION_ACT_SHARED_MEMORY
layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
#if COLORED_LIGHTING_INTERNAL == 128
const ivec3 workGroups = ivec3(16, 8, 16);
#elif COLORED_LIGHTING_INTERNAL == 192
const ivec3 workGroups = ivec3(24, 12, 24);
#elif COLORED_LIGHTING_INTERNAL == 256
const ivec3 workGroups = ivec3(32, 16, 32);
#elif COLORED_LIGHTING_INTERNAL == 384
const ivec3 workGroups = ivec3(48, 24, 48);
#elif COLORED_LIGHTING_INTERNAL == 512
const ivec3 workGroups = ivec3(64, 32, 64);
#elif COLORED_LIGHTING_INTERNAL == 768
const ivec3 workGroups = ivec3(96, 32, 96);
#elif COLORED_LIGHTING_INTERNAL == 1024
const ivec3 workGroups = ivec3(128, 32, 128);
#endif
#ifdef OPTIMIZATION_ACT_SHARED_MEMORY
shared vec4 sharedLight[10][10][10];
#endif
//Common Variables//
writeonly uniform image3D floodfill_img;
writeonly uniform image3D floodfill_img_copy;
//Common Functions//
vec4 GetLightSample(sampler3D lightSampler, ivec3 pos) {
#ifdef OPTIMIZATION_ACT_SHARED_MEMORY
ivec3 localPos = pos - ivec3(gl_WorkGroupID) * ivec3(8); // Convert global pos to local shared pos
if (all(greaterThanEqual(localPos, ivec3(0))) && all(lessThan(localPos, ivec3(8)))) {
return sharedLight[localPos.x][localPos.y][localPos.z];
} else {
return texelFetch(lightSampler, pos, 0); // fallback to global fetch
}
#else
return texelFetch(lightSampler, pos, 0);
#endif
}
vec4 GetLightCalculated(sampler3D lightSampler, ivec3 pos, ivec3 voxelVolumeSize, uint voxel) {
vec4 light_px = GetLightSample(lightSampler, clamp(pos + ivec3( 1, 0, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_py = GetLightSample(lightSampler, clamp(pos + ivec3( 0, 1, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_pz = GetLightSample(lightSampler, clamp(pos + ivec3( 0, 0, 1), ivec3(0), voxelVolumeSize - 1));
vec4 light_nx = GetLightSample(lightSampler, clamp(pos + ivec3(-1, 0, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_ny = GetLightSample(lightSampler, clamp(pos + ivec3( 0, -1, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_nz = GetLightSample(lightSampler, clamp(pos + ivec3( 0, 0, -1), ivec3(0), voxelVolumeSize - 1));
vec4 light = light_px + light_py + light_pz + light_nx + light_ny + light_nz;
light /= 6.42; // Slightly higher than 6 to prevent the light from travelling too far
if (voxel >= 200u) {
vec3 tint = specialTintColor[min(voxel - 200u, specialTintColor.length() - 1u)];
light.rgb *= tint;
light.a *= dot(tint, vec3(0.333333));
}
return light;
}
//Includes//
#include "/lib/voxelization/lightVoxelization.glsl"
//Program//
void main() {
ivec3 pos = ivec3(gl_GlobalInvocationID);
vec3 posM = vec3(pos) / vec3(voxelVolumeSize);
vec3 posOffset = floor(previousCameraPosition) - floor(cameraPosition);
ivec3 previousPos = pos - ivec3(posOffset);
ivec3 localPos = ivec3(gl_LocalInvocationID);
#ifdef OPTIMIZATION_ACT_SHARED_MEMORY
vec4 prevLight = vec4(0.0);
if (int(framemod2) == 0)
prevLight = texelFetch(floodfill_sampler, previousPos, 0);
else
prevLight = texelFetch(floodfill_sampler_copy, previousPos, 0);
sharedLight[localPos.x][localPos.y][localPos.z] = prevLight;
barrier();
ivec3 alignedOffset = ivec3(posOffset) / 8 * 8;
previousPos = pos - alignedOffset;
#endif
#ifdef OPTIMIZATION_ACT_BEHIND_PLAYER
ivec3 absPosFromCenter = abs(pos - voxelVolumeSize / 2);
if (absPosFromCenter.x + absPosFromCenter.y + absPosFromCenter.z > 16) {
vec4 viewPos = gbufferProjectionInverse * vec4(0.0, 0.0, 1.0, 1.0);
viewPos /= viewPos.w;
vec3 nPlayerPos = normalize(mat3(gbufferModelViewInverse) * viewPos.xyz);
if (dot(normalize(posM - 0.5), nPlayerPos) < 0.0) {
#ifdef COLORED_LIGHT_FOG
if (int(framemod2) == 0) {
imageStore(floodfill_img_copy, pos, GetLightSample(floodfill_sampler, previousPos));
} else {
imageStore(floodfill_img, pos, GetLightSample(floodfill_sampler_copy, previousPos));
}
#endif
return;
}
}
#endif
vec4 light = vec4(0.0);
uint rawData = GetVoxelVolumeRaw(pos);
uint voxel = rawData & 32767u;
uint isColorwheelGeometry = (rawData - voxel) >> 15u;
if (voxel == 1u) { // Solid Blocks
light = vec4(0.0);
} else if (voxel == 0u || voxel >= 200u) { // Air, Non-solids, Translucents
if (int(framemod2) == 0) {
#ifdef OPTIMIZATION_ACT_HALF_RATE_SPREADING
if (posM.z > 0.5) light = GetLightSample(floodfill_sampler, previousPos);
else
#endif
light = GetLightCalculated(floodfill_sampler, previousPos, voxelVolumeSize, voxel);
} else {
#ifdef OPTIMIZATION_ACT_HALF_RATE_SPREADING
if (posM.z < 0.5) light = GetLightSample(floodfill_sampler_copy, previousPos);
else
#endif
light = GetLightCalculated(floodfill_sampler_copy, previousPos, voxelVolumeSize, voxel);
}
} else { // Light Sources
vec4 color = GetSpecialBlocklightColor(int(voxel));
if (isColorwheelGeometry == 1u) color.a = 1.0;
light = max(light, vec4(pow2(color.rgb), color.a));
}
light = clamp(light, vec4(0.0), vec4(1000.0)); // Prevents a random NaN from consuming the volume
if (int(framemod2) == 0) {
imageStore(floodfill_img_copy, pos, light);
} else {
imageStore(floodfill_img, pos, light);
}
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//////////Shadowcomp 1//////////Shadowcomp 1//////////Shadowcomp 1//////////
#ifdef SHADOWCOMP
#define OPTIMIZATION_ACT_BEHIND_PLAYER
#define OPTIMIZATION_ACT_HALF_RATE_SPREADING
//#define OPTIMIZATION_ACT_SHARED_MEMORY
layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
#if COLORED_LIGHTING_INTERNAL == 128
const ivec3 workGroups = ivec3(16, 8, 16);
#elif COLORED_LIGHTING_INTERNAL == 192
const ivec3 workGroups = ivec3(24, 12, 24);
#elif COLORED_LIGHTING_INTERNAL == 256
const ivec3 workGroups = ivec3(32, 16, 32);
#elif COLORED_LIGHTING_INTERNAL == 384
const ivec3 workGroups = ivec3(48, 24, 48);
#elif COLORED_LIGHTING_INTERNAL == 512
const ivec3 workGroups = ivec3(64, 32, 64);
#elif COLORED_LIGHTING_INTERNAL == 768
const ivec3 workGroups = ivec3(96, 32, 96);
#elif COLORED_LIGHTING_INTERNAL == 1024
const ivec3 workGroups = ivec3(128, 32, 128);
#endif
#ifdef OPTIMIZATION_ACT_SHARED_MEMORY
shared vec4 sharedLight[10][10][10];
#endif
//Common Variables//
writeonly uniform image3D floodfill_img;
writeonly uniform image3D floodfill_img_copy;
//Common Functions//
vec4 GetLightSample(sampler3D lightSampler, ivec3 pos) {
#ifdef OPTIMIZATION_ACT_SHARED_MEMORY
ivec3 localPos = pos - ivec3(gl_WorkGroupID) * ivec3(8); // Convert global pos to local shared pos
if (all(greaterThanEqual(localPos, ivec3(0))) && all(lessThan(localPos, ivec3(8)))) {
return sharedLight[localPos.x][localPos.y][localPos.z];
} else {
return texelFetch(lightSampler, pos, 0); // fallback to global fetch
}
#else
return texelFetch(lightSampler, pos, 0);
#endif
}
vec4 GetLightCalculated(sampler3D lightSampler, ivec3 pos, ivec3 voxelVolumeSize, uint voxel) {
vec4 light_px = GetLightSample(lightSampler, clamp(pos + ivec3( 1, 0, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_py = GetLightSample(lightSampler, clamp(pos + ivec3( 0, 1, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_pz = GetLightSample(lightSampler, clamp(pos + ivec3( 0, 0, 1), ivec3(0), voxelVolumeSize - 1));
vec4 light_nx = GetLightSample(lightSampler, clamp(pos + ivec3(-1, 0, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_ny = GetLightSample(lightSampler, clamp(pos + ivec3( 0, -1, 0), ivec3(0), voxelVolumeSize - 1));
vec4 light_nz = GetLightSample(lightSampler, clamp(pos + ivec3( 0, 0, -1), ivec3(0), voxelVolumeSize - 1));
vec4 light = light_px + light_py + light_pz + light_nx + light_ny + light_nz;
light /= 6.42; // Slightly higher than 6 to prevent the light from travelling too far
if (voxel >= 200u) {
vec3 tint = specialTintColor[min(voxel - 200u, specialTintColor.length() - 1u)];
light.rgb *= tint;
light.a *= dot(tint, vec3(0.333333));
}
return light;
}
//Includes//
#include "/lib/voxelization/lightVoxelization.glsl"
//Program//
void main() {
ivec3 pos = ivec3(gl_GlobalInvocationID);
vec3 posM = vec3(pos) / vec3(voxelVolumeSize);
vec3 posOffset = floor(previousCameraPosition) - floor(cameraPosition);
ivec3 previousPos = pos - ivec3(posOffset);
ivec3 localPos = ivec3(gl_LocalInvocationID);
#ifdef OPTIMIZATION_ACT_SHARED_MEMORY
vec4 prevLight = vec4(0.0);
if (int(framemod2) == 0)
prevLight = texelFetch(floodfill_sampler, previousPos, 0);
else
prevLight = texelFetch(floodfill_sampler_copy, previousPos, 0);
sharedLight[localPos.x][localPos.y][localPos.z] = prevLight;
barrier();
ivec3 alignedOffset = ivec3(posOffset) / 8 * 8;
previousPos = pos - alignedOffset;
#endif
#ifdef OPTIMIZATION_ACT_BEHIND_PLAYER
ivec3 absPosFromCenter = abs(pos - voxelVolumeSize / 2);
if (absPosFromCenter.x + absPosFromCenter.y + absPosFromCenter.z > 16) {
vec4 viewPos = gbufferProjectionInverse * vec4(0.0, 0.0, 1.0, 1.0);
viewPos /= viewPos.w;
vec3 nPlayerPos = normalize(mat3(gbufferModelViewInverse) * viewPos.xyz);
if (dot(normalize(posM - 0.5), nPlayerPos) < 0.0) {
#ifdef COLORED_LIGHT_FOG
if (int(framemod2) == 0) {
imageStore(floodfill_img_copy, pos, GetLightSample(floodfill_sampler, previousPos));
} else {
imageStore(floodfill_img, pos, GetLightSample(floodfill_sampler_copy, previousPos));
}
#endif
return;
}
}
#endif
vec4 light = vec4(0.0);
uint rawData = GetVoxelVolumeRaw(pos);
uint voxel = rawData & 32767u;
uint isColorwheelGeometry = (rawData - voxel) >> 15u;
if (voxel == 1u) { // Solid Blocks
light = vec4(0.0);
} else if (voxel == 0u || voxel >= 200u) { // Air, Non-solids, Translucents
if (int(framemod2) == 0) {
#ifdef OPTIMIZATION_ACT_HALF_RATE_SPREADING
if (posM.z > 0.5) light = GetLightSample(floodfill_sampler, previousPos);
else
#endif
light = GetLightCalculated(floodfill_sampler, previousPos, voxelVolumeSize, voxel);
} else {
#ifdef OPTIMIZATION_ACT_HALF_RATE_SPREADING
if (posM.z < 0.5) light = GetLightSample(floodfill_sampler_copy, previousPos);
else
#endif
light = GetLightCalculated(floodfill_sampler_copy, previousPos, voxelVolumeSize, voxel);
}
} else { // Light Sources
vec4 color = GetSpecialBlocklightColor(int(voxel));
if (isColorwheelGeometry == 1u) color.a = 1.0;
light = max(light, vec4(pow2(color.rgb), color.a));
}
light = clamp(light, vec4(0.0), vec4(1000.0)); // Prevents a random NaN from consuming the volume
if (int(framemod2) == 0) {
imageStore(floodfill_img_copy, pos, light);
} else {
imageStore(floodfill_img, pos, light);
}
}
#endif
@@ -1,43 +1,43 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
}
#endif
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
}
#endif