update: automodpack

This commit is contained in:
snusxd
2026-04-05 13:08:45 +03:00
commit 5fa8d3277d
6090 changed files with 682709 additions and 0 deletions

View File

@@ -0,0 +1,248 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#define ROUGHNESS_MULTIPLIER 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
#define ROUGHNESS_INTENSITY 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
in vec3 sunVec;
#ifdef END
in float vlFactor;
#endif
//Pipeline Constants//
//Common Variables//
vec3 upVec = normalize(gbufferModelView[1].xyz);
vec3 eastVec = normalize(gbufferModelView[0].xyz);
vec3 northVec = normalize(gbufferModelView[2].xyz);
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float farMinusNear = far - near;
float z0;
float z1;
vec2 view = vec2(viewWidth, viewHeight);
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
#include "/lib/colors/skyColors.glsl"
#include "/lib/colors/lightAndAmbientColors.glsl"
#include "/lib/materials/materialMethods/reflections.glsl"
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
//Program//
void main() {
ivec2 texelCoord = ivec2(texCoord * view);
vec4 color = texelFetch(colortex0, texelCoord, 0);
vec4 texture4 = texelFetch(colortex4, texelCoord, 0);
z0 = texelFetch(depthtex0, texelCoord, 0).r;
z1 = texelFetch(depthtex1, texelCoord, 0).r;
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
vec4 reflectOutput = vec4(0.0);
if (
z0 < 1.0
#if WORLD_SPACE_REFLECTIONS_INTERNAL == -1 || WATER_REFLECT_QUALITY <= 0
&& z0 == z1
#endif
) {
vec3 texture6 = texelFetch(colortex6, texelCoord, 0).rgb;
vec3 texture8 = texelFetch(colortex8, 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 entityOrHand = z0 < 0.56;
float dither = texture2DLod(noisetex, gl_FragCoord.xy / 128.0, 0.0).b;
#if defined TAA || defined PBR_REFLECTIONS
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
int materialMaskInt = int(texture6.g * 255.1);
float skyLightFactor = texture6.b;
float smoothnessD = texture6.r;
float fresnelM = texture4.a;
float intenseFresnel = 0.0;
float ssao = 1.0;
vec3 reflectColor = vec3(1.0);
#include "/lib/materials/materialHandling/deferredMaterials.glsl"
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
if (fresnelM > 0.0) {
#ifdef TAA
float noiseMult = 0.3;
#else
float noiseMult = 0.3;
#endif
#ifdef PBR_REFLECTIONS
bool opaqueSurface = z0 == z1;
float minBlendFactor = 0.035 + 0.09 * pow2(pow2(pow2(smoothnessD)));
if (entityOrHand) {
noiseMult *= 0.125;
minBlendFactor = 0.125;
if (!opaqueSurface) reflectColor = vec3(0.0);
}
#endif
float smoothnessDM = smoothnessD * ROUGHNESS_MULTIPLIER;
noiseMult *= pow2(1.0 - smoothnessDM) * ROUGHNESS_INTENSITY;
vec2 roughCoord = gl_FragCoord.xy / 128.0;
vec3 roughNoise = vec3(
texture2DLod(noisetex, roughCoord, 0.0).r,
texture2DLod(noisetex, roughCoord + 0.09375, 0.0).r,
texture2DLod(noisetex, roughCoord + 0.1875, 0.0).r
);
roughNoise = fract(roughNoise + vec3(dither, dither * goldenRatio, dither * pow2(goldenRatio)));
roughNoise = noiseMult * (roughNoise - vec3(0.5));
vec3 refNormal = normalM + roughNoise;
float enderDragonDead = 1.0 - texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
vec4 reflection = GetReflection(refNormal, viewPos.xyz, nViewPos, playerPos, lViewPos, z0,
depthtex1, dither, skyLightFactor, fresnel,
smoothnessDM, vec3(0.0), vec3(0.0), vec3(0.0), 0.0, enderDragonDead, vec2(0.0));
reflection.rgb *= reflectColor;
reflectOutput = reflection;
#ifdef PBR_REFLECTIONS
if (opaqueSurface) {
refDist = min(refDist, far - lViewPos);
vec4 virtualRefPos = vec4(viewPos.xyz + refDist * nViewPos, 1.0);
vec4 playerVirtualRefPos = gbufferModelViewInverse * virtualRefPos; // note: don't need to do perspective division with model view matrix
vec4 virtualPrevRefPos = playerVirtualRefPos;
virtualPrevRefPos.xyz -= previousCameraPosition - cameraPosition;
virtualPrevRefPos = gbufferPreviousProjection * (gbufferPreviousModelView * virtualPrevRefPos);
virtualPrevRefPos.xyz = 0.5 * virtualPrevRefPos.xyz / virtualPrevRefPos.w + 0.5;
virtualPrevRefPos.z = min(1, virtualPrevRefPos.z);
if (virtualPrevRefPos.xyz == clamp01(virtualPrevRefPos.xyz)) {
vec4 prevPos = gbufferProjection * (
gbufferModelView * vec4(
playerPos + (cameraPosition - previousCameraPosition) +
gbufferModelViewInverse[3].xyz - transpose(mat3(gbufferPreviousModelView)) * gbufferPreviousModelView[3].xyz
, 1.0
)
);
prevPos.xyz = 0.5 * prevPos.xyz / prevPos.w + 0.5;
virtualPrevRefPos.xy *= view;
virtualPrevRefPos.xy = (
smoothstep(0, 1, smoothstep(0, 1, fract(virtualPrevRefPos.xy - 0.5))) +
floor(virtualPrevRefPos.xy - 0.5) +
0.5
) / view;
float linearZ1 = GetLinearDepth(z1);
vec2 pixelMovement = view * (prevPos.xy - texCoord);
vec3 prevNormalM = mat3(gbufferModelView) * texture2D(colortex1, virtualPrevRefPos.xy).rgb;
vec4 prevRefCurrentPosHeuristic = playerVirtualRefPos;
prevRefCurrentPosHeuristic.xyz += normalize(previousCameraPosition - cameraPosition - playerVirtualRefPos.xyz) * refDist;
prevRefCurrentPosHeuristic = gbufferProjection * (gbufferModelView * prevRefCurrentPosHeuristic);
prevRefCurrentPosHeuristic.xyz = 0.5 * prevRefCurrentPosHeuristic.xyz / prevRefCurrentPosHeuristic.w + 0.5;
vec4 prevRef = texture2D(colortex7, virtualPrevRefPos.xy);
float prevValid = exp(
- 0.03 * length(view * (virtualPrevRefPos.xy - texCoord))
- min(0.75, 10.0 * sqrt(length(cameraPosition - previousCameraPosition)))
- 0.003 * length(pixelMovement)
- 12.0 * length(normalM - prevNormalM)
- abs(prevRef.a - linearZ1) * far / 1.0
- 10 * length(prevRefCurrentPosHeuristic.xy - clamp01(prevRefCurrentPosHeuristic.xy))
);
reflectOutput.rgb = mix(prevRef.rgb, reflectOutput.rgb, min1(minBlendFactor / prevValid));
reflectOutput.a = linearZ1;
}
}
#endif
}
}
/* DRAWBUFFERS:7 */
gl_FragData[0] = reflectOutput;
// same check as #ifdef PBR_REFLECTIONS but for Optifine to understand:
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:71 */
gl_FragData[1] = vec4(texture4.rgb, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
out vec3 sunVec;
#ifdef END
out float vlFactor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
sunVec = GetSunVector();
#ifdef END
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#endif
}
#endif

View File

@@ -0,0 +1,403 @@
/////////////////////////////////////
// Complementary Shaders by EminGT //
/////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite1.glsl"
#include "/lib/shaderSettings/endBeams.glsl"
#include "/lib/shaderSettings/overworldBeams.glsl"
#include "/lib/shaderSettings/longExposure.glsl"
#define NETHER_STORM
#define NETHER_STORM_LOWER_ALT 28 //[-296 -292 -288 -284 -280 -276 -272 -268 -264 -260 -256 -252 -248 -244 -240 -236 -232 -228 -224 -220 -216 -212 -208 -204 -200 -196 -192 -188 -184 -180 -176 -172 -168 -164 -160 -156 -152 -148 -144 -140 -136 -132 -128 -124 -120 -116 -112 -108 -104 -100 -96 -92 -88 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 22 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300]
#define NETHER_STORM_HEIGHT 200 //[25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 220 240 260 280 300 325 350 375 400 425 450 475 500 550 600 650 700 750 800 850 900]
#define NETHER_STORM_I 0.40 //[0.05 0.06 0.07 0.08 0.09 0.10 0.12 0.14 0.16 0.18 0.22 0.26 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50]
#ifndef NETHER
#undef NETHER_STORM
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
flat in vec3 upVec, sunVec;
#ifdef LIGHTSHAFTS_ACTIVE
flat in float vlFactor;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
vec2 view = vec2(viewWidth, viewHeight);
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#ifdef LIGHTSHAFTS_ACTIVE
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float vlTime = min(abs(SdotU) - 0.05, 0.15) / 0.15;
#endif
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * (far - near));
}
//Includes//
#include "/lib/atmospherics/fog/waterFog.glsl"
#include "/lib/atmospherics/fog/caveFactor.glsl"
#if defined PBR_REFLECTIONS || WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0
#include "/lib/materials/materialMethods/reflectionBlurFilter.glsl"
#endif
#ifdef BLOOM_FOG_COMPOSITE1
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#ifdef LIGHTSHAFTS_ACTIVE
#if defined END && defined END_BEAMS
#include "/lib/atmospherics/enderBeams.glsl"
#elif defined OVERWORLD && defined OVERWORLD_BEAMS
#include "/lib/atmospherics/overworldBeams.glsl"
#endif
#include "/lib/atmospherics/volumetricLight.glsl"
#endif
#if WATER_MAT_QUALITY >= 3 || defined NETHER_STORM || defined COLORED_LIGHT_FOG || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || (defined END && END_CENTER_LIGHTING > 0)
#include "/lib/util/spaceConversion.glsl"
#endif
#if WATER_MAT_QUALITY >= 3
#include "/lib/materials/materialMethods/refraction.glsl"
#endif
#ifdef NETHER_STORM
#include "/lib/atmospherics/netherStorm.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#if RAINBOWS > 0 && defined OVERWORLD
#include "/lib/atmospherics/rainbow.glsl"
#endif
#ifdef COLORED_LIGHT_FOG
#include "/lib/voxelization/lightVoxelization.glsl"
#include "/lib/atmospherics/fog/coloredLightFog.glsl"
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
#include "/lib/atmospherics/endCrystalVortex.glsl"
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
#include "/lib/atmospherics/endPortalBeam.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
#if defined DISTANT_HORIZONS && !defined OVERWORLD
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
/* TM5723: The "1.0 - translucentMult" trick is done because of the default color attachment
value being vec3(0.0). This makes it vec3(1.0) to avoid issues especially on improved glass */
vec3 translucentMult = 1.0 - texelFetch(colortex3, texelCoord, 0).rgb; //TM5723
vec4 volumetricEffect = vec4(0.0);
vec2 texCoordM = texCoord;
#if WATER_MAT_QUALITY >= 3
texCoordM = DoRefraction(color, z0, z1, viewPos.xyz, lViewPos);
#endif
#if defined PBR_REFLECTIONS || WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS_INTERNAL > 0
if (z0 < 1.0) {
vec4 compositeReflection = texture2D(colortex7, texCoord);
float fresnelM = pow2(texture2D(colortex4, texCoord).a); // including attenuation through fog and clouds
if (abs(fresnelM - 0.5) < 0.5) { // 0.0 fresnel doesnt need ref calculations, and 1.0 fresnel basically means error
if (z0 == z1 || z0 <= 0.56) { // Solids
#ifdef PBR_REFLECTIONS
if (fresnelM > 0.00001) {
compositeReflection = sampleBlurFilteredReflection(compositeReflection, dither, z0);
compositeReflection.rgb = max(compositeReflection.rgb, vec3(0.0)); // We seem to have some negative values for some reason
// This physically doesn't make sense but fits Minecraft
const float texturePreservation = 0.7;
compositeReflection.rgb = mix(compositeReflection.rgb, max(color, compositeReflection.rgb), texturePreservation);
color = mix(color, compositeReflection.rgb, fresnelM);
}
#endif
}
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
else { // Translucents
vec4 ssrReflection = texture2D(colortex8, texCoordM);
color = max(color - ssrReflection.rgb, vec3(0.0));
compositeReflection.rgb *= fresnelM;
compositeReflection = mix(compositeReflection, ssrReflection, float(ssrReflection.a > 0.999));
vec3 combinedRef = mix(ssrReflection.rgb, compositeReflection.rgb, compositeReflection.a);
color += combinedRef;
}
#endif
}
}
#endif
vec4 screenPos1 = vec4(texCoord, z1, 1.0);
vec4 viewPos1 = gbufferProjectionInverse * (screenPos1 * 2.0 - 1.0);
viewPos1 /= viewPos1.w;
float lViewPos1 = length(viewPos1.xyz);
#if defined DISTANT_HORIZONS && !defined OVERWORLD
float z1DH = texelFetch(dhDepthTex1, texelCoord, 0).r;
vec4 screenPos1DH = vec4(texCoord, z1DH, 1.0);
vec4 viewPos1DH = dhProjectionInverse * (screenPos1DH * 2.0 - 1.0);
viewPos1DH /= viewPos1DH.w;
lViewPos1 = min(lViewPos1, length(viewPos1DH.xyz));
#endif
#if defined LIGHTSHAFTS_ACTIVE || RAINBOWS > 0 && defined OVERWORLD
vec3 nViewPos = normalize(viewPos1.xyz);
float VdotL = dot(nViewPos, lightVec);
#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)
vec3 playerPos = ViewToPlayer(viewPos1.xyz);
vec3 nPlayerPos = normalize(playerPos);
#endif
#if RAINBOWS > 0 && defined OVERWORLD && !defined SPOOKY
if (isEyeInWater == 0) color += GetRainbow(translucentMult, z0, z1, lViewPos, lViewPos1, VdotL, dither);
#endif
float vlFactorM = 0.0;
#ifdef LIGHTSHAFTS_ACTIVE
vlFactorM = vlFactor;
float VdotU = dot(nViewPos, upVec);
volumetricEffect = GetVolumetricLight(color, vlFactorM, translucentMult, lViewPos, lViewPos1, nViewPos, VdotL, VdotU, texCoord, z0, z1, dither);
#endif
float lightFogLength = 0.0;
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0
vec4 endCrystalVortex = pow2(EndCrystalVortices(vec3(0.0), playerPos, dither));
volumetricEffect = sqrt(pow2(volumetricEffect) + endCrystalVortex);
lightFogLength = sqrt(pow2(lightFogLength) + length(endCrystalVortex.rgb));
#endif
#ifdef NETHER_STORM
volumetricEffect = GetNetherStorm(color, translucentMult, nPlayerPos, playerPos, lViewPos, lViewPos1, dither);
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
volumetricEffect.rgb *= GetAtmColorMult();
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
volumetricEffect.rgb *= moonPhaseInfluence;
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
vec4 endPortalBeam = pow2(GetEndPortalBeam(vec3(0.0), playerPos));
volumetricEffect = sqrt(pow2(volumetricEffect) + endPortalBeam);
lightFogLength = sqrt(pow2(lightFogLength) + length(endPortalBeam.rgb));
#endif
#ifdef NETHER_STORM
color = mix(color, volumetricEffect.rgb, volumetricEffect.a);
#endif
#ifdef COLORED_LIGHT_FOG
vec3 lightFog = GetColoredLightFog(nPlayerPos, translucentMult, lViewPos, lViewPos1, dither, vlFactorM);
float lightFogMult = COLORED_LIGHT_FOG_I;
lightFogLength += length(lightFog);
//if (heldItemId == 40000 && heldItemId2 != 40000) lightFogMult = 0.0; // Hold spider eye to disable light fog
#ifdef OVERWORLD
#ifdef EPIC_THUNDERSTORM
lightFogMult = mix(lightFogMult, min(lightFogMult * 1.75, 1.7), rainFactor * inRainy);
#endif
lightFogMult *= 0.2 + 0.6 * mix(1.0, 1.0 - sunFactor * invRainFactor, eyeBrightnessM);
#endif
#endif
if (isEyeInWater == 1) {
if (z0 == 1.0) color.rgb = waterFogColor;
vec3 underwaterMult = vec3(0.80, 0.87, 0.97);
#if DARKER_DEPTH_OCEANS > 0
vec4 texture6 = texelFetch(colortex6, texelCoord, 0);
float renderDistanceFade = lViewPos * 20.0 / far;
float lightSourceFactor = pow3(1.0 - texture6.a);
lightSourceFactor += renderDistanceFade;
lightSourceFactor = clamp01(lightSourceFactor);
float heldLight = max(heldBlockLightValue, heldBlockLightValue2);
if (heldLight > 0){
if (heldItemId == 45032 || heldItemId2 == 45032) heldLight = 15; // Lava Bucket
heldLight = clamp(heldLight, 0.0, 15.0);
heldLight = sqrt2(heldLight / 15.0) * -1.0 + 1.0; // Normalize and invert
heldLight = mix(heldLight, 1.0, clamp01((lViewPos) * 35.0 / far)); // Only do it around the player
} else {
heldLight = 1.0;
}
float mixFactor = heldLight * lightSourceFactor * (1.0 - nightVision);
float waterDepthStart = waterAltitude + 10;
float depthFactor = clamp01(10.0 / abs(min(cameraPosition.y, waterDepthStart + 0.001) - waterDepthStart));
float depthDarkness = clamp(abs(1.0 - (1.0 - depthFactor) * (1.0 - depthFactor)), DARKER_DEPTH_OCEANS * 0.05, 1.0);
underwaterMult *= mix(1.0, depthDarkness, mixFactor);
#endif
color.rgb *= underwaterMult * 0.85;
volumetricEffect.rgb *= pow2(underwaterMult * 0.71);
#ifdef COLORED_LIGHT_FOG
lightFog *= underwaterMult;
#endif
} else if (isEyeInWater == 2) {
if (z1 == 1.0) color.rgb = fogColor * 5.0;
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 1.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 1.0, colorEndBreath, 1.0);
#endif
volumetricEffect.rgb *= 0.0;
#ifdef COLORED_LIGHT_FOG
lightFog *= 0.0;
#endif
}
#ifdef COLORED_LIGHT_FOG
color /= 1.0 + pow2(GetLuminance(lightFog)) * lightFogMult * 2.0;
color += lightFog * lightFogMult * 0.5;
#endif
color = pow(color, vec3(2.2));
#if defined LIGHTSHAFTS_ACTIVE || defined END_PORTAL_BEAM_INTERNAL
#ifdef END
volumetricEffect.rgb *= volumetricEffect.rgb;
#endif
color += volumetricEffect.rgb;
#endif
#ifdef BLOOM_FOG_COMPOSITE1
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-2-3
#endif
#if RETRO_LOOK == 1
color.rgb *= vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.5 * RETRO_LOOK_I;
#elif RETRO_LOOK == 2
color.rgb *= mix(vec3(1.0), vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.5, nightVision) * RETRO_LOOK_I;
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
#if LIGHTSHAFT_QUALI_DEFINE > 0 && LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 && defined OVERWORLD || defined END || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || defined COLORED_LIGHT_FOG
vec4 texture5 = vec4(0.0);
#if LENSFLARE_MODE > 0 || defined ENTITY_TAA_NOISY_CLOUD_FIX || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL || defined COLORED_LIGHT_FOG
texture5 = texelFetch(colortex5, texelCoord, 0);
if (viewWidth + viewHeight - gl_FragCoord.x - gl_FragCoord.y > 1.5)
vlFactorM = texture5.a;
#endif
texture5.r = sqrt(pow2(texture5.r) + lightFogLength);
/* DRAWBUFFERS:05 */
gl_FragData[1] = vec4(texture5.r, 0.0, 0.0, vlFactorM);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
flat out vec3 upVec, sunVec;
#ifdef LIGHTSHAFTS_ACTIVE
flat out float vlFactor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#ifdef LIGHTSHAFTS_ACTIVE
#if LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END
vlFactor = texelFetch(colortex5, ivec2(viewWidth-1, viewHeight-1), 0).a;
#else
#if LIGHTSHAFT_BEHAVIOUR == 2
vlFactor = 0.0;
#elif LIGHTSHAFT_BEHAVIOUR == 3
vlFactor = 1.0;
#endif
#endif
#endif
}
#endif

