This commit is contained in:
serveur
2026-10-18 00:10:27 +02:00
parent 917b358119
commit 04962b174a
8407 changed files with 1284624 additions and 325 deletions
@@ -0,0 +1,272 @@
//////////////////////////////////////////
// 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]
#define REFLECTION_RESPONSIVENESS 0.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
in vec3 sunVec;
#ifdef END
flat 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"
#if defined SKY_EFFECT_REFLECTION_OPAQUE && defined OVERWORLD
#if AURORA_STYLE > 0
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#else
#include "/lib/atmospherics/stars.glsl"
#endif
#ifdef VL_CLOUDS_ACTIVE
#include "/lib/atmospherics/clouds/mainClouds.glsl"
#endif
#endif
#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 isHardcodedMetal = 0.0;
float rawAlbedoF0 = 0.8;
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 (abs(fresnelM - 0.5) < 0.5) { // 0.0 fresnel doesnt need ref calculations, and 1.0 fresnel basically means error
#ifdef TAA
float noiseMult = 0.3;
#else
float noiseMult = 0.3;
#endif
#ifdef PBR_REFLECTIONS
bool opaqueSurface = z0 == z1;
float minBlendFactor = (0.035 + REFLECTION_RESPONSIVENESS * 0.075) + (0.09 + REFLECTION_RESPONSIVENESS * 0.05) * pow2(pow2(pow2(smoothnessD)));
if (entityOrParticle) {
noiseMult *= 0.125;
minBlendFactor = 0.125 + REFLECTION_RESPONSIVENESS * 0.075;
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
flat 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
@@ -0,0 +1,530 @@
/////////////////////////////////////
// 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"
#include "/lib/shaderSettings/raindropColor.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
#define COLORED_LIGHT_FOG_CAVE_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_CAVE_I
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec;
// #undef LIGHTSHAFTS_ACTIVE
#ifdef LIGHTSHAFTS_ACTIVE
flat in float vlFactor;
#endif
//Pipeline Stuff//
#define ALLOW_REFRACTION
#define SMOOTHNESS_AFFECTED_REF_BLUR
#define UNDERWATER_LIGHT_SOURCE_DETECTION
#if defined MC_OS_MAC && (defined DISTANT_HORIZONS || defined VOXY)
// Remove the uses of colortex6 to stay below the 8 sampler limit of macos
#undef IRIS_FEATURE_FADE_VARIABLE
#undef ALLOW_REFRACTION
#undef SMOOTHNESS_AFFECTED_REF_BLUR
#undef UNDERWATER_LIGHT_SOURCE_DETECTION
#endif
//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;
#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"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/colors/lightAndAmbientColors.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
#include "/lib/lighting/shadowSampling.glsl"
#ifdef END
#include "/lib/atmospherics/volumetricLight/enderBeams.glsl"
#elif defined OVERWORLD && defined OVERWORLD_BEAMS
#include "/lib/atmospherics/overworldBeams.glsl"
#endif
#include "/lib/atmospherics/volumetricLight/volumetricLight.glsl"
#endif
#if defined WATER_REFRACTION || defined BETTER_LABPBR_REFRACTIONS_INTERNAL
#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
#ifdef IMPROVED_RAIN
#include "/lib/colors/lightAndAmbientColors.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);
vec3 nViewPos = normalize(viewPos.xyz);
#ifdef UNDERWATER_LIGHT_SOURCE_DETECTION
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
int materialMaskInt = int(texture6.g * 255.1);
#endif
#if defined DISTANT_HORIZONS || defined VOXY
#ifdef DISTANT_HORIZONS
float z0lod = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
vec4 viewPosLod = dhProjectionInverse * (screenPosLod * 2.0 - 1.0);
#elif defined VOXY
float z0lod = texelFetch(vxDepthTexTrans, texelCoord, 0).r;
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
vec4 viewPosLod = vxProjInv * (screenPosLod * 2.0 - 1.0);
#endif
viewPosLod /= viewPosLod.w;
lViewPos = min(lViewPos, length(viewPosLod.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 defined WATER_REFRACTION && defined ALLOW_REFRACTION
texCoordM = DoRefraction(color, z0, z1, viewPos.xyz, lViewPos);
#endif
#ifdef BETTER_LABPBR_REFRACTIONS_INTERNAL
texCoordM = DoLabPBRRefraction(color, z0, z1, viewPos.xyz, texCoordM);
#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 defined DISTANT_HORIZONS || defined VOXY
fresnelM *= 1.0 - smoothstep(0.8, 1.05, lViewPos / far);
#endif
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) {
#if BLURRED_REFLECTIONS_I > 0
vec4 blurredReflection = sampleBlurFilteredReflection(compositeReflection, nViewPos, dither, z0);
compositeReflection = mix(compositeReflection, blurredReflection, BLURRED_REFLECTIONS_I * 0.1);
#endif
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);
float z1lod = 1.0;
#if defined DISTANT_HORIZONS || defined VOXY
#ifdef DISTANT_HORIZONS
z1lod = texelFetch(dhDepthTex1, texelCoord, 0).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = dhProjectionInverse * (screenPos1Lod * 2.0 - 1.0);
#elif defined VOXY
z1lod = texelFetch(vxDepthTexOpaque, texelCoord, 0).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = vxProjInv * (screenPos1Lod * 2.0 - 1.0);
#endif
viewPos1Lod /= viewPos1Lod.w;
lViewPos1 = min(lViewPos1, length(viewPos1Lod.xyz));
#endif
#if defined LIGHTSHAFTS_ACTIVE || RAINBOWS > 0 && defined OVERWORLD
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) || GLITTER_RAIN > 0
vec3 playerPos = ViewToPlayer(viewPos1.xyz);
vec3 nPlayerPos = normalize(playerPos);
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
vec4 screenPos0 = vec4(texCoord, z0, 1.0);
vec4 viewPos0 = gbufferProjectionInverse * (screenPos0 * 2.0 - 1.0);
viewPos0 /= viewPos0.w;
vec3 playerPos0 = ViewToPlayer(viewPos0.xyz);
#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(vlFactorM, translucentMult, lViewPos, lViewPos1, nViewPos, VdotL, VdotU, z0, z1, z1lod, dither);
#endif
float lightFogLength = 0.0;
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
vec4 endCrystalVortex = pow4(EndCrystalVortices(vec3(0.0), playerPos0, dither)); // playerPos0 is needed as we also need translucent Depth
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), playerPos0));
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
float caveFactorColoredFog = GetCaveFactor() * (1.0 - clamp01(isEyeInWater));
vec3 lightFog = GetColoredLightFog(nPlayerPos, translucentMult, lViewPos, lViewPos1, dither, vlFactorM, caveFactorColoredFog);
float lightFogMult = COLORED_LIGHT_FOG_I;
#ifdef NIGHT_DESATURATION_REMOVE_NEAR_LIGHTS
lightFogLength += length(lightFog);
#endif
#ifdef OVERWORLD
#if COLORED_LIGHT_FOG_RAIN_I > 0
lightFogMult = mix(lightFogMult, COLORED_LIGHT_FOG_RAIN_I * 0.01, rainFactor * inRainy);
#endif
#if COLORED_LIGHT_FOG_CAVE_I > 0
lightFogMult = mix(lightFogMult, COLORED_LIGHT_FOG_CAVE_I * 0.01, caveFactorColoredFog);
#endif
lightFogMult *= 0.2 + 0.6 * mix(1.0, 1.0 - sunFactor * invRainFactor, eyeBrightnessM);
#endif
#else
vec3 lightFog = vec3(0.0);
#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
float renderDistanceFade = lViewPos * 20.0 / far;
#ifdef UNDERWATER_LIGHT_SOURCE_DETECTION
float lightSourceFactor = pow3(1.0 - texture6.a);
#else
float lightSourceFactor = 1.0 - eyeBrightnessXM;
#endif
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.55);
#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 // Fix banding
lightFog = max(vec3(0.0), lightFog + (dither - 0.5) * 0.02);
#endif
color += lightFog;
#endif
#ifdef IMPROVED_RAIN
vec4 rainData = texelFetch(colortex12, texelCoord, 0);
if (rainData.r > 0.0) {
float rainDistance = rainData.r * 100.0;
if (rainDistance < lViewPos1) {
int packedRain = int(rainData.g * 255.0 + 0.5);
bool isRain = (packedRain & 1) != 0;
int glitterFactor = int((packedRain & 2) != 0);
bool isSnow = !isRain;
float blocklight = rainData.b;
vec3 rainColor = isSnow ? vec3(1.0, 1.0, 1.0) : vec3(0.925, 0.96, 1.0);
rainColor *= blocklightCol * 2.0 * blocklight + (ambientColor + 0.2 * lightColor) * (0.6 + 0.3 * sunFactor);
vec3 rainMix = vec3(rainData.a);
if (rainDistance > lViewPos) rainMix *= pow2(DoReducedLuminanceCorrection(translucentMult, 0.25));
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) rainMix = vec3(0.0);
#endif
rainColor *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
#if GLITTER_RAIN > 0
rainColor += glitterFactor * (vec3(0.752) * 5.0 - rainColor);
#endif
rainColor += lightFog * (1.0 + 4.0 * rainData.g) + color.rgb * rainData.g * 0.25;
color = mix(color, rainColor, rainMix);
}
}
#endif
color = pow(color, vec3(2.2));
#if defined LIGHTSHAFTS_ACTIVE || defined END_PORTAL_BEAM_INTERNAL
#if defined END && defined TAA // Fix banding
volumetricEffect.rgb = max(vec3(0.0), volumetricEffect.rgb - dither * 0.005);
#endif
// We add volumetric effect AFTER the "pow color by 2.2" line to get nicer blending
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
// color.rgb = translucentMult;
/* 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
/* DRAWBUFFERS:05 */
gl_FragData[1] = vec4(lightFogLength, 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
@@ -0,0 +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.37373871;
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
@@ -0,0 +1,293 @@
//////////////////////////////////////////
// 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 VOXY
#ifdef DISTANT_HORIZONS
float z0lod = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
vec4 viewPosLod = dhProjectionInverse * (screenPosLod * 2.0 - 1.0);
#elif defined VOXY
float z0lod = texelFetch(vxDepthTexTrans, texelCoord, 0).r;
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
vec4 viewPosLod = vxProjInv * (screenPosLod * 2.0 - 1.0);
#endif
viewPosLod /= viewPosLod.w;
lViewPos = min(lViewPos, length(viewPosLod.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
@@ -0,0 +1,225 @@
//////////////////////////////////////////
// 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 scaledCoordMinusOffset = scaledCoord - offset;
vec2 coord = scaledCoordMinusOffset * 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 = (scaledCoordMinusOffset + 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);
#if defined DISTANT_HORIZONS || defined VOXY
#ifdef DISTANT_HORIZONS
float z1lod = texelFetch(dhDepthTex1, texelCoord, 0).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = dhProjectionInverse * (screenPos1Lod * 2.0 - 1.0);
#elif defined VOXY
float z1lod = texelFetch(vxDepthTexOpaque, texelCoord, 0).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = vxProjInv * (screenPos1Lod * 2.0 - 1.0);
#endif
viewPos1Lod /= viewPos1Lod.w;
lViewPos = min(lViewPos, length(viewPos1Lod.xyz));
#endif
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);
#if defined DISTANT_HORIZONS || defined VOXY
#ifdef DISTANT_HORIZONS
float z1lod = texture2D(dhDepthTex1, coordb).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = dhProjectionInverse * (screenPos1Lod * 2.0 - 1.0);
#elif defined VOXY
float z1lod = texture2D(vxDepthTexOpaque, coordb).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = vxProjInv * (screenPos1Lod * 2.0 - 1.0);
#endif
viewPos1Lod /= viewPos1Lod.w;
lViewPos = min(lViewPos, length(viewPos1Lod.xyz));
#endif
// 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
@@ -0,0 +1,418 @@
//////////////////////////////////////////
// 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 AURORA_INFLUENCE) && 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 AURORA_INFLUENCE) && defined OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
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 defined AURORA_INFLUENCE && defined OVERWORLD
#include "/lib/atmospherics/auroraBorealisVisibility.glsl"
#endif
// #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 VdotU) {
vec3 baseRgb = rgb;
float skyboxBlend = 1.0;
#ifdef NO_PURKINJE_IN_SKYBOX
float z0lod = 1.0;
#ifdef DISTANT_HORIZONS
z0lod = texelFetch(dhDepthTex, texelCoord, 0).r;
#elif defined VOXY
z0lod = texelFetch(vxDepthTexTrans, texelCoord, 0).r;
#endif
if (z0 == 1.0 && z0lod == 1.0) {
float horizonCenter = 0.0;
#ifdef OVERWORLD
// Shift horizon band down as camera height increases so terrain/sky seam stays covered.
horizonCenter = clamp(-cameraPosition.y / max(renderDistance * 1.35, 1.0), -0.55, 0.0);
#endif
float horizonBand = abs(VdotU - horizonCenter);
// Keep Purkinje only near horizon on pure skybox pixels (mirrored up/down fade).
skyboxBlend = 1.0 - smoothstep(0.22, 0.38, horizonBand);
}
#endif
float interiorFactorM = 0;
#ifdef NETHER
float nightDesaturationIntensity = NIGHT_DESATURATION_NETHER;
float distanceFadeSetting = PURKINJE_RENDER_DISTANCE_FADE_NETHER;
interiorFactorM = 1.0;
#elif defined END
float nightDesaturationIntensity = NIGHT_DESATURATION_END;
nightFactor = 1.0;
float distanceFadeSetting = 0.1;
interiorFactorM = -10000.0;
#else
float distanceFadeSetting = 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 = sqrt2(clamp01(fogValue));
#if defined VOXY || defined DISTANT_HORIZONS
float dynamicFar = max(far, 512.0);
#else
float dynamicFar = far;
#endif
float renderDistanceFade = mix(0, lViewPos * 2.5 / dynamicFar, distanceFadeSetting * (1.0 - lightFogFactor));
if (isEyeInWater == 1) renderDistanceFade = lViewPos * 7.0 / dynamicFar;
float nightCaveDesaturation = max0(NIGHT_CAVE_DESATURATION * 0.1 - inSulfurCaves);
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
float lightmap = texture6.a;
#if defined PHOTONICS_LIGHTING && PHOTONICS_MAX_LIGHTS > 0
float phRtCoverage = getPhotonicsFade(playerPos);
lightmap *= mix(1.0, 0.35, phRtCoverage);
float lightmapTemp = texelFetch(colortex20, texelCoord, 0).r;
float photonicsLight = clamp01(lightmapTemp);
const float photonicsBoostCurve = 0.3;
const float photonicsBoostAmount = 0.9;
float photonicsBoosted = pow(photonicsLight, photonicsBoostCurve);
photonicsLight = mix(photonicsLight, photonicsBoosted, photonicsBoostAmount);
lightmap += photonicsLight * phRtCoverage;
lightmap = min1(lightmap);
#endif
lightSourceFactor = pow3(1.0 - lightmap * (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 auroraInfluenceVisibility = 1.0;
#if defined AURORA_INFLUENCE && defined OVERWORLD
auroraInfluenceVisibility = GetAuroraVisibility(0.5, 0.0);
auroraInfluenceVisibility = 1.0 - auroraInfluenceVisibility * 0.66;
#endif
float purkinjeIntensity = 0.004 * purkinjeOverwrite * nightDesaturationIntensity;
purkinjeIntensity = purkinjeIntensity * fuzzyOr(interiorFactor, sqrt3(nightFactor - 0.1)); // No purkinje shift in daylight
purkinjeIntensity *= mix(1.0, auroraInfluenceVisibility, 1.0 - interiorFactor); // Remove purkinje shift when aurora is visible, but only when not underground
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);
#ifdef NO_PURKINJE_IN_SKYBOX
return mix(baseRgb, max0(rgb), skyboxBlend);
#else
return max0(rgb);
#endif
}
//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 nViewPos = normalize(viewPos.xyz);
float VdotU = dot(nViewPos, normalize(gbufferModelView[1].xyz));
vec3 playerPos = ViewToPlayer(viewPos.xyz);
#if defined DISTANT_HORIZONS || defined VOXY
#ifdef DISTANT_HORIZONS
float z0lod = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
vec4 viewPosLod = dhProjectionInverse * (screenPosLod * 2.0 - 1.0);
#elif defined VOXY
float z0lod = texelFetch(vxDepthTexTrans, texelCoord, 0).r;
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
vec4 viewPosLod = vxProjInv * (screenPosLod * 2.0 - 1.0);
#endif
viewPosLod /= viewPosLod.w;
lViewPos = min(lViewPos, length(viewPosLod.xyz));
#endif
#else
float lViewPos = 0.0;
#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, VdotU);
#endif
/* DRAWBUFFERS:35 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(vec3(0.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 AURORA_INFLUENCE) && 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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +1,780 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/enderStars.glsl"
#include "/lib/shaderSettings/enderNebula.glsl"
#include "/lib/shaderSettings/deferred1.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec, eastVec;
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
flat in float vlFactor;
#endif
//Pipeline Constants//
const bool colortex0MipmapEnabled = true;
//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;
float farMinusNear = far - near;
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
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
#else
float vlFactor = 0.0;
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
float chunkFade = 1.0;
#endif
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * farMinusNear);
}
float GetLinearDepth(float depth, float far, float near) {
return (2.0 * near) / (far + near - depth * (far - near));
}
float CalculateLinearDepth(float depth_sample, float near_plane, float far_plane) {
return (2.0 * near_plane) / (far_plane + near_plane - depth_sample * (far_plane - near_plane));
}
#ifdef PHOTONICS_LIGHTING
vec3 compressLightSoftKnee(vec3 lightValue, float kneeStart, float maxExtra) {
vec3 safeLight = max0(lightValue);
float lightLum = GetLuminance(safeLight);
if (lightLum <= kneeStart) return safeLight;
float lumExcess = lightLum - kneeStart;
float compressedLum = kneeStart + lumExcess / (1.0 + lumExcess / maxExtra);
float lumScale = compressedLum / max(lightLum, 1e-5);
return safeLight * lumScale;
}
#endif
#if SSAO_QUALI > 0
// Original offset distribution function
vec2 OffsetDist(float x, int s) {
float n = fract(x * 1.414) * 3.1415;
return pow2(vec2(cos(n), sin(n)) * x / s);
}
// Improved offset distribution function for DH SSAO
vec2 OffsetDistImproved(float x_norm, int s) {
float n = fract(x_norm * 1.41421356237f) * 6.28318530718f;
float radius_mult = x_norm;
return vec2(cos(n), sin(n)) * radius_mult;
}
// Original SSAO function for regular geometry
float GetAmbientOcclusion(sampler2D depthtex, float z0, float linearZ0, float dither, float farM, float nearM, float aoWorldRange, vec3 playerPos) {
if (z0 < 0.56) return 1.0;
float ao = 0.0;
#if SSAO_QUALI == 2
int samples = 4;
float scm = 0.4;
#elif SSAO_QUALI == 3
int samples = 12;
float scm = 0.6;
#endif
#define SSAO_I_FACTOR 0.004
float sampleDepth = 0.0, angle = 0.0, dist = 0.0;
float fovScale = gbufferProjection[1][1];
float distScale = max((farM - nearM) * linearZ0 + near, 3.0);
vec2 scale = vec2(scm / aspectRatio, scm) * fovScale / distScale;
for (int i = 1; i <= samples; i++) {
vec2 offset = OffsetDist(i + dither, samples) * scale;
if (i % 2 == 0) offset.y = -offset.y;
vec2 coord1 = texCoord + offset;
vec2 coord2 = texCoord - offset;
sampleDepth = GetLinearDepth(texture2D(depthtex, coord1).r, farM, nearM);
float aosample = aoWorldRange * (linearZ0 - sampleDepth) * 2.0;
angle = clamp(0.5 - aosample, 0.0, 1.0);
dist = clamp(0.5 * aosample - 1.0, 0.0, 1.0);
sampleDepth = GetLinearDepth(texture2D(depthtex, coord2).r, farM, nearM);
aosample = aoWorldRange * (linearZ0 - sampleDepth) * 2.0;
angle += clamp(0.5 - aosample, 0.0, 1.0);
dist += clamp(0.5 * aosample - 1.0, 0.0, 1.0);
ao += clamp(angle + dist, 0.0, 1.0);
}
ao /= samples;
#define SSAO_IM SSAO_I * SSAO_I_FACTOR
#ifdef RAIN_ATMOSPHERE
vec3 lightningPos = getLightningPos(playerPos, lightningBoltPosition.xyz, false);
vec2 lightningAdd = lightningFlashEffect(lightningPos, vec3(0.0), 550.0, 0, 0) * isLightningActive() * 0.5;
ao += lightningAdd.y;
#endif
return pow(ao, SSAO_IM);
}
#ifdef DISTANT_HORIZONS
#include "/lib/misc/dhSSAO.glsl"
#endif
#endif
#if defined DISTANT_HORIZONS || defined VOXY
float GetLinearDepth(float depth, mat4 invProjMatrix) {
depth = depth * 2.0 - 1.0;
vec2 zw = depth * invProjMatrix[2].zw + invProjMatrix[3].zw;
return -zw.x / zw.y;
}
float GetLODShadows(vec3 viewPos, vec3 nViewPos, sampler2D depthtex, mat4 projection, mat4 projectionInverse, float dither, int materialMaskInt) {
#if defined OVERWORLD || defined END
float shadow = 1.0;
vec3 tracePos = viewPos.xyz;
vec3 traceStep = normalize(lightVec) * 2.5;
#ifdef TAA
tracePos += traceStep * (fract(dither + frameCounter * 0.618) + 0.2);
#else
tracePos += traceStep * (dither + 0.2);
#endif
#ifdef END
tracePos.xy += 5.0 * (dither - 0.5); // Blur to match end shadows
#endif
float traceZ = 0.0;
float zDelta = 0.0;
#ifdef VOXY
if (materialMaskInt != 253) // Reduced Edge TAA (Leaves)
tracePos -= nViewPos * 1.5; // Tweak to imitate shadow bias
#endif
for (int i = 0; i < 32; i++) {
vec4 pos = projection * vec4(tracePos.xyz, 1.0);
pos = pos / pos.w * 0.5 + 0.5;
if (pos.x < 0.0 || pos.x > 1.0 || pos.y < 0.0 || pos.y > 1.0) break;
#ifdef VOXY
traceZ = texture2D(depthtex0, pos.xy).r;
if (traceZ < 1.0) {
zDelta = -tracePos.z - GetLinearDepth(traceZ, gbufferProjectionInverse);
} else
#endif
{
traceZ = texture2D(depthtex, pos.xy).r;
zDelta = -tracePos.z - GetLinearDepth(traceZ, projectionInverse);
}
shadow *= 1.0 - smoothstep(0.0, 0.01, zDelta) * smoothstep(5.0, 4.0, zDelta);
tracePos += traceStep;
}
return shadow;
#else
return 1.0;
#endif
}
#endif
//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/atmospherics/fog/endCenterFog.glsl"
#ifdef PHOTONICS_LIGHTING
#include "/lib/shaderSettings/photonics.glsl"
#include "/photonics/ph_samplers.glsl"
#include "/lib/shaderSettings/mainLighting.glsl"
#endif
#if AURORA_STYLE > 0
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if NETHER_NOISE == 1 && defined NETHER
#include "/lib/atmospherics/netherNoise.glsl"
#endif
#ifdef BEDROCK_NOISE
#include "/lib/atmospherics/stars.glsl"
#endif
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#endif
#ifdef VL_CLOUDS_ACTIVE
#include "/lib/atmospherics/clouds/mainClouds.glsl"
#endif
#if defined END && defined END_STARS
#include "/lib/atmospherics/enderStars.glsl"
#endif
#if defined END && END_NEBULA > 0
#include "/lib/atmospherics/enderNebula.glsl"
#endif
#if defined END && BLACK_HOLE > 0
#include "/lib/atmospherics/blackHole.glsl"
#endif
#if defined WORLD_OUTLINE || RETRO_LOOK == 1 || RETRO_LOOK == 2
#include "/lib/misc/worldOutline.glsl"
#endif
#ifdef DARK_OUTLINE
#include "/lib/misc/darkOutline.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#ifdef DISTANT_LIGHT_BOKEH
#include "/lib/misc/distantLightBokeh.glsl"
#endif
#ifdef BEDROCK_NOISE
#include "/lib/atmospherics/bedrockNoise.glsl"
#endif
#if defined END && EP_END_FLASH > 0 && (MC_VERSION >= 12109 || ANGELICA_VERSION >= 20155000) && defined IS_IRIS
#include "/lib/atmospherics/endFlash.glsl"
#endif
#ifdef BLOCKLIGHT_CAUSTICS
#include "/lib/lighting/blocklightCaustics.glsl"
#endif
//Program//
void main() {
vec4 albedoTextureSample = texelFetch(colortex0, texelCoord, 0);
vec4 color = vec4(albedoTextureSample.rgb, 1.0);
float pixelVisibilityFactor = albedoTextureSample.a;
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);
vec3 nViewPos = normalize(viewPos.xyz);
vec3 playerPos = ViewToPlayer(viewPos.xyz);
#ifdef PHOTONICS_LIGHTING
float photonicsLightMask = 0;
{
if (z0 < 0.99999) {
float phRtCoverage = getPhotonicsFade(playerPos);
if (phRtCoverage > 0.0001) {
vec3 photonicsAlbedo = clamp01(texelFetch(colortex10, texelCoord, 0).rgb);
#if PHOTONICS_MAX_LIGHTS == 0 && !defined PHOTONICS_COMBINED_GI
vec3 directCurved = vec3(0.0);
vec3 directGlow = vec3(0.0);
#else
vec3 directLight = sample_photonics_direct(texCoord);
vec3 handheldLight = vec3(0.0);
#if HELD_LIGHTING_MODE >= 1 || PHOTONICS_HANDHELD_MODE != 0
handheldLight = sample_photonics_handheld(texCoord);
#endif
vec3 totalDirect = directLight + handheldLight;
vec3 directBase = max0(totalDirect * 1.34);
vec3 directCurved = pow(directBase, vec3(0.78));
float lightingMultiplier = 1.5;
directCurved *= lightingMultiplier * XLIGHT_I;
float directLuminance = GetLuminance(directBase);
// Remove tiny luminance floor so mask can fully fade to zero at light edges.
const float luminanceFloor = 0.0028;
const float luminanceSoftness = 0.0058;
directLuminance = max0(directLuminance - luminanceFloor);
directLuminance *= smoothstep(0.0, luminanceSoftness, directLuminance);
float curveMask = smoothstep(0.001, 0.025, directLuminance);
directCurved = mix(totalDirect, directCurved * 1.55, 0.75 * curveMask);
#ifdef BLOCKLIGHT_CAUSTICS
#if defined DO_PIXELATION_EFFECTS && defined PIXELATED_SHADOWS
playerPos += texelFetch(colortex11, texelCoord, 0).rgb;
#endif
vec3 worldPos = playerPos + cameraPosition;
vec3 worldGeoNormal = texelFetch(colortex20, texelCoord, 0).rgb;
directCurved *= GetBlocklightCaustics(worldGeoNormal, worldPos);
#endif
vec3 directGlow = compressLightSoftKnee(max0(directCurved), 0.85, 0.25);
#endif
vec3 indirectLighting = texelFetch(colortex9, ivec2(texelCoord * PHOTONICS_RENDER_SCALE), 0).rgb * 0.23;
float indirectLuminance = GetLuminance(indirectLighting);
indirectLighting = pow(indirectLighting, vec3(1.16));
indirectLighting *= 1.8 * PHOTONICS_INDIRECT_INTENSITY * 0.1 * mix(1.2, indirectLuminance * 0.33, min1(indirectLuminance * 1.1));
indirectLighting = min1(indirectLighting);
vec3 photonicsLightingRaw = max0(directCurved + indirectLighting);
vec3 photonicsLighting = compressLightSoftKnee(photonicsLightingRaw, 0.80, 0.8);
photonicsLightMask = GetLuminance(clamp01(photonicsLightingRaw));
color.rgb += photonicsLighting * photonicsAlbedo * phRtCoverage;
color.rgb += 0.12 * directGlow * phRtCoverage;
}
}
}
#endif
float dither = texture2DLod(noisetex, texCoord * vec2(viewWidth, viewHeight) / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
#if defined VOXY && SHADOW_QUALITY > -1
float lodShadow = 0.0;
#endif
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float skyFade = 0.0;
vec3 waterRefColor = vec3(0.0);
vec3 auroraBorealis = vec3(0.0);
vec3 nightNebula = vec3(0.0);
vec3 netherNoise = vec3(0.0);
vec3 bedrockNoise = vec3(0.0);
vec3 normalM = vec3(0.0);
float fresnelM = 0.0;
float linearZ0_DH;
vec4 texture6 = texelFetch(colortex6, texelCoord, 0).rgba;
int materialMaskInt = int(texture6.g * 255.1);
float blackHoleEventHorizon = 1.0;
#if BLACK_HOLE > 0 && defined END
vec3 blackHoleDir = getBlackHoleDir();
vec4 blackHole = GetBlackHole(nViewPos, blackHoleDir);
blackHoleEventHorizon = 1.0 - blackHole.a;
#endif
if (z0 < 1.0) {
#ifdef DISTANT_LIGHT_BOKEH
int dlbo = 1;
vec3 dlbColor = color.rgb;
dlbColor += texelFetch(colortex0, texelCoord + ivec2( 0, dlbo), 0).rgb;
dlbColor += texelFetch(colortex0, texelCoord + ivec2( 0,-dlbo), 0).rgb;
dlbColor += texelFetch(colortex0, texelCoord + ivec2( dlbo, 0), 0).rgb;
dlbColor += texelFetch(colortex0, texelCoord + ivec2(-dlbo, 0), 0).rgb;
dlbColor = max(color.rgb, dlbColor * 0.2);
float dlbMix = GetDistantLightBokehMix(lViewPos);
color.rgb = mix(color.rgb, dlbColor, dlbMix);
#endif
#if SSAO_QUALI > 0 || defined WORLD_OUTLINE || RETRO_LOOK == 1 || RETRO_LOOK == 2
float linearZ0 = GetLinearDepth(z0);
#endif
#if SSAO_QUALI > 0
float ssao = GetAmbientOcclusion(depthtex0, z0, linearZ0, dither, far, near, far - near, playerPos);
#else
float ssao = 1.0;
#endif
bool entityOrParticle = z0 < 0.56;
float intenseFresnel = 0.0;
float isHardcodedMetal = 0.0;
float smoothnessD = texture6.r;
vec3 reflectColor = vec3(1.0);
#ifdef PBR_REFLECTIONS
vec4 texture4 = texelFetch(colortex4, texelCoord, 0);
normalM = mat3(gbufferModelView) * texture4.rgb;
float rawAlbedoF0 = texture4.a * 0.5 + 0.5; // Decode the raw (pre-lighting) albedo magnitude stashed by the gbuffer pass in colortex4's alpha
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
#else
float fresnel = 0.0;
float rawAlbedoF0 = 1.0;
#endif
#include "/lib/materials/materialHandling/deferredMaterials.glsl"
#if defined WORLD_OUTLINE || RETRO_LOOK == 1 || RETRO_LOOK == 2
#if !defined WORLD_OUTLINE_ON_ENTITIES && RETRO_LOOK == 0
if (!entityOrParticle)
#endif
DoWorldOutline(color.rgb, linearZ0, playerPos, fresnel, dither);
#endif
#ifdef DARK_OUTLINE
DoDarkOutline(color.rgb, z0, pixelVisibilityFactor, playerPos, far);
#endif
color.rgb *= ssao;
#ifdef PBR_REFLECTIONS
#if WORLD_SPACE_REFLECTIONS_INTERNAL == -1 && !defined END
// Way steeper fresnel falloff on SSR-only mode to hide SSR limitation and gain performance
float fresnelFactor = (1.0 - smoothnessD) * 0.7 * (1.0 - isHardcodedMetal); // On Hardcoded metals we use the full fresnel value
fresnelM = max(fresnel - fresnelFactor, 0.0) / (1.0 - fresnelFactor);
#else
fresnelM = mix(fresnel * 0.7 + 0.3, fresnel, isHardcodedMetal);
#endif
#ifdef BETTER_LABPBR_REFLECTIONS_INTERNAL
// Actual Schlick fresnel
fresnelM = intenseFresnel + (1.0 - intenseFresnel) * pow5(fresnelM);
#else
fresnelM = mix(pow2(fresnelM), fresnelM * 0.75 + 0.25, intenseFresnel);
#endif
fresnelM = fresnelM * sqrt1(smoothnessD) - dither * 0.01;
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
chunkFade = texture6.b > 0.50001 ? (1.0 - texture6.b) * 2.0 : 1.0;
#endif
waterRefColor = color.rgb;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
} else {
#if defined DISTANT_HORIZONS || defined VOXY
#ifdef DISTANT_HORIZONS
float z0lod = texelFetch(dhDepthTex, texelCoord, 0).r;
#elif defined VOXY
float z0lod = texelFetch(vxDepthTexTrans, texelCoord, 0).r;
#endif
if (z0lod < 1.0 && z0lod > 0.0) { // Lod Chunks
vec4 screenPosLod = vec4(texCoord, z0lod, 1.0);
#ifdef DISTANT_HORIZONS
vec4 viewPosLod = dhProjectionInverse * (screenPosLod * 2.0 - 1.0);
viewPosLod /= viewPosLod.w;
#if SHADOW_QUALITY > -1
color.rgb *= 0.5 + 0.5 * GetLODShadows(viewPosLod.xyz, nViewPos, dhDepthTex, dhProjection, dhProjectionInverse, dither, materialMaskInt);
#endif
#if SSAO_QUALI > 0 && defined DISTANT_HORIZONS_SSAO
linearZ0_DH = CalculateLinearDepth(z0lod, dhNearPlane, dhFarPlane);
float ssao_dh = DoAmbientOcclusionDH(z0lod, linearZ0_DH, dhDepthTex, dither, texture6.a);
color.rgb *= ssao_dh;
#endif
#elif defined VOXY
vec4 viewPosLod = vxProjInv * (screenPosLod * 2.0 - 1.0);
viewPosLod /= viewPosLod.w;
#if SHADOW_QUALITY > -1
lodShadow = GetLODShadows(viewPosLod.xyz, nViewPos, vxDepthTexTrans, vxProj, vxProjInv, dither, materialMaskInt);
lodShadow += OSIEBCA; // For being able to check if a calculation has been done;
#endif
#if SSAO_QUALI > 0
float farLod = 16*20, nearLod = 4;
float aoWorldRange = (farLod - nearLod);
float ssao = GetAmbientOcclusion(vxDepthTexTrans, z0lod, GetLinearDepth(z0lod, farLod, nearLod), dither, farLod, nearLod, aoWorldRange, playerPos);
color.rgb *= pow3(ssao);
#endif
#endif
lViewPos = length(viewPosLod.xyz);
playerPos = ViewToPlayer(viewPosLod.xyz);
waterRefColor = color.rgb;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
} else
#endif
{ // Sky
skyFade = 1.0;
#ifdef OVERWORLD
#if AURORA_STYLE > 0
auroraBorealis = GetAuroraBorealis(viewPos.xyz, VdotU, dither);
color.rgb += auroraBorealis;
#endif
#if NIGHT_NEBULAE == 1
nightNebula += GetNightNebula(viewPos.xyz, VdotU, VdotS);
color.rgb += nightNebula;
#endif
#endif
#ifdef NETHER
color.rgb = netherColor * (1.0 - maxBlindnessDarkness);
#ifdef ATM_COLOR_MULTS
color.rgb *= atmColorMult;
#endif
#endif
#ifdef END
color.rgb = endSkyColor;
#ifdef END_STARS
vec3 starViewPos = viewPos.xyz;
#if BLACK_HOLE > 0
starViewPos = GetBlackHoleLensedDirection(nViewPos, blackHoleDir);
#endif
vec3 starColor = GetEnderStars(starViewPos, VdotU, 1.0, 0.0);
#define ADD_STAR_LAYER_END1 (STAR_LAYER_END == 1 || STAR_LAYER_END == 3)
#define ADD_STAR_LAYER_END2 (STAR_LAYER_END == 2 || STAR_LAYER_END == 3)
#if ADD_STAR_LAYER_END1
starColor = max(starColor, GetEnderStars(starViewPos, VdotU, 0.66, 0.0));
#endif
#if ADD_STAR_LAYER_END2
starColor = max(starColor, GetEnderStars(starViewPos, VdotU, 2.2, 0.33));
#endif
color.rgb += starColor;
#endif
#if (MC_VERSION >= 12109 || ANGELICA_VERSION >= 20155000) && defined IS_IRIS && EP_END_FLASH > 0
if (endFlashIntensityM > 0.0) {
color.rgb += DrawEndFlash(nViewPos, VdotU, dither);
}
#endif
color.rgb *= 1.0 - maxBlindnessDarkness;
#ifdef ATM_COLOR_MULTS
color.rgb *= atmColorMult;
#endif
#if BLACK_HOLE > 0
color.rgb *= blackHoleEventHorizon;
color.rgb += blackHole.rgb;
#endif
#endif
}
}
#if defined NETHER && NETHER_NOISE == 1
netherNoise = GetNetherNoise(viewPos.xyz, VdotU, dither);
color.rgb += pow4(skyFade) * netherNoise;
#endif
#if defined END && END_NEBULA > 0
vec3 nebulaViewPos = viewPos.xyz;
#if BLACK_HOLE > 0
nebulaViewPos = GetBlackHoleLensedDirection(nViewPos, getBlackHoleDir());
#endif
color.rgb += pow4(skyFade) * GetEnderNebula(nebulaViewPos, VdotU) * (1.0 - maxBlindnessDarkness) * blackHoleEventHorizon;
#endif
float cloudLinearDepth = 1.0;
vec4 clouds = vec4(0.0);
#ifdef VL_CLOUDS_ACTIVE
float cloudZCheck = 0.56;
if (z0 > cloudZCheck) {
clouds = GetClouds(cloudLinearDepth, skyFade, vec3(0.0), playerPos, viewPos.xyz,
lViewPos, VdotS, VdotU, dither, auroraBorealis, nightNebula, sunVec);
color = mix(color, vec4(clouds.rgb, 0.0), clouds.a);
}
#endif
#ifdef SKY_EFFECT_REFLECTION_TRANSLUCENT
waterRefColor = mix(waterRefColor, clouds.rgb, clouds.a);
#endif
waterRefColor = sqrt(waterRefColor) * 0.5;
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
if (viewWidth + viewHeight - gl_FragCoord.x - gl_FragCoord.y < 1.5)
cloudLinearDepth = vlFactor;
#endif
#if defined OVERWORLD && defined ATMOSPHERIC_FOG && (defined SPECIAL_BIOME_WEATHER || RAIN_STYLE == 2)
if (isEyeInWater == 0) {
float altitudeFactorRaw = GetAtmFogAltitudeFactor(playerPos.y + cameraPosition.y);
vec3 atmFogColor = GetAtmFogColor(altitudeFactorRaw, VdotS);
#ifdef ATM_COLOR_MULTS
atmFogColor *= atmColorMult;
#endif
#if RAIN_STYLE == 2
float factor = 1.0;
#else
float factor = max(inSnowy, inDry);
#endif
color = mix(color, vec4(atmFogColor, 0.0), 0.5 * rainFactor * factor * sqrt1(skyFade));
}
#endif
#if defined OVERWORLD || defined NETHER
#ifdef BEDROCK_NOISE
bedrockNoise = GetBedrockNoise(viewPos.xyz, VdotU, dither);
color.rgb += pow4(skyFade) * bedrockNoise;
#endif
#endif
#if defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900
float attentuation = doEndCenterFog(cameraPositionBest, normalize(playerPos), min(renderDistance, lViewPos), 0.5);
vec3 pointLightFog = vec3(END_CENTER_LIGHTING_R, END_CENTER_LIGHTING_G + 0.05, END_CENTER_LIGHTING_B) * 0.25 * END_CENTER_LIGHTING * 0.1 * attentuation * (1.0 - vlFactor);
color.rgb = sqrt(pow2(color.rgb) + vec3(pointLightFog));
#endif
// color.rgb = texelFetch(colortex9, ivec2(texelCoord * PHOTONICS_RENDER_SCALE), 0).rgb;
// color.rgb = vec3(clamp01(smoothstep(0.01, 1.0, GetLuminance(sample_photonics_direct(texCoord))) * 1000000));
/*DRAWBUFFERS:05*/
gl_FragData[0] = vec4(color.rgb, 1.0);
gl_FragData[1] = vec4(waterRefColor, cloudLinearDepth);
// same check as #ifdef PBR_REFLECTIONS but for Optifine to understand:
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/*DRAWBUFFERS:054*/
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a));
#ifdef VOXY
/* RENDERTARGETS: 0,5,4,19 */
gl_FragData[3] = vec4(waterRefColor, cloudLinearDepth);
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS: 0,5,4,19,20 */
gl_FragData[4] = vec4(photonicsLightMask, 1.0, 1.0, 1.0);
#endif
#if SHADOW_QUALITY > -1
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS: 0,5,4,19,20,18 */
gl_FragData[5] = vec4(lodShadow, 1.0, 1.0, 1.0);
#else
/* RENDERTARGETS: 0,5,4,19,18 */
gl_FragData[4] = vec4(lodShadow, 1.0, 1.0, 1.0);
#endif
#endif
#elif defined PHOTONICS_LIGHTING
/* RENDERTARGETS: 0,5,4,20 */
gl_FragData[3] = vec4(photonicsLightMask, 1.0, 1.0, 1.0);
#endif
#elif defined VOXY
/* RENDERTARGETS: 0,5,19 */
gl_FragData[2] = vec4(waterRefColor, cloudLinearDepth);
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS: 0,5,19,20 */
gl_FragData[3] = vec4(photonicsLightMask, 1.0, 1.0, 1.0);
#endif
#if SHADOW_QUALITY > -1
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS: 0,5,19,20,18 */
gl_FragData[4] = vec4(lodShadow, 1.0, 1.0, 1.0);
#else
/* RENDERTARGETS: 0,5,19,18 */
gl_FragData[3] = vec4(lodShadow, 1.0, 1.0, 1.0);
#endif
#endif
#elif defined PHOTONICS_LIGHTING
/* RENDERTARGETS: 0,5,20 */
gl_FragData[2] = vec4(photonicsLightMask, 1.0, 1.0, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1 || DRAGON_DEATH_EFFECT_INTERNAL > 0
uniform isampler2D endcrystal_sampler;
#endif
flat out vec3 upVec, sunVec, eastVec;
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
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();
eastVec = normalize(gbufferModelView[0].xyz);
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#ifdef END
if (frameCounter % int(0.06666 / frameTimeSmooth + 0.5) == 0) { // Change speed is not too different above 10 fps
#if MC_VERSION >= 12106
bool isEnderDragonDead = !heavyFog;
#else
vec2 absCamPosXZ = abs(cameraPosition.xz);
float maxCamPosXZ = max(absCamPosXZ.x, absCamPosXZ.y);
bool isEnderDragonDead = gl_Fog.start / far > 0.5 || maxCamPosXZ > 350.0;
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1 || DRAGON_DEATH_EFFECT_INTERNAL > 0
isEnderDragonDead = texelFetch(endcrystal_sampler, ivec2(35, 5), 0).r == 0;
#endif
#endif
if (isEnderDragonDead) vlFactor = max(vlFactor - OSIEBCA*2, 0.0);
else vlFactor = min(vlFactor + OSIEBCA*2, 1.0);
}
#endif
#endif
}
#endif
@@ -0,0 +1,281 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/materials.glsl"
#include "/lib/shaderSettings/SSAO.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
#define CHUNKS_FADE_IN_NO_FRAG_MOD_INJECT
//////////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 dhSSAOBrightnessTweak = 1.05;
if (mat == DH_BLOCK_LEAVES) {
#include "/lib/materials/specificMaterials/terrain/leaves.glsl"
} else if (mat == DH_BLOCK_GRASS) {
smoothnessG = pow2(color.g) * 0.85;
float isSide = 1.0 - clamp01(dot(worldGeoNormal, ViewToPlayer(upVec)));
dhSSAOBrightnessTweak = mix(1.0, 1.2, isSide); // only make brighter on the sides
} else if (mat == DH_BLOCK_SNOW) {
#include "/lib/materials/specificMaterials/terrain/snow.glsl"
} 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
dhSSAOBrightnessTweak = 0.9;
} else if (mat == DH_BLOCK_ILLUMINATED) {
emission = 2.5;
snowNoiseIntensity = 0.0;
sandNoiseIntensity = 0.2;
mossNoiseIntensity = 0.2;
dhSSAOBrightnessTweak = 1.2;
}
#if SSAO_QUALI > 0
color.rgb *= dhSSAOBrightnessTweak;
#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.4, far * 0.6, 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
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead, vec3(1.0));
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
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() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
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 = position.xyz;
glColor = gl_Color;
#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
#endif
gl_Position = dhProjection * gbufferModelView * position;
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
}
#endif
@@ -0,0 +1,305 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/water.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
#define CHUNKS_FADE_IN_NO_FRAG_MOD_INJECT
//////////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 && !defined LOW_QUALITY_WATER_MATERIAL || 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_TRANSLUCENT && 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(depthtex0, 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.4, far * 0.6, 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
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, vec3(1.0));
#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,
dhDepthTex, 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);
#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() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
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 = position.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
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
#endif
gl_Position = dhProjection * gbufferModelView * position;
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
}
#endif
@@ -0,0 +1,625 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/final.glsl"
#include "/lib/shaderSettings/activateSettings.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"
//Common Variables//
vec2 view = vec2(viewWidth, viewHeight);
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 && WORLD_SPACE_PLAYER_REF == 1
#include "/lib/voxelization/SSBOs/clearSSBOs.glsl"
#endif
//Common Functions//
#if IMAGE_SHARPENING > 0
vec2 viewD = 1.0 / vec2(viewWidth, viewHeight);
vec2 sharpenOffsets[4] = vec2[4](
vec2( viewD.x, 0.0),
vec2( 0.0, viewD.x),
vec2(-viewD.x, 0.0),
vec2( 0.0, -viewD.x)
);
void SharpenImage(inout vec3 color, vec2 texCoordM) {
#ifdef TAA
float sharpenMult = IMAGE_SHARPENING;
#else
float sharpenMult = IMAGE_SHARPENING * 0.5;
#endif
float mult = 0.0125 * sharpenMult;
color *= 1.0 + 0.05 * sharpenMult;
for (int i = 0; i < 4; i++) {
color -= texture2D(colortex3, texCoordM + sharpenOffsets[i]).rgb * mult;
}
}
#endif
float retroNoise (vec2 noise) {
return fract(sin(dot(noise.xy,vec2(10.998,98.233)))*12433.14159265359);
}
vec2 curveDisplay(vec2 texCoord, float curvatureAmount, int screenRoundness) {
texCoord = texCoord * 2.0 - 1.0;
vec2 offset = abs(texCoord.yx) * curvatureAmount * 0.5;
if (screenRoundness == 1) {
offset *= offset;
} else if (screenRoundness == 2) {
offset *= pow2(offset);
} else if (screenRoundness == 3) {
offset *= pow3(offset);
}
texCoord += texCoord * offset;
return texCoord * 0.5 + 0.5;
}
vec2 border(vec2 texCoord) {
const float borderAmount = 2.0 + BORDER_AMOUNT * 0.1;
texCoord = texCoord * borderAmount - borderAmount * 0.5;
return texCoord * 0.5 + 0.5;
}
#if PANINI_PROJECTION > 0
// Panini Projection Shader
// Adapted from: https://modrinth.com/shader/panini-projection
// Original Author: xiananjyzy
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. Obtain a copy at http://mozilla.org.
//
// Modifications made by SpacEagle17 in 2026.
bool paniniProjection(inout vec2 texCoord) {
const float dist = PANINI_PROJECTION * 0.1;
const float distPlus1 = dist + 1.0;
float aspect = viewWidth / viewHeight;
float cosLonEdge = 1.0 / sqrt(1.0 + aspect * aspect);
float scaleEdge = distPlus1 / (dist + cosLonEdge);
float zoom = 1.0 / (scaleEdge * cosLonEdge);
vec2 ndc = (texCoord * 2.0 - 1.0) / zoom;
ndc.x *= aspect;
float xSq = ndc.x * ndc.x;
float k = xSq / (distPlus1 * distPlus1);
float discriminant = 1.0 + k * (1.0 - dist * dist);
float cosLon = (-k * dist + sqrt(max(0.0, discriminant))) / (k + 1.0);
float scaleFactor = distPlus1 / (dist + cosLon);
float divisor = scaleFactor * cosLon;
if (divisor <= 0.0) return false;
vec2 projected = ndc / (divisor * vec2(aspect, 1.0));
texCoord = projected * 0.5 + 0.5;
if (any(lessThan(texCoord, vec2(0.0))) || any(greaterThan(texCoord, vec2(1.0)))) return false;
return true;
}
#endif
vec3 sampleFinalTexture(sampler2D tex, vec2 uv) {
#if PANINI_PROJECTION > 0
// Panini remapping minifies the source non-uniformly; bias LOD and recover some local contrast.
const float lodBias = -0.55;
vec2 texel = 1.0 / vec2(viewWidth, viewHeight);
vec3 center = texture2DLod(tex, uv, lodBias).rgb;
vec3 ring =
texture2DLod(tex, uv + vec2( texel.x, 0.0), lodBias).rgb +
texture2DLod(tex, uv + vec2(-texel.x, 0.0), lodBias).rgb +
texture2DLod(tex, uv + vec2(0.0, texel.y), lodBias).rgb +
texture2DLod(tex, uv + vec2(0.0, -texel.y), lodBias).rgb;
float sharpenAmount = 0.11 + 0.012 * PANINI_PROJECTION;
vec3 sharpened = center + (4.0 * center - ring) * sharpenAmount;
return clamp(sharpened, 0.0, 1.0);
#else
return texture2D(tex, uv).rgb;
#endif
}
vec3 scanline(vec2 texCoord, vec3 color, float frequency, float intensity, float speed, float amount, vec3 scanlineRGB, bool monochrome, bool flipDirection) {
if (flipDirection) {
texCoord = texCoord.yx;
}
float count = viewHeight * amount;
vec2 scanlineColor = vec2(
sin(mod(texCoord.y + frameTimeCounter * 0.2 * speed, frequency) * count),
cos(mod(texCoord.y + frameTimeCounter * 0.5 * speed, 0.7 * frequency) * count)
);
vec3 scanlines;
if (monochrome) {
scanlines = vec3(scanlineColor.y + scanlineColor.x * 0.2);
} else {
scanlines = vec3(scanlineColor.x * scanlineRGB.r, scanlineColor.y * scanlineRGB.g, scanlineColor.x * scanlineRGB.b);
}
return color += color * scanlines * intensity * 0.1;
}
float halftones(vec2 texCoord, float angle, float scale) { // Thanks to https://www.shadertoy.com/view/4sBBDK by starea
vec2 coord = texCoord * viewSize;
vec2 dots = rotate(angle) * coord * scale;
return sin(dots.x) * sin(dots.y) * 4.0;
}
float noiseSpeedLines(float a, float p, float s) {
float p1 = hash11Modified(mod(floor(a), p), s);
float p2 = hash11Modified(mod(floor(a) + 2.0, p), s);
return smoothstep(0.0, 0.1, mix(p1, p2, smoothstep(0.0, 1.0, fract(a))) - 0.3);
}
float layeredNoiseSpeedLines(float a, float s) {
return noiseSpeedLines(a, 20.0, s) + noiseSpeedLines(a * 5.0, 20.0 * 5.0, s);
}
float speedLines(vec2 uv, float speed) { // Thanks to https://www.shadertoy.com/view/NldyDn by HalbFettKaese - modified a bit
uv = uv * 2.0 - 1.0;
float a = atan(uv.x, uv.y) / pi;
float value = layeredNoiseSpeedLines((a * 17) * (1.9 - SPEED_LINE_THICKNESS) * 1.5, (floor(frameTimeCounter * 10.0 * SPEED_LINES_SPEED) / 10.0) * 2.0);
value -= 1.0 / length(uv) * 0.9;
return clamp(value, 0.0, 0.1 * speed);
}
float randomNoiseOverlay1(vec2 st) {
return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);
}
float grid(float uv) {
if (hideGUI == 1) return 0.0;
float mainLine = smoothstep(0.9995 * (1.0 - MAIN_GRID_INTERVAL * 0.00005), 1.0, cos(uv * tau / (1.0 / MAIN_GRID_INTERVAL))) * 0.3;
float subLine = smoothstep(0.9998 * (1.0 - SUB_GRID_INTERVAL * 0.00075), 1.0, cos(uv * tau * SUB_GRID_INTERVAL / (1.0 / MAIN_GRID_INTERVAL))) * 0.1;
return mainLine + subLine;
}
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
// Function to apply horizontal noise
vec2 applyHorizontalNoise(vec2 texCoordM, float resolution, float intensity, float speed) {
float horizontalNoiseResolution = resolution * 100.0;
float horizontalNoiseIntensity = intensity * 0.002;
float horizontalNoiseSpeed = speed * 0.0001;
texCoordM.y *= horizontalNoiseResolution;
texCoordM.y = float(int(texCoordM.y)) * (1.0 / horizontalNoiseResolution);
float noise = retroNoise(vec2(frameTimeCounter * horizontalNoiseSpeed, texCoordM.y));
texCoordM.x += noise * horizontalNoiseIntensity;
return texCoordM;
}
// Function to apply vertical screen displacement
void applyVerticalScreenDisplacement(inout vec2 texCoordM, inout float verticalOffset, float verticalScrollSpeed, float verticalStutterSpeed, float verticalEdgeGlitch, bool isVertical) {
float displaceEffectOn = 1.0;
float scrollSpeed = verticalScrollSpeed * 2.0;
float stutterSpeed = verticalStutterSpeed * 0.2;
float scroll = (1.0 - step(retroNoise(vec2(frameTimeCounter * 0.00002, 8.0)), 0.9 * (1.0 - VERTICAL_SCROLL_FREQUENCY * 0.3))) * scrollSpeed;
float stutter = (1.0 - step(retroNoise(vec2(frameTimeCounter * 0.00005, 9.0)), 0.8 * (1.0 - VERTICAL_STUTTER_FREQUENCY * 0.3))) * stutterSpeed;
float stutter2 = (1.0 - step(retroNoise(vec2(frameTimeCounter * 0.00003, 5.0)), 0.7 * (1.0 - VERTICAL_STUTTER_FREQUENCY * 0.3))) * stutterSpeed;
verticalOffset = sin(frameTimeCounter) * scroll + stutter * stutter2;
if(isVertical) texCoordM.y = mix(texCoordM.y, mod(texCoordM.y + verticalOffset, verticalEdgeGlitch), displaceEffectOn);
else texCoordM.x = mix(texCoordM.x, mod(texCoordM.x + verticalOffset, verticalEdgeGlitch), displaceEffectOn);
}
#if defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000009
vec4 waterMarkFunction(ivec2 pixelSize, vec2 textCoord, vec2 screenUV, float watermarkSizeMult, bool hideWatermark){
float watermarkAspectRatio = float(pixelSize.x) / pixelSize.y;
float watermarkSize = 1 / watermarkSizeMult;
if (aspectRatio < 3) textCoord += vec2(3 * screenUV.x * watermarkSize * 1.5 - 3 * watermarkSize * 1.5, 1.0 - 3 * watermarkAspectRatio * screenUV.y * watermarkSize * 1.5 / aspectRatio);
else textCoord += vec2(screenUV.x * aspectRatio - aspectRatio, 1.0 - watermarkAspectRatio * screenUV.y);
// Only sample texture if we're in the valid range
if (textCoord.x > -1 && textCoord.x < 0 && textCoord.y > 0 && textCoord.y < 1) {
vec2 texCoordMapped = fract(textCoord);
ivec2 fetchCoord = ivec2(texCoordMapped * pixelSize);
vec4 EuphoriaPatchesText = texelFetch(epWatermark, fetchCoord, 0);
float guiIsNotHidden = 1.0;
if (hideWatermark) {
#if WATERMARK == 2
if (hideGUI == 0) guiIsNotHidden = 0.0;
#elif WATERMARK == 3
if (hideGUI == 0 || heldItemId != 40000 && heldItemId2 != 40000) guiIsNotHidden = 0.0;
#endif
}
return vec4(EuphoriaPatchesText.rgb, EuphoriaPatchesText.a * guiIsNotHidden);
}
return vec4(0.0); // Transparent
}
#endif
vec3 staticColor(vec3 color, float staticIntensity, float minStaticStrength, float maxStaticStrength, float staticSpeed) { // credit to arananderson https://www.shadertoy.com/view/tsX3RN
float maxStrength = max(minStaticStrength, maxStaticStrength);
float minStrength = min(minStaticStrength, maxStaticStrength);
float speed = staticSpeed * 10.0;
vec2 fractCoord = fract(texCoord * fract(sin(frameTimeCounter * speed + 1.0)));
maxStrength = clamp(sin(frameTimeCounter * 0.5), minStrength, maxStrength);
vec3 staticColor = vec3(retroNoise(fractCoord)) * maxStrength;
return mix(vec3(1.0), color - staticColor, staticIntensity);
}
float getUnderwaterDistortion(vec2 uv, float intensity) {
return WATER_REFRACTION_INTENSITY * intensity * sin((uv.x + uv.y) * 25.0 + frameTimeCounter * UNDERWATER_DISTORTION_STRENGTH);
}
vec2 getNetherHeatDistortion(vec2 uv, float z0, float lightmap) {
float heatAmount = max(0.0, eyeBrightnessSmooth.x / 240.0 - 0.2) * 1.25;
float verticalFalloff = 1.0 - pow3(uv.y); // More intensity at bottom of screen (heat rising effect)
float depthFactor = clamp01((z0 - 0.06) * 4.0); // Adjusted depth to only be 0 close to the player
float distanceAdjustedLightmap = pow3(lightmap) * 0.23 * (0.3 + min(depthFactor, 0.7)); // Boost distant lights, reduce close ones
// Blend frequencies based on distance - near:far
float freqY1 = mix(25.0, 14.0, depthFactor);
float freqY2 = mix(18.0, 27.0, depthFactor);
float freqX1 = mix(22.0, 14.8, depthFactor);
float freqX2 = mix(15.0, 21.7, depthFactor);
vec2 heatDistort = vec2(
sin((uv.y * NETHER_HEAT_DISTORTION_SCALE * freqY1) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 1.3) * 0.7 +
sin((uv.y * NETHER_HEAT_DISTORTION_SCALE * freqY2) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 0.9) * 0.2,
sin((uv.x * NETHER_HEAT_DISTORTION_SCALE * freqX1) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 1.5) * 0.7 +
sin((uv.x * NETHER_HEAT_DISTORTION_SCALE * freqX2) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 1.1) * 0.3
);
float playerSpeed = smoothstep(0.0, 0.75, 1.0 - clamp01(length(cameraPosition - previousCameraPosition) / sqrt3(frameTime)));
float distortionMask = max(heatAmount * pow2(verticalFalloff), distanceAdjustedLightmap) * playerSpeed;
return heatDistort * 0.00012 * NETHER_HEAT_DISTORTION * distortionMask;
}
#include "/lib/textRendering/textRenderer.glsl"
void beginTextM(int textSize, vec2 offset) {
float scale = 860;
beginText(ivec2(vec2(scale * viewWidth / viewHeight, scale) * texCoord) / textSize, ivec2(0 + offset.x, scale / textSize - offset.y));
text.bgCol = vec4(0.0);
}
#ifdef EUPHORIA_PATCHES_POTATO_REMOVED
#include "/lib/misc/potato.glsl"
#endif
#ifdef ENTITIES_ARE_LIGHT
#include "/lib/misc/worldOutline.glsl"
#endif
#include "/lib/misc/pixelCraft.glsl"
#include "/lib/misc/endCreditsBackground.glsl"
//Program//
void main() {
vec3 color = vec3(0.0);
float viewWidthM = viewWidth;
float viewHeightM = viewHeight;
#if PIXELATED_SCREEN_SIZE > 0 || defined SCREEN_DITHERING_INTERNAL
vec2 cellSize = getCellSize();
#endif
#if BORDER_AMOUNT != 0
vec2 texCoordM = border(texCoord);
#else
vec2 texCoordM = texCoord;
#endif
#ifdef CURVE_DISPLAY
texCoordM = curveDisplay(texCoordM, CURVATURE_AMOUNT, SCREEN_ROUNDNESS);
#endif
vec2 texCoordBorder = texCoordM;
#if HORIZONTAL_NOISE > 0 && defined RETRO_ON
texCoordM = applyHorizontalNoise(texCoordM, HORIZONTAL_NOISE, HORIZONTAL_NOISE_INTENSITY, HORIZONTAL_NOISE_SPEED);
#endif
#if defined VERTICAL_SCREEN_DISPLACEMENT && defined RETRO_ON
float verticalOffset = 0.0;
applyVerticalScreenDisplacement(texCoordM, verticalOffset, VERTICAL_SCROLL_SPEED, VERTICAL_STUTTER_SPEED, VERTICAL_EDGE_GLITCH, true);
#endif
#if WATERMARK > 0 && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000009)
vec4 watermarkColor = waterMarkFunction(ivec2(100, 29), vec2(0.05), texCoordM.xy, WATERMARK_SIZE, true);
#endif
#if CAMERA_NOISE_OVERLAY == 1
texCoordM += vec2(randomNoiseOverlay1(texCoordM + vec2(0.0, 0.0)), randomNoiseOverlay1(texCoordM + vec2(1.0, 1.0))) * 0.01 * CAMERA_NOISE_OVERLAY_INTENSITY;
#endif
#if defined UNDERWATER_DISTORTION && PIXELATED_SCREEN_SIZE == 0
if (isEyeInWater == 1)
texCoordM += getUnderwaterDistortion(texCoord, 0.00035);
#endif
#if LETTERBOXING > 0 && defined EXCLUDE_ENTITIES || defined BAD_APPLE || DELTARUNE_BATTLE_BACKGROUND == 2 || defined ENTITIES_ARE_LIGHT || NETHER_HEAT_DISTORTION > 0 && defined NETHER
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
#if defined ENTITIES_ARE_LIGHT || NETHER_HEAT_DISTORTION > 0 && defined NETHER
float z0 = GetLinearDepth(texelFetch(depthtex0, texelCoord, 0).r);
#endif
#endif
#if NETHER_HEAT_DISTORTION > 0 && defined NETHER && PIXELATED_SCREEN_SIZE == 0
texCoordM += getNetherHeatDistortion(texCoordM, z0, texture6.a);
#endif
#if PANINI_PROJECTION > 0
bool paniniValid = paniniProjection(texCoordM);
#else
bool paniniValid = true;
#endif
#if PIXELATED_SCREEN_SIZE > 0
#define textureFinal(tex) (paniniValid ? createPixelation(tex, texCoordM, PIXELATED_SCREEN_SMOOTHNESS, cellSize) : vec3(0.0))
#else
#define textureFinal(tex) (paniniValid ? sampleFinalTexture(tex, texCoordM) : vec3(0.0))
#endif
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
color = textureFinal(colortex3);
} else {
color = textureFinal(colortex2);
}
#else
color = textureFinal(colortex3);
#endif
#ifdef SCREEN_DITHERING_INTERNAL
color = ditherColor(color, texCoordM, cellSize);
#endif
#ifdef PALETTE_SWAP
color = convertToPaletteColor(color);
#endif
#if CHROMA_ABERRATION > 0
#if PIXELATED_SCREEN_SIZE > 0
float scale = cellSize.x * viewWidth * 0.25;
vec2 aberration = (texCoordM - 0.5) * (2.0 / vec2(viewWidth, viewHeight)) * scale * CHROMA_ABERRATION;
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
color.rb = vec2(createPixelation(colortex3, texCoordM + aberration, PIXELATED_SCREEN_SMOOTHNESS, cellSize).r,
createPixelation(colortex3, texCoordM - aberration, PIXELATED_SCREEN_SMOOTHNESS, cellSize).b);
} else {
color.rb = vec2(createPixelation(colortex2, texCoordM + aberration, PIXELATED_SCREEN_SMOOTHNESS, cellSize).r,
createPixelation(colortex2, texCoordM - aberration, PIXELATED_SCREEN_SMOOTHNESS, cellSize).b);
}
#else
color.rb = vec2(createPixelation(colortex3, texCoordM + aberration, PIXELATED_SCREEN_SMOOTHNESS, cellSize).r,
createPixelation(colortex3, texCoordM - aberration, PIXELATED_SCREEN_SMOOTHNESS, cellSize).b);
#endif
#else
vec2 scale = vec2(1.0, viewHeight / viewWidth);
float aberrationStrength = CHROMA_ABERRATION;
vec2 aberration = (texCoordM - 0.5) * (2.0 / vec2(viewWidth, viewHeight)) * scale * aberrationStrength;
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
color.rb = vec2(texture2D(colortex3, texCoordM + aberration).r, texture2D(colortex3, texCoordM - aberration).b);
} else {
color.rb = vec2(texture2D(colortex2, texCoordM + aberration).r, texture2D(colortex2, texCoordM - aberration).b);
}
#else
color.rb = vec2(texture2D(colortex3, texCoordM + aberration).r, texture2D(colortex3, texCoordM - aberration).b);
#endif
#endif
#endif
#if IMAGE_SHARPENING > 0 && PIXELATED_SCREEN_SIZE == 0
#if LONG_EXPOSURE > 0
if(hideGUI == 0 || isViewMoving()){ // GUI visible OR moving
#endif
SharpenImage(color, texCoordM);
#if LONG_EXPOSURE > 0
}
#endif
#endif
#if LETTERBOXING > 0
#if BORDER_AMOUNT > 0
viewWidthM = viewWidth - viewWidth * BORDER_AMOUNT * 0.04;
#endif
float letterboxMargin = 0.5 - viewWidthM / (2 * viewHeightM * ASPECT_RATIO);
#if LETTERBOXING == 2
letterboxMargin = mix(0.0, letterboxMargin, isSneaking);
#endif
if (texCoord.y > 1.0 - letterboxMargin || texCoord.y < letterboxMargin) {
#ifdef EXCLUDE_ENTITIES
if (int(texture6.g * 255.1) != 254) color *= 0.0;
#else
color *= mix(0.0, 1.0, LETTERBOXING_TRANSPARENCY);
#endif
}
#endif
#ifdef BAD_APPLE
color = vec3((int(texture6.g * 255.1) != 254) ? 0.0 : 1.0);
#endif
#if DELTARUNE_BATTLE_BACKGROUND > 0
vec3 deltaruneColor = movingCheckerboard(texCoord, 100.0, 1.0, vec2(0.05, -0.05), vec3(1.0, 0.0, 1.0));
deltaruneColor += movingCheckerboard(texCoord, 100.0, 1.0, vec2(-0.025, 0.025), vec3(1.0, 0.0, 1.0) * 0.5);
#if DELTARUNE_BATTLE_BACKGROUND == 1
if (texture2D(depthtex0, texCoord).r == 1.0) color = deltaruneColor;
#elif DELTARUNE_BATTLE_BACKGROUND == 2
if ((int(texture6.g * 255.1) != 254)) {
color = deltaruneColor;
}
#endif
#endif
/*ivec2 boxOffsets[8] = ivec2[8](
ivec2( 1, 0),
ivec2( 0, 1),
ivec2(-1, 0),
ivec2( 0,-1),
ivec2( 1, 1),
ivec2( 1,-1),
ivec2(-1, 1),
ivec2(-1,-1)
);
for (int i = 0; i < 8; i++) {
color = max(color, texelFetch(colortex3, texelCoord + boxOffsets[i], 0).rgb);
}*/
#ifdef ENTITIES_ARE_LIGHT
vec4 texture10 = texture2D(colortex10, texCoordM);
color = texture10.a * mix(vec3(1.0), texture10.rgb, texture6.a);
DoWorldOutline(color, z0, vec3(1.0), 0.0, 1.0);
#endif
#if WATERMARK > 0 && (defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000009)
#if WATERMARK < 4
color.rgb = mix(color.rgb, watermarkColor.rgb, watermarkColor.a);
#elif WATERMARK == 4
color.rgb = mix(color.rgb, vec3(GetLuminance(watermarkColor.rgb)), watermarkColor.a);
#endif
#endif
#ifdef LET_THERE_BE_COLORS
color = hash33(color * frameTimeCounter);
#endif
#if STATIC_NOISE > 0 && defined RETRO_ON
float staticIntensity = 0.0;
staticIntensity = STATIC_NOISE * 0.1;
color *= staticColor(color, staticIntensity, MIN_STATIC_STRENGTH, MAX_STATIC_STRENGTH, STATIC_SPEED);
#endif
#if SCANLINE > 0 && defined RETRO_ON
color = scanline(texCoord, color, SCANLINE_FREQUENCY, SCANLINE, SCANLINE_SPEED, SCANLINE_AMOUNT, vec3(SCANLINE_R, SCANLINE_G, SCANLINE_B), SCANLINE_NEW_MONOCHROME, SCANLINE_NEW_DIRECTION);
#endif
#ifdef HALFTONE
#ifdef HALFTONE_MONOCHROME
float colorOld = GetLuminance(color);
#else
vec3 colorOld = color;
#endif
const float dotAngle = HALFTONE_ANGLE * pi * 0.5;
const float dotScale = HALFTONE_SCALE;
const float dotBrightness = HALFTONE_BRIGHTNESS * 2.0;
color = vec3(colorOld * dotBrightness * 5.0 - 5.0 + halftones(texCoordM, dotAngle, dotScale));
#endif
#if SPEED_LINES > 0
#if SPEED_LINES != 3
float speedIntensity = (length(cameraPosition - previousCameraPosition) / frameTime) * 0.08;
float speedThreshold = 3.0;
float speedFactor = smoothstep(speedThreshold * 0.45, speedThreshold, speedIntensity);
float isSprintingM = 0.0;
#if SPEED_LINES == 2
isSprintingM = isSprinting;
#endif
speedIntensity = max(speedFactor, isSprintingM);
#else
float speedIntensity = 1.0;
#endif
float speedLines = speedLines(texCoordM, speedIntensity);
speedLines = mix(0.0, speedLines, SPEED_LINES_TRANSPARENCY);
color += vec3(speedLines);
#endif
#if MAIN_GRID_INTERVAL > 1
float grid = max(grid(texCoordM.x), grid(texCoordM.y));
#if GRID_CONDITION == 0
color += grid;
#elif GRID_CONDITION == 1
color += mix(0.0, grid, isSneaking);
#elif GRID_CONDITION == 2
float isHoldingSpyglass = 0.0;
if (heldItemId == 45014 || heldItemId2 == 45014) isHoldingSpyglass = 1.0; //holding spyglass
color += mix(0.0, grid, isHoldingSpyglass);
#endif
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 && WORLD_SPACE_PLAYER_REF == 1
clearSSBOs();
#endif
#ifdef VIGNETTE_R
vec2 texCoordMin = texCoordM.xy - 0.5;
float vignette = 1.0 - dot(texCoordMin, texCoordMin) * (1.0 - GetLuminance(color));
color *= vignette;
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
color += vec3((dither - 0.25) / 128.0);
#if defined CURVE_DISPLAY || BORDER_AMOUNT != 0
if (texCoordBorder.x < 0.0 || texCoordBorder.x > 1.0) color = vec3(0.0);
if (texCoordBorder.y < 0.0 || texCoordBorder.y > 1.0) color = vec3(0.0);
#endif
#ifdef EUPHORIA_PATCHES_POTATO_REMOVED
color.rgb = potatoError();
#endif
#include "/lib/textRendering/all_text_messages.glsl"
// color.rgb = endCreditsEffect(texCoord);
// Example of printing a float value (for debugging)
// float placeholder = texelFetch(endcrystal_sampler, ivec2(35, 8), 0).r;
// beginTextM(2, vec2(5));
// text.bgCol = vec4(0.0, 0.0, 0.0, 0.8);
// text.fpPrecision = 6;
// printFloat(placeholder);
// printLine();
// endText(color.rgb);
// color.rgb = texture2D(colortex13, texCoord).rgb;
/* DRAWBUFFERS:0 */
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
@@ -0,0 +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
@@ -0,0 +1,227 @@
//////////////////////////////////////////
// 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, vec3(1.0));
#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) { // Main hand holding air
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));
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(0.0, 1.0, 0.0, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(0.0, 0.0, 0.0, 0.0);
#endif
#endif
#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
@@ -0,0 +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
@@ -0,0 +1,525 @@
//////////////////////////////////////////
// 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
#ifdef GBUFFERS_BLOCK_TRANSLUCENT
#include "/lib/atmospherics/fog/mainFog.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
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, noGeneratedNormals = false;
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = 0.0, enderDragonDead = 1.0, materialAO = 1.0;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0;
#ifdef PHOTONICS_LIGHTING
vec3 oldAlbedo = vec3(0.0);
#endif
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, glColor, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, materialAO, 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
if (!noGeneratedNormals) 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;
#ifdef PHOTONICS_LIGHTING
oldAlbedo = color.rgb;
#endif
vec3 rawAlbedoM = color.rgb;
// Tints the direct-light specular highlight for named labPBR metals with their F0 color
#ifdef BETTER_LABPBR_REFLECTIONS_INTERNAL
int materialMaskIntM = int(materialMask * 255.1);
vec3 metalHighlightTintM = (RP_MODE == 3 && materialMaskIntM >= 215 && materialMaskIntM <= 222) ? GetLabPBRMetalF0(materialMaskIntM, rawAlbedoM) : vec3(1.0);
#else
vec3 metalHighlightTintM = vec3(1.0);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, false,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, metalHighlightTintM);
#ifdef BETTER_LABPBR_AO_INTERNAL
float lightExposureM = max(GetLuminance(shadowMult), lmCoordM.x);
color.rgb *= mix(materialAO, 1.0, lightExposureM);
#endif
#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 GBUFFERS_BLOCK_TRANSLUCENT
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float skyFade = 0.0;
float prevAlpha = color.a;
color.a = 1.0;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
float fogAlpha = color.a;
color.a = prevAlpha * (1.0 - skyFade);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
#ifdef PHOTONICS_LIGHTING
vec4 phAlbedoOut = vec4(oldAlbedo, 1.0);
vec3 playerPosDelta = vec3(0.0);
#ifdef DO_PIXELATION_EFFECTS
// Compute snap delta here where dFdx/dFdy are valid (same triangle in 2x2 quad)
// Store world-space delta so post-passes can apply it without any derivatives
vec2 pixelationOffset = ComputeTexelOffset(tex, texCoord);
playerPosDelta = TexelSnap(playerPos, pixelationOffset) - playerPos;
#endif
#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 >= 1 || WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, 0.0);
#endif
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS:0,3,6,4,10,11,20 */
gl_FragData[4] = phAlbedoOut;
gl_FragData[5] = vec4(playerPosDelta, 1.0);
gl_FragData[6] = vec4(normalize((gbufferModelViewInverse * vec4(normal, 0.0f)).xyz), 1.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, 0.0);
#elif defined PHOTONICS_LIGHTING
/* RENDERTARGETS:0,3,6,4,10,11,20 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0);
gl_FragData[4] = phAlbedoOut;
gl_FragData[5] = vec4(playerPosDelta, 1.0);
gl_FragData[6] = vec4(normalize((gbufferModelViewInverse * vec4(normal, 0.0f)).xyz), 1.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
vec3 rawBinormal = gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w;
binormal = rawBinormal * inversesqrt(max(dot(rawBinormal, rawBinormal), 1e-8));
vec3 rawTangent = gl_NormalMatrix * at_tangent.xyz;
tangent = rawTangent * inversesqrt(max(dot(rawTangent, rawTangent), 1e-8));
#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
@@ -0,0 +1,200 @@
//////////////////////////////////////////
// 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, northVec;
in vec3 normal;
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 || defined VOXY)
#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) * vec4(vec3(1.0), glColor.a);
color.rgb *= 0.9 + 0.25 * dot(upVec, normal) - 0.1 * abs(dot(northVec, normal)) - rainFactor * 0.2;
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 || defined VOXY
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 VOXY
float z1lod = texelFetch(vxDepthTexOpaque, texelCoord, 0).r;
vec4 screenPos1Lod = vec4(texCoord, z1lod, 1.0);
vec4 viewPos1Lod = vxProjInv * (screenPos1Lod * 2.0 - 1.0);
viewPos1Lod /= viewPos1Lod.w;
if (length(viewPos1Lod.rgb) < length(viewPos)) {
discard;
}
#endif
#ifdef BORDER_FOG
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);
#if MC_VERSION < 12106
cloudDistance *= 3.0;
#else
cloudDistance *= 1.5;
#endif
color.a *= clamp01(cloudDistance);
#endif
#endif
color.a *= min1(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, northVec;
out vec3 normal;
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;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
northVec = normalize(gbufferModelView[2].xyz);
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
@@ -0,0 +1,103 @@
//////////////////////////////////////////
// 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);
#ifdef GBUFFERS_COLORWHEEL
vec2 lmcoord;
float ao;
vec4 overlayColor;
clrwl_computeFragment(color, color, lmcoord, ao, overlayColor);
color.rgb = mix(color.rgb, overlayColor.rgb, overlayColor.a);
#else
color.rgb *= glColor.rgb;
#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;
//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
@@ -0,0 +1,566 @@
//////////////////////////////////////////
// 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//
#ifdef IS_IRIS
bool ProbablyMainPlayer(vec3 playerPos) {
vec3 boxOffsets = vec3(2.0);
return all(lessThan(abs(playerPos + relativeEyePosition), boxOffsets));
}
void HideArmor(inout vec4 color, vec3 playerPos) {
if (atlasSize.x > 1000.0) return; // Skip Dropped Items
#if HIDE_ARMOR == 1
if (ProbablyMainPlayer(playerPos))
#endif
color.a = 0.0;
}
void HideArmorDontSkip(inout vec4 color, vec3 playerPos) {
#if HIDE_ARMOR == 1
if (ProbablyMainPlayer(playerPos))
#endif
color.a = 0.0;
}
void HideElytra(inout vec4 color, vec3 playerPos) {
if (atlasSize.x > 1000.0) return; // Skip Dropped Items
if (!isElytraFlying) {
#if HIDE_ARMOR == 1
if (ProbablyMainPlayer(playerPos))
#endif
color.a = 0.0;
}
}
#endif
//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 GBUFFERS_ENTITIES_TRANSLUCENT
#include "/lib/atmospherics/fog/mainFog.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, materialAO = 1.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(1.0), rawAlbedoM = vec3(1.0);
#ifdef PHOTONICS_LIGHTING
vec3 oldAlbedo = vec3(0.0);
#endif
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);
#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, glColor, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, materialAO, 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
if (entityId >= 50015 && entityId <= 50017) { // Player
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
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;
#ifdef PHOTONICS_LIGHTING
oldAlbedo = color.rgb;
#endif
rawAlbedoM = color.rgb;
// Tints the direct-light specular highlight for named labPBR metals with their F0 color
#ifdef BETTER_LABPBR_REFLECTIONS_INTERNAL
int materialMaskIntM = int(materialMask * 255.1);
vec3 metalHighlightTintM = (RP_MODE == 3 && materialMaskIntM >= 215 && materialMaskIntM <= 222) ? GetLabPBRMetalF0(materialMaskIntM, rawAlbedoM) : vec3(1.0);
#else
vec3 metalHighlightTintM = vec3(1.0);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
true, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, metalHighlightTintM);
#ifdef BETTER_LABPBR_AO_INTERNAL
float lightExposureM = max(GetLuminance(shadowMult), lmCoordM.x);
color.rgb *= mix(materialAO, 1.0, lightExposureM);
#endif
#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 GBUFFERS_ENTITIES_TRANSLUCENT
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
float skyFade = 0.0;
float prevAlpha = color.a;
color.a = 1.0;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
float fogAlpha = color.a;
color.a = prevAlpha * (1.0 - skyFade);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
#ifdef PHOTONICS_LIGHTING
vec4 phAlbedoOut = vec4(oldAlbedo, 1.0);
vec3 playerPosDelta = vec3(0.0);
#ifdef DO_PIXELATION_EFFECTS
// Compute snap delta here where dFdx/dFdy are valid (same triangle in 2x2 quad)
// Store world-space delta so post-passes can apply it without any derivatives
vec2 pixelationOffset = ComputeTexelOffset(tex, texCoord);
playerPosDelta = TexelSnap(playerPos, pixelationOffset) - playerPos;
#endif
#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 || WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, entitySSBLMask);
#endif
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS:0,3,6,4,10,11,20 */
gl_FragData[4] = phAlbedoOut; // SS_BLOCKLIGHT is undefined with Photonics
gl_FragData[5] = vec4(playerPosDelta, 1.0);
gl_FragData[6] = vec4(normalize((gbufferModelViewInverse * vec4(normal, 0.0f)).xyz), 1.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, entitySSBLMask);
#elif defined PHOTONICS_LIGHTING
/* RENDERTARGETS:0,3,6,4,10,11,20 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0);
gl_FragData[4] = phAlbedoOut;
gl_FragData[5] = vec4(playerPosDelta, 1.0);
gl_FragData[6] = vec4(normalize((gbufferModelViewInverse * vec4(normal, 0.0f)).xyz), 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;
#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
vec3 rawBinormal = gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w;
binormal = rawBinormal * inversesqrt(max(dot(rawBinormal, rawBinormal), 1e-8));
vec3 rawTangent = gl_NormalMatrix * at_tangent.xyz;
tangent = rawTangent * inversesqrt(max(dot(rawTangent, rawTangent), 1e-8));
#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
@@ -0,0 +1,409 @@
//////////////////////////////////////////
// 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, materialAO = 1.0; // No SSAO, No TAA, Reduce Reflection
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(0.5), rawAlbedoM = vec3(1.0); // Reduced shadowMult for held items to not get too bright
#ifdef PHOTONICS_LIGHTING
vec3 oldAlbedo = vec3(0.0);
#endif
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = vec3(0.0);
#endif
vec3 playerPosDelta = vec3(0.0);
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, glColor, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, materialAO, viewPos, 0.0);
#endif
#endif
// Support for modded light sources and blockID set by the user
#ifdef IS_IRIS
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;
#ifdef PHOTONICS_LIGHTING
oldAlbedo = color.rgb;
#endif
rawAlbedoM = color.rgb;
// Tints the direct-light specular highlight for named labPBR metals with their F0 color
#ifdef BETTER_LABPBR_REFLECTIONS_INTERNAL
int materialMaskIntM = int(materialMask * 255.1);
vec3 metalHighlightTintM = (RP_MODE == 3 && materialMaskIntM >= 215 && materialMaskIntM <= 222) ? GetLabPBRMetalF0(materialMaskIntM, rawAlbedoM) : vec3(1.0);
#else
vec3 metalHighlightTintM = vec3(1.0);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, 0.0, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead, metalHighlightTintM);
#ifdef BETTER_LABPBR_AO_INTERNAL
float lightExposureM = max(GetLuminance(shadowMult), lmCoordM.x);
color.rgb *= mix(materialAO, 1.0, lightExposureM);
#endif
#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
#ifdef PHOTONICS_LIGHTING
#ifdef DO_PIXELATION_EFFECTS
// Compute snap delta here where dFdx/dFdy are valid (same triangle in 2x2 quad)
// Store world-space delta so post-passes can apply it without any derivatives
// Must use actual depth (no +0.38 hand bias) to match deferred's depthtex0 reconstruction
vec2 pixelationOffset = ComputeTexelOffset(tex, texCoord);
vec3 playerPosUnbiased = ViewToPlayer(ScreenToView(vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z)));
playerPosDelta = TexelSnap(playerPosUnbiased, pixelationOffset) - playerPosUnbiased;
#endif
#endif
}
#ifdef PHOTONICS_LIGHTING
vec4 phAlbedoOut = vec4(oldAlbedo, 1.0);
#endif
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
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;
float albedoData = 1.0;
#if defined IS_IRIS || defined IS_ANGELICA || MC_VERSION >= 11600
purkinjeData = lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission);
albedoData = clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0;
#endif
/* DRAWBUFFERS:036 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult, 1.0);
gl_FragData[2] = vec4(smoothnessD, materialMask, skyLightFactor, purkinjeData);
#if BLOCK_REFLECT_QUALITY >= 2 && (RP_MODE >= 2 || defined IS_IRIS || defined IS_ANGELICA && ANGELICA_VERSION >= 20000008) || defined BETTER_LABPBR_REFRACTIONS_INTERNAL
/* DRAWBUFFERS:0364 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, albedoData);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:03649 */
gl_FragData[4] = vec4(lightAlbedo, handSSBLMask);
#endif
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS:0,3,6,4,10,11,20*/
gl_FragData[4] = phAlbedoOut; // SS_BLOCKLIGHT is undefined with Photonics
gl_FragData[5] = vec4(playerPosDelta, 1.0);
gl_FragData[6] = vec4(normal, 1.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, handSSBLMask);
#elif defined PHOTONICS_LIGHTING
/* RENDERTARGETS:0,3,6,4,10,11,20 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, albedoData);
gl_FragData[4] = phAlbedoOut;
gl_FragData[5] = vec4(playerPosDelta, 1.0);
gl_FragData[6] = vec4(normal, 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;
#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
vec3 rawBinormal = gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w;
binormal = rawBinormal * inversesqrt(max(dot(rawBinormal, rawBinormal), 1e-8));
vec3 rawTangent = gl_NormalMatrix * at_tangent.xyz;
tangent = rawTangent * inversesqrt(max(dot(rawTangent, rawTangent), 1e-8));
#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
@@ -0,0 +1,192 @@
/////////////////////////////////////
// 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
#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 EUPHORIA_PATCHES_VERSION >= 10903 || ANGELICA_VERSION >= 20134000
bool applyDragonEffect = entityId == 50208;
#else
bool applyDragonEffect = true;
#endif
if (applyDragonEffect) {
if (dither < 0.8) discard;
color.rgb *= 15.0;
#if DRAGON_DEATH_EFFECT_INTERNAL == 1
discard;
#endif
}
#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 EUPHORIA_PATCHES_VERSION >= 10903 || ANGELICA_VERSION >= 20134000
bool isDragonDeathBeams = entityId == 50208;
#else
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
position.xyz += cameraPosition;
bool isDragonDeathBeams =
(entityId == 0 || entityId == 50204) && (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
&& all(lessThan(abs(position.xz), vec2(20))) && position.y > 65; // Isolate it so it's only near the end center
#endif
if (isDragonDeathBeams) {
SetEndDragonDeath();
#if DRAGON_DEATH_EFFECT_INTERNAL == 1
gl_Position = vec4(0.0);
#endif
}
#endif
}
#endif
@@ -0,0 +1,293 @@
//////////////////////////////////////////
// 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 CUSTOM_SKY_MOD_SUPPORT
#ifdef CUSTOM_SKY_MOD_SUPPORT
#endif
#define HIDE_VANILLA_STARS
#ifdef HIDE_VANILLA_STARS
#endif
#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;
const int doSimpleTonemap = 15;
//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 defined HIDE_VANILLA_STARS && !defined EUPHORIA_PATCHES_IS_ASTROCRAFT_INSTALLED
if (vanillaStars > 0.5) {
discard;
}
#endif
#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);
bool isCustomSky;
color.rgb = GetSky(VdotU, VdotS, dither, true, false, isCustomSky, false);
#if defined CUSTOM_SKY_MOD_SUPPORT && MC_VERSION >= 11605
float mixAlphaFactor = alphaColor;
#ifdef EUPHORIA_PATCHES_IS_CAELUM_INSTALLED
mixAlphaFactor = 1.0;
#endif
if (alphaColor < 1.0 && alphaColor > 0.0 && renderStage != MC_RENDER_STAGE_SKY) color.rgb = mix(color.rgb, glColor.rgb * alphaColor, mixAlphaFactor);
#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 = GetStarCoordUpperHemisphere(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
#if MC_VERSION >= 11605 && (defined IS_ANGELICA || defined IS_IRIS)
vanillaStars = float(renderStage == MC_RENDER_STAGE_STARS);
#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
}
#endif
@@ -0,0 +1,308 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/tonemaps.glsl"
#define SUN_MOON_IPBR 3 //[0 1 2 3]
#ifdef SUN_MOON_IPBR
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
#ifdef SAVE_SKYBOX_DATA
in vec4 averageSkyColorM;
#endif
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;
const int doSimpleTonemap = 15;
//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() {
float materialMask = 0.0;
int hasCustomSky = 0;
vec4 skyColor = vec4(0.0);
vec4 averageSkyColor = vec4(0.0);
#ifdef OVERWORLD
vec2 tSize = textureSize(tex, 0);
vec4 color = texture2D(tex, texCoord);
color.rgb *= max0(glColor.rgb);
#ifdef SAVE_SKYBOX_DATA
if (renderStage == MC_RENDER_STAGE_SUNSET || renderStage == MC_RENDER_STAGE_CUSTOM_SKY || renderStage == MC_RENDER_STAGE_SKY) {
skyColor = color * glColor.a;
hasCustomSky = int(step(0.5, textureSize(tex, 0).x));
materialMask = OSIEBCA * 238.0 * hasCustomSky;
averageSkyColor = averageSkyColorM;
}
#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 VdotS = dot(nViewPos, sunVec);
float VdotU = dot(nViewPos, upVec);
float sunMaskRadius = 0.95;
#if SUN_MOON_STYLE == 2
sunMaskRadius = 0.92;
#endif
#ifdef IS_IRIS
bool sunSideCheck = VdotS > sunMaskRadius;
bool isSun = renderStage == MC_RENDER_STAGE_SUN;
bool isMoon = renderStage == MC_RENDER_STAGE_MOON;
#if defined EUPHORIA_PATCHES_MOD_INSTALLED && defined CURRENT_EUPHORIA_PATCHES_DIMENSION_AETHER_THE_AETHER
isSun = renderStage == MC_RENDER_STAGE_CUSTOM_SKY;
isMoon = renderStage == MC_RENDER_STAGE_CUSTOM_SKY;
#endif
bool aroundSunMoon = isSun || isMoon;
#if IRIS_VERSION < 10814
if (sunSideCheck) isSun = true; // Workaround for sun rendering as MC_RENDER_STAGE_MOON in some Iris versions
isMoon = VdotS < -sunMaskRadius; // Workaround for moon rendering as MC_RENDER_STAGE_SUN in some Iris versions
aroundSunMoon = abs(VdotS) > sunMaskRadius;
#ifdef EUPHORIA_PATCHES_IS_SPACE_MOD_INSTALLED
isSun = false;
isMoon = false;
aroundSunMoon = false;
#endif
#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;
bool aroundSunMoon = isSun || isMoon;
#endif
if (isSun || isMoon) {
#if SUN_MOON_STYLE >= 2 && IRIS_VERSION >= 10814
discard;
#endif
#if defined SAVE_SKYBOX_DATA && defined EUPHORIA_PATCHES_IS_SKYBOX_MOD_INSTALLED && IRIS_VERSION < 10814 && SUN_MOON_STYLE >= 2
if (hasCustomSky < 1) discard;
#endif
#ifndef EUPHORIA_PATCHES_IS_SKYBOX_MOD_INSTALLED
#if SUN_MOON_STYLE >= 2 && IRIS_VERSION < 10814
discard;
#endif
#if SUN_MOON_IPBR == 1 || SUN_MOON_IPBR == 3
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;
}
#endif
#if SUN_MOON_IPBR == 2 || SUN_MOON_IPBR == 3
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);
}
#endif
color.rgb *= GetHorizonFactor(VdotU);
#ifdef CAVE_FOG
color.rgb *= 1.0 - 0.75 * GetCaveFactor();
#endif
#endif
} else { // Custom Sky
#if MC_VERSION >= 11300 || defined IS_ANGELICA
#if CUSTOM_SKY_SUPPORT_SLIDER > 0
color.rgb *= mix(vec3(1.0), color.rgb * smoothstep1(sqrt1(max0(VdotU))), float(aroundSunMoon)); // 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
#ifndef EUPHORIA_PATCHES_IS_SKYBOX_MOD_INSTALLED
float rainFactorM = rainFactorDynamic;
#ifdef SUN_MOON_DURING_RAIN
rainFactorM *= 0.8;
#endif
color.a *= 1.0 - rainFactorM;
#endif
#if CUSTOM_SKY_SUPPORT_SLIDER > 0
// 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);
#ifdef EUPHORIA_PATCHES_IS_SKYBOX_MOD_INSTALLED
vanillaSunMoonMask = 0; // No mask with skybox mod as it breaks visuals
#endif
color.rgb *= max0(clamp01(glColor.a) + vanillaSunMoonMask * rainStrength); // Support fop skybox altering mods
float customSkySupportSlider = CUSTOM_SKY_SUPPORT_SLIDER * 0.1;
#ifdef EUPHORIA_PATCHES_IS_STELLAR_VIEW_INSTALLED
customSkySupportSlider = 0.0; // Breaks stellar view visuals, so we disable it when stellar view is installed
#endif
color.a *= max(mix(0.0, mix(1.0, clamp01(glColor.a), customSkySupportSlider), step(0.02, 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
#ifdef SAVE_SKYBOX_DATA
/* RENDERTARGETS:0,6,13,14 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, 0.0);
gl_FragData[2] = skyColor;
gl_FragData[3] = averageSkyColor;
#else
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
#ifdef SAVE_SKYBOX_DATA
out vec4 averageSkyColorM;
#endif
flat out vec4 glColor;
#ifdef OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
#ifdef SAVE_SKYBOX_DATA
vec4 getAverageColor(sampler2D tex) {
vec4 acc = vec4(0.0);
float grid = 4.0;
float invGrid = 1.0 / grid;
for (float x = 0.0; x < grid; x++) {
for (float y = 0.0; y < grid; y++) {
vec2 sampleUV = (vec2(x, y) + 0.5) * invGrid;
acc += textureLod(tex, sampleUV, 0.0);
}
}
return acc * (invGrid * invGrid);
}
#endif
//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 SAVE_SKYBOX_DATA
averageSkyColorM = getAverageColor(tex) * glColor;
#endif
#ifdef OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif
@@ -0,0 +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.0);
#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
@@ -0,0 +1,805 @@
//////////////////////////////////////////
// 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/materials.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/interactiveFoliage.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#include "/lib/shaderSettings/wavingBlocks.glsl"
//#define NIGHT_DESATURATION
//#define INTENSE_DEEP_DARK
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
#ifdef GBUFFERS_VOXELS
#include "/photonics/photonics.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
flat in int blockLightEmission;
in vec2 texCoord;
#ifdef GBUFFERS_COLORWHEEL
vec2 lmCoord;
#else
in vec2 lmCoord;
#endif
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
flat in vec2 midCoord;
in vec3 blockUV;
in vec3 atMidBlock;
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat in ivec2 pixelTexSize;
// #endif
in vec3 normal;
in vec3 vertexPos;
#ifdef GBUFFERS_VOXELS
in vec3 blockNormal;
#endif
in vec4 glColorRaw;
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
#if ANISOTROPIC_FILTER > 0
in vec4 spriteBounds;
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
flat in float chunkFade;
#endif
//Pipeline Constants//
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
const float voxelDistance = 64.0;
#elif COLORED_LIGHTING_INTERNAL > 0
#if WORLD_SPACE_REFLECTIONS_INTERNAL == -1
const float voxelDistance = 32.0;
#else
const float voxelDistance = 64.0;
#endif
#endif
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
vec3 sunVec = GetSunVector();
float NdotU = dot(normal, upVec);
float geoNdotU = NdotU;
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;
vec4 glColor = glColorRaw;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if RAIN_PUDDLES >= 1 || 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//
void DoFoliageColorTweaks(inout vec3 color, inout vec3 shadowMult, inout float snowMinNdotU, vec3 viewPos, vec3 nViewPos, float lViewPos, float dither) {
float factor = max(80.0 - lViewPos, 0.0);
shadowMult *= 1.0 + 0.004 * noonFactor * factor;
#if defined IPBR && !defined IPBR_COMPAT_MODE
color.rgb *= 0.97 - 0.2 * signMidCoordPos.x;
#endif
//#define FOLIAGE_ALT_SUBSURFACE
#ifdef FOLIAGE_ALT_SUBSURFACE
float edgeSize = 0.12;
float edgeEffectFactor = 0.75;
vec2 texCoordM = texCoord;
texCoordM.y -= edgeSize * dither * absMidCoordPos.y;
texCoordM.y = max(texCoordM.y, midCoord.y - absMidCoordPos.y);
vec4 colorSample = texture2DLod(tex, texCoordM, 0);
if (colorSample.a < 0.5) {
float edgeFactor = dot(nViewPos, lightVec);
shadowMult *= 1.0 + edgeEffectFactor * (1.0 + edgeFactor);
}
shadowMult *= 1.03 + 0.2333 * edgeEffectFactor * (dot(normal, lightVec) - 1.0);
#endif
#ifdef SNOWY_WORLD
if (glColor.g - glColor.b > 0.01)
snowMinNdotU = min(pow2(pow2(max0(color.g * 2.0 - color.r - color.b))) * 5.0, 0.1);
else
snowMinNdotU = min(pow2(pow2(max0(color.g * 2.0 - color.r - color.b))) * 3.0, 0.1) * 0.25;
#ifdef DISTANT_HORIZONS
// DH chunks don't have foliage. The border looks too noticeable without this tweak
snowMinNdotU = mix(snowMinNdotU, 0.09, smoothstep(far * 0.5, far, lViewPos));
#endif
#endif
}
void DoBrightBlockTweaks(vec3 color, float minLight, inout vec3 shadowMult, inout float highlightMult) {
float factor = mix(minLight * 0.5 + 0.5, 1.0, pow2(pow2(color.r)));
shadowMult = vec3(factor);
highlightMult /= factor;
}
void DoOceanBlockTweaks(inout float smoothnessD) {
smoothnessD *= max0(lmCoord.y - 0.95) * 20.0;
}
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/util/dither.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || ANISOTROPIC_FILTER > 0 || defined DISTANT_LIGHT_BOKEH
#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
#if ANISOTROPIC_FILTER > 0
#include "/lib/materials/materialMethods/anisotropicFiltering.glsl"
#endif
#ifdef PUDDLE_VOXELIZATION
#include "/lib/voxelization/puddleVoxelization.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#ifdef SNOWY_WORLD
#include "/lib/materials/materialMethods/snowyWorld.glsl"
#endif
#ifdef DISTANT_LIGHT_BOKEH
#include "/lib/misc/distantLightBokeh.glsl"
#endif
#if RAIN_PUDDLES >= 1 && BLOCK_REFLECT_QUALITY == 1 && defined OVERWORLD
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#include "/lib/atmospherics/sky.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#if defined 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
#if PIXEL_WATER > 0
#include "/lib/materials/materialMethods/waterProcedureTexture.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
//Program//
void main() {
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
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 nViewPos = normalize(viewPos);
vec3 playerPos = vertexPos;
vec3 worldPos = playerPos + cameraPosition;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0), normal_PH = normal;
#ifdef GBUFFERS_VOXELS
#undef GENERATED_NORMALS
#undef COATED_TEXTURES
// Photonics raytracing
RayJob ray = RayJob(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), false);
ray.origin = worldPos - world_offset - 0.001f * blockNormal;
ray.direction = playerPos - gbufferModelViewInverse[3].xyz;
ray_constraint = ivec3(ray.origin);
trace_ray(ray);
if (!ray.result_hit) discard;
if (ray.result_normal == vec3(0.0f)) ray.result_normal = blockNormal;
playerPos = ray.result_position + world_offset - cameraPosition;
viewPos = (gbufferModelView * vec4(playerPos, 1.0f)).xyz;
vec4 ndc4 = gbufferProjection * vec4(viewPos, 1.0f);
screenPos = ndc4.xyz / ndc4.w * 0.5f + 0.5f;
gl_FragDepth = screenPos.z;
lViewPos = length(viewPos);
nViewPos = normalize(viewPos);
normal_PH = normalize(gl_NormalMatrix * ray.result_normal);
normalM = normal_PH;
vec4 color = vec4(ray.result_color, 1.0f);
#else
#if SHOCKWAVE > 0
vec4 color = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
#if ANISOTROPIC_FILTER == 0
vec4 color = texture2D(tex, texCoord);
#else
vec4 color = textureAF(tex, texCoord);
#endif
#endif
#endif
float smoothnessD = 0.0, materialMask = 0.0;
#if !defined POM || !defined POM_ALLOW_CUTOUT
if (color.a <= 0.00001) discard; // 6WIR4HT23
#endif
vec3 colorP = color.rgb;
#ifdef GBUFFERS_COLORWHEEL
float ao;
vec4 overlayColor;
clrwl_computeFragment(color, color, lmCoord, ao, overlayColor);
color.rgb = mix(color.rgb, overlayColor.rgb, overlayColor.a);
lmCoord = clamp((lmCoord - 1.0 / 32.0) * 32.0 / 30.0, 0.0, 1.0);
#else
color.rgb *= glColor.rgb;
#endif
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
int subsurfaceMode = 0;
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false, noGeneratedNormals = false, doTileRandomisation = true;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0, snowFactor = 1.0, snowMinNdotU = 0.0, noPuddles = 0.0, materialAO = 1.0;
vec2 lmCoordM = lmCoord;
#ifdef PHOTONICS_LIGHTING
vec3 oldAlbedo = vec3(0.0);
#endif
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
bool isFoliage = false;
float overlayNoiseIntensity = 1.0, snowNoiseIntensity = 1.0, sandNoiseIntensity = 1.0, mossNoiseIntensity = 1.0, overlayNoiseTransparentOverwrite = 0.0, overlayNoiseEmission = 1.0, IPBRMult = 1.0, lavaNoiseIntensity = LAVA_NOISE_INTENSITY, enderDragonDead = 1.0, purkinjeOverwrite = 0.0;
vec3 dhColor = vec3(1.0);
bool isLightSource = false;
if (lmCoord.x > 0.99 || blockLightEmission > 0) { // Mod support for light level 15 (and all light levels with iris 1.7) light sources
if (mat == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, lmCoord.x, blockLightEmission, 0.0);
}
isLightSource = true;
overlayNoiseIntensity = 0.0;
}
#ifndef GBUFFERS_COLORWHEEL
if (length(abs(worldGeoNormal.xz) - vec2(sqrt(0.5))) < 0.01) { // Auto SSS on unknown cross model blocks (modded)
if (mat == 0) {
subsurfaceMode = 1;
noSmoothLighting = true, noDirectionalShading = true;
}
isFoliage = true;
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
}
#endif
#include "/lib/materials/materialHandling/terrainMaterials.glsl"
#ifdef SNOWY_WORLD
DoSnowyWorld(color, smoothnessG, highlightMult, smoothnessD, emission,
playerPos, lmCoord, snowFactor, snowMinNdotU, NdotU, subsurfaceMode);
#endif
#if defined NETHER && defined BIOME_COLORED_NETHER_PORTALS && !defined IPBR
if (mat == 10476 || mat == 10588 || mat == 10592) { // Crying Obsidian, Respawn Anchor lit and unlit
float luminance = GetLuminance(color.rgb);
emission = sqrt(luminance * luminance) * 10.0;
color.a *= luminance;
}
#endif
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoiseApply.glsl"
#endif
#if defined COATED_TEXTURES && defined IPBR
CoatTextures(color.rgb, noiseFactor, playerPos, doTileRandomisation); // Has to be after seasons and overlay noise to work properly with them in IPBR mode
#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
#if RAIN_PUDDLES >= 1 && defined OVERWORLD
float puddleLightFactor = max0(lmCoord.y * 32.0 - 31.0) * clamp((1.0 - 1.15 * lmCoord.x) * 10.0, 0.0, 1.0);
float puddleNormalFactor = pow2(max0(NdotUmax0 - 0.5) * 2.0);
float puddleMixer = puddleLightFactor * inRainy * puddleNormalFactor;
#if RAIN_PUDDLES < 3
float wetnessM = wetnessDynamic;
#else
float wetnessM = 1.0;
#endif
#ifdef PUDDLE_VOXELIZATION
vec3 voxelPos = SceneToPuddleVoxel(playerPos);
vec3 voxel_sample_pos = clamp01(voxelPos / vec3(puddle_voxelVolumeSize));
if (CheckInsidePuddleVoxelVolume(voxelPos)) {
noPuddles += texture2D(puddle_sampler, voxel_sample_pos.xz).r;
}
#endif
if (pow2(pow2(wetnessM)) * puddleMixer - noPuddles > 0.00001) {
vec2 worldPosXZ = playerPos.xz + cameraPosition.xz;
vec2 puddleWind = vec2(frameTimeCounter) * 0.03;
#if WATER_STYLE == 1
vec2 puddlePosNormal = floor(worldPosXZ * 16.0) * 0.0625;
#else
vec2 puddlePosNormal = worldPosXZ;
#endif
puddlePosNormal *= 0.1;
vec2 pNormalCoord1 = puddlePosNormal + vec2(puddleWind.x, puddleWind.y);
vec2 pNormalCoord2 = puddlePosNormal + vec2(puddleWind.x * -1.5, puddleWind.y * -1.0);
vec3 pNormalNoise1 = texture2DLod(noisetex, pNormalCoord1, 0.0).rgb;
vec3 pNormalNoise2 = texture2DLod(noisetex, pNormalCoord2, 0.0).rgb;
float pNormalMult = 0.03;
vec3 puddleNormal = vec3((pNormalNoise1.xy + pNormalNoise2.xy - vec2(1.0)) * pNormalMult, 1.0);
puddleNormal = clamp(normalize(puddleNormal * tbnMatrix), vec3(-1.0), vec3(1.0));
puddleNormal = normalize(mix(geoNormal, puddleNormal, rainFactor));
#if RAIN_PUDDLES == 1 || RAIN_PUDDLES == 3
vec2 puddlePosForm = puddlePosNormal * 0.05;
float pFormNoise = texture2DLod(noisetex, puddlePosForm, 0.0).b * 3.0;
pFormNoise += texture2DLod(noisetex, puddlePosForm * 0.5, 0.0).b * 5.0;
pFormNoise += texture2DLod(noisetex, puddlePosForm * 0.25, 0.0).b * 8.0;
pFormNoise *= sqrt1(wetnessM) * 0.5625 + 0.4375;
pFormNoise = clamp(pFormNoise - 7.0, 0.0, 1.0);
#else
float pFormNoise = wetnessM;
#endif
puddleMixer *= pFormNoise;
float puddleSmoothnessG = 0.7 - rainFactor * 0.3;
float puddleHighlight = (1.5 - subsurfaceMode * 0.6 * invNoonFactor);
smoothnessG = mix(smoothnessG, puddleSmoothnessG, puddleMixer);
highlightMult = mix(highlightMult, puddleHighlight, puddleMixer);
smoothnessD = mix(smoothnessD, 1.0, sqrt1(puddleMixer));
normalM = normalize(mix(normalM, puddleNormal, sqrt1(puddleMixer) * 0.98));
} else puddleMixer = 0.0;
#endif
#if SHOW_LIGHT_LEVEL > 0
#include "/lib/misc/showLightLevels.glsl"
#endif
#ifdef DH_BLENDING
float fog = max(length(playerPos.xz), abs(playerPos.y)) / far;
fog = pow2(pow2(pow2(pow2(fog))));
fog = exp(-3.0 * fog);
float newDither = fract(dither * 50.0); // Using normal dither here doesnt work well with TAA
if (newDither > fog) discard;
fog *= fog;
emission *= fog;
#endif
#ifdef SS_BLOCKLIGHT
float lmCoordXModified = lmCoord.x;
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
lmCoordXModified = lmCoord.x == 1.0 && blockLightEmission < 0.5 ? 0.0 : lmCoord.x;
#endif
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoordXModified);
#endif
emission *= EMISSION_MULTIPLIER;
#ifdef PHOTONICS_LIGHTING
oldAlbedo = color.rgb;
#endif
vec3 rawAlbedoM = color.rgb;
// Tints the direct-light specular highlight for named labPBR metals with their F0 color
#ifdef BETTER_LABPBR_REFLECTIONS_INTERNAL
int materialMaskIntM = int(materialMask * 255.1);
vec3 metalHighlightTintM = (RP_MODE == 3 && materialMaskIntM >= 215 && materialMaskIntM <= 222) ? GetLabPBRMetalF0(materialMaskIntM, rawAlbedoM) : vec3(1.0);
#else
vec3 metalHighlightTintM = vec3(1.0);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, metalHighlightTintM);
#ifdef BETTER_LABPBR_AO_INTERNAL
float lightExposureM = max(GetLuminance(shadowMult), lmCoordM.x);
color.rgb *= mix(materialAO, 1.0, lightExposureM);
#endif
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#if defined END && END_ROD_COLOR_PROFILE == 0
if (mat == 10500) lightAlbedo = vec3(1.0, 0.6078, 0.9); // End Rod
#endif
#ifdef COLORED_CANDLE_LIGHT
if (mat >= 10900 && mat <= 10922) { // Candles:Lit
lightAlbedo = normalize(color.rgb) * lmCoord.x;
}
#endif
#endif
#ifdef IPBR
color.rgb += maRecolor;
#endif
#if RAIN_PUDDLES >= 1 && BLOCK_REFLECT_QUALITY == 1 && defined OVERWORLD
// Adding low quality sky reflection to puddles if Block Reflection Quality is Low
if (puddleMixer > 0.00001) {
vec3 nViewPosR = normalize(reflect(nViewPos, normalM));
float RVdotU = dot(nViewPosR, upVec);
float RVdotS = dot(nViewPosR, sunVec);
vec3 sky = GetLowQualitySky(RVdotU, RVdotS, dither, true, false);
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sky *= atmColorMult;
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
sky *= moonPhaseInfluence;
#endif
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
sky *= 0.5 + 0.5 * GetLuminance(shadowMult);
fresnel *= 0.5;
color.rgb = mix(color.rgb, sky, fresnel * puddleMixer);
}
#endif
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, mat);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
if (chunkFade < 1.0) skyLightFactor = 1.0 - chunkFade * 0.5;
#endif
#ifdef PHOTONICS_LIGHTING
vec4 phAlbedoOut = vec4(oldAlbedo, 1.0);
vec3 playerPosDelta = vec3(0.0);
#ifdef DO_PIXELATION_EFFECTS
// Compute snap delta here where dFdx/dFdy are valid (same triangle in 2x2 quad)
// Store world-space delta so post-passes can apply it without any derivatives
vec2 pixelationOffset = ComputeTexelOffset(tex, texCoord);
playerPosDelta = TexelSnap(playerPos, pixelationOffset) - playerPos;
#endif
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE != 0
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, 0.0);
#endif
#ifdef PHOTONICS_LIGHTING
/* RENDERTARGETS:0,6,4,10,11,20 */
gl_FragData[3] = phAlbedoOut;
gl_FragData[4] = vec4(playerPosDelta, 1.0);
gl_FragData[5] = vec4(normalize((gbufferModelViewInverse * vec4(normal_PH, 0.0f)).xyz), 1.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 0.0);
#elif defined PHOTONICS_LIGHTING
/* RENDERTARGETS:0,6,4,10,11,20 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, clamp(maxOf(rawAlbedoM), 0.02, 0.99) * 2.0 - 1.0);
gl_FragData[3] = phAlbedoOut;
gl_FragData[4] = vec4(playerPosDelta, 1.0);
gl_FragData[5] = vec4(normalize((gbufferModelViewInverse * vec4(normal_PH, 0.0f)).xyz), 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
flat out int blockLightEmission;
out vec2 texCoord;
#ifdef GBUFFERS_COLORWHEEL
vec2 lmCoord;
#else
out vec2 lmCoord;
#endif
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
flat out vec2 midCoord;
out vec3 blockUV;
out vec3 atMidBlock;
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat out ivec2 pixelTexSize;
// #endif
out vec3 normal;
out vec3 vertexPos;
#ifdef GBUFFERS_VOXELS
out vec3 blockNormal;
#endif
out vec4 glColorRaw;
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
#if ANISOTROPIC_FILTER > 0
out vec4 spriteBounds;
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
flat out float chunkFade;
#endif
//Attributes//
attribute vec4 mc_Entity;
attribute vec4 mc_midTexCoord;
attribute vec4 at_midBlock;
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
//Common Variables//
vec4 glColor = vec4(1.0);
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined WAVING_ANYTHING_TERRAIN || defined INTERACTIVE_FOLIAGE || defined WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
float infnorm(vec3 x) {return max(max(abs(x.x), abs(x.y)), abs(x.z));} // Thanks to gri for general non axis aligned normal detection
float isCross(vec3 x) {return length(abs(normalize(x).xz) - vec2(sqrt(0.5)));}
//Program//
void main() {
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.1, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
blockUV = 0.5 - at_midBlock.xyz / 64.0;
atMidBlock = at_midBlock.xyz;
glColorRaw = gl_Color;
if (glColorRaw.a < 0.1) glColorRaw.a = 1.0;
glColor = glColorRaw;
normal = normalize(gl_NormalMatrix * gl_Normal);
#ifdef GBUFFERS_VOXELS
blockNormal = gl_Normal;
#endif
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// pixelTexSize = ivec2(absMidCoordPos * 2.0 * atlasSize);
// #endif
mat = int(mc_Entity.x + 0.5);
#if !(defined GBUFFERS_COLORWHEEL || defined GBUFFERS_VOXELS)
if ((mat == 10132 || mat == 10133)){ // Improve Patrix Resource pack extra grass block model
if (isCross(gl_Normal) < 0.5) mat = 10005; // First detect cross models
else if (infnorm(gl_Normal) < 0.99) mat = 10031; // Then detect extruding faces, but ONLY if it's not already detected as cross
}
#endif
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
vertexPos = position.xyz;
#ifdef GBUFFERS_VOXELS
mat = 2;
// mat = get_block_id(floor(rt_camera_position + vertexPos));
#endif
blockLightEmission = 0;
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
blockLightEmission = clamp(int(at_midBlock.w + 0.5), 0, 15);
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVING_ANYTHING_TERRAIN || defined WAVE_EVERYTHING || defined INTERACTIVE_FOLIAGE
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVING_ANYTHING_TERRAIN
DoWave(position.xyz, mat);
#endif
#ifdef INTERACTIVE_FOLIAGE
if (mat == 10003 || mat == 10005 || mat == 10015 || mat == 10021 || mat == 10029 || mat == 10023 || mat == 10629 || mat == 10632 || mat == 10025 || mat == 10027 || mat == 10923 || mat == 10972) {
vec3 playerPosM = position.xyz + relativeEyePosition;
DoInteractiveWave(playerPosM, mat);
position.xyz = playerPosM - relativeEyePosition;
}
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#ifdef FLICKERING_FIX
if (mat == 10257) gl_Position.z -= 0.00001; // Iron Bars
#endif
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
vec3 rawBinormal = gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w;
binormal = rawBinormal * inversesqrt(max(dot(rawBinormal, rawBinormal), 1e-8));
vec3 rawTangent = gl_NormalMatrix * at_tangent.xyz;
tangent = rawTangent * inversesqrt(max(dot(rawTangent, rawTangent), 1e-8));
#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 ANISOTROPIC_FILTER > 0
vec3 upVec = normalize(gbufferModelView[1].xyz);
if (mc_Entity.y > 0.5 && dot(normal, upVec) < 0.999) absMidCoordPos = vec2(0.0); // Fix257062
vec2 spriteRadius = abs(texCoord - mc_midTexCoord.xy);
vec2 bottomLeft = mc_midTexCoord.xy - spriteRadius;
vec2 topRight = mc_midTexCoord.xy + spriteRadius;
spriteBounds = vec4(bottomLeft, topRight);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
chunkFade = mc_chunkFade;
#endif
}
#endif
@@ -0,0 +1,387 @@
//////////////////////////////////////////
// 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;
if (color.a < 0.01) discard;
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));
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
} 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, vec3(1.0));
#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);
#if WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:0634 */
gl_FragData[3] = vec4(0.0, 1.0, 0.0, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:06349 */
gl_FragData[4] = vec4(0.0, 0.0, 0.0, SSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:0639 */
gl_FragData[3] = 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
@@ -0,0 +1,595 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT // Can't be filled with white spaces because of Physics Mod detection
// 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/water.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#define WAVING_WATER_VERTEX
#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;
flat in int blockLightEmission;
in vec2 texCoord;
#ifdef GBUFFERS_COLORWHEEL_TRANSLUCENT
vec2 lmCoord;
#else
in vec2 lmCoord;
#endif
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
in vec3 playerPos;
in vec3 normal;
in vec3 viewVector;
in vec3 atMidBlock;
in vec3 blockUV;
in vec4 glColor;
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && !defined LOW_QUALITY_WATER_MATERIAL || defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec4 vTexCoordAM;
#endif
#if ANISOTROPIC_FILTER > 0 && defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
flat in vec2 midCoord;
in vec4 spriteBounds;
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
flat in float chunkFade;
#endif
//Pipeline Constants//
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
vec3 sunVec = GetSunVector();
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 WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && !defined LOW_QUALITY_WATER_MATERIAL || 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//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#include "/lib/materials/materialMethods/translucentTweaks.glsl"
float vlFactor = 0.0;
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#endif
#if !defined ATMOSPHERIC_FOG && !defined BORDER_FOG
#include "/lib/colors/skyColors.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0 && defined SKY_EFFECT_REFLECTION_TRANSLUCENT && defined OVERWORLD && AURORA_STYLE > 0
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0
#if defined SKY_EFFECT_REFLECTION_TRANSLUCENT && 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 TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || WATER_STYLE >= 2 || ANISOTROPIC_FILTER > 0 && defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.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 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 PORTAL_EDGE_EFFECT
#include "/lib/voxelization/lightVoxelization.glsl"
#endif
#ifdef CONNECTED_GLASS_EFFECT
#include "/lib/materials/materialMethods/connectedGlass.glsl"
#endif
#if ANISOTROPIC_FILTER > 0 && defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
#include "/lib/materials/materialMethods/anisotropicFiltering.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#if SEASONS > 0 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoise.glsl"
#endif
#if PIXEL_WATER > 0
#include "/lib/materials/materialMethods/waterProcedureTexture.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
#include "/lib/atmospherics/fog/endCenterFog.glsl"
//Program//
void main() {
#if SHOCKWAVE > 0
vec4 colorP = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
#if ANISOTROPIC_FILTER == 0 || !defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
vec4 colorP = texture2D(tex, texCoord);
#else
vec4 colorP = textureAF(tex, texCoord);
#endif
#endif
#ifdef GBUFFERS_COLORWHEEL_TRANSLUCENT
float ao;
vec4 overlayColor;
clrwl_computeFragment(colorP, colorP, lmCoord, ao, overlayColor);
vec4 color = mix(colorP, overlayColor, overlayColor.a);
lmCoord = clamp((lmCoord - 1.0 / 32.0) * 32.0 / 30.0, 0.0, 1.0);
#else
vec4 color = colorP * vec4(glColor.rgb, 1.0);
#endif
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);
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef LIGHT_COLOR_MULTS
lightColorMult = GetLightColorMult();
#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
float materialMask = 0.0;
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float VdotN = dot(nViewPos, normal);
vec3 worldPos = playerPos + cameraPosition;
// Materials
vec4 translucentMult = vec4(1.0);
bool noSmoothLighting = false, noDirectionalShading = false, translucentMultCalculated = false, noGeneratedNormals = false;
int subsurfaceMode = 0;
vec2 lmCoordM = lmCoord;
float smoothnessG = 0.0, highlightMult = 1.0, reflectMult = 0.0, emission = 0.0, materialAO = 1.0;
vec3 normalM = VdotN > 0.0 ? -normal : normal; // Inverted Iris Water Normal Workaround
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
vec3 shadowMult = vec3(1.0);
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
float fresnelM = pow3(fresnel);
float overlayNoiseIntensity = 1.0, snowNoiseIntensity = 1.0, sandNoiseIntensity = 1.0, mossNoiseIntensity = 1.0, overlayNoiseTransparentOverwrite = 0.0, overlayNoiseAlpha = 1.0, overlayNoiseFresnelMult = 1.0, IPBRMult = 1.0, purkinjeOverwrite = 0.0, enderDragonDead = 1.0, SSBLAlpha = 1.0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#include "/lib/materials/materialHandling/translucentMaterials.glsl"
#if defined WATER_REFRACTION && SELECT_OUTLINE == 4
int materialMaskInt = int(texelFetch(colortex6, texelCoord, 0).g * 255.1);
if (materialMaskInt == 252) {
materialMask = OSIEBCA * 252.0; // Versatile Selection Outline
}
#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
#ifdef REFLECTIVE_WORLD
smoothnessG = 1.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
// Blending
if (!translucentMultCalculated)
translucentMult = vec4(mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a), 1.0);
translucentMult.rgb = mix(translucentMult.rgb, vec3(1.0), min1(pow2(pow2(lViewPos / far))));
#ifdef SS_BLOCKLIGHT
float lmCoordXModified = lmCoord.x;
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
lmCoordXModified = lmCoord.x == 1.0 && blockLightEmission < 0.5 ? 0.0 : lmCoord.x;
#endif
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoordXModified);
#endif
bool isLightSource = false;
if (lmCoord.x > 0.99 || blockLightEmission > 0) { // Mod support for light level 15 (and all light levels with iris 1.7) light sources
if (mat == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, lmCoord.x, blockLightEmission, 0.0);
}
isLightSource = true;
overlayNoiseIntensity = 0.0;
}
emission *= EMISSION_MULTIPLIER;
// Lighting
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, false,
false, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, vec3(1.0));
#ifdef BETTER_LABPBR_AO_INTERNAL
float lightExposureM = max(GetLuminance(shadowMult), lmCoordM.x);
color.rgb *= mix(materialAO, 1.0, lightExposureM);
#endif
#ifdef SS_BLOCKLIGHT
vec3 normalizedColor = normalize(color.rgb);
vec3 maskedLightAlbedo =
(mat == 30012 || mat == 30016 || (mat >= 31000 && mat < 32000) || mat == 32004) // Slime, Honey, Glass, Ice
? normalizedColor : vec3(0.0);
vec3 lightAlbedo = mix(maskedLightAlbedo, normalizedColor * min1(emission), color.a);
#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
fresnelM = (fresnelM * 0.85 + 0.15) * reflectMult;
vec2 texelOffset = vec2(0.0);
#ifdef PIXELATED_WATER_REFLECTIONS
texelOffset = ComputeTexelOffset(tex, texCoord);
#endif
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, -1.0,
depthtex1, dither, skyLightFactor, fresnel,
smoothnessG, geoNormal, color.rgb, shadowMult, highlightMult, enderDragonDead, texelOffset);
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
#else
fresnelM = 0.0;
vec4 reflection = vec4(0.0);
#endif
////
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, mat);
#endif
float skyFade = 0.0;
float prevAlpha = color.a;
color.a = 1.0;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither, false, 0.0);
#if defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900
float attentuation = doEndCenterFog(cameraPositionBest, normalize(playerPos), min(renderDistance, lViewPos), 0.5);
vec3 pointLightFog = vec3(END_CENTER_LIGHTING_R, END_CENTER_LIGHTING_G, END_CENTER_LIGHTING_B) * 0.5 * END_CENTER_LIGHTING * 0.1 * attentuation * enderDragonDead;
color.rgb = sqrt(pow2(color.rgb) + vec3(pointLightFog));
#endif
float fogAlpha = color.a;
color.a = prevAlpha * (1.0 - skyFade);
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
#ifdef DH_BLENDING
float fog = max(length(playerPos.xz), abs(playerPos.y)) / far;
fog = pow2(pow2(pow2(pow2(fog))));
fog = exp(-3.0 * fog);
color.a *= fog;
#endif
#ifdef ENTITIES_ARE_LIGHT
SSBLAlpha = 0.0;
#endif
/* DRAWBUFFERS:036 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult.rgb, translucentMult.a);
gl_FragData[2] = vec4(1.0, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
// supposed to be " #if defined WATER_REFRACTION || (WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0) " but Optifine bad
#if DETAIL_QUALITY >= 3 || (WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0) || defined SS_BLOCKLIGHT || defined BETTER_LABPBR_REFRACTIONS_INTERNAL
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0 || defined BETTER_LABPBR_REFRACTIONS_INTERNAL
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:036489 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[4] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
gl_FragData[5] = vec4(lightAlbedo, SSBLAlpha);
#else
/* DRAWBUFFERS:03648 */
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
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0369 */
gl_FragData[3] = vec4(lightAlbedo, SSBLAlpha);
#endif
#endif
#elif WORLD_SPACE_REFLECTIONS_INTERNAL > 0
/* DRAWBUFFERS:06348 */
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
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
flat out int blockLightEmission;
out vec2 texCoord;
#ifdef GBUFFERS_COLORWHEEL_TRANSLUCENT
vec2 lmCoord;
#else
out vec2 lmCoord;
#endif
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
out vec3 playerPos;
out vec3 normal;
out vec3 viewVector;
out vec3 atMidBlock;
out vec3 blockUV;
out vec4 glColor;
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && !defined LOW_QUALITY_WATER_MATERIAL || defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec4 vTexCoordAM;
#endif
#if ANISOTROPIC_FILTER > 0 && defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
flat out vec2 midCoord;
out vec4 spriteBounds;
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
flat out float chunkFade;
#endif
//Attributes//
attribute vec4 mc_Entity;
attribute vec4 at_midBlock;
attribute vec4 mc_midTexCoord;
attribute vec4 at_tangent;
//Common Variables//
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && !defined LOW_QUALITY_WATER_MATERIAL || defined GENERATED_NORMALS || defined CUSTOM_PBR
#else
vec3 binormal;
vec3 tangent;
#endif
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined WAVE_EVERYTHING || defined WAVING_WATER_VERTEX
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
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);
blockLightEmission = 0;
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
blockLightEmission = clamp(int(at_midBlock.w + 0.5), 0, 15);
#endif
normal = normalize(gl_NormalMatrix * gl_Normal);
atMidBlock = at_midBlock.xyz;
blockUV = 0.5 - at_midBlock.xyz / 64.0;
vec3 rawBinormal = gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w;
binormal = rawBinormal * inversesqrt(max(dot(rawBinormal, rawBinormal), 1e-8));
vec3 rawTangent = gl_NormalMatrix * at_tangent.xyz;
tangent = rawTangent * inversesqrt(max(dot(rawTangent, rawTangent), 1e-8));
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;
#if ANISOTROPIC_FILTER == 0 || !defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
#else
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
#endif
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#ifdef POM
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
playerPos = position.xyz;
#ifdef WAVING_WATER_VERTEX
DoWave(position.xyz, mat);
#endif
#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;
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#if ANISOTROPIC_FILTER > 0 && defined ANISOTROPIC_FILTER_ON_TRANSLUCENTS
vec3 upVec = normalize(gbufferModelView[1].xyz);
if (mc_Entity.y > 0.5 && dot(normal, upVec) < 0.999) absMidCoordPos = vec2(0.0); // Fix257062
vec2 spriteRadius = abs(texCoord - mc_midTexCoord.xy);
vec2 bottomLeft = mc_midTexCoord.xy - spriteRadius;
vec2 topRight = mc_midTexCoord.xy + spriteRadius;
spriteBounds = vec4(bottomLeft, topRight);
#endif
#ifdef IRIS_FEATURE_FADE_VARIABLE
chunkFade = mc_chunkFade;
#endif
#if MC_VERSION >= 260100
if (mat == 10049) mat = 32001; // Cauldron Water
#endif
}
#endif
@@ -0,0 +1,215 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/raindropColor.glsl"
#define MCWIND_RAIN
#ifdef MCWIND_RAIN
#endif
#if defined MCWIND_INTERNAL && defined MCWIND_RAIN
#include "/mcwind/mcwind.glsl"
#endif
#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;
#ifdef IMPROVED_RAIN
in float lPos;
#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;
//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);
#ifdef IMPROVED_RAIN
vec4 sampleRain = texture2D(tex, texCoord * vec2(2.0, 1.0));
if (sampleRain.r + sampleRain.g < 1.5 && (sampleRain.a > 0.0 || color.r + color.g < 1.5)) color = sampleRain;
#endif
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;
int glitterFactor = 0;
#if GLITTER_RAIN > 0
int rainbowGlitterOn = 1;
#if GLITTER_RAIN == 1
rainbowGlitterOn = 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;
}
#endif
glitterFactor = int(step(0.7, Noise3D((playerPos + cameraPosition) * 0.004 + frameTimeCounter * 0.02)) * step(0.1, rainFactor) * rainbowGlitterOn);
#endif
#ifndef IMPROVED_RAIN
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
color.rgb += glitterFactor * (vec3(0.752) * 5.0 - color.rgb);
#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.0);
#endif
#else
vec4 data;
// Distance to camera (max 100 blocks)
data.r = lPos / 100.0;
int rainBit = int(color.r + color.g < 1.5);
// Pack bits:
// bit 0 = is rain (1) or snow (0)
// bit 1 = glitter
int packedRain = rainBit | (glitterFactor << 1);
data.g = float(packedRain) / 255.0;
// Blocklight
data.b = lmCoord.x;
// Opacity
data.a = color.a;
/* RENDERTARGETS: 12 */
gl_FragData[0] = data;
#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;
#ifdef IMPROVED_RAIN
out float lPos;
#endif
//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
#if defined MCWIND_INTERNAL && defined MCWIND_RAIN
vec3 mcwWorldPos = position.xyz + cameraPosition.xyz;
float mcwTopWeight = clamp(position.y / 16.0 + 0.5, 0.0, 1.0);
position.xyz += mcw_rainLean(mcwWorldPos, mcwTopWeight) * eyeBrightnessM2; // eyeBrightnessM2 prevents clipping inside interiors
#else
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
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#ifdef IMPROVED_RAIN
lPos = length(position.xyz);
gl_Position.z = 0.0;
#endif
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
@@ -0,0 +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
@@ -0,0 +1,470 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/wavingBlocks.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;
in vec4 position;
flat in vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
#endif
//Pipeline Constants//
#include "/lib/pipelineSettings.glsl"
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 sunVec = GetSunVector();
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//
#include "/lib/util/dither.glsl"
#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 HIDE_ARMOR > 0
if (currentRenderedItemId == 45124 && !isElytraFlying) discard;
#endif
if (entityId > 0) {
#if PLAYER_SHADOW == -1
if (entityId == 50016 || entityId == 50017) { // Player
discard;
}
#endif
// Entity Shadow Fade Out
float fadeEnd = shadowDistance * entityShadowDistanceMul + 2.0;
float fadeStart = fadeEnd * 0.8;
float opacity = 1.0 - smoothstep(fadeStart, fadeEnd, max(length(position.xz), abs(position.y)));
float dither = Bayer64(gl_FragCoord.xy);
if (opacity < dither) discard;
}
#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(syncedTimeDynamic * 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
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
if (entityId == 50200) discard; // remove end crystal healing beam
#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;
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;
writeonly uniform uimage3D wsr_lod_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
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
uniform isampler2D endcrystal_sampler;
#endif
//Program//
void main() {
texCoord = gl_MultiTexCoord0.xy;
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
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); // WS752GH42G
}
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);
}
#endif
gl_Position = shadowProjection * shadowModelView * position;
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#if EUPHORIA_PATCHES_VERSION >= 10903 || ANGELICA_VERSION >= 20134000
#define FUCK entityId == 50208
#define THE || false
#define DRAGON || false
#define DEATH || false
#define BEAMS || false
#else
#if MC_VERSION >= 12100
#define FUCK gl_Color.a == 1.0
#define THE && (entityId == 0 || entityId == 50204)
#else
#define FUCK gl_Color.a < 0.5
#define THE && entityId == 0
#endif
#define DRAGON && renderStage == MC_RENDER_STAGE_ENTITIES
#ifndef IRIS_TAG_SUPPORT
#define DEATH && abs(normal.y) > 0.8 && abs(normal.y) < 1.0
#define BEAMS || false
#else
float dragonDeathFactor = 0.0001 * texelFetch(endcrystal_sampler, ivec2(35, 0), 0).r;
float deathFadeFactor = exp(-3.0 * (1.0 - dragonDeathFactor)) * dragonDeathFactor;
#define DEATH && deathFadeFactor > 1.0
#if MC_VERSION >= 12100
#define BEAMS || renderStage == MC_RENDER_STAGE_NONE && gl_Color.a == 1.0
#else
#define BEAMS || renderStage == MC_RENDER_STAGE_NONE && gl_Color.a < 0.5
#endif
#endif
#endif
// AAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!
if (FUCK THE DRAGON DEATH BEAMS) {
#ifndef IRIS_TAG_SUPPORT
SetEndDragonDeath();
#endif
gl_Position = vec4(0.0);
}
#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
@@ -0,0 +1,66 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
#include "/lib/common.glsl"
#ifdef FRAGMENT_SHADER
in vec3 worldPos;
in vec3 cageNormal;
#include "/photonics/photonics.glsl"
void main() {
RayJob ray = RayJob(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), false);
ray.origin = worldPos - world_offset - 0.01f * cageNormal;
ray.direction = mat3(shadowModelViewInverse) * vec3(0.0f, 0.0f, -1.0f);
ray_constraint = ivec3(ray.origin);
trace_ray(ray);
if (!ray.result_hit) {
discard;
}
{ // Calculate depth position
vec3 feetPlayerPos = (ray.result_position + world_offset) - cameraPosition;
vec3 shadowViewPos = (shadowModelView * vec4(feetPlayerPos, 1.0f)).xyz;
vec4 shadowNdcPos = shadowProjection * vec4(shadowViewPos, 1.0f);
shadowNdcPos.xyz /= shadowNdcPos.w;
shadowNdcPos.z *= 0.2f; // distortion
vec3 shadowScreenPos = shadowNdcPos.xyz * 0.5f + 0.5f;
gl_FragDepth = shadowScreenPos.z;
}
vec4 albedo = vec4(ray.result_color, 1.0f);
gl_FragData[0] = albedo;
}
#endif
#ifdef VERTEX_SHADER
out vec3 worldPos;
out vec3 cageNormal;
void main() {
cageNormal = gl_Normal;
vec4 position = shadowModelViewInverse * shadowProjectionInverse * ftransform();
worldPos = position.xyz + cameraPosition.xyz;
gl_Position = shadowProjection * shadowModelView * position;
float dist = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
float distortFactor = dist * shadowMapBias + (1.0 - shadowMapBias);
gl_Position.xy *= 1.0 / distortFactor;
gl_Position.z = gl_Position.z * 0.2;
}
#endif
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +1,168 @@
{
"unusedString": "
//Common//
#include "/lib/common.glsl"
",
"version": 1,
"excludeLodsFromVanillaDepth": true,
"opaqueDrawBuffers": [
0,
6
#ifdef SS_BLOCKLIGHT
, 9
#endif
],
"translucentDrawBuffers": [
0, 6
#ifdef SS_BLOCKLIGHT
, 9
#endif
],
"blending": {
-1: "off",
0: "SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ONE_MINUS_SRC_ALPHA"
},
"taaOffset": "{
#if defined TAA && TAA_JITTER > 0
// Jitter offset from Chocapic13
vec2 jitterOffsets[8] = vec2[8](
vec2( 0.125,-0.375),
vec2(-0.125, 0.375),
vec2( 0.625, 0.125),
vec2( 0.375,-0.625),
vec2(-0.625, 0.625),
vec2(-0.875,-0.125),
vec2( 0.375,-0.875),
vec2( 0.875, 0.875)
);
vec2 offset = jitterOffsets[int(framemod8)] * (1.0 / vec2(viewWidth, viewHeight));
#if TAA_JITTER == 1
offset *= 0.125;
#elif TAA_JITTER == 2
offset *= 0.33;
#endif
return offset;
#else
return vec2(0.0);
#endif
}",
"uniforms": [
"viewWidth",
"viewHeight",
"framemod8",
"sunAngle",
"far",
"screenBrightness",
"nightVision",
"worldDay",
"worldTime",
"cameraPosition",
"previousCameraPosition",
"cameraPositionInt",
"cameraPositionFract",
"previousCameraPositionFract",
"fogColor",
#if MC_VERSION >= 11600
"inNetherWastes",
"inCrimsonForest",
"inWarpedForest",
"inBasaltDeltas",
"inSoulValley",
#endif
"inSnowy",
"inDry",
"inRainy",
"cloudHeight",
"isEyeInWater",
"skyColor",
"heldBlockLightValue",
"heldBlockLightValue2",
"heldItemId",
"heldItemId2",
"relativeEyePosition",
"moonPhase",
"darknessLightFactor",
"frameCounter",
"rainStrength",
"eyeBrightness",
"eyeBrightnessM",
"maxBlindnessDarkness",
"near",
"frameTimeCounter",
"blindness",
"darknessFactor",
"worldTimeSmooth",
"worldAgeSmooth",
#ifdef EUPHORIA_PATCHES_UNIFORMS
"euphoriaPatchesIsDayAdvancing",
"euphoriaPatchesCurrentDayMillis",
"euphoriaPatchesCurrentSeasonTick",
"euphoriaPatchesSeasonDuration",
"euphoriaPatchesTotalSeasonDuration",
#endif
#if MC_VERSION >= 12109 || ANGELICA_VERSION >= 20155000
"endFlashPosition",
"endFlashIntensityM",
#endif
"eyeAltitude",
"rainFactor",
"wetness",
"inVanillaEnd",
"lightningBoltPosition",
"viewSize",
"thunderFactor",
"firstPersonCamera",
"entityId",
"is_invisible",
"currentPlayerArmor",
"isOnGround",
"inJungle",
"inForest",
"isShockwave",
#if MC_VERSION >= 12104
"inPaleGarden",
#endif
#if MC_VERSION >= 260200
"inSulfurCaves",
#endif
"inSand",
"inRedSand",
"inLushCave",
"shadowModelView",
"shadowProjection",
"shadowModelViewInverse",
"shadowProjectionInverse",
"vxRenderDistance",
"vxModelView", "vxModelViewInv","vxModelViewPrev",
"vxProj", "vxProjInv", "vxProjPrev"
],
"samplers": {
"tex": "sampler2D",
"gaux2": "sampler2D",
"gaux4": "sampler2D",
"colortex10": "sampler2D",
"colortex18": "sampler2D",
"colortex19": "sampler2D",
"depthtex1": "sampler2D",
"vxDepthTexOpaque": "sampler2D",
"vxDepthTexTrans": "sampler2D",
"noisetex": "sampler2D",
"shadowtex0": "sampler2DShadow",
"shadowtex1": "sampler2DShadow",
"shadowcolor0": "sampler2D",
"colortex6" : "sampler2D",
"colortex13" : "sampler2D",
"colortex14" : "sampler2D"
}
}
@@ -0,0 +1,253 @@
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
#define VOXY_PATCH
#define texture2DLod textureLod
#define texture2D texture
mat4 gbufferModelView = vxModelView;
mat4 gbufferModelViewInverse = vxModelViewInv;
mat4 gbufferPreviousModelView = vxModelViewPrev;
mat4 gbufferProjection = vxProj;
mat4 gbufferProjectionInverse = vxProjInv;
mat4 gbufferPreviousProjection = vxProjPrev;
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/materials.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/interactiveFoliage.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#include "/lib/shaderSettings/wavingBlocks.glsl"
//#define NIGHT_DESATURATION
#define CHUNKS_FADE_IN_NO_FRAG_MOD_INJECT
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
//Pipeline//
layout(location = 0) out vec4 gbufferData0;
layout(location = 1) out vec4 gbufferData6;
#ifdef SS_BLOCKLIGHT
layout(location = 2) out vec4 gbufferData9;
#endif
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
vec3 sunVec = GetSunVector();
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;
int blockLightEmission = 0;
int mat;
float NdotU;
float NdotUmax0;
vec2 lmCoord;
vec2 lmCoordM;
vec3 normal;
vec4 glColor;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
void DoFoliageColorTweaks(inout vec3 color, inout vec3 shadowMult, inout float snowMinNdotU, vec3 viewPos, vec3 nViewPos, float lViewPos, float dither) {
#ifdef SNOWY_WORLD
if (glColor.g - glColor.b > 0.01)
snowMinNdotU = min(pow2(pow2(max0(color.g * 2.0 - color.r - color.b))) * 5.0, 0.1);
else
snowMinNdotU = min(pow2(pow2(max0(color.g * 2.0 - color.r - color.b))) * 3.0, 0.1) * 0.25;
#endif
}
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#define GBUFFERS_TERRAIN
#include "/lib/lighting/mainLighting.glsl"
#undef GBUFFERS_TERRAIN
#ifdef SNOWY_WORLD
#include "/lib/materials/materialMethods/snowyWorld.glsl"
#endif
#ifdef DISTANT_LIGHT_BOKEH
#include "/lib/misc/distantLightBokeh.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 voxy_emitFragment(VoxyFragmentParameters parameters) {
// Prepare
mat = int(parameters.customId);
lmCoord = clamp((parameters.lightMap - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
lmCoordM = lmCoord;
normal = upVec;
switch (uint(parameters.face) >> 1u) {
case 0u:
normal = vxModelView[1].xyz;
break;
case 1u:
normal = vxModelView[2].xyz;
break;
case 2u:
normal = vxModelView[0].xyz;
break;
}
if ((parameters.face & 1) == 0) {
normal = -normal;
}
NdotU = dot(normal, upVec);
NdotUmax0 = max(NdotU, 0.0);
glColor = parameters.tinting;
//
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
vec4 color = parameters.sampledColour * 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(viewPos);
vec3 nViewPos = normalize(viewPos);
vec3 playerPos = mat3(vxModelViewInv) * viewPos + vxModelViewInv[3].xyz;
vec3 worldPos = playerPos + cameraPosition;
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
int subsurfaceMode = 0;
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false, noGeneratedNormals = false, doTileRandomisation = true;
float smoothnessD = 0.0, materialMask = 0.0;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0, snowFactor = 1.0, snowMinNdotU = 0.0, noPuddles = 0.0;
vec3 geoNormal = normal, normalM = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(mat3(vxModelViewInv) * normal);
bool isFoliage = false;
float overlayNoiseIntensity = 1.0, snowNoiseIntensity = 1.0, sandNoiseIntensity = 1.0, mossNoiseIntensity = 1.0, overlayNoiseTransparentOverwrite = 0.0, overlayNoiseEmission = 1.0, IPBRMult = 1.0, lavaNoiseIntensity = LAVA_NOISE_INTENSITY, enderDragonDead = 1.0, purkinjeOverwrite = 0.0;
vec3 dhColor = vec3(1.0);
bool isLightSource = false;
if (lmCoord.x > 0.99) { // Mod support for light level 15 light sources
if (mat == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, lmCoord.x, blockLightEmission, 0.0);
}
isLightSource = true;
overlayNoiseIntensity = 0.0;
}
// Praying to god these don't cause massive issues
vec2 atlasSize = vec2(999999999.0);
vec2 midCoord = vec2(999999999.0);
vec2 signMidCoordPos = vec2(999999999.0);
vec2 absMidCoordPos = vec2(999999999.0);
vec2 texCoord = vec2(999999999.0);
#include "/lib/materials/materialHandling/terrainMaterials.glsl"
#ifdef SNOWY_WORLD
DoSnowyWorld(color, smoothnessG, highlightMult, smoothnessD, emission,
playerPos, lmCoord, snowFactor, snowMinNdotU, NdotU, subsurfaceMode);
#endif
#define GBUFFERS_TERRAIN
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoiseApply.glsl"
#endif
#undef GBUFFERS_TERRAIN
#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
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, vec3(1.0));
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#if defined END && END_ROD_COLOR_PROFILE == 0
if (mat == 10500) lightAlbedo = vec3(1.0, 0.6078, 0.9); // End Rod
#endif
#ifdef COLORED_CANDLE_LIGHT
if (mat >= 10900 && mat <= 10922) { // Candles:Lit
lightAlbedo = normalize(color.rgb) * lmCoord.x;
}
#endif
#endif
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef IRIS_FEATURE_FADE_VARIABLE
skyLightFactor *= 0.5;
#endif
float entitySSBLMask = 1.0;
#ifdef ENTITIES_ARE_LIGHT
entitySSBLMask = 0.0;
#endif
// Writing to: 0,6,9 (defined in voxy.json)
gbufferData0 = color;
gbufferData6 = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
gbufferData9 = vec4(lightAlbedo, entitySSBLMask);
#endif
}
#endif
@@ -0,0 +1,272 @@
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
#define VOXY_PATCH
#define texture2DLod textureLod
#define texture2D texture
mat4 gbufferModelView = vxModelView;
mat4 gbufferModelViewInverse = vxModelViewInv;
mat4 gbufferPreviousModelView = vxModelViewPrev;
mat4 gbufferProjection = vxProj;
mat4 gbufferProjectionInverse = vxProjInv;
mat4 gbufferPreviousProjection = vxProjPrev;
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/water.glsl"
#include "/lib/shaderSettings/shockwave.glsl"
#include "/lib/shaderSettings/emissionMult.glsl"
#define CHUNKS_FADE_IN_NO_FRAG_MOD_INJECT
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
//Pipeline//
layout(location = 0) out vec4 gbufferData0;
layout(location = 1) out vec4 gbufferData6;
#ifdef SS_BLOCKLIGHT
layout(location = 2) out vec4 gbufferData9;
#endif
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
vec3 sunVec = GetSunVector();
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;
int blockLightEmission = 0;
int mat;
float NdotU;
float NdotUmax0;
vec2 lmCoord;
vec2 lmCoordM;
vec3 normal;
vec3 viewVector;
vec4 glColor;
mat3 tbnMatrix;
#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/util/dither.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#include "/lib/materials/materialMethods/translucentTweaks.glsl"
float vlFactor = 0.0;
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0
#if defined SKY_EFFECT_REFLECTION_TRANSLUCENT && defined OVERWORLD
#if AURORA_STYLE > 0
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#else
#include "/lib/atmospherics/stars.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 TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef SNOWY_WORLD
#include "/lib/materials/materialMethods/snowyWorld.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#if PIXEL_WATER > 0
#include "/lib/materials/materialMethods/waterProcedureTexture.glsl"
#endif
//Program//
void voxy_emitFragment(VoxyFragmentParameters parameters) {
// Prepare
mat = int(parameters.customId);
lmCoord = clamp((parameters.lightMap - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
lmCoordM = lmCoord;
normal = upVec;
switch (uint(parameters.face) >> 1u) {
case 0u:
normal = vxModelView[1].xyz;
break;
case 1u:
normal = vxModelView[2].xyz;
break;
case 2u:
normal = vxModelView[0].xyz;
break;
}
if ((parameters.face & 1) == 0) {
normal = -normal;
}
NdotU = dot(normal, upVec);
NdotUmax0 = max(NdotU, 0.0);
glColor = parameters.tinting;
//
vec4 colorP = parameters.sampledColour;
vec4 color = parameters.sampledColour * 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(viewPos);
vec3 nViewPos = normalize(viewPos);
vec3 playerPos = mat3(vxModelViewInv) * viewPos + vxModelViewInv[3].xyz;
vec3 worldPos = playerPos + cameraPosition;
vec3 tangent = vxModelView[0].xyz;
vec3 binormal = vxModelView[2].xyz;
tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z);
viewVector = vec3(playerPos.x, playerPos.z, 0);
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
float materialMask = 0.0;
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float VdotN = dot(nViewPos, normal);
// Materials
vec4 translucentMult = vec4(1.0);
bool noSmoothLighting = false, noDirectionalShading = false, translucentMultCalculated = false, noGeneratedNormals = false;
int subsurfaceMode = 0;
float smoothnessG = 0.0, highlightMult = 1.0, reflectMult = 0.0, emission = 0.0;
vec3 geoNormal = normal, normalM = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(mat3(vxModelViewInv) * normal);
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
float fresnelM = pow3(fresnel);
float overlayNoiseIntensity = 1.0, snowNoiseIntensity = 1.0, sandNoiseIntensity = 1.0, mossNoiseIntensity = 1.0, overlayNoiseTransparentOverwrite = 0.0, overlayNoiseAlpha = 1.0, overlayNoiseFresnelMult = 1.0, IPBRMult = 1.0, purkinjeOverwrite = 0.0, enderDragonDead = 1.0, SSBLAlpha = 1.0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#include "/lib/materials/materialHandling/translucentMaterials.glsl"
bool isLightSource = false;
if (lmCoord.x > 0.99) { // Mod support for light level 15 light sources
if (mat == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, lmCoord.x, blockLightEmission, 0.0);
}
isLightSource = true;
overlayNoiseIntensity = 0.0;
}
#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
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, false,
false, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead, vec3(1.0));
#ifdef SS_BLOCKLIGHT
vec3 normalizedColor = normalize(color.rgb);
vec3 maskedLightAlbedo =
(mat == 30012 || mat == 30016 || (mat >= 31000 && mat < 32000) || mat == 32004) // Slime, Honey, Glass, Ice
? normalizedColor : vec3(0.0);
vec3 lightAlbedo = mix(maskedLightAlbedo, normalizedColor * min1(emission), color.a);
#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
fresnelM = (fresnelM * 0.85 + 0.15) * reflectMult;
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, -1.0,
vxDepthTexOpaque, dither, skyLightFactor, fresnel,
smoothnessG, geoNormal, color.rgb, shadowMult, highlightMult, enderDragonDead, vec2(0.0));
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
#else
fresnelM = 0.0;
vec4 reflection = vec4(0.0);
#endif
float entitySSBLMask = 1.0;
#ifdef ENTITIES_ARE_LIGHT
entitySSBLMask = 0.0;
#endif
////
// Writing to: 0,6,9 (defined in voxy.json)
gbufferData0 = color;
gbufferData6 = vec4(1.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
gbufferData9 = vec4(lightAlbedo, entitySSBLMask);
#endif
}
#endif