View File

@@ -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.37;
vec2 blurstr = vec2(1.0 / (viewWidth / viewHeight), 1.0) * fovScale / distScale;
vec4 previousColoredLight = vec4(0.0);
float mask = clamp(2.0 - 2.0 * max(abs(prevCoord.x - 0.5), abs(prevCoord.y - 0.5)), 0.0, 1.0);
vec2 offset = OffsetDist(dither) * blurstr;
vec2 sampleZPos = coord + offset;
float sampleZ0 = texture2D(depthtex0, sampleZPos).r;
float sampleZ1 = texture2D(depthtex1, sampleZPos).r;
float linearSampleZ = GetLinearDepth(sampleZ1 >= 1.0 ? sampleZ0 : sampleZ1);
float sampleWeight = clamp(abs(lz - linearSampleZ) * far / 16.0, 0.0, 1.0);
sampleWeight = 1.0 - sampleWeight * sampleWeight;
previousColoredLight += texture2D(colortex10, prevCoord.xy + offset) * sampleWeight;
previousColoredLight *= previousColoredLight * mask;
lightAlbedo = clamp01(lightAlbedo);
if (lightAlbedo.g + lightAlbedo.b < 0.05) lightAlbedo.r *= 0.45; // red color reduction to prevent redstone from overpowering everything
return sqrt(max(vec4(0.0), mix(previousColoredLight, lightAlbedo * lightAlbedo / clamp(previousColoredLight.r + previousColoredLight.g + previousColoredLight.b, 0.01, 1.0), 0.01)));
}
#endif
//Includes//
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
#if defined SS_BLOCKLIGHT
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
float z = texture2D(depthtex1, texCoord).x;
float dither;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
#endif
// SS_BLOCKLIGHT code
#ifdef SS_BLOCKLIGHT
vec4 lightAlbedo = texture2D(colortex9, texCoord);
dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ENTITIES_ARE_LIGHT
int heldBlockLight = 0;
heldBlockLight = (viewPos.x > 0.0 ^^ isRightHanded) ? heldBlockLightValue2 : heldBlockLightValue;
if (heldBlockLight > 0) {
lightAlbedo.a *= 30;
}
#endif
float lightZ = z >= 1.0 ? z0 : z;
vec4 coloredLight = GetMultiColoredBlocklight(lightAlbedo, texCoord, lightZ, dither);
#endif
#ifdef SS_BLOCKLIGHT
/* RENDERTARGETS: 0,10 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(coloredLight);
#else
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(color, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}
#endif

View File

@@ -0,0 +1,292 @@
//////////////////////////////////////////
// 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;
#ifndef SPACEAGLE17
float DoFSneaking = isSneaking * float(heldItemId == 45014 || heldItemId2 == 45014);
bool isDoFGUI = hideGUI == 0 && (heldItemId == 45014 || heldItemId2 == 45014); // while holding a spyglass
#else
float DoFSneaking = isSneaking;
bool isDoFGUI = hideGUI == 0;
#endif
vec2 dofOffsets[18] = vec2[18](
vec2( 0.0 , 0.25 ),
vec2(-0.2165 , 0.125 ),
vec2(-0.2165 , -0.125 ),
vec2( 0 , -0.25 ),
vec2( 0.2165 , -0.125 ),
vec2( 0.2165 , 0.125 ),
vec2( 0 , 0.5 ),
vec2(-0.25 , 0.433 ),
vec2(-0.433 , 0.25 ),
vec2(-0.5 , 0 ),
vec2(-0.433 , -0.25 ),
vec2(-0.25 , -0.433 ),
vec2( 0 , -0.5 ),
vec2( 0.25 , -0.433 ),
vec2( 0.433 , -0.2 ),
vec2( 0.5 , 0 ),
vec2( 0.433 , 0.25 ),
vec2( 0.25 , 0.433 )
);
#endif
vec2 getPolygonOffset(float angle, int sides, float radius) { // based on the hexablur function by halcy from https://www.shadertoy.com/view/4tK3WK
float rotationRadians = DOF_SHAPE_ROTATION_DEGREES * (pi / 180.0);
// Calculate regular polygon coordinates
float segmentAngle = 2.0 * pi / float(sides);
float r = cos(pi / float(sides)) / cos(mod(angle, segmentAngle) - pi / float(sides));
r *= radius;
vec2 baseCoord = vec2(sin(angle), cos(angle)) * r;
return rotate(rotationRadians) * baseCoord;
}
//Common Functions//
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
void DoWorldBlur(inout vec3 color, float z1, float lViewPos0) {
if (z1 < 0.56) return;
vec3 dof = vec3(0.0);
vec3 cocColor = vec3(1, 0, 0.8) * 10.0;
vec2 dofScale = vec2(1.0, aspectRatio);
#if WORLD_BLUR == 1 // Distance Blur
#ifdef OVERWORLD
float dbMult;
if (isEyeInWater == 0) {
dbMult = mix(WB_DB_NIGHT_I, WB_DB_DAY_I, sunFactor * eyeBrightnessM);
dbMult = mix(dbMult, WB_DB_RAIN_I, rainFactor * eyeBrightnessM);
} else dbMult = WB_DB_WATER_I;
#elif defined NETHER
float dbMult = WB_DB_NETHER_I;
#elif defined END
float dbMult = WB_DB_END_I;
#endif
float coc = clamp(lViewPos0 * 0.001, 0.0, 0.1) * dbMult * 0.03;
#elif WORLD_BLUR == 2 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0 // Depth Of Field
#if TILT_SHIFT != 0
float tiltOffset = texCoord.y * 2.0 - 1.0;
tiltOffset *= 0.0007 * TILT_SHIFT;
#else
float tiltOffset = 0.0;
#endif
#if TILT_SHIFT2 != 0
float shiftOffset = texCoord.x * 2.0 - 1.0;
shiftOffset *= 0.0007 * TILT_SHIFT2;
#else
float shiftOffset = 0.0;
#endif
#if WB_DOF_FOCUS >= 0
float coc = max(abs(z1 - centerDepthSmooth + tiltOffset + shiftOffset) * 0.125 * WB_DOF_I - 0.0001, 0.0);
#elif WB_DOF_FOCUS == -1
float coc = clamp(abs(lViewPos0 * 0.005 - pow2(vsBrightness) + tiltOffset + shiftOffset), 0.0, 0.1) * WB_DOF_I * 0.03;
#endif
#endif
#ifdef DOF_VIEW_FOCUS_NEW2
float cocView = float(coc < 0.005 + 0.001 * abs(max(float(TILT_SHIFT), float(TILT_SHIFT2))) && coc > 0 && isDoFGUI);
#endif
#if TILT_SHIFT == 0 && TILT_SHIFT2 == 0
coc = coc / sqrt(coc * coc + 0.1);
#endif
#ifdef WB_FOV_SCALED
coc *= gbufferProjection[1][1] * 0.8;
#endif
#ifdef WB_CHROMATIC
float midDistX = texCoord.x - 0.5;
float midDistY = texCoord.y - 0.5;
vec2 chromaticScale = vec2(midDistX, midDistY);
chromaticScale = sign(chromaticScale) * sqrt(abs(chromaticScale));
chromaticScale *= vec2(1.0, viewHeight / viewWidth);
vec2 aberration = (15.0 / vec2(viewWidth, viewHeight)) * chromaticScale * coc;
#endif
#if DOF_SHAPE == 0 // Original mode
#ifdef WB_ANAMORPHIC
dofScale *= vec2(0.5, 1.5);
#endif
#endif
if (coc * 0.5 > 1.0 / max(viewWidth, viewHeight)) {
#if DOF_SHAPE == 0 // Original implementation
for (int i = 0; i < 18; i++) {
vec2 offset = dofOffsets[i] * coc * 0.0085 * dofScale;
float lod = log2(viewHeight * aspectRatio * coc * 0.75 / 320.0);
#ifndef WB_CHROMATIC
dof += texture2DLod(colortex0, texCoord + offset, lod).rgb;
#else
dof += vec3(texture2DLod(colortex0, texCoord + offset + aberration, lod).r,
texture2DLod(colortex0, texCoord + offset , lod).g,
texture2DLod(colortex0, texCoord + offset - aberration, lod).b);
#endif
}
dof /= 18.0;
#elif DOF_SHAPE >= 3 && DOF_SHAPE <= 8
float totalWeight = 0.0;
float lod = log2(viewHeight * aspectRatio * coc * 0.75 / 320.0);
int polygonSamples = int(DOF_POLYGON_SAMPLES * 10);
// Sample in multiple concentric rings to fill the polygon
for (int ring = 1; ring <= DOF_POLYGON_RINGS; ring++) {
float ringFactor = float(ring) / float(DOF_POLYGON_RINGS);
// For each polygon ring, sample multiple points
for (int i = 0; i < polygonSamples; i++) {
float angle = float(i) * (2.0 * pi) / float(polygonSamples);
vec2 offset = getPolygonOffset(angle, DOF_SHAPE, ringFactor * coc * 0.01) * dofScale;
float weight = 1.0 - 0.2 * ringFactor; // Weight based on distance from center
#ifndef WB_CHROMATIC
vec3 sampleColor = texture2DLod(colortex0, texCoord + offset, lod).rgb;
dof += sampleColor * weight;
#else
dof += vec3(
texture2DLod(colortex0, texCoord + offset + aberration, lod).r,
texture2DLod(colortex0, texCoord + offset, lod).g,
texture2DLod(colortex0, texCoord + offset - aberration, lod).b
) * weight;
#endif
totalWeight += weight;
}
}
dof /= totalWeight;
#endif
#ifdef DOF_SNEAKING
color = mix(color, dof, DoFSneaking);
#else
color = dof;
#endif
}
#ifdef DOF_VIEW_FOCUS_NEW2
#ifdef DOF_SNEAKING
color = mix(color, cocColor, cocView * DoFSneaking);
#else
color = mix(color, cocColor, cocView);
#endif
#endif
}
#endif
//Includes//
#if (WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0) && defined BLOOM_FOG_COMPOSITE3
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
//Program//
void main() {
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
#if WORLD_BLUR > 0 || TILT_SHIFT != 0 || TILT_SHIFT2 != 0
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
#if defined DISTANT_HORIZONS && defined NETHER
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
#ifdef DOF_SNEAKING
if (DoFSneaking > 0.1) {
#endif
DoWorldBlur(color, z1, lViewPos);
#ifdef DOF_SNEAKING
}
#endif
#ifdef BLOOM_FOG_COMPOSITE3
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-3
#endif
#endif
#ifdef PIXELATE_SCREEN
if (int(texelFetch(colortex6, texelCoord, 0).g * 255.1) == 252) { // Selection Outline
color *= max(100.0 - PIXELATED_SCREEN_SIZE * 3.0, 1.0);
#if SELECT_OUTLINE == 4 || SELECT_OUTLINE == 1
color *= 10;
#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

View File

@@ -0,0 +1,195 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/bloom.glsl"
#include "/lib/shaderSettings/worldMotionBlur.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
const bool colortex0MipmapEnabled = true;
//Common Variables//
float weight[7] = float[7](1.0, 6.0, 15.0, 20.0, 15.0, 6.0, 1.0);
vec2 view = vec2(viewWidth, viewHeight);
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
#endif
//Common Functions//
vec3 BloomTile(float lod, vec2 offset, vec2 scaledCoord) {
vec3 bloom = vec3(0.0);
float scale = exp2(lod);
vec2 coord = (scaledCoord - offset) * scale;
float padding = 0.5 + 0.005 * scale;
if (abs(coord.x - 0.5) < padding && abs(coord.y - 0.5) < padding) {
for (int i = -3; i <= 3; i++) {
for (int j = -3; j <= 3; j++) {
float wg = weight[i + 3] * weight[j + 3];
vec2 pixelOffset = vec2(i, j) / view;
vec2 bloomCoord = (scaledCoord - offset + pixelOffset) * scale;
bloom += texture2D(colortex0, bloomCoord).rgb * wg;
}
}
bloom /= 4096.0;
}
return pow(bloom / 128.0, vec3(0.25));
}
//Includes//
#if MOTION_BLUR_EFFECT == 1
#include "/lib/util/dither.glsl"
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#endif
//Program//
void main() {
vec3 blur = vec3(0.0);
#if BLOOM_ENABLED == 1
vec2 scaledCoord = texCoord * max(vec2(viewWidth, viewHeight) / vec2(1920.0, 1080.0), vec2(1.0));
#if defined OVERWORLD || defined END
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), scaledCoord);
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), scaledCoord);
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), scaledCoord);
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), scaledCoord) * 0.8;
blur += BloomTile(6.0, vec2(0.135 , 0.3325), scaledCoord) * 0.8;
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), scaledCoord) * 0.6;
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), scaledCoord) * 0.4;
#else
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), scaledCoord);
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), scaledCoord);
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), scaledCoord);
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), scaledCoord);
blur += BloomTile(6.0, vec2(0.135 , 0.3325), scaledCoord);
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), scaledCoord);
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), scaledCoord) * 0.6;
#endif
#endif
#if MOTION_BLUR_EFFECT == 1
vec3 color = vec3(0.0);
float z = texture2D(depthtex1, texCoord).x;
float dither = Bayer64(gl_FragCoord.xy);
if (z <= 0.56) {
color = texelFetch(colortex0, texelCoord, 0).rgb;
} else {
float mbwg = 0.0;
vec2 doublePixel = 2.0 / vec2(viewWidth, viewHeight);
vec4 currentPosition = vec4(texCoord, z, 1.0) * 2.0 - 1.0;
vec4 viewPos = gbufferProjectionInverse * currentPosition;
viewPos = gbufferModelViewInverse * viewPos;
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
vec3 cameraOffset = cameraPosition - previousCameraPosition;
vec4 previousPosition = viewPos + vec4(cameraOffset, 0.0);
previousPosition = gbufferPreviousModelView * previousPosition;
previousPosition = gbufferPreviousProjection * previousPosition;
previousPosition /= previousPosition.w;
vec2 velocity = (currentPosition - previousPosition).xy;
velocity = velocity / (1.0 + length(velocity)) * MOTION_BLURRING_STRENGTH;
#ifndef LOW_QUALITY_MOTION_BLUR
int sampleCount = 9;
velocity *= 0.02;
#else
int sampleCount = 3;
velocity *= 0.06;
#endif
vec2 coord = texCoord - velocity * (float(sampleCount) / 2.0 - 1.0 + dither);
for (int i = 0; i < sampleCount; i++, coord += velocity) {
vec2 coordb = clamp(coord, doublePixel, 1.0 - doublePixel);
vec3 sampleb = texture2DLod(colortex0, coordb, 0).rgb;
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
float z1 = texture2D(depthtex1, coordb).r;
vec4 screenPos = vec4(coordb, z1, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
// Remove bloom fog from mb samples or else we get edge artifacts
sampleb /= GetBloomFog(lViewPos);
#endif
color += sampleb;
mbwg += 1.0;
}
color /= mbwg;
#ifdef MOTION_BLUR_BLOOM_FOG_FIX
// Reapply bloom fog because we removed it from our samples
color *= GetBloomFog(lViewPos);
#endif
}
#endif
/* DRAWBUFFERS:3 */
gl_FragData[0] = vec4(blur, 1.0);
#if MOTION_BLUR_EFFECT == 1
/* DRAWBUFFERS:30 */
gl_FragData[1] = vec4(color, 1.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = gl_MultiTexCoord0.xy;
#if MOTION_BLUR_EFFECT == 1 && defined MOTION_BLUR_BLOOM_FOG_FIX
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif

View File

@@ -0,0 +1,358 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/composite5.glsl"
#include "/lib/shaderSettings/blueScreen.glsl"
#include "/lib/shaderSettings/bloom.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
noperspective in vec2 texCoord;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
//Common Variables//
float pw = 1.0 / viewWidth;
float ph = 1.0 / viewHeight;
vec2 view = vec2(viewWidth, viewHeight);
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
#endif
//Common Functions//
#include "/lib/colors/tonemaps.glsl"
void DoBSLColorSaturation(inout vec3 color) {
float saturationFactor = T_SATURATION + 0.07;
float grayVibrance = (color.r + color.g + color.b) / 3.0;
float graySaturation = grayVibrance;
if (saturationFactor < 1.00) graySaturation = dot(color, vec3(0.299, 0.587, 0.114));
float mn = min(color.r, min(color.g, color.b));
float mx = max(color.r, max(color.g, color.b));
float sat = (1.0 - (mx - mn)) * (1.0 - mx) * grayVibrance * 5.0;
vec3 lightness = vec3((mn + mx) * 0.5);
color = mix(color, mix(color, lightness, 1.0 - T_VIBRANCE), sat);
color = mix(color, lightness, (1.0 - lightness) * (2.0 - T_VIBRANCE) / 2.0 * abs(T_VIBRANCE - 1.0));
color = color * saturationFactor - graySaturation * (saturationFactor - 1.0);
}
#if BLOOM_ENABLED == 1
vec2 rescale = max(vec2(viewWidth, viewHeight) / vec2(1920.0, 1080.0), vec2(1.0));
vec3 GetBloomTile(float lod, vec2 coord, vec2 offset) {
float scale = exp2(lod);
vec2 bloomCoord = coord / scale + offset;
bloomCoord = clamp(bloomCoord, offset, 1.0 / scale + offset);
vec3 bloom = texture2D(colortex3, bloomCoord / rescale).rgb;
bloom *= bloom;
bloom *= bloom;
return bloom * 128.0;
}
void DoBloom(inout vec3 color, vec2 coord, float dither, float lViewPos) {
vec3 blur1 = GetBloomTile(2.0, coord, vec2(0.0 , 0.0 ));
vec3 blur2 = GetBloomTile(3.0, coord, vec2(0.0 , 0.26 ));
vec3 blur3 = GetBloomTile(4.0, coord, vec2(0.135 , 0.26 ));
vec3 blur4 = GetBloomTile(5.0, coord, vec2(0.2075 , 0.26 ));
vec3 blur5 = GetBloomTile(6.0, coord, vec2(0.135 , 0.3325));
vec3 blur6 = GetBloomTile(7.0, coord, vec2(0.160625 , 0.3325));
vec3 blur7 = GetBloomTile(8.0, coord, vec2(0.1784375, 0.3325));
vec3 blur = (blur1 + blur2 + blur3 + blur4 + blur5 + blur6 + blur7) * 0.14;
float bloomStrength = BLOOM_STRENGTH + 0.2 * darknessFactor;
#if defined BLOOM_FOG && defined NETHER && defined BORDER_FOG
float farM = min(renderDistance, NETHER_VIEW_LIMIT); // consistency9023HFUE85JG
float netherBloom = lViewPos / clamp(farM, 96.0, 256.0);
netherBloom *= netherBloom;
netherBloom *= netherBloom;
netherBloom = 1.0 - exp(-8.0 * netherBloom);
netherBloom *= 1.0 - maxBlindnessDarkness;
bloomStrength = mix(bloomStrength * 0.7, bloomStrength * 1.8, netherBloom);
#endif
color = mix(color, blur, bloomStrength);
//color += blur * bloomStrength * (ditherFactor.x + ditherFactor.y);
}
#endif
#include "/lib/util/colorConversion.glsl"
// #if COLORED_LIGHTING_INTERNAL > 0
// #include "/lib/voxelization/lightVoxelization.glsl"
// #endif
// http://www.diva-portal.org/smash/get/diva2:24136/FULLTEXT01.pdf
// The MIT License
// Copyright © 2024 Benjamin Stott "sixthsurge"
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vec3 purkinjeShift(vec3 rgb, vec4 texture6, vec3 playerPos, float lViewPos, float purkinjeOverwrite, float z0, float fogValue) {
float interiorFactorM = 0;
#ifdef NETHER
float nightDesaturationIntensity = NIGHT_DESATURATION_NETHER;
float renderdistanceFade = PURKINJE_RENDER_DISTANCE_FADE_NETHER;
interiorFactorM = 1.0;
#elif defined END
float nightDesaturationIntensity = NIGHT_DESATURATION_END;
nightFactor = 1.0;
float renderdistanceFade = 0.1;
interiorFactorM = -10000.0;
#else
float renderdistanceFade = PURKINJE_RENDER_DISTANCE_FADE;
#ifdef MOON_PHASE_INF_PURKINJE
float nightDesaturationIntensity = moonPhase == 0 ? MOON_PHASE_FULL_PURKINJE : moonPhase != 4 ? MOON_PHASE_PARTIAL_PURKINJE : MOON_PHASE_DARK_PURKINJE;
#else
float nightDesaturationIntensity = NIGHT_DESATURATION_OW;
#endif
#endif
float lightFogFactor = smoothstep(-0.5, 1.0, fogValue);
float renderDistanceFade = mix(0, lViewPos * 2.5 / far, renderdistanceFade * (1.0 - lightFogFactor));
if (isEyeInWater == 1) renderDistanceFade = lViewPos * 7.0 / far;
float nightCaveDesaturation = NIGHT_CAVE_DESATURATION * 0.1;
float interiorFactor = isEyeInWater == 1 ? 0.0 : pow2(1.0 - texture6.b * (1.0 - lightFogFactor));
interiorFactor = mix(interiorFactor, interiorFactorM, renderDistanceFade);
interiorFactor -= sqrt2(eyeBrightnessM) * 0.66;
interiorFactor = smoothstep(0.0, 1.0, clamp01(interiorFactor));
// interiorFactor = 0.0;
// return vec3(interiorFactor);
float lightSourceFactor = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_NEAR_LIGHTS
lightSourceFactor = pow3(1.0 - texture6.a * (1.0 - lightFogFactor));
lightSourceFactor += renderDistanceFade;
lightSourceFactor = clamp01(lightSourceFactor);
#endif
float heldLight = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_LIGHTS_IN_HAND
heldLight = max(heldBlockLightValue, heldBlockLightValue2);
if (heldItemId == 45032 || heldItemId2 == 45032) heldLight = 15; // Lava Bucket
if (heldLight > 0){
heldLight = clamp(heldLight, 0.0, 15.0);
heldLight = sqrt2(heldLight / 15.0) * -1.0 + 1.0; // Normalize and invert
heldLight = mix(heldLight, 1.0, clamp01(lViewPos * 15 / far)); // Only do it around the player
} else {
heldLight = 1.0;
}
#endif
float nightVisionFactor = 1.0;
#ifdef NIGHT_DESATURATION_REMOVE_NIGHT_VISION
nightVisionFactor = nightVision * -1.0 + 1.0;
#endif
float purkinjeIntensity = 0.004 * purkinjeOverwrite * nightDesaturationIntensity;
purkinjeIntensity = purkinjeIntensity * fuzzyOr(interiorFactor, sqrt3(nightFactor - 0.1)); // No purkinje shift in daylight
purkinjeIntensity *= lightSourceFactor; // Reduce purkinje intensity in blocklight
purkinjeIntensity *= (1.0 - lightFogFactor);
purkinjeIntensity *= clamp01(nightCaveDesaturation + (1.0 - nightCaveDesaturation) * pow3(1.0 - interiorFactor)); // Reduce purkinje intensity underground
purkinjeIntensity *= clamp01(heldLight); // Reduce purkinje intensity when holding light sources
purkinjeIntensity *= nightVisionFactor * (1.0 - isLightningActive()); // Reduce purkinje intensity when using night vision or during lightning
purkinjeIntensity = clamp(purkinjeIntensity, 0.01, 1.0); // prevent it going to 0 to avoid NaNs
if (nightDesaturationIntensity < 300) {
float blueDominance = rgb.b / max(max(rgb.r, rgb.g), 0.01);
float blueReduction = smoothstep(0.9, 2.3, blueDominance);
// Create a darker tint for blue colors
vec3 purkinjeTint = vec3(0.5, 0.7, 1.0);
purkinjeTint *= mix(vec3(1.0), vec3(0.6, 0.7, 0.65), blueReduction * 0.7);
purkinjeTint *= rec709ToRec2020;
const vec3 rodResponse = vec3(7.15e-5, 4.81e-1, 3.28e-1) * rec709ToRec2020;
vec3 xyz = rgb * rec2020ToXyz;
vec3 scotopicLuminance = xyz * (1.33 * (1.0 + (xyz.y + xyz.z) / xyz.x) - 0.5);
float purkinje = dot(rodResponse, scotopicLuminance * xyzToRec2020) * 0.45;
float purkinjeFactor = exp2(-rcp(purkinjeIntensity) * purkinje) * (1.0 - blueReduction * 0.5);
rgb = mix(rgb, purkinje * purkinjeTint, purkinjeFactor);
} else {
rgb = mix(rgb, vec3(GetLuminance(rgb) * 0.9), clamp01(purkinjeIntensity));
}
// return vec3(purkinjeIntensity);
return max0(rgb);
}
//Includes//
#ifdef BLOOM_FOG
#include "/lib/atmospherics/fog/bloomFog.glsl"
#endif
#if BLOOM_ENABLED == 1
#include "/lib/util/dither.glsl"
#endif
#if LENSFLARE_MODE > 0 && defined OVERWORLD
#include "/lib/misc/lensFlare.glsl"
#endif
#include "/lib/util/spaceConversion.glsl"
//Program//
void main() {
vec3 color = texture2D(colortex0, texCoord).rgb;
vec4 texture5 = texelFetch(colortex5, texelCoord, 0);
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD || defined NIGHT_DESATURATION
float z0 = texture2D(depthtex0, texCoord).r;
vec4 screenPos = vec4(texCoord, z0, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
float lViewPos = length(viewPos.xyz);
vec3 playerPos = ViewToPlayer(viewPos.xyz);
#else
float lViewPos = 0.0;
#endif
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
#if defined DISTANT_HORIZONS && defined NETHER
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = min(lViewPos, length(viewPosDH.xyz));
#endif
#endif
float dither = texture2DLod(noisetex, texCoord * view / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef BLOOM_FOG
color /= GetBloomFog(lViewPos);
#endif
#if BLOOM_ENABLED == 1
DoBloom(color, texCoord, dither, lViewPos);
#endif
#ifdef COLORGRADING
color =
pow(color.r, GR_RC) * vec3(GR_RR, GR_RG, GR_RB) +
pow(color.g, GR_GC) * vec3(GR_GR, GR_GG, GR_GB) +
pow(color.b, GR_BC) * vec3(GR_BR, GR_BG, GR_BB);
color *= 0.01;
#endif
#ifdef TONEMAP_COMPARISON
color = texCoord.x < mix(0.5, 0.0, isSneaking) ? tonemap_left(color) : tonemap_right(color); // Thanks to SixthSurge
#else
#ifndef SPOOKY
color = tonemap(color);
#else
color = LottesTonemap(color);
#endif
#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
#ifdef NIGHT_DESATURATION
if (materialMaskInt == 251) { // Night Desaturation
purkinjeOverwrite = 0.0;
}
#endif
#if SELECT_OUTLINE == 4 || defined NIGHT_DESATURATION
if (materialMaskInt == 252) { // Selection Outline
#if SELECT_OUTLINE == 4 // Versatile Selection Outline
float colorMF = 1.0 - dot(color, vec3(0.25, 0.45, 0.1));
colorMF = smoothstep1(smoothstep1(smoothstep1(smoothstep1(smoothstep1(colorMF)))));
color = mix(color, 3.0 * (color + 0.2) * vec3(colorMF * SELECT_OUTLINE_I), 0.3);
#endif
purkinjeOverwrite = 0.0;
}
#endif
#if LENSFLARE_MODE > 0 && defined OVERWORLD
DoLensFlare(color, viewPos.xyz, dither);
#endif
DoBSLColorSaturation(color);
#ifdef NIGHT_DESATURATION
color.rgb = purkinjeShift(color.rgb, texture6, playerPos, lViewPos, purkinjeOverwrite, z0, texture5.r);
#endif
/* DRAWBUFFERS:35 */
gl_FragData[0] = vec4(color, 1.0);
gl_FragData[1] = vec4(vec3(0), texture5.a);
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
noperspective out vec2 texCoord;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#if defined BLOOM_FOG || LENSFLARE_MODE > 0 && defined OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif

View File

@@ -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

View File

@@ -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
#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
// 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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,514 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/enderStars.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
//Common Functions//
float GetLinearDepth(float depth) {
return (2.0 * near) / (far + near - depth * farMinusNear);
}
// Improved linear depth calculation with safety checks
float CalculateLinearDepth(float depth_sample, float near_plane, float far_plane) {
if (far_plane == near_plane)
return depth_sample > 0.5 ? 1.0 : 0.0; // Avoid division by zero or undefined behavior
float far_minus_near = far_plane - near_plane;
if (far_plane + near_plane - depth_sample * far_minus_near == 0.0)
return 1.0; // Return max linear depth
return (2.0 * near_plane) / (far_plane + near_plane - depth_sample * far_minus_near);
}
#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 DoAmbientOcclusion(float z0, float linearZ0, float dither, 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(farMinusNear * 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(depthtex0, coord1).r);
float aosample = farMinusNear * (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(depthtex0, coord2).r);
aosample = farMinusNear * (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 EPIC_THUNDERSTORM
vec3 lightningPos = getLightningPos(playerPos, lightningBoltPosition.xyz, false);
vec2 lightningAdd = lightningFlashEffect(lightningPos, vec3(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
//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"
#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 WORLD_OUTLINE || RETRO_LOOK == 1 || RETRO_LOOK == 2
#include "/lib/misc/worldOutline.glsl"
#endif
#ifdef DARK_OUTLINE
#include "/lib/misc/darkOutline.glsl"
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
#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 && defined IS_IRIS
#include "/lib/atmospherics/endFlash.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);
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
#if defined ATM_COLOR_MULTS || defined SPOOKY
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#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);
float fresnelM = 0.0;
float linearZ0_DH;
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 = DoAmbientOcclusion(z0, linearZ0, dither, playerPos);
#else
float ssao = 1.0;
#endif
vec4 texture6 = texelFetch(colortex6, texelCoord, 0).rgba;
int materialMaskInt = int(texture6.g * 255.1);
bool entityOrHand = z0 < 0.56;
float intenseFresnel = 0.0;
float smoothnessD = texture6.r;
vec3 reflectColor = vec3(1.0);
#include "/lib/materials/materialHandling/deferredMaterials.glsl"
#ifdef WORLD_OUTLINE
#ifndef WORLD_OUTLINE_ON_ENTITIES
if (!entityOrHand)
#endif
DoWorldOutline(color.rgb, linearZ0, pixelVisibilityFactor, playerPos, far);
#endif
#ifdef DARK_OUTLINE
DoDarkOutline(color.rgb, z0, pixelVisibilityFactor, playerPos, far);
#endif
color.rgb *= ssao;
#ifdef PBR_REFLECTIONS
vec3 texture4 = texelFetch(colortex4, texelCoord, 0).rgb;
normalM = mat3(gbufferModelView) * texture4;
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
#if WORLD_SPACE_REFLECTIONS_INTERNAL == -1
// Way steeper fresnel falloff on SSR-only mode to hide SSR limitation and gain performance
float fresnelFactor = (1.0 - smoothnessD) * 0.7;
fresnelM = max(fresnel - fresnelFactor, 0.0) / (1.0 - fresnelFactor);
#else
fresnelM = fresnel * 0.7 + 0.3;
#endif
fresnelM = mix(pow2(fresnelM), fresnelM * 0.75 + 0.25, intenseFresnel);
fresnelM = fresnelM * sqrt1(smoothnessD) - dither * 0.01;
#endif
waterRefColor = color.rgb;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither);
} else { // Sky
#ifdef DISTANT_HORIZONS
float z0DH = texelFetch(dhDepthTex, texelCoord, 0).r;
if (z0DH < 1.0) { // Distant Horizons Chunks
vec4 screenPosDH = vec4(texCoord, z0DH, 1.0);
vec4 viewPosDH = dhProjectionInverse * (screenPosDH * 2.0 - 1.0);
viewPosDH /= viewPosDH.w;
lViewPos = length(viewPosDH.xyz);
playerPos = ViewToPlayer(viewPosDH.xyz);
#if SSAO_QUALI > 0 || defined WORLD_OUTLINE || defined TEMPORAL_FILTER || RETRO_LOOK == 1 || RETRO_LOOK == 2
linearZ0_DH = CalculateLinearDepth(z0DH, dhNearPlane, dhFarPlane);
#endif
#if SSAO_QUALI > 0
float ssao_dh = DoAmbientOcclusionDH(z0DH, linearZ0_DH, dhDepthTex, dither);
color.rgb *= ssao_dh;
#endif
waterRefColor = color.rgb;
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither);
} else { // Start of Actual Sky
#endif
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);
#if defined ATM_COLOR_MULTS || defined SPOOKY
color.rgb *= atmColorMult;
#endif
#endif
#ifdef END
color.rgb = endSkyColor;
#ifdef END_STARS
vec3 starColor = GetEnderStars(viewPos.xyz, 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(viewPos.xyz, VdotU, 0.66, 0.0));
#endif
#if ADD_STAR_LAYER_END2
starColor = max(starColor, GetEnderStars(viewPos.xyz, VdotU, 2.2, 0.33));
#endif
color.rgb += starColor;
color.rgb *= 1.0 - maxBlindnessDarkness;
#endif
#if MC_VERSION >= 12109 && defined IS_IRIS && EP_END_FLASH > 0
if (endFlashIntensity > 0.0) {
color.rgb += DrawEndFlash(nViewPos, VdotU, dither);
}
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
color.rgb *= atmColorMult;
#endif
#endif
#ifdef DISTANT_HORIZONS
} // End of Actual Sky
#endif
}
#if defined NETHER && NETHER_NOISE == 1
netherNoise = GetNetherNoise(viewPos.xyz, VdotU, dither);
color.rgb += pow4(skyFade) * netherNoise;
#endif
#ifdef END
#ifdef END_SMOKE
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos.xyz * 1000.0, 1.0)).xyz);
vec3 endSmoke = texture2DLod(noisetex, (wpos.xz / wpos.y) * 0.5 + frameTimeCounter * 0.004, 0.0).g * abs(VdotU) * endSkyColor * 1.5;
color.rgb += pow4(skyFade) * endSmoke * (1.0 - maxBlindnessDarkness);
#endif
#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
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);
#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
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
/*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));
#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

View File

@@ -0,0 +1,296 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/materials.glsl"
#include "/lib/shaderSettings/SSAO.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 playerPos;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
vec2 lmCoordM = lmCoord;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/util/dither.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.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
#if defined ATM_COLOR_MULTS || defined SPOOKY
atmColorMult = GetAtmColorMult();
#endif
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false;
int subsurfaceMode = 0;
float smoothnessG = 0.0, smoothnessD = 0.0, highlightMult = 1.0, emission = 0.0, snowFactor = 1.0, snowMinNdotU = 0.0, noPuddles = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0), maRecolor = vec3(0.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float overlayNoiseEmission = 1.0;
float IPBRMult = 1.0;
bool isFoliage = false;
vec3 dhColor = color.rgb;
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
float lavaNoiseIntensity = LAVA_NOISE_INTENSITY;
float dhSSAOBrightnessBoost = 1.05;
if (mat == DH_BLOCK_LEAVES) {
#include "/lib/materials/specificMaterials/terrain/leaves.glsl"
dhSSAOBrightnessBoost = 1.35; // make brighter to compensate SSAO
#ifdef SPOOKY
int seed = worldDay / 2; // Thanks to Bálint
int currTime = (worldDay % 2) * 24000 + worldTime; // Effect happens every 2 minecraft days
float randomTime = 24000 * hash1(worldDay * 5); // Effect happens randomly throughout the day
int timeWhenItHappens = (int(hash1(seed)) % (2 * 24000)) + int(randomTime);
if (currTime > timeWhenItHappens && currTime < timeWhenItHappens + 100) { // 100 in ticks - 5s, how long the effect will be on, aka leaves are gone
discard; // disable leaves
}
#endif
} else if (mat == DH_BLOCK_GRASS) {
smoothnessG = pow2(color.g) * 0.85;
dhSSAOBrightnessBoost = mix(1.0, 1.2, 1.0 - clamp01(dot(worldGeoNormal, ViewToPlayer(upVec)))); // only make brighter on the sides
} else if (mat == DH_BLOCK_SNOW) {
#include "/lib/materials/specificMaterials/terrain/snow.glsl"
dhSSAOBrightnessBoost = 1.19;
} else if (mat == DH_BLOCK_LAVA) {
#include "/lib/materials/specificMaterials/terrain/lava.glsl"
#ifndef NETHER
color.rgb *= 0.75;
#else
color.rgb *= 0.89;
#endif
dhSSAOBrightnessBoost = 0.9;
} else if (mat == DH_BLOCK_ILLUMINATED) {
emission = 2.5;
snowNoiseIntensity = 0.0;
sandNoiseIntensity = 0.2;
mossNoiseIntensity = 0.2;
dhSSAOBrightnessBoost = 1.2;
}
#if SSAO_QUALI > 0
color.rgb *= dhSSAOBrightnessBoost;
#endif
#ifdef SNOWY_WORLD
DoSnowyWorld(color, smoothnessG, highlightMult, smoothnessD, emission,
playerPos, lmCoord, snowFactor, snowMinNdotU, NdotU, subsurfaceMode);
#endif
vec3 playerPosAlt = ViewToPlayer(viewPos); // AMD has problems with vertex playerPos and DH
float lengthCylinder = max(length(playerPosAlt.xz), abs(playerPosAlt.y));
highlightMult *= 0.5 + 0.5 * pow2(1.0 - smoothstep(far, far * 1.5, lengthCylinder));
color.a *= smoothstep(far * 0.5, far * 0.7, lengthCylinder);
if (color.a < min(dither, 1.0)) discard;
vec3 noisePos = floor((playerPos + cameraPosition) * 4.0 + 0.001) / 32.0;
float noiseTexture = Noise3D(noisePos) + 0.5;
float noiseFactor = max0(1.0 - 0.3 * dot(color.rgb, color.rgb));
color.rgb *= pow(noiseTexture, 0.6 * noiseFactor);
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#define GBUFFERS_TERRAIN
#include "/lib/materials/overlayNoiseApply.glsl"
#undef GBUFFERS_TERRAIN
#endif
#if SEASONS > 0
#define GBUFFERS_TERRAIN
#include "/lib/materials/seasons.glsl"
#undef GBUFFERS_TERRAIN
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead);
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = gl_FragData[1] = vec4(smoothnessG, 0.0, 0.0, lmCoordM.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 playerPos;
out vec4 glColor;
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
mat = dhMaterialId;
lmCoord = GetLightMapCoordinates();
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif

View File

@@ -0,0 +1,319 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
#include "/lib/shaderSettings/water.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 playerPos;
in vec3 viewVector;
in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
vec2 lmCoordM = lmCoord;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
eastVec.x, northVec.x, normal.x,
eastVec.y, northVec.y, normal.y,
eastVec.z, northVec.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#include "/lib/atmospherics/fog/mainFog.glsl"
float vlFactor = 0.0;
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#endif
#if (AURORA_STYLE > 0 || defined AURORA_INFLUENCE) && defined OVERWORLD
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0
#if defined SKY_EFFECT_REFLECTION && defined OVERWORLD
#include "/lib/atmospherics/stars.glsl"
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#endif
#ifdef VL_CLOUDS_ACTIVE
#include "/lib/atmospherics/clouds/mainClouds.glsl"
#endif
#endif
#include "/lib/materials/materialMethods/reflections.glsl"
#endif
#ifdef ATM_COLOR_MULTS
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#if PIXEL_WATER > 0
#include "/lib/materials/materialMethods/waterProcedureTexture.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 colorP = vec4(vec3(0.85), glColor.a);
vec4 color = glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
if (texture2D(depthtex1, screenPos.xy).r < 1.0) discard;
float lViewPos = length(playerPos);
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef ATM_COLOR_MULTS
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
#ifdef VL_CLOUDS_ACTIVE
float cloudLinearDepth = texelFetch(gaux2, texelCoord, 0).a;
if (pow2(cloudLinearDepth + OSIEBCA * dither) * renderDistance < min(lViewPos, renderDistance)) discard;
#endif
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false;
#ifdef GENERATED_NORMALS
bool noGeneratedNormals = false;
#endif
int subsurfaceMode = 0;
float smoothnessG = 0.0, highlightMult = 0.0, emission = 0.0, materialMask = 0.0, reflectMult = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
float SSBLAlpha = 1.0;
if (mat == DH_BLOCK_WATER) {
#ifdef SHADER_WATER
#include "/lib/materials/specificMaterials/translucents/water.glsl"
#endif
color.rgb *= 1.2; // compensates for lack of texture and material reflections
}
float fresnelM = (pow3(fresnel) * 0.85 + 0.15) * reflectMult;
float lengthCylinder = max(length(playerPos.xz), abs(playerPos.y) * 2.0);
color.a *= smoothstep(far * 0.5, far * 0.7, lengthCylinder);
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#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
bool isLightSource = lmCoord.x > 0.99;
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
centerShadowBias, subsurfaceMode, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
vec3 normalizedColor = normalize(color.rgb);
vec3 lightAlbedo = normalizedColor * step(0.6, lmCoord.x);
#endif
// Reflections
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#if WATER_REFLECT_QUALITY >= 0
#ifdef LIGHT_COLOR_MULTS
highlightColor *= lightColorMult;
#endif
#ifdef MOON_PHASE_INF_REFLECTION
highlightColor *= pow2(moonPhaseInfluence);
#endif
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, -1.0,
dhDepthTex1, dither, skyLightFactor, fresnel,
smoothnessG, geoNormal, color.rgb, shadowMult, highlightMult, 0.0, vec2(0.0));
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
#endif
////
float sky = 0.0;
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither);
float fogAlpha = color.a;
color.a = prevAlpha * (1.0 - sky);
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessG, 0.0, skyLightFactor, lmCoordM.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, SSBLAlpha);
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:06948 */
gl_FragData[3] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[4] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
#else
#if WORLD_SPACE_REFLECTIONS > 0
/* DRAWBUFFERS:0648 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[3] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 playerPos;
out vec3 viewVector;
out vec4 glColor;
//Attributes//
attribute vec4 at_tangent;
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
mat = dhMaterialId;
lmCoord = GetLightMapCoordinates();
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
mat3 tbnMatrix = mat3(
eastVec.x, northVec.x, normal.x,
eastVec.y, northVec.y, normal.y,
eastVec.z, northVec.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif

View File

@@ -0,0 +1,550 @@
//////////////////////////////////////////
// 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);
//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;
}
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;
}
vec3 sampleCell(sampler2D tex, vec2 origin, vec2 size, int count) {
vec3 sum = vec3(0.0);
float fCount = float(count);
for (int i = 0; i < count * count; i++) {
vec2 offset = vec2(mod(float(i), fCount) + 0.5, floor(float(i) / fCount) + 0.5) / fCount;
sum += texture2D(tex, origin + size * offset).rgb;
}
return sum / (fCount * fCount);
}
vec3 createPixelation(sampler2D tex, vec2 uv, float pixelSize, float sampleCount) {
vec2 cellSize = vec2(float(int(ceil(256.0 / pixelSize) + 1) & ~1)) / vec2(viewWidth, viewHeight);
vec2 cellOrigin = floor(uv / cellSize) * cellSize;
sampleCount = max0(sampleCount) + 1.0;
return mix(
sampleCell(tex, cellOrigin, cellSize, int(sampleCount)),
sampleCell(tex, cellOrigin, cellSize, int(sampleCount) + 1),
fract(sampleCount)
);
}
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;
#if defined SPOOKY && (!defined RETRO_ON || !defined VERTICAL_SCREEN_DISPLACEMENT)
float randomShutterTime = 24000.0 * hash1(worldDay * 5);
int displaceEffect = int(hash1(worldDay / 2)) % (2 * 24000) + int(randomShutterTime);
displaceEffectOn = 0.0;
if (worldTime > displaceEffect && worldTime < displaceEffect + 100.0) {
displaceEffectOn = 1.0;
}
#endif
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);
}
#ifdef IS_IRIS
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);
}
#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
//Program//
void main() {
vec3 color = vec3(0.0);
float viewWidthM = viewWidth;
float viewHeightM = viewHeight;
float animation = 0.0;
#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) || defined SPOOKY
float verticalOffset = 0.0;
applyVerticalScreenDisplacement(texCoordM, verticalOffset, VERTICAL_SCROLL_SPEED, VERTICAL_STUTTER_SPEED, VERTICAL_EDGE_GLITCH, true);
#endif
#if WATERMARK > 0 && defined IS_IRIS
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
#ifdef UNDERWATER_DISTORTION
if (isEyeInWater == 1)
texCoordM += WATER_REFRACTION_INTENSITY * 0.00035 * sin((texCoord.x + texCoord.y) * 25.0 + frameTimeCounter * UNDERWATER_DISTORTION_STRENGTH);
#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
float heatAmount = max(0.0, eyeBrightnessSmooth.x / 240.0 - 0.2) * 1.25;
float verticalFalloff = 1.0 - pow3(texCoord.y); // More intensity at bottom of screen (heat rising effect)
float lightmap = texture6.a;
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((texCoord.y * NETHER_HEAT_DISTORTION_SCALE * freqY1) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 1.3) * 0.7 +
sin((texCoord.y * NETHER_HEAT_DISTORTION_SCALE * freqY2) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 0.9) * 0.2,
sin((texCoord.x * NETHER_HEAT_DISTORTION_SCALE * freqX1) + frameTimeCounter * NETHER_HEAT_DISTORTION_SPEED * 1.5) * 0.7 +
sin((texCoord.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;
texCoordM += heatDistort * 0.00012 * NETHER_HEAT_DISTORTION * distortionMask;
#endif
#if defined PIXELATE_SCREEN
#define textureFinal(tex) createPixelation(tex, texCoord, PIXELATED_SCREEN_SIZE, PIXELATED_SCREEN_SMOOTHNESS).rgb
#else
#define textureFinal(tex) texture2D(tex, texCoordM).rgb
#endif
#if LONG_EXPOSURE > 0
if (hideGUI == 0 || isViewMoving()) {
color = textureFinal(colortex3);
} else {
color = textureFinal(colortex2);
}
#else
color = textureFinal(colortex3);
#endif
#if CHROMA_ABERRATION > 0 || defined SPOOKY
vec2 scale = vec2(1.0, viewHeight / viewWidth);
#ifdef SPOOKY
float aberrationStrength = max(CHROMA_ABERRATION, playerMood * 10.0);
#else
float aberrationStrength = CHROMA_ABERRATION;
#endif
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
#if IMAGE_SHARPENING > 0 && !defined PIXELATE_SCREEN
#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
viewWidth M = 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), texture10.rgb, texture6.a);
DoWorldOutline(color, z0, 1.0, vec3(1.0), far);
#endif
#if WATERMARK > 0 && defined IS_IRIS
#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) || defined SPOOKY
float staticIntensity = 0.0;
#ifdef SPOOKY
if (playerMood > 0.9) staticIntensity = (playerMood * 10.0 - 9.0) * 0.75;
#else
staticIntensity = STATIC_NOISE * 0.1;
#endif
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
#ifdef SPOOKY
color.rgb = mix(color.rgb, color.rgb * GetLuminance(color), 0.60);
#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
#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"
// Example of printing a float value (for debugging)
// float placeholder = texture2D(colortex2, ivec2(0)).g;
// beginTextM(2, vec2(5));
// text.fpPrecision = 6;
// printFloat(placeholder);
// endText(color.rgb);
// color.rgb = texture2D(colortex9, 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

View File

@@ -0,0 +1,104 @@
//////////////////////////////////////////
// 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
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

View File

@@ -0,0 +1,223 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec2 lmCoord;
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
//Common Functions//
//Includes//
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
//Program//
void main() {
vec4 color = glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float materialMask = 0.0;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0, emission = 0.0, enderDragonDead = 1.0;
#ifndef GBUFFERS_LINE
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoord, false, false, false,
false, 0, 0.0, 0.0, 0.0, purkinjeOverwrite, false,
enderDragonDead);
#endif
if (abs(color.a - 0.4) + dot(color.rgb, color.rgb) < 0.01) {
#if SELECT_OUTLINE == 0
discard;
#elif SELECT_OUTLINE == 2 // Rainbow
float posFactor = playerPos.x + playerPos.y + playerPos.z + cameraPosition.x + cameraPosition.y + cameraPosition.z;
color.rgb = clamp(abs(mod(fract(frameTimeCounter*0.25 + posFactor*0.2) * 6.0 + vec3(0.0,4.0,2.0), 6.0) - 3.0) - 1.0,
0.0, 1.0) * vec3(3.0, 2.0, 3.0) * SELECT_OUTLINE_I;
#elif SELECT_OUTLINE == 3 // Select Color
color.rgb = vec3(SELECT_OUTLINE_R, SELECT_OUTLINE_G, SELECT_OUTLINE_B) * SELECT_OUTLINE_I;
#elif SELECT_OUTLINE == 4 // Versatile
color.a = 0.1;
#endif
materialMask = OSIEBCA * 252.0; // Selection Outline
#ifdef SELECT_OUTLINE_AUTO_HIDE
if (heldItemId == 40008 && (
heldItemId2 == 40008 ||
heldItemId2 == 45060 ||
heldItemId2 == 45108 ||
heldItemId2 >= 44000 &&
heldItemId2 < 45000)) {
// Both hands hold nothing or only a light/totem/shield in off-hand
discard;
}
#endif
}
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
#if COLORED_LIGHTING_INTERNAL > 0 && defined NETHER
if (gl_FragCoord.x < 0.0)
color = shadow2D(shadowtex0, vec3(0.5)); // To Activate Shadowmap in Nether
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL > 0 && !defined GBUFFERS_LINE
if (color.a == 1.0 && GetLuminance(color.rgb) > 0.9999 && color.g > 0.9999 && color.b > 0.9999) {
discard;
}
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(0.0, 0.0, 0.0, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
flat out vec4 glColor;
//Attributes//
#ifdef WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
#ifndef GBUFFERS_LINE
gl_Position = ftransform();
#else
float lineWidth = 2.0;
vec2 screenSize = vec2(viewWidth, viewHeight);
const mat4 VIEW_SCALE = mat4(mat3(1.0 - (1.0 / 256.0)));
vec4 linePosStart = projectionMatrix * VIEW_SCALE * modelViewMatrix * vec4(vaPosition, 1.0);
vec4 linePosEnd = projectionMatrix * VIEW_SCALE * modelViewMatrix * (vec4(vaPosition + vaNormal, 1.0));
vec3 ndc1 = linePosStart.xyz / linePosStart.w;
vec3 ndc2 = linePosEnd.xyz / linePosEnd.w;
vec2 lineScreenDirection = normalize((ndc2.xy - ndc1.xy) * screenSize);
vec2 lineOffset = vec2(-lineScreenDirection.y, lineScreenDirection.x) * lineWidth / screenSize;
if (lineOffset.x < 0.0)
lineOffset *= -1.0;
if (gl_VertexID % 2 == 0)
gl_Position = vec4((ndc1 + vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
else
gl_Position = vec4((ndc1 - vec3(lineOffset, 0.0)) * linePosStart.w, linePosStart.w);
#endif
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#if !defined GBUFFERS_LINE && (defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING)
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
}
#endif

View File

@@ -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);
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

View File

@@ -0,0 +1,487 @@
//////////////////////////////////////////
// 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;
#ifdef GBUFFERS_COLORWHEEL
vec2 lmCoord;
#else
in vec2 lmCoord;
#endif
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
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if SEASONS > 0 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoise.glsl"
#endif
#ifdef PORTAL_EDGE_EFFECT
#include "/lib/voxelization/lightVoxelization.glsl"
#endif
#if SHOCKWAVE > 0
#include "/lib/misc/shockwave.glsl"
#endif
//Program//
void main() {
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
vec3 worldPos = playerPos + cameraPosition;
#if SHOCKWAVE > 0
vec4 color = doShockwave(playerPos + relativeEyePosition, texCoord);
#else
vec4 color = texture2D(tex, texCoord);
#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 *= glColor;
#endif
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef DISTANT_HORIZONS
if (getDHFadeFactor(playerPos) < dither) {
discard;
}
#endif
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float IPBRMult = 1.0;
int subsurfaceMode = 0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#if defined ATM_COLOR_MULTS || defined SPOOKY
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
bool noSmoothLighting = false, noDirectionalShading = false;
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = 0.0, enderDragonDead = 1.0;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0;
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
float purkinjeOverwrite = 0.0;
if (lmCoord.x > 0.99) { // Mod support for light level 15 (and all light levels with iris 1.7) light sources
if (blockEntityId == 0) {
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, 1.0, 15, 0.0);
}
overlayNoiseIntensity = 0.0;
}
if (blockEntityId < 21025 && blockEntityId > 20999){
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, 1.0, 15, 1.0);
}
if (blockEntityId == 5017) { // Player Head
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
#ifdef IPBR
#include "/lib/materials/materialHandling/blockEntityIPBR.glsl"
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (blockEntityId == 5024) { // End Portal, End Gateway
#ifdef SPECIAL_PORTAL_EFFECTS
#include "/lib/materials/specificMaterials/others/endPortalEffect.glsl"
#endif
overlayNoiseIntensity = 0.0;
} else if (blockEntityId == 5004) { // Signs
noSmoothLighting = true;
if (glColor.r + glColor.g + glColor.b <= 2.99 || lmCoord.x > 0.999) { // Sign Text
#include "/lib/materials/specificMaterials/others/signText.glsl"
}
} else if (blockEntityId == 5020) { // Conduit
overlayNoiseIntensity = 0.3;
} else if (blockEntityId == 5012) { // Ender Chest
overlayNoiseIntensity = 0.5;
} else {
noSmoothLighting = true;
}
#endif
#if defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
#include "/lib/materials/overlayNoiseApply.glsl"
#endif
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
#ifdef GENERATED_NORMALS
GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, false,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
if (blockEntityId == 5004) lightAlbedo = vec3(0.0); // fix glowing sign text affecting blocklight color
#endif
skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, blockEntityId);
#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, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, 0.0);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, 0.0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#ifdef END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
layout(r32i) uniform iimage2D endcrystal_img;
#endif
out vec2 texCoord;
#ifdef GBUFFERS_COLORWHEEL
vec2 lmCoord;
#else
out vec2 lmCoord;
#endif
flat out int mat;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 atMidBlock;
out vec4 glColor;
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat out ivec2 pixelTexSize;
// #endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
attribute vec4 mc_midTexCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
attribute vec4 at_tangent;
#endif
attribute vec4 at_midBlock;
attribute vec4 mc_Entity;
//Common Variables//
//Common Functions//
//Includes//
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.1, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
mat = int(mc_Entity.x + 0.5);
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
atMidBlock = at_midBlock.xyz;
if (normal != normal) normal = -upVec; // Mod Fix: Fixes Better Nether Fireflies
#ifdef END_PORTAL_BEAM_INTERNAL
if (blockEntityId == 5024 && length((gl_ModelViewMatrix * gl_Vertex).xyz) < 28) // end portal
imageStore(endcrystal_img, ivec2(35, 4), ivec4(1));
#endif
#ifdef IPBR
/*if (blockEntityId == 5024) { // End Portal, End Gateway
gl_Position.z -= 0.002;
}*/
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || SHOCKWAVE > 0
if (blockEntityId == 5008) { // Chest
float fractWorldPosY = fract((gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).y + cameraPosition.y);
if (fractWorldPosY > 0.56 && 0.57 > fractWorldPosY) gl_Position.z -= 0.0001;
}
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// ivec2 pixelTexSize = ivec2(absMidCoordPos * 2.0 * atlasSize);
// #endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif

View File

@@ -0,0 +1,180 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/clouds.glsl"
#include "/lib/shaderSettings/cloudsAndLighting.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
#if CLOUD_STYLE_DEFINE == 50
// We use CLOUD_STYLE_DEFINE instead of CLOUD_STYLE in this file because Optifine can't use generated defines for pipeline stuff
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec4 glColor;
#endif
//Pipeline Constants//
//Common Variables//
#if CLOUD_STYLE_DEFINE == 50
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
#endif
//Common Functions//
//Includes//
#if CLOUD_STYLE_DEFINE == 50
#include "/lib/colors/skyColors.glsl"
#include "/lib/util/spaceConversion.glsl"
#if defined TAA && (defined BORDER_FOG || RAINBOW_CLOUD != 0 || defined AURORA_INFLUENCE)
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
#include "/lib/colors/moonPhaseInfluence.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#endif
//Program//
void main() {
#if CLOUD_STYLE_DEFINE != 50
discard;
#else
vec4 color = texture2D(tex, texCoord) * glColor;
vec4 translucentMult = vec4(mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a), 1.0);
#if defined BORDER_FOG || RAINBOW_CLOUD != 0 || defined AURORA_INFLUENCE
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
#ifdef TAA
vec3 viewPos = ScreenToView(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
#else
vec3 viewPos = ScreenToView(screenPos);
#endif
vec3 playerPos = ViewToPlayer(viewPos);
float xzMaxDistance = max(abs(playerPos.x), abs(playerPos.z));
#if MC_VERSION < 12106
float cloudDistance = 375.0;
#else
float cloudDistance = 2000.0;
#endif
cloudDistance = clamp((cloudDistance - xzMaxDistance) / cloudDistance, 0.0, 1.0);
color.a *= clamp01(cloudDistance * 3.0);
#endif
color.a *= CLOUD_TRANSPARENCY;
#ifdef OVERWORLD
vec3 cloudLight = mix(vec3(0.8, 1.6, 1.5) * sqrt1(nightFactor), mix(dayDownSkyColor, dayMiddleSkyColor, 0.1), sunFactor);
#if RAINBOW_CLOUD != 0
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz);
wpos /= (abs(wpos.y) + length(wpos.xz));
cloudLight *= getRainbowColor(wpos.xz * rainbowCloudDistribution * 0.3, 0.05);
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
cloudLight *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
cloudLight = mix(AuroraAmbientColor(cloudLight, viewPos), cloudLight, auroraSpookyMix);
#endif
#ifdef SPOOKY
color.rgb *= 0.5;
#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
#if defined ATM_COLOR_MULTS || defined SPOOKY
color.rgb *= sqrt(GetAtmColorMult()); // C72380KD - Reduced atmColorMult impact on things
#endif
#ifdef MOON_PHASE_INF_ATMOSPHERE
color.rgb *= moonPhaseInfluence;
#endif
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:063 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);
gl_FragData[2] = vec4(1.0 - translucentMult.rgb, translucentMult.a);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
#if CLOUD_STYLE_DEFINE == 50
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec4 glColor;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
#if CLOUD_STYLE_DEFINE == 50
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#endif
//Program//
void main() {
#if CLOUD_STYLE_DEFINE != 50
gl_Position = vec4(-1.0);
#else
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
glColor = gl_Color;
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#ifdef TAA
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
#endif
#endif
}
#endif

View File

@@ -0,0 +1,93 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
//Common Functions//
//Includes//
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color.rgb *= glColor.rgb;
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
vec2 lmCoord = GetLightMapCoordinates();
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif

View File

@@ -0,0 +1,472 @@
//////////////////////////////////////////
// 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
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
flat in vec2 midCoord;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
in vec3 viewVector;
in vec4 vTexCoordAM;
#endif
//Pipeline Constants//
//Common Variables//
float NdotU = dot(normal, upVec);
float NdotUmax0 = max(NdotU, 0.0);
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
float shadowTimeVar1 = abs(sunVisibility - 0.5) * 2.0;
float shadowTimeVar2 = shadowTimeVar1 * shadowTimeVar1;
float shadowTime = shadowTimeVar2 * shadowTimeVar2;
float skyLightCheck = 0.0;
float entitySSBLMask = 1.0;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
#include "/lib/util/miplevel.glsl"
#endif
#ifdef GENERATED_NORMALS
#include "/lib/materials/materialMethods/generatedNormals.glsl"
#endif
#ifdef COATED_TEXTURES
#include "/lib/materials/materialMethods/coatedTextures.glsl"
#endif
#if IPBR_EMISSIVE_MODE != 1
#include "/lib/materials/materialMethods/customEmission.glsl"
#endif
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.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, skyLightFactor = 0.0, materialMask = OSIEBCA * 254.0, enderDragonDead = 1.0; // No SSAO, No TAA
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(1.0);
vec3 lightAlbedo = vec3(0.0);
float alphaCheck = color.a;
#ifdef DO_PIXELATION_EFFECTS
// Fixes artifacts on fragment edges with non-nvidia gpus
if (entityId != 50112) alphaCheck = max(fwidth(color.a), alphaCheck); // Except for nametags as that causes issues
#endif
if (alphaCheck > 0.001) {
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseEmission = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
#if SEASONS > 0
#include "/lib/materials/seasons.glsl"
#endif
#if MONOTONE_WORLD > 0
#if MONOTONE_WORLD == 1
color.rgb = vec3(1.0);
#elif MONOTONE_WORLD == 2
color.rgb = vec3(0.0);
#else
color.rgb = vec3(0.5);
#endif
#endif
float dither = Bayer64(gl_FragCoord.xy);
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#ifdef DISTANT_HORIZONS
if (entityId != 0 && getDHFadeFactor(playerPos) < dither) {
discard;
}
#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;
if (entityId == 50016 || entityId == 50017) { // Player
#include "/lib/materials/specificMaterials/others/SpacEagle17.glsl"
}
#ifdef IPBR
#include "/lib/materials/materialHandling/entityIPBR.glsl"
#ifdef IS_IRIS
vec3 maRecolor = vec3(0.0);
#include "/lib/materials/materialHandling/irisIPBR.glsl"
#endif
if (materialMask != OSIEBCA * 254.0) materialMask += OSIEBCA * 100.0; // Entity Reflection Handling
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (entityId == 50004) { // Lightning Bolt
#include "/lib/materials/specificMaterials/entities/lightningBolt.glsl"
} else if (entityId == 50008) { // Item Frame, Glow Item Frame
noSmoothLighting = true;
} else if (entityId == 50016 || entityId == 50017) { // Player
#if IRIS_VERSION >= 10800
if (entityId == 50017) entitySSBLMask = 0.0;
#else
if (length(playerPos) < 4.0) entitySSBLMask = 0.0;
#endif
} else if (entityId == 50076) { // Boats
playerPos.y += 0.38; // consistentBOAT2176
}
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
if (entityId == 50020) { // blaze
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50052) { // Magma Cube
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50088) { // Entity Flame
color.rgb = changeColorFunction(color.rgb, 2.0, colorSoul, inSoulValley);
} else if (entityId == 50092 || entityId == 50093) { // fireball, small fireball
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
}
#endif
#endif
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
normalM = gl_FrontFacing ? normalM : -normalM; // Inverted Normal Workaround
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
#ifdef SS_BLOCKLIGHT
lightAlbedo = normalize(color.rgb) * min1(emission);
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
true, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#if defined IPBR && defined IS_IRIS
color.rgb += maRecolor;
#endif
skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
emissionOld = emission;
}
#ifdef ENTITIES_ARE_LIGHT
entitySSBLMask = 1.0;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emissionOld));
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 1
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, entitySSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, entitySSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && defined IS_IRIS
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 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
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#ifdef GBUFFERS_ENTITIES_GLOWING
if (glColor.a > 0.99) gl_Position.z *= 0.01;
#endif
#ifdef EMIN_BOAT
if (entityId == 50076) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
position.y += 1.25;
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
}
#endif
#ifdef FLICKERING_FIX
if (entityId == 50008 || entityId == 50012) { // Item Frame, Glow Item Frame
if (dot(normal, upVec) > 0.99) {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
vec3 comPos = fract(position.xyz + cameraPosition);
comPos = abs(comPos - vec3(0.5));
if ((comPos.y > 0.437 && comPos.y < 0.438) || (comPos.y > 0.468 && comPos.y < 0.469)) {
gl_Position.z += 0.0001;
}
}
if (gl_Normal.y == 1.0) { // Maps
normal = upVec * 2.0;
}
} else if (entityId == 50084) { // Slime, Chicken
gl_Position.z -= 0.00015;
}
#if SHADOW_QUALITY == -1
#ifdef VANILLA_ENTITY_SHADOWS
if (glColor.a < 0.5) gl_Position.z -= 0.0005;
#else
if (glColor.a < 0.5) gl_Position.z += 0.0005;
#endif
#endif
#endif
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
#if END_CRYSTAL_VORTEX_INTERNAL / 2 == 1
if (entityId == 50200) {
gl_Position = vec4(-1);
}
#endif
#if DRAGON_DEATH_EFFECT_INTERNAL > 0 && !defined IRIS_TAG_SUPPORT
if (entityId == 0 && gl_Color.a < 0.2 && abs(normal.y) < 0.2) {
glColor.a = -100000.0;
}
#endif
}
#endif

View File

@@ -0,0 +1,357 @@
//////////////////////////////////////////
// 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
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
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.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, skyLightFactor = 0.0, materialMask = OSIEBCA * 254.0, enderDragonDead = 1.0; // No SSAO, No TAA
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, shadowMult = vec3(0.5); // Reduced shadowMult for held items to not get too bright
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = vec3(0.0);
#endif
float alphaCheck = color.a;
#ifdef DO_PIXELATION_EFFECTS
// Fixes artifacts on fragment edges with non-nvidia gpus
alphaCheck = max(fwidth(color.a), alphaCheck);
#endif
if (alphaCheck > 0.001) {
#if defined GENERATED_NORMALS || PIXEL_WATER == 1
vec3 colorP = color.rgb;
#endif
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z + 0.38);
vec3 viewPos = ScreenToView(screenPos);
vec3 playerPos = ViewToPlayer(viewPos);
if (color.a < 0.75) materialMask = 0.0;
bool noSmoothLighting = true, noGeneratedNormals = false, noDirectionalShading = false, noVanillaAO = false;
float smoothnessG = 0.0, highlightMult = 1.0, noiseFactor = 0.6;
vec3 geoNormal = normalM;
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
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
#ifdef IS_IRIS
vec3 maRecolor = vec3(0.0);
#include "/lib/materials/materialHandling/irisIPBR.glsl"
if (materialMask != OSIEBCA * 254.0) materialMask += OSIEBCA * 100.0; // Entity Reflection Handling
#endif
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#ifdef COATED_TEXTURES
CoatTextures(color.rgb, noiseFactor, playerPos, false);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, 0.0);
#endif
#endif
// Support for modded light sources and blockID set by the user
#if defined IS_IRIS && !defined MC_OS_MAC
if (currentRenderedItemId == 0) {
float screenWidth = viewPos.x;
float region1End = -0.1; // End of the first 2/5 region
float region2Start = 0.1; // Start of the last 2/5 region
int heldBlockLight = 0;
if (screenWidth <= region1End || screenWidth >= region2Start) {
heldBlockLight = (viewPos.x > 0.0 ^^ isRightHanded) ? heldBlockLightValue2 : heldBlockLightValue;
}
if (heldBlockLight > 0) {
bool doesNothing;
emission = DoAutomaticEmission(noSmoothLighting, doesNothing, color.rgb, 0.0, heldBlockLight, 0.0);
}
}
#endif
#ifdef SS_BLOCKLIGHT
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoord.x);
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#endif
emission *= EMISSION_MULTIPLIER;
DoLighting(color, shadowMult, playerPos, viewPos, 0.0, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, noDirectionalShading, noVanillaAO,
false, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, false,
enderDragonDead);
#ifdef SS_BLOCKLIGHT
lightAlbedo = normalize(color.rgb) * min1(emission);
#endif
#if defined IPBR && defined IS_IRIS
color.rgb += maRecolor;
#endif
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
float purkinjeData = 1.0;
#if defined IS_IRIS || MC_VERSION >= 11600
purkinjeData = lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission);
#endif
/* DRAWBUFFERS:06 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, purkinjeData);
#if BLOCK_REFLECT_QUALITY >= 2 && (RP_MODE >= 2 || defined IS_IRIS)
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, handSSBLMask);
#endif
#elif defined SS_BLOCKLIGHT
/* DRAWBUFFERS:069 */
gl_FragData[2] = vec4(lightAlbedo, handSSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec4 glColor;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && defined IS_IRIS
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
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
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if HAND_SWAYING > 0
#include "/lib/misc/handSway.glsl"
#endif
}
#endif

View File

@@ -0,0 +1,301 @@
//////////////////////////////////////////
// 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
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;
#ifdef OVERWORLD
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
#else
vec3 lightVec = sunVec;
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
#endif
//Common Functions//
//Includes//
#include "/lib/util/dither.glsl"
#include "/lib/util/spaceConversion.glsl"
#include "/lib/lighting/mainLighting.glsl"
#ifdef CUSTOM_PBR
#include "/lib/materials/materialHandling/customMaterials.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
if (glColor.a < 0.0) discard;
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
vec4 color = texture2D(tex, texCoord);
#if defined GENERATED_NORMALS || PIXEL_WATER == 1
vec3 colorP = color.rgb;
#endif
color *= glColor;
float smoothnessD = 0.0, materialMask = OSIEBCA * 254.0, enderDragonDead = 1.0; // No SSAO, No TAA
vec3 normalM = normal, lightAlbedo = vec3(0.0), shadowMult = vec3(1.0);
float purkinjeOverwrite = 0.0, emission = 0.0;
vec2 lmCoordM = lmCoord;
if (color.a > 0.001) {
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 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 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
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
bool noSmoothLighting = atlasSize.x < 600.0; // To fix fire looking too dim
bool noGeneratedNormals = false;
float smoothnessG = 0.0, highlightMult = 0.0, noiseFactor = 0.75;
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (entityId == 50004
#if MC_VERSION >= 12105 && defined IS_IRIS
|| color.r < 0.45 && color.g < 0.45 && color.b < 0.5 && gl_Color.a == 0.0
#endif
) { // Lightning Bolt
#include "/lib/materials/specificMaterials/entities/lightningBolt.glsl"
}
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);
#endif
emission *= EMISSION_MULTIPLIER;
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, 0.5,
worldGeoNormal, lmCoordM, noSmoothLighting, false, false,
true, 0, smoothnessG, highlightMult, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
}
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#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 >= 1
/* DRAWBUFFERS:064 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 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;
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && defined IS_IRIS
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
//Pipeline Constants//
#if DRAGON_DEATH_EFFECT_INTERNAL > 0
#extension GL_ARB_shader_image_load_store : enable
#endif
//Attributes//
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || (defined IPBR && defined IS_IRIS) || 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//
#include "/lib/util/spaceConversion.glsl"
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
#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;
#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
midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#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 DRAGON_DEATH_EFFECT_INTERNAL > 0
if (entityId == 0 && (gl_Color.a < 0.2 || gl_Color.a == 1.0)) { // Only lightning bolts and dragon death effect run in this program, lightning has an entity ID assigned
glColor.a = -100000.0;
SetEndDragonDeath();
}
#endif
}
#endif

View File

@@ -0,0 +1,271 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/stars.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 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;
//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
#if defined ATM_COLOR_MULTS || defined SPOOKY
#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);
#ifdef OVERWORLD
if (vanillaStars > 0.5) {
discard;
}
#if IRIS_VERSION >= 10800 && IRIS_VERSION < 10805
if (renderStage == MC_RENDER_STAGE_MOON) {
discard; // Fixes the vanilla sky gradient causing the sun to disappear
}
#endif
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
vec3 nViewPos = normalize(viewPos.xyz);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float dither = Bayer8(gl_FragCoord.xy);
color.rgb = GetSky(VdotU, VdotS, dither, true, false);
#ifdef 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;
#ifdef SPOOKY
sunBrightness = 18.0;
#endif
color.rgb = mix(color.rgb, vec3(0.9, 0.5, 0.3) * sunBrightness, sunMoonMixer);
} else {
float horizonFactor = GetHorizonFactor(-SdotU);
sunMoonMixer = max0(sunMoonMixer - 0.25) * 1.33333 * horizonFactor;
starCoord = GetStarCoord(viewPos.xyz, 1.0) * 0.5 + 0.617;
float moonNoise = texture2DLod(noisetex, starCoord, 0.0).g
+ texture2DLod(noisetex, starCoord * 2.5, 0.0).g * 0.7
+ texture2DLod(noisetex, starCoord * 5.0, 0.0).g * 0.5;
moonNoise = max0(moonNoise - 0.75) * 1.7;
float moonNoiseIntensity = 1.0;
vec3 moonColor = vec3(0.38, 0.4, 0.5);
#if defined SPOOKY && BLOOD_MOON > 0
moonNoiseIntensity = mix(1.0, 1.5, getBloodMoon(moonPhase, sunVisibility));
moonColor = mix(moonColor, vec3(1.0, 0.0, 0.0), getBloodMoon(moonPhase, sunVisibility));
#endif
moonColor *= (1.2 - (0.2 + 0.2 * sqrt1(nightFactor)) * moonNoise * moonNoiseIntensity);
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
//Vanilla Star Dedection by Builderb0y
vanillaStars = float(glColor.r == glColor.g && glColor.g == glColor.b && glColor.r > 0.0 && glColor.r < 0.51);
#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

View File

@@ -0,0 +1,203 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/tonemaps.glsl"
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
in vec2 texCoord;
flat in vec4 glColor;
#ifdef OVERWORLD
flat in vec3 upVec, sunVec;
#endif
//Pipeline Constants//
//Common Variables//
#ifdef OVERWORLD
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
#endif
const int DoCompTonemap = 0;
const int DoBSLTonemap = 1;
const int ACESTonemap = 2;
const int ACESRedModified = 3;
const int BurgessTonemap = 4;
const int LottesTonemap = 5;
const int Uncharted2 = 6;
const int uncharted2_tonemap_partial = 7;
const int uncharted2_filmic = 8;
const int reinhard2 = 9;
const int filmic = 10;
const int GTTonemap = 11;
const int uchimura = 12;
const int agxTonemap = 13;
const int unreal = 14;
//Common Functions//
//Includes//
#include "/lib/colors/lightAndAmbientColors.glsl"
#ifdef END
#include "/lib/colors/skyColors.glsl"
#endif
#ifdef CAVE_FOG
#include "/lib/atmospherics/fog/caveFactor.glsl"
#endif
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
#ifdef OVERWORLD
vec2 tSize = textureSize(tex, 0);
vec4 color = texture2D(tex, texCoord);
color.rgb *= glColor.rgb;
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
viewPos /= viewPos.w;
vec3 nViewPos = normalize(viewPos.xyz);
float VdotS = dot(nViewPos, sunVec);
float VdotU = dot(nViewPos, upVec);
bool sunSideCheck = VdotS > 0.0;
#ifdef IS_IRIS
bool isSun = renderStage == MC_RENDER_STAGE_SUN;
bool isMoon = renderStage == MC_RENDER_STAGE_MOON;
if (sunSideCheck) isSun = true; // Workaround for sun rendering as MC_RENDER_STAGE_MOON in some Iris versions
#else
bool tSizeCheck = abs(tSize.y - 264.0) < 248.5; //tSize.y must range from 16 to 512
bool isSun = tSizeCheck && sunSideCheck;
bool isMoon = tSizeCheck && !sunSideCheck;
#endif
if (isSun || isMoon) {
#if SUN_MOON_STYLE >= 2
discard;
#endif
if (isSun) {
float sunBrightness = 4.5;
#ifdef SPOOKY
sunBrightness = 1.2;
#endif
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.5, 0.28), vec3(0.35), rainFactor * 0.75) * sunBrightness * 0.5;
else color.rgb *= mix(vec3(1.1, 0.55, 0.0), vec3(0.35), rainFactor * 0.75) * sunBrightness; // all other tonemaps
color.rgb *= 0.25 + 0.75 * sunVisibility2 + 0.5 * noonFactor;
}
if (isMoon) {
// vec3 pixelGlareColor = color.rgb;
// pixelGlareColor = mix(pixelGlareColor, pixelGlareColor * vec3(0.9, 0.95, 1.1), 0.5) * 1.3;
color.rgb *= smoothstep1(min1(length(color.rgb))) * 1.3;
float luminance = GetLuminance(color.rgb);
// float pixelGlareFactor = 1 - step(0.09,luminance);
// color.rgb = mix(color.rgb, pixelGlareColor, pixelGlareFactor);
#ifdef SPOOKY
color.rgb = mix(color.rgb, luminance * vec3(1.0, 0.0, 0.0) * 1.5, getBloodMoon(moonPhase, sunVisibility));
#endif
}
color.rgb *= GetHorizonFactor(VdotU);
#ifdef CAVE_FOG
color.rgb *= 1.0 - 0.75 * GetCaveFactor();
#endif
} else { // Custom Sky
#if MC_VERSION >= 11300
color.rgb *= color.rgb * smoothstep1(sqrt1(max0(VdotU)));
#else
discard;
// Old mc custom skyboxes are weirdly broken, so we discard.
#endif
}
if (isEyeInWater == 1) color.rgb *= 0.25;
// Reduced visibility in rain
float rainFactorM = rainFactor;
#ifdef SUN_MOON_DURING_RAIN
rainFactorM *= 0.8;
#endif
#if defined CLEAR_SKY_WHEN_RAINING || defined NO_RAIN_ABOVE_CLOUDS
rainFactorM *= heightRelativeToCloud;
#endif
color.a *= 1.0 - rainFactorM;
#endif
#ifdef NETHER
vec4 color = vec4(0.0);
#endif
#ifdef END
vec4 color = vec4(endSkyColor, 1.0);
#endif
#if RETRO_LOOK == 1
color.rgb = GetLuminance(color.rgb) * vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.3 * RETRO_LOOK_I;
#elif RETRO_LOOK == 2
color.rgb = mix(color.rgb, GetLuminance(color.rgb) * vec3(RETRO_LOOK_R, RETRO_LOOK_G, RETRO_LOOK_B) * 0.3 * RETRO_LOOK_I, nightVision);
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
flat out vec4 glColor;
#ifdef OVERWORLD
flat out vec3 upVec, sunVec;
#endif
//Attributes//
//Common Variables//
//Common Functions//
//Includes//
//Program//
void main() {
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
glColor = gl_Color;
#ifdef OVERWORLD
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
#endif
}
#endif

View File

@@ -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);
#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

View File

@@ -0,0 +1,809 @@
//////////////////////////////////////////
// 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 EYES
#define EYE_FREQUENCY 1.0 //[0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5]
#define EYE_SPEED 1.0 //[0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0]
#define EYE_RED_PROBABILITY 0.07 //[0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00]
//#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
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
flat in vec3 upVec, sunVec, northVec, eastVec;
in vec3 normal;
in vec3 vertexPos;
in vec4 glColorRaw;
#if RAIN_PUDDLES >= 1 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE || 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
//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//
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 SPOOKY_RAIN_PUDDLE_OVERRIDE || 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
#ifdef SS_BLOCKLIGHT
#include "/lib/lighting/coloredBlocklight.glsl"
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
#include "/lib/colors/colorMultipliers.glsl"
#endif
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.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;
#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
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, isFoliage = false;
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0, snowFactor = 1.0, snowMinNdotU = 0.0, noPuddles = 0.0, 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;
vec2 lmCoordM = lmCoord;
vec3 normalM = normal, geoNormal = normal, shadowMult = vec3(1.0);
vec3 worldGeoNormal = normalize(ViewToPlayer(geoNormal * 10000.0));
vec3 dhColor = vec3(1.0);
float purkinjeOverwrite = 0.0;
float SSBLAlpha = 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;
}
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;
}
#ifdef EYES
#ifdef SPOOKY
vec3 eyes1 = vec3(0.0);
vec3 eyes2 = vec3(0.0);
float sideRandom = hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.00001, vec3(100)));
vec3 blockUVEyes = blockUV;
if (step(0.5, sideRandom) > 0.0) { // Randomly make eyes visible only on either the x or z axis
blockUVEyes.x = 0.0;
} else {
blockUVEyes.z = 0.0;
}
float spookyEyesFrequency = EYE_FREQUENCY;
float spookyEyesSpeed = EYE_SPEED;
float randomEyesTime = 24000 * hash1(worldDay * 3); // Effect happens randomly throughout the day
int moreEyesEffect = (int(hash1(worldDay / 2)) % (2 * 24000)) + int(randomEyesTime);
if (worldTime > moreEyesEffect && worldTime < moreEyesEffect + 30) { // 30 in ticks - 1.5s, how long the effect will be on
spookyEyesFrequency = 20.0; // make eyes appear everywhere
}
if ((blockUVEyes.x > 0.15 && blockUVEyes.x < 0.43 || blockUVEyes.x < 0.85 && blockUVEyes.x > 0.57 || blockUVEyes.z > 0.15 && blockUVEyes.z < 0.43 || blockUVEyes.z < 0.85 && blockUVEyes.z > 0.57) && blockUVEyes.y > 0.42 && blockUVEyes.y < 0.58 && abs(clamp01(dot(normal, upVec))) < 0.99) eyes1 = vec3(1.0); // Eye Shape 1 Horizontal
if ((blockUVEyes.x > 0.65 && blockUVEyes.x < 0.8 || blockUVEyes.x < 0.35 && blockUVEyes.x > 0.2 || blockUVEyes.z > 0.65 && blockUVEyes.z < 0.8 || blockUVEyes.z < 0.35 && blockUVEyes.z > 0.2) && blockUVEyes.y > 0.3 && blockUVEyes.y < 0.7 && abs(clamp01(dot(normal, upVec))) < 0.99) eyes2 = vec3(1.0); // Eye Shape 2 Vertical
vec3 spookyEyes = mix(eyes1, eyes2, step(0.75, hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.00005, vec3(100))))); // have either eye shape 1 or 2 randomly, the horizontal ones have a 0.75 to 0.25 higher probability of appearing
spookyEyes *= vec3(step(1.0075 - spookyEyesFrequency * 0.01, hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.0000005 * spookyEyesSpeed, vec3(100))))); // Make them appear randomly and much less
#endif
#endif
#ifdef IPBR
vec3 maRecolor = vec3(0.0);
#include "/lib/materials/materialHandling/terrainIPBR.glsl"
#ifdef REFLECTIVE_WORLD
smoothnessD = 1.0;
smoothnessG = 1.0;
#endif
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
#endif
if (mat == 10001) { // No directional shading
noDirectionalShading = true;
} else if (mat == 10003 || mat == 10005 || mat == 10029 || mat == 10031) { // Grounded Waving Foliage
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true, isFoliage = true;
DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, viewPos, nViewPos, lViewPos, dither);
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
} else if (mat == 10007 || mat == 10009 || mat == 10011) { // Leaves
#include "/lib/materials/specificMaterials/terrain/leaves.glsl"
} else if (mat == 10013 || mat == 10923) { // Vine
subsurfaceMode = 3, centerShadowBias = true; noSmoothLighting = true, isFoliage = true;
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
} else if (mat == 10015 || mat == 10017 || mat == 10019) { // Non-waving Foliage
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true, isFoliage = true;
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
} else if (mat == 10021 || mat == 10023) { // Upper Waving Foliage
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true, isFoliage = true;
sandNoiseIntensity = 0.3, mossNoiseIntensity = 0.0;
DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, viewPos, nViewPos, lViewPos, dither);
} else if (mat == 10068 || mat == 10070){ // Lava
vec3 previousLavaColor = color.rgb;
if (emission < 1.0) emission = max(2.0, emission);
#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
vec3 lavaNoiseColor = color.rgb;
#if LAVA_VARIATION > 0
vec2 lavaPos = (floor(worldPos.xz * 16.0) + worldPos.y * 32.0) * 0.000666;
vec2 wind = vec2(frameTimeCounter * 0.012, 0.0);
lavaNoiseIntensity *= 0.95;
#include "/lib/materials/specificMaterials/terrain/lavaNoise.glsl"
color.rgb = lavaNoiseColor;
#else
if (LAVA_TEMPERATURE != 0.0) color.rgb += LAVA_TEMPERATURE * 0.3;
#endif
vec3 maxLavaColor = max(previousLavaColor, lavaNoiseColor);
vec3 minLavaColor = min(previousLavaColor, lavaNoiseColor);
#if RAIN_PUDDLES >= 1 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE
noPuddles = 1.0;
#endif
#include "/lib/materials/specificMaterials/terrain/lavaEdge.glsl"
emission *= LAVA_EMISSION;
} else if (mat > 20999 && mat < 21025){
emission = DoAutomaticEmission(noSmoothLighting, noDirectionalShading, color.rgb, lmCoord.x, blockLightEmission, 1.0);
}
#ifdef SNOWY_WORLD
else if ((mat == 10132 || mat == 10133)) { // Grass Block:Normal
if (glColor.b < 0.999) { // Grass Block:Normal:Grass Part
snowMinNdotU = min(pow2(pow2(color.g)) * 1.9, 0.1);
color.rgb = color.rgb * 0.5 + 0.5 * (color.rgb / glColor.rgb);
}
}
#endif
else if (lmCoord.x > 0.99999) lmCoordM.x = 0.95;
#endif
if (mat == 10572) { // Dragon Egg
overlayNoiseIntensity = 0.0;
#ifndef EMISSIVE_DRAGON_EGG
emission *= 0.0;
#endif
}
#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);
#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 SPOOKY_RAIN_PUDDLE_OVERRIDE
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);
#ifdef NO_RAIN_ABOVE_CLOUDS
puddleNormalFactor *= mix(0.0, 1.0, heightRelativeToCloud);
#endif
float puddleMixer = puddleLightFactor * inRainy * puddleNormalFactor;
#if RAIN_PUDDLES < 3
float wetnessM = wetness;
#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));
#if RAIN_PUDDLES == 1 || RAIN_PUDDLES == 3 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE
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 = mix(normalM, puddleNormal, puddleMixer * rainFactor);
}
#endif
#if SHOW_LIGHT_LEVEL > 0
#include "/lib/misc/showLightLevels.glsl"
#endif
#ifdef SS_BLOCKLIGHT
float lmCoordXModified = lmCoord.x;
#ifdef IS_IRIS
lmCoordXModified = lmCoord.x == 1.0 && blockLightEmission < 0.5 ? 0.0 : lmCoord.x;
#endif
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoordXModified);
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#endif
#ifdef SPOOKY
if (mat != 10068 && mat != 10070) { // Lava
float noiseAdd = hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.000001, vec3(100)));
emission *= mix(clamp(noiseAdd * 1.5, 0.1, 2.0), 1.0, smoothstep(0.1, 0.11, texture2DLod(noisetex, vec2(frameTimeCounter * 0.008 + noiseAdd), 0.0).r));
}
#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);
#ifdef SS_BLOCKLIGHT
vec3 lightAlbedo = normalize(color.rgb) * min1(emission);
#ifdef COLORED_CANDLE_LIGHT
if (mat >= 10900 && mat <= 10922) { // Candles:Lit
lightAlbedo = normalize(color.rgb) * lmCoord.x;
}
#endif
#endif
#ifdef DISTANT_HORIZONS
if (getDHFadeFactor(playerPos) < dither) {
discard;
}
#endif
#ifdef IPBR
color.rgb += maRecolor;
#endif
#if defined SPOOKY && defined EYES
vec2 flickerEyeNoise = texture2DLod(noisetex, vec2(frameTimeCounter * 0.025 + hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.000001, vec3(100)))), 0.0).rb;
if (length(playerPos) > 8.0) {
vec3 eyesColor = mix(vec3(1.0), vec3(3.0, 0.0, 0.0), vec3(step(1.0 - EYE_RED_PROBABILITY * mix(1.0, 2.0, getBloodMoon(moonPhase, sunVisibility)), hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.0000002, vec3(500)))))); // Make Red eyes appear rarely, 7% chance
color.rgb += spookyEyes * 3.0 * skyLightCheck * min1(max(flickerEyeNoise.r, flickerEyeNoise.g)) * clamp((1.0 - 1.15 * lmCoord.x) * 10.0, 0.0, 1.0) * eyesColor;
}
#endif
float skyLightFactor = GetSkyLightFactor(lmCoordM, shadowMult);
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, mat);
#endif
// color.rgb = lmCoord.x == 1.0 && blockLightEmission == 0 ? vec3(1) : vec3(0);
#ifdef SPOOKY
int seed = worldDay / 2; // Thanks to Bálint
int currTime = (worldDay % 2) * 24000 + worldTime; // Effect happens every 2 minecraft days
float randomTime = 24000 * hash1(worldDay * 5); // Effect happens randomly throughout the day
int timeWhenItHappens = (int(hash1(seed)) % (2 * 24000)) + int(randomTime);
if (currTime > timeWhenItHappens && currTime < timeWhenItHappens + 100) { // 100 in ticks - 5s, how long the effect will be on, aka leaves are gone
if (mat == 10007 || mat == 10009 || mat == 10011) discard; // Disable leaves
}
#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, 1.0);
#ifdef SS_BLOCKLIGHT
/* DRAWBUFFERS:0649 */
gl_FragData[3] = vec4(lightAlbedo, SSBLAlpha);
#endif
#elif defined 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;
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
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
out vec3 vertexPos;
out vec4 glColorRaw;
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR || defined SPOOKY_RAIN_PUDDLE_OVERRIDE
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec3 viewVector;
out vec4 vTexCoordAM;
#endif
#if ANISOTROPIC_FILTER > 0
out vec4 spriteBounds;
#endif
//Attributes//
attribute vec4 mc_Entity;
attribute vec4 mc_midTexCoord;
attribute vec4 at_midBlock;
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR || defined SPOOKY_RAIN_PUDDLE_OVERRIDE
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);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
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);
#ifndef GBUFFERS_COLORWHEEL
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
#if ANISOTROPIC_FILTER > 0
if (mc_Entity.y > 0.5 && dot(normal, upVec) < 0.999) absMidCoordPos = vec2(0.0); // Fix257062
#endif
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
vertexPos = position.xyz;
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 SPOOKY
// if (mat == 10744) { // Cobweb Thanks to gri
// vec3 irisThirdPersonPull = vec3(0.0);
// #ifdef IS_IRIS
// irisThirdPersonPull = eyePosition - cameraPosition;
// #endif
// vec3 pullCenter = vec3(0.1, -0.1, -0.05) - irisThirdPersonPull;
// float pullFactor = pow(min(abs(sin(1.81 * frameTimeCounter) + cos(0.9124 * frameTimeCounter)), 1.0), 10.0) * 4.0 / (length(position.xyz) + max(20 * texture2DLod(noisetex, vec2(frameTimeCounter * 0.1), 0.0).r, 10.0));
// vec3 pullDir = pullCenter - position.xyz - at_midBlock.xyz / 64.0;
// position.xyz += pullDir * pullFactor;
// }
// #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 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
#endif
#ifdef POM
mat3 tbnMatrix = mat3(
tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z
);
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
vTexCoordAM.zw = abs(texMinMidCoord) * 2;
vTexCoordAM.xy = min(texCoord, midCoord - texMinMidCoord);
#endif
#if ANISOTROPIC_FILTER > 0
vec2 spriteRadius = abs(texCoord - mc_midTexCoord.xy);
vec2 bottomLeft = mc_midTexCoord.xy - spriteRadius;
vec2 topRight = mc_midTexCoord.xy + spriteRadius;
spriteBounds = vec4(bottomLeft, topRight);
#endif
}
#endif

View File

@@ -0,0 +1,388 @@
//////////////////////////////////////////
// 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
#if defined ATM_COLOR_MULTS || defined SPOOKY
#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
#ifdef AURORA_INFLUENCE
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
vec4 colorP = color;
color *= glColor;
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
vec3 viewPos = ScreenToView(screenPos);
float lViewPos = length(viewPos);
vec3 playerPos = ViewToPlayer(viewPos);
float dither = texture2DLod(noisetex, gl_FragCoord.xy / 128.0, 0.0).b;
#ifdef TAA
dither = fract(dither + goldenRatio * mod(float(frameCounter), 3600.0));
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
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, materialMask = OSIEBCA * 254.0, enderDragonDead = 1.0; // No SSAO, No TAA
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
if (atlasSize.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 = 0.0;
color.rgb = sqrt3(color.rgb);
color.rgb *= 0.7;
if (dither > 0.4) discard;
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
#ifdef OVERWORLD
} else if (color.b > 0.7 && color.r < 0.28 && color.g < 0.425 && color.g > color.r * 1.4) { // physics mod rain
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= rainTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + ambientColor * lmCoord.y * (0.7 + 0.35 * sunFactor));
} else if (color.rgb == vec3(1.0) && color.a < 0.765 && color.a > 0.605) { // physics mod snow (default snow opacity only)
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.a < 0.1 || isEyeInWater == 3) discard;
color.a *= snowTexOpacity;
color.rgb = sqrt2(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + lmCoord.y * (0.7 + 0.35 * sunFactor) + ambientColor * 0.2);
#endif
} else if (color.r == 1.0 && color.b < 0.778 && color.g < 0.97) { // Fire Particle
#ifdef SOUL_SAND_VALLEY_OVERHAUL_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorSoul, inSoulValley);
#endif
#ifdef PURPLE_END_FIRE_INTERNAL
color.rgb = changeColorFunction(color.rgb, 3.0, colorEndBreath, 1.0);
#endif
emission = 2.0;
} else if (color.r == color.g && color.r - 0.5 * color.b < 0.06) { // Underwater Particle
if (isEyeInWater == 1) {
color.rgb = sqrt2(color.rgb) * 0.35;
if (fract(playerPos.y + cameraPosition.y) > 0.25) discard;
}
} else if (color.a < 0.99 && dot(color.rgb, color.rgb) < 1.0) { // Campfire Smoke
color.a *= SMOKE_PARTICLE_OPACITY;
materialMask = 0.0;
} 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
float auroraSpookyMix = 0.0;
#if defined SPOOKY && BLOOD_MOON > 0
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#endif
bool isLightSource = lmCoord.x > 0.99;
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, geoNormal, normalM, dither,
worldGeoNormal, lmCoordM, noSmoothLighting, false, true,
false, 0, 0.0, 1.0, emission, purkinjeOverwrite, isLightSource,
enderDragonDead);
#if MC_VERSION >= 11500
vec3 nViewPos = normalize(viewPos);
float VdotU = dot(nViewPos, upVec);
float VdotS = dot(nViewPos, sunVec);
float sky = 0.0;
float prevAlpha = color.a;
DoFog(color, sky, lViewPos, playerPos, VdotU, VdotS, dither);
color.a = prevAlpha;
#endif
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
float SSBLMask = 0.0;
#ifdef ENTITIES_ARE_LIGHT
SSBLMask = 1.0;
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:063 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.0, materialMask, 0.0, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
gl_FragData[2] = vec4(1.0 - translucentMult, 1.0);
#ifdef SS_BLOCKLIGHT
/* RENDERTARGETS: 0,6,3,9,10 */
gl_FragData[3] = vec4(0.0, 0.0, 0.0, SSBLMask);
gl_FragData[4] = vec4(0.0, 0.0, 0.0, SSBLMask);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
out vec2 texCoord;
out vec2 lmCoord;
flat out vec3 upVec, sunVec, northVec, eastVec;
out vec3 normal;
flat out vec4 glColor;
//Attributes//
#if defined WAVE_EVERYTHING || defined ATLAS_ROTATION
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
normal = normalize(gl_NormalMatrix * gl_Normal);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
#ifdef FLICKERING_FIX
gl_Position.z -= 0.000002;
#endif
}
#endif

View File

@@ -0,0 +1,598 @@
//////////////////////////////////////////
// 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;
flat in vec3 upVec, sunVec, northVec, eastVec;
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 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE) && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
flat in vec3 binormal, tangent;
#endif
#ifdef POM
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 WATER_STYLE >= 2 || (RAIN_PUDDLES >= 1 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE) && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || 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"
#if defined OVERWORLD_BEAMS && defined OVERWORLD
float vlFactor = 0.0;
#endif
#ifdef OVERWORLD
#include "/lib/atmospherics/sky.glsl"
#endif
#if !defined ATMOSPHERIC_FOG && !defined BORDER_FOG
#include "/lib/colors/skyColors.glsl"
#endif
#if defined AURORA_INFLUENCE || (WATER_REFLECT_QUALITY >= 0 && defined SKY_EFFECT_REFLECTION && defined OVERWORLD && AURORA_STYLE > 0)
#include "/lib/atmospherics/auroraBorealis.glsl"
#endif
#if WATER_REFLECT_QUALITY >= 0
#if defined SKY_EFFECT_REFLECTION && defined OVERWORLD
#include "/lib/atmospherics/stars.glsl"
#if NIGHT_NEBULAE == 1
#include "/lib/atmospherics/nightNebula.glsl"
#endif
#ifdef VL_CLOUDS_ACTIVE
#include "/lib/atmospherics/clouds/mainClouds.glsl"
#endif
#endif
#include "/lib/materials/materialMethods/reflections.glsl"
#endif
#ifdef TAA
#include "/lib/antialiasing/jitter.glsl"
#endif
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || WATER_STYLE >= 2
#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
#if defined ATM_COLOR_MULTS || defined SPOOKY
#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
#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
vec4 colorP = texture2D(tex, texCoord);
#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 DISTANT_HORIZONS
if (getDHFadeFactor(playerPos) < dither) {
discard;
}
#endif
#ifdef LIGHT_COLOR_MULTS
lightColorMult = GetLightColorMult();
#endif
#if defined ATM_COLOR_MULTS || defined SPOOKY
atmColorMult = GetAtmColorMult();
sqrtAtmColorMult = sqrt(atmColorMult);
#endif
float overlayNoiseIntensity = 1.0;
float snowNoiseIntensity = 1.0;
float sandNoiseIntensity = 1.0;
float mossNoiseIntensity = 1.0;
float overlayNoiseTransparentOverwrite = 0.0;
float overlayNoiseAlpha = 1.0;
float overlayNoiseFresnelMult = 1.0;
float IPBRMult = 1.0;
bool isFoliage = false;
vec3 dhColor = vec3(1.0);
float purkinjeOverwrite = 0.0, enderDragonDead = 1.0;
#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;
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 SSBLAlpha = 1.0;
#ifdef IPBR
#include "/lib/materials/materialHandling/translucentIPBR.glsl"
#ifdef GENERATED_NORMALS
if (!noGeneratedNormals) GenerateNormals(normalM, colorP.rgb * colorP.a * 1.5);
#endif
#if IPBR_EMISSIVE_MODE != 1
emission = GetCustomEmissionForIPBR(color, emission);
#endif
#else
#ifdef CUSTOM_PBR
float smoothnessD = 0.0;
float materialMaskPh = 0.0;
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMaskPh, viewPos, lViewPos);
reflectMult = smoothnessD;
#endif
if (mat == 32000) { // Water
#ifdef SHADER_WATER
#include "/lib/materials/specificMaterials/translucents/water.glsl"
#endif
overlayNoiseIntensity = 0.0;
overlayNoiseFresnelMult = 0.0;
IPBRMult = 0.0;
overlayNoiseAlpha = 0.0;
} else if (mat == 30020) { // Nether Portal
#ifdef SPECIAL_PORTAL_EFFECTS
#include "/lib/materials/specificMaterials/translucents/netherPortal.glsl"
#endif
overlayNoiseIntensity = 0.0;
} else if (mat == 32016) { // Beacon
overlayNoiseAlpha = 0.8;
mossNoiseIntensity = 0.5;
sandNoiseIntensity = 0.5;
}
#endif
#if WATER_MAT_QUALITY >= 3 && 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 IS_IRIS
lmCoordXModified = lmCoord.x == 1.0 && blockLightEmission < 0.5 ? 0.0 : lmCoord.x;
#endif
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos, playerPos, lmCoordXModified);
#endif
#if defined SPOOKY && BLOOD_MOON > 0
auroraSpookyMix = getBloodMoon(moonPhase, sunVisibility);
ambientColor *= 1.0 + auroraSpookyMix * vec3(2.0, -1.0, -1.0);
#endif
#ifdef AURORA_INFLUENCE
ambientColor = mix(AuroraAmbientColor(ambientColor, viewPos), ambientColor, auroraSpookyMix);
#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 and blockID set by user
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);
#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
#ifdef SPOOKY
highlightColor *= 0.3;
#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);
#if defined END && END_CENTER_LIGHTING > 0
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 ENTITIES_ARE_LIGHT
SSBLAlpha = 0.0;
#endif
/* DRAWBUFFERS:03 */
gl_FragData[0] = color;
gl_FragData[1] = vec4(1.0 - translucentMult.rgb, translucentMult.a);
#if DETAIL_QUALITY >= 3 || (WATER_REFLECT_QUALITY > 0 && WORLD_SPACE_REFLECTIONS > 0) || defined SS_BLOCKLIGHT
/* DRAWBUFFERS:036 */
gl_FragData[2] = vec4(1.0, materialMask, skyLightFactor, lmCoord.x + clamp01(purkinjeOverwrite) + clamp01(emission));
#if WORLD_SPACE_REFLECTIONS > 0
#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 > 0
/* DRAWBUFFERS:0348 */
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, sqrt(fresnelM * color.a * fogAlpha));
gl_FragData[3] = vec4(reflection.rgb * fresnelM * color.a * fogAlpha, reflection.a);
#endif
}
#endif
//////////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;
flat out vec3 upVec, sunVec, northVec, eastVec;
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 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE) && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
flat out vec3 binormal, tangent;
#endif
#ifdef POM
out vec4 vTexCoordAM;
#endif
// #if SEASONS == 1 || SEASONS == 4 || defined MOSS_NOISE_INTERNAL || defined SAND_NOISE_INTERNAL
// flat out ivec2 pixelTexSize;
// #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 || defined SPOOKY_RAIN_PUDDLE_OVERRIDE) && WATER_STYLE == 1 && WATER_MAT_QUALITY >= 2 || 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);
upVec = normalize(gbufferModelView[1].xyz);
eastVec = normalize(gbufferModelView[0].xyz);
northVec = normalize(gbufferModelView[2].xyz);
sunVec = GetSunVector();
atMidBlock = at_midBlock.xyz;
blockUV = 0.5 - at_midBlock.xyz / 64.0;
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
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;
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
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
}
#endif

View File

@@ -0,0 +1,155 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/raindropColor.glsl"
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in vec2 lmCoord;
in vec2 texCoord;
flat in vec3 upVec, sunVec;
in vec3 playerPos;
flat in vec4 glColor;
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunFactor = SdotU < 0.0 ? clamp(SdotU + 0.375, 0.0, 0.75) / 0.75 : clamp(SdotU + 0.03125, 0.0, 0.0625) / 0.0625;
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
float sunVisibility2 = sunVisibility * sunVisibility;
//Common Functions//
//Includes//
#include "/lib/colors/lightAndAmbientColors.glsl"
#ifdef COLOR_CODED_PROGRAMS
#include "/lib/misc/colorCodedPrograms.glsl"
#endif
//Program//
void main() {
vec4 color = texture2D(tex, texCoord);
color *= glColor;
if (color.a < 0.1 || isEyeInWater == 3) discard;
#ifdef NO_RAIN_ABOVE_CLOUDS
if (cameraPosition.y > maximumCloudsHeight) discard;
#endif
if (color.r + color.g < 1.5) color.a *= rainTexOpacity;
else color.a *= snowTexOpacity;
color.rgb = sqrt3(color.rgb) * (blocklightCol * 2.0 * lmCoord.x + (ambientColor + 0.2 * lightColor) * lmCoord.y * (0.6 + 0.3 * sunFactor));
color.rgb *= vec3(WEATHER_TEX_R, WEATHER_TEX_G, WEATHER_TEX_B);
#if GLITTER_RAIN > 0
float rainbowGlitterOn = 1.0;
#if GLITTER_RAIN == 1
rainbowGlitterOn = 0.0;
float randomRainbowGlitterTime = 24000 * hash1(worldDay * 3); // Effect happens randomly throughout the day
int rainbowGlitterEffect = (int(hash1(worldDay / 2)) % (2 * 24000)) + int(randomRainbowGlitterTime);
if (worldTime > rainbowGlitterEffect && worldTime < rainbowGlitterEffect + 400) { // 400 in ticks - 20s, how long the effect will be on
rainbowGlitterOn = 1.0;
}
#endif
color.rgb = mix(color.rgb, vec3(0.752, 0.752, 0.752) * 5.0, mix(0.0, step(0.7, Noise3D((playerPos + cameraPosition) * 0.004 + frameTimeCounter * 0.02)), rainbowGlitterOn * rainFactor));
#endif
#ifdef COLOR_CODED_PROGRAMS
ColorCodeProgram(color, -1);
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = color;
#ifdef PBR_REFLECTIONS
/* DRAWBUFFERS:04 */
gl_FragData[1] = vec4(0);
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out vec2 lmCoord;
out vec2 texCoord;
flat out vec3 upVec, sunVec;
out vec3 playerPos;
flat out vec4 glColor;
//Attributes//
#if defined ATLAS_ROTATION || defined WAVE_EVERYTHING
attribute vec4 mc_midTexCoord;
#endif
//Common Variables//
//Common Functions//
//Includes//
#ifdef WAVE_EVERYTHING
#include "/lib/materials/materialMethods/wavingBlocks.glsl"
#endif
//Program//
void main() {
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
glColor = gl_Color;
#ifdef WAVING_RAIN
float rainWavingFactor = eyeBrightnessM2; // Prevents clipping inside interiors
position.xz += rainWavingFactor * (0.4 * position.y + 0.2) * vec2(sin(frameTimeCounter * 0.3) + 0.5, sin(frameTimeCounter * 0.5) * 0.5);
position.xz *= 1.0 - 0.08 * position.y * rainWavingFactor;
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
#ifdef ATLAS_ROTATION
texCoord += texCoord * float(hash33(mod(cameraPosition * 0.5, vec3(100.0))));
#endif
lmCoord = GetLightMapCoordinates();
upVec = normalize(gbufferModelView[1].xyz);
sunVec = GetSunVector();
playerPos = (gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex).xyz;
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE || defined WAVE_EVERYTHING
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
#endif
}
#endif

View File

@@ -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

View File

@@ -0,0 +1,430 @@
//////////////////////////////////////////
// Complementary Shaders by EminGT //
// With Euphoria Patches by SpacEagle17 //
//////////////////////////////////////////
//Common//
#include "/lib/common.glsl"
#include "/lib/shaderSettings/wavingBlocks.glsl"
#include "/lib/shaderSettings/shadowMainLighting.glsl"
#define SHADOW_SATURATION 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#if defined MIRROR_DIMENSION || defined WORLD_CURVATURE
#include "/lib/misc/distortWorld.glsl"
#endif
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
#ifdef FRAGMENT_SHADER
flat in int mat;
in vec2 texCoord;
flat in vec3 sunVec, upVec;
in vec4 position;
flat in vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
in vec2 signMidCoordPos;
flat in vec2 absMidCoordPos;
#endif
//Pipeline Constants//
//Common Variables//
float SdotU = dot(sunVec, upVec);
float sunVisibility = clamp(SdotU + 0.0625, 0.0, 0.125) / 0.125;
//Common Functions//
void DoNaturalShadowCalculation(inout vec4 color1, inout vec4 color2) {
color1.rgb *= glColor.rgb;
color1.rgb = mix(vec3(1.0), color1.rgb, pow(color1.a, (1.0 - color1.a) * 0.5) * 1.05);
color1.rgb *= 1.0 - pow(color1.a, 64.0);
color1.rgb *= 0.2; // Natural Strength
color2.rgb = normalize(color1.rgb) * 0.5;
}
//Includes//
#ifdef CONNECTED_GLASS_EFFECT
#include "/lib/materials/materialMethods/connectedGlass.glsl"
#endif
//Program//
void main() {
vec4 color1 = texture2DLod(tex, texCoord, 0); // Shadow Color
#ifdef SHADOW_COLORWHEEL
vec2 lmCoord; // needed as otherwise undeclared in the function below
float ao;
vec4 overlayColor;
clrwl_computeFragment(color1, color1, lmCoord, ao, overlayColor);
#endif
#if SHADOW_QUALITY >= 1
vec4 color2 = color1; // Light Shaft Color
color2.rgb *= 0.25; // Natural Strength
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
float positionYM = position.y;
#endif
if (mat < 32008) {
if (mat < 32000) {
#if defined CONNECTED_GLASS_EFFECT || defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
if (mat == 30008 || mat >= 31000) { // Tinted Glass || Stained Glass, Stained Glass Pane
#ifdef CONNECTED_GLASS_EFFECT
DoSimpleConnectedGlass(color1);
#endif
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
positionYM = 0.0; // 86AHGA: For scene-aware light shafts to be less prone to get extreme under large glass planes
#endif
}
#endif
DoNaturalShadowCalculation(color1, color2);
} else {
if (mat == 32000) { // Water
vec3 worldPos = position.xyz + cameraPosition;
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
// For scene-aware light shafts to be more prone to get extreme near water
positionYM += 3.5;
#endif
// Water Caustics
#if WATER_CAUSTIC_STYLE < 3
#if MC_VERSION >= 11300
float wcl = pow2(GetLuminance(color1.rgb));
color1.rgb = color1.rgb * wcl * 1.2;
color1.rgb *= mix(1.0, WATER_CAUSTIC_STRENGTH, wcl);
#else
color1.rgb = mix(color1.rgb, vec3(GetLuminance(color1.rgb)), 0.88);
color1.rgb = pow2(color1.rgb) * vec3(2.5, 3.0, 3.0) * 0.96;
#endif
#else
#define WATER_SPEED_MULT_M WATER_SPEED_MULT * 0.035
vec2 causticWind = vec2(frameTimeCounter * WATER_SPEED_MULT_M, 0.0);
vec2 cPos1 = worldPos.xz * 0.10 - causticWind;
vec2 cPos2 = worldPos.xz * 0.05 + 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);
////
// Underwater Light Shafts
vec3 worldPosM = worldPos;
#if WATER_FOG_MULT > 100
#define WATER_FOG_MULT_M WATER_FOG_MULT * 0.01;
worldPosM *= WATER_FOG_MULT_M;
#endif
vec2 waterWind = vec2(syncedTime * 0.01, 0.0);
float waterNoise = texture2DLod(noisetex, worldPosM.xz * 0.012 - waterWind, 0.0).g;
waterNoise += texture2DLod(noisetex, worldPosM.xz * 0.05 + waterWind, 0.0).g;
float factor = max(2.5 - 0.025 * length(position.xz), 0.8333) * 1.3;
waterNoise = pow(waterNoise * 0.5, factor) * factor * 1.3;
#if MC_VERSION >= 11300 && WATERCOLOR_MODE >= 2
color2.rgb = normalize(sqrt1(glColor.rgb)) * vec3(0.24, 0.22, 0.26);
#else
color2.rgb = vec3(0.08, 0.12, 0.195);
#endif
color2.rgb *= waterNoise * (1.0 + sunVisibility - rainFactor);
////
#ifdef UNDERWATERCOLOR_CHANGED
color1.rgb *= vec3(UNDERWATERCOLOR_RM, UNDERWATERCOLOR_GM, UNDERWATERCOLOR_BM);
color2.rgb *= vec3(UNDERWATERCOLOR_RM, UNDERWATERCOLOR_GM, UNDERWATERCOLOR_BM);
#endif
} else /*if (mat == 32004)*/ { // Ice
color1.rgb *= color1.rgb;
color1.rgb *= color1.rgb;
color1.rgb = mix(vec3(1.0), color1.rgb, pow(color1.a, (1.0 - color1.a) * 0.5) * 1.05);
color1.rgb *= 1.0 - pow(color1.a, 64.0);
color1.rgb *= 0.28;
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.2 * (1.0 - GLASS_OPACITY)), 1.0);
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 EPIC_THUNDERSTORM
if (entityId == 50004) discard; //remove lightning shadows
#endif
#ifdef SPOOKY
int seed = worldDay / 2; // Thanks to Bálint
int currTime = (worldDay % 2) * 24000 + worldTime; // Effect happens every 2 minecraft days
float randomTime = 24000 * hash1(worldDay * 5); // Effect happens randomly throughout the day
int timeWhenItHappens = (int(hash1(seed)) % (2 * 24000)) + int(randomTime);
if (currTime > timeWhenItHappens && currTime < timeWhenItHappens + 100) { // 100 in ticks - 5s, how long the effect will be on, aka leaves are gone
if (mat == 10007 || mat == 10009 || mat == 10011) discard; // disable leaves
}
#endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(saturateColors(color1.rgb, SHADOW_SATURATION), color1.a); // Shadow Color
#if SHADOW_QUALITY >= 1
#if defined LIGHTSHAFTS_ACTIVE && LIGHTSHAFT_BEHAVIOUR == 1 && defined OVERWORLD
color2.a = 0.25 + max0(positionYM * 0.05); // consistencyMEJHRI7DG
#endif
/* DRAWBUFFERS:01 */
gl_FragData[1] = vec4(saturateColors(color2.rgb, pow(SHADOW_SATURATION, 0.8)), color2.a); // Light Shaft Color
#endif
}
#endif
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
#ifdef VERTEX_SHADER
flat out int mat;
out vec2 texCoord;
flat out vec3 sunVec, upVec;
out vec4 position;
flat out vec4 glColor;
#ifdef CONNECTED_GLASS_EFFECT
out vec2 signMidCoordPos;
flat out vec2 absMidCoordPos;
#endif
//Pipeline Constants//
#if COLORED_LIGHTING_INTERNAL > 0 || END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#extension GL_ARB_shader_image_load_store : enable
#endif
//Attributes//
attribute vec4 mc_Entity;
attribute vec4 mc_midTexCoord;
attribute vec4 at_midBlock;
//Common Variables//
vec2 lmCoord;
#if COLORED_LIGHTING_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
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_img_lod;
#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 || defined END_PORTAL_BEAM_INTERNAL
#include "/lib/voxelization/lightVoxelization.glsl"
#ifdef PUDDLE_VOXELIZATION
#include "/lib/voxelization/puddleVoxelization.glsl"
#endif
#if WORLD_SPACE_REFLECTIONS_INTERNAL > 0
#include "/lib/voxelization/reflectionVoxelization.glsl"
#endif
#ifdef ACT_GROUND_LEAVES_FIX
#include "/lib/voxelization/leavesVoxelization.glsl"
#endif
#endif
#if END_CRYSTAL_VORTEX_INTERNAL > 0 || DRAGON_DEATH_EFFECT_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
#include "/lib/voxelization/endCrystalVoxelization.glsl"
#endif
//Program//
void main() {
texCoord = gl_MultiTexCoord0.xy;
lmCoord = GetLightMapCoordinates();
glColor = gl_Color;
sunVec = GetSunVector();
upVec = normalize(gbufferModelView[1].xyz);
mat = int(mc_Entity.x + 0.5);
#if defined WORLD_CURVATURE || defined MIRROR_DIMENSION
position = shadowModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
#else
position = shadowModelViewInverse * shadowProjectionInverse * ftransform();
#endif
#ifdef WORLD_CURVATURE
position.y += doWorldCurvature(position.xz);
#endif
#ifdef MIRROR_DIMENSION
doMirrorDimension(position);
#endif
#if defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX || defined WAVE_EVERYTHING
DoWave(position.xyz, mat);
#ifdef WAVE_EVERYTHING
DoWaveEverything(position.xyz);
#endif
#endif
#ifdef CONNECTED_GLASS_EFFECT
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
signMidCoordPos = sign(texMinMidCoord);
absMidCoordPos = abs(texMinMidCoord);
#endif
// #ifdef SPOOKY
// if (mat == 10744) { // Cobweb Thanks to gri
// vec3 irisThirdPersonPull = vec3(0.0);
// #ifdef IS_IRIS
// irisThirdPersonPull = eyePosition - cameraPosition;
// #endif
// vec3 pullCenter = vec3(0.1, -0.1, -0.05) - irisThirdPersonPull;
// float pullFactor = pow(min(abs(sin(1.81 * frameTimeCounter) + cos(0.9124 * frameTimeCounter)), 1.0), 10.0) * 4.0 / (length(position.xyz) + max(20 * texture2DLod(noisetex, vec2(frameTimeCounter * 0.1), 0.0).r, 10.0));
// vec3 pullDir = pullCenter - position.xyz - at_midBlock.xyz / 64.0;
// position.xyz += pullDir * pullFactor;
// }
// #endif
#ifdef PERPENDICULAR_TWEAKS
if (mat == 10003 || mat == 10005 || mat == 10015 || mat == 10017 || mat == 10019 || mat == 10029 || mat == 10039) { // Foliage
#ifndef CONNECTED_GLASS_EFFECT
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
vec2 texMinMidCoord = texCoord - midCoord;
#endif
if (texMinMidCoord.y < 0.0) {
vec3 normal = gl_NormalMatrix * gl_Normal;
position.xyz += normal * 0.35;
}
}
#endif
if (mat == 32000) { // Water
position.y += 0.015 * max0(length(position.xyz) - 50.0);
}
vec3 normal = mat3(shadowModelViewInverse) * gl_NormalMatrix * gl_Normal;
#if COLORED_LIGHTING_INTERNAL > 0 || defined END_PORTAL_BEAM_INTERNAL
if (gl_VertexID % 4 == 0) {
UpdateVoxelMap(mat, normal);
#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
#ifdef ACT_GROUND_LEAVES_FIX
UpdateLeavesVoxelMap(mat);
#endif
#ifdef END_PORTAL_BEAM_INTERNAL
if (mat == 10556 && normal.y > 0.99 && length(position.xyz) < 32) SetEndPortalLoc(position.xyz);
#endif
}
#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 MC_VERSION >= 12100
#define VALUE == 1.0
#else
#define VALUE < 0.5
#endif
if (entityId == 0 && gl_Color.a VALUE && renderStage == MC_RENDER_STAGE_ENTITIES && abs(normal.y) > 0.999 && abs(normal.y) < 1.0) {
gl_Position = vec4(0);
#ifndef IRIS_TAG_SUPPORT
SetEndDragonDeath();
#endif
}
#endif
float lVertexPos = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
float distortFactor = lVertexPos * shadowMapBias + (1.0 - shadowMapBias);
gl_Position.xy *= 1.0 / distortFactor;
gl_Position.z = gl_Position.z * 0.2;
}
#endif

View File

@@ -0,0 +1,156 @@
//////////////////////////////////////////
// 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_old = GetLightSample(lightSampler, pos);
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_old + light_px + light_py + light_pz + light_nx + light_ny + light_nz;
light /= 7.2; // Slightly higher than 7 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 isCreateGeometry = (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 (isCreateGeometry == 1u) color.a = 1.0;
light = max(light, vec4(pow2(color.rgb), color.a));
}
if (int(framemod2) == 0) {
imageStore(floodfill_img_copy, pos, light);
} else {
imageStore(floodfill_img, pos, light);
}
}
#endif

View File

@@ -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