Flesh Dimension now has spooky
ihfr:the_carnage < this dimension now uses the Spooklementary_1.1 nether shaders. this was surprisingly easy. will have to manually adjust settings via hard-coding them in
This commit is contained in:
@ -0,0 +1,292 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform float far, near;
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
uniform sampler2D colortex0;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE || WATER_QUALITY >= 3 || defined NETHER_STORM
|
||||
|
||||
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE || defined NETHER_STORM
|
||||
uniform int frameCounter;
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
uniform sampler2D colortex3;
|
||||
#else
|
||||
uniform sampler2D colortex8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LIGHTSHAFTS_ACTIVE
|
||||
//uniform float viewWidth, viewHeight;
|
||||
uniform float blindness;
|
||||
uniform float darknessFactor;
|
||||
uniform float frameTime;
|
||||
uniform float frameTimeSmooth;
|
||||
|
||||
uniform ivec2 eyeBrightness;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
|
||||
uniform sampler2D shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
uniform sampler2D shadowcolor1;
|
||||
#endif
|
||||
|
||||
#if WATER_QUALITY >= 3
|
||||
uniform sampler2D colortex1;
|
||||
#endif
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE && defined LENSFLARE
|
||||
uniform sampler2D colortex4;
|
||||
#endif
|
||||
|
||||
uniform float wetness;
|
||||
uniform float inRainy;
|
||||
|
||||
//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;
|
||||
|
||||
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//
|
||||
|
||||
//Includes//
|
||||
#include "/spookylib/atmospherics/fog/waterFog.glsl"
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE
|
||||
#include "/spookylib/atmospherics/fog/bloomFog.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef LIGHTSHAFTS_ACTIVE
|
||||
#ifdef END
|
||||
#include "/spookylib/atmospherics/enderBeams.glsl"
|
||||
#endif
|
||||
#include "/spookylib/atmospherics/volumetricLight.glsl"
|
||||
#endif
|
||||
|
||||
#if WATER_QUALITY >= 3 || defined NETHER_STORM
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
#endif
|
||||
|
||||
#if WATER_QUALITY >= 3
|
||||
#include "/spookylib/materials/materialMethods/refraction.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef NETHER_STORM
|
||||
#include "/spookylib/atmospherics/netherStorm.glsl"
|
||||
#endif
|
||||
|
||||
#include "/spookylib/colors/colorMultipliers.glsl"
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
|
||||
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
|
||||
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE || WATER_QUALITY >= 3 || defined BLOOM_FOG_COMPOSITE || defined NETHER_STORM
|
||||
vec4 screenPos = vec4(texCoord, z0, 1.0);
|
||||
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
|
||||
viewPos /= viewPos.w;
|
||||
float lViewPos = length(viewPos.xyz);
|
||||
#endif
|
||||
|
||||
#if WATER_QUALITY >= 3
|
||||
DoRefraction(color, z0, z1, viewPos.xyz, lViewPos);
|
||||
#endif
|
||||
|
||||
vec4 volumetricEffect = vec4(0.0);
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE || defined NETHER_STORM
|
||||
/* 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 */
|
||||
#ifndef LIGHT_COLORING
|
||||
vec3 translucentMult = 1.0 - texelFetch(colortex3, texelCoord, 0).rgb;
|
||||
#else
|
||||
vec3 translucentMult = 1.0 - texelFetch(colortex8, texelCoord, 0).rgb;
|
||||
#endif
|
||||
|
||||
float dither = texture2D(noisetex, texCoord * view / 128.0).b;
|
||||
#ifdef TAA
|
||||
dither = fract(dither + 1.61803398875 * mod(float(frameCounter), 3600.0));
|
||||
#endif
|
||||
|
||||
vec4 screenPos1 = vec4(texCoord, z1, 1.0);
|
||||
vec4 viewPos1 = gbufferProjectionInverse * (screenPos1 * 2.0 - 1.0);
|
||||
viewPos1 /= viewPos1.w;
|
||||
float lViewPos1 = length(viewPos1.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef LIGHTSHAFTS_ACTIVE
|
||||
vec3 nViewPos = normalize(viewPos.xyz);
|
||||
float VdotL = dot(nViewPos, lightVec);
|
||||
#endif
|
||||
|
||||
#ifdef LIGHTSHAFTS_ACTIVE
|
||||
float vlFactorM = vlFactor;
|
||||
|
||||
float VdotU = dot(nViewPos, upVec);
|
||||
|
||||
volumetricEffect = GetVolumetricLight(color, vlFactorM, translucentMult, lViewPos1, nViewPos, VdotL, VdotU, texCoord, z0, z1, dither);
|
||||
#endif
|
||||
|
||||
#ifdef NETHER_STORM
|
||||
vec3 playerPos = ViewToPlayer(viewPos.xyz);
|
||||
|
||||
volumetricEffect = GetNetherStorm(color, translucentMult, playerPos, viewPos.xyz, lViewPos, lViewPos1, dither);
|
||||
#endif
|
||||
|
||||
volumetricEffect.rgb *= GetAtmColorMult();
|
||||
|
||||
#ifdef NETHER_STORM
|
||||
if (isEyeInWater == 0) color = mix(color, volumetricEffect.rgb, volumetricEffect.a);
|
||||
#endif
|
||||
|
||||
if (isEyeInWater == 1) {
|
||||
if (z0 == 1.0) color.rgb = waterFogColor;
|
||||
|
||||
vec3 underwaterMult = vec3(0.80, 0.87, 0.97);
|
||||
color.rgb *= underwaterMult * 0.85;
|
||||
volumetricEffect.rgb *= pow2(underwaterMult * 0.71);
|
||||
} else {
|
||||
if (isEyeInWater == 2) {
|
||||
if (z1 == 1.0) color.rgb = fogColor * 5.0;
|
||||
|
||||
volumetricEffect.rgb *= 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
color = pow(color, vec3(2.2));
|
||||
|
||||
#ifdef LIGHTSHAFTS_ACTIVE
|
||||
#ifdef END
|
||||
volumetricEffect.rgb *= volumetricEffect.rgb;
|
||||
#endif
|
||||
|
||||
color += volumetricEffect.rgb;
|
||||
#endif
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE
|
||||
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-2-3
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
|
||||
// a.k.a #if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
|
||||
#if LIGHTSHAFT_QUALI_DEFINE > 0 && LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 && defined OVERWORLD && defined REALTIME_SHADOWS || defined END
|
||||
#ifdef LENSFLARE
|
||||
if (viewWidth + viewHeight - gl_FragCoord.x - gl_FragCoord.y > 1.5)
|
||||
vlFactorM = texelFetch(colortex4, texelCoord, 0).r;
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:04 */
|
||||
gl_FragData[1] = vec4(vlFactorM, 0.0, 0.0, 1.0);
|
||||
#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
|
||||
|
||||
//Uniforms//
|
||||
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform sampler2D colortex4;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
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(colortex4, ivec2(viewWidth-1, viewHeight-1), 0).r;
|
||||
#else
|
||||
#if LIGHTSHAFT_BEHAVIOUR == 2
|
||||
vlFactor = 0.0;
|
||||
#elif LIGHTSHAFT_BEHAVIOUR == 3
|
||||
vlFactor = 1.0;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,159 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
#ifdef MOTION_BLURRING
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE2
|
||||
flat in vec3 upVec, sunVec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform sampler2D colortex0;
|
||||
|
||||
#ifdef MOTION_BLURRING
|
||||
uniform float viewWidth, viewHeight, aspectRatio;
|
||||
|
||||
uniform vec3 cameraPosition, previousCameraPosition;
|
||||
|
||||
uniform mat4 gbufferPreviousProjection, gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelView, gbufferPreviousModelView, gbufferModelViewInverse;
|
||||
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE2
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
#ifdef NETHER
|
||||
uniform float far;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
#if defined MOTION_BLURRING && defined BLOOM_FOG_COMPOSITE2
|
||||
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//
|
||||
#ifdef MOTION_BLURRING
|
||||
vec3 MotionBlur(vec3 color, float z, float dither) {
|
||||
if (z > 0.56) {
|
||||
float mbwg = 0.0;
|
||||
vec2 doublePixel = 2.0 / vec2(viewWidth, viewHeight);
|
||||
vec3 mblur = vec3(0.0);
|
||||
|
||||
vec4 currentPosition = vec4(texCoord, z, 1.0) * 2.0 - 1.0;
|
||||
|
||||
vec4 viewPos = gbufferProjectionInverse * currentPosition;
|
||||
viewPos = gbufferModelViewInverse * viewPos;
|
||||
viewPos /= viewPos.w;
|
||||
|
||||
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 * 0.02;
|
||||
|
||||
vec2 coord = texCoord - velocity * (3.5 + dither);
|
||||
for (int i = 0; i < 9; i++, coord += velocity) {
|
||||
vec2 coordb = clamp(coord, doublePixel, 1.0 - doublePixel);
|
||||
mblur += texture2DLod(colortex0, coordb, 0).rgb;
|
||||
mbwg += 1.0;
|
||||
}
|
||||
mblur /= mbwg;
|
||||
|
||||
return mblur;
|
||||
} else return color;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Includes//
|
||||
#ifdef MOTION_BLURRING
|
||||
#include "/spookylib/util/dither.glsl"
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE2
|
||||
#include "/spookylib/atmospherics/fog/bloomFog.glsl"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
|
||||
|
||||
#ifdef MOTION_BLURRING
|
||||
float z = texture2D(depthtex1, texCoord).x;
|
||||
float dither = Bayer64(gl_FragCoord.xy);
|
||||
|
||||
color = MotionBlur(color, z, dither);
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE2
|
||||
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);
|
||||
|
||||
color *= GetBloomFog(lViewPos); // Reminder: Bloom Fog can move between composite1-2-3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
#ifdef MOTION_BLURRING
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE2
|
||||
flat out vec3 upVec, sunVec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
#ifdef MOTION_BLURRING
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE2
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,204 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
#if WORLD_BLUR > 0
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
flat in vec3 upVec, sunVec;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform float far, near;
|
||||
|
||||
uniform sampler2D colortex0;
|
||||
|
||||
#if WORLD_BLUR > 0
|
||||
uniform float viewWidth, viewHeight, aspectRatio;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
#if WORLD_BLUR == 2 && 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
|
||||
|
||||
#ifdef WB_FOV_SCALED
|
||||
uniform mat4 gbufferProjection;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if WORLD_BLUR > 0 && defined BLOOM_FOG_COMPOSITE3
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
#endif
|
||||
|
||||
//Pipeline Constants//
|
||||
#if WORLD_BLUR > 0
|
||||
const bool colortex0MipmapEnabled = true;
|
||||
#endif
|
||||
|
||||
//Common Variables//
|
||||
#if WORLD_BLUR > 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;
|
||||
|
||||
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
|
||||
|
||||
//Common Functions//
|
||||
#if WORLD_BLUR > 0
|
||||
void DoWorldBlur(inout vec3 color, float z1, float lViewPos0) {
|
||||
if (z1 < 0.56) return;
|
||||
vec3 dof = vec3(0.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 // Depth Of Field
|
||||
#if WB_DOF_FOCUS >= 0
|
||||
float coc = max(abs(z1 - centerDepthSmooth) * 0.125 * WB_DOF_I - 0.0001, 0.0);
|
||||
#elif WB_DOF_FOCUS == -1
|
||||
float coc = clamp(abs(lViewPos0 * 0.005 - pow2(vsBrightness)), 0.0, 0.1) * WB_DOF_I * 0.03;
|
||||
#endif
|
||||
#endif
|
||||
coc = coc / sqrt(coc * coc + 0.1);
|
||||
|
||||
#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
|
||||
#ifdef WB_ANAMORPHIC
|
||||
dofScale *= vec2(0.5, 1.5);
|
||||
#endif
|
||||
|
||||
if (coc * 0.5 > 1.0 / max(viewWidth, viewHeight)) {
|
||||
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;
|
||||
color = dof;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//Includes//
|
||||
#if WORLD_BLUR > 0 && defined BLOOM_FOG_COMPOSITE3
|
||||
#include "/spookylib/atmospherics/fog/bloomFog.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
|
||||
|
||||
#if WORLD_BLUR > 0
|
||||
float z1 = texelFetch(depthtex1, texelCoord, 0).r;
|
||||
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
|
||||
|
||||
vec4 screenPos0 = vec4(texCoord, z0, 1.0);
|
||||
vec4 viewPos0 = gbufferProjectionInverse * (screenPos0 * 2.0 - 1.0);
|
||||
viewPos0 /= viewPos0.w;
|
||||
float lViewPos0 = length(viewPos0.xyz);
|
||||
|
||||
DoWorldBlur(color, z1, lViewPos0);
|
||||
|
||||
#ifdef BLOOM_FOG_COMPOSITE3
|
||||
color *= GetBloomFog(lViewPos0); // Reminder: Bloom Fog can move between composite1-2-3
|
||||
#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
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
flat out vec3 upVec, sunVec;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
#if WORLD_BLUR > 0
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,105 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//Varyings//
|
||||
varying vec2 texCoord;
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
//Uniforms//
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform sampler2D colortex0;
|
||||
|
||||
//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);
|
||||
|
||||
//Common Functions//
|
||||
vec3 BloomTile(float lod, vec2 offset, vec2 rescale) {
|
||||
vec3 bloom = vec3(0.0);
|
||||
float scale = exp2(lod);
|
||||
vec2 coord = (texCoord - 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) * rescale;
|
||||
vec2 bloomCoord = (texCoord - offset + pixelOffset) * scale;
|
||||
bloom += texture2D(colortex0, bloomCoord).rgb * wg;
|
||||
}
|
||||
}
|
||||
bloom /= 4096.0;
|
||||
}
|
||||
|
||||
return pow(bloom / 128.0, vec3(0.25));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec3 blur = vec3(0.0);
|
||||
|
||||
#ifdef BLOOM
|
||||
vec2 rescale = 1.0 / vec2(1920.0, 1080.0);
|
||||
|
||||
#if defined OVERWORLD || defined END
|
||||
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), rescale);
|
||||
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), rescale);
|
||||
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), rescale);
|
||||
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), rescale) * 0.8;
|
||||
blur += BloomTile(6.0, vec2(0.135 , 0.3325), rescale) * 0.8;
|
||||
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), rescale) * 0.6;
|
||||
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), rescale) * 0.4;
|
||||
#else
|
||||
blur += BloomTile(2.0, vec2(0.0 , 0.0 ), rescale);
|
||||
blur += BloomTile(3.0, vec2(0.0 , 0.26 ), rescale);
|
||||
blur += BloomTile(4.0, vec2(0.135 , 0.26 ), rescale);
|
||||
blur += BloomTile(5.0, vec2(0.2075 , 0.26 ), rescale);
|
||||
blur += BloomTile(6.0, vec2(0.135 , 0.3325), rescale);
|
||||
blur += BloomTile(7.0, vec2(0.160625 , 0.3325), rescale);
|
||||
blur += BloomTile(8.0, vec2(0.1784375, 0.3325), rescale) * 0.6;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:3 */
|
||||
#else
|
||||
/* DRAWBUFFERS:8 */
|
||||
#endif
|
||||
gl_FragData[0] = vec4(blur, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
texCoord = gl_MultiTexCoord0.xy;
|
||||
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,314 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
flat in vec3 upVec, sunVec;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float viewWidth, viewHeight;
|
||||
uniform float darknessFactor;
|
||||
|
||||
|
||||
|
||||
uniform sampler2D colortex0;
|
||||
|
||||
|
||||
#ifdef BLOOM
|
||||
#ifndef LIGHT_COLORING
|
||||
uniform sampler2D colortex3;
|
||||
#else
|
||||
uniform sampler2D colortex8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
uniform int isEyeInWater;
|
||||
#endif
|
||||
|
||||
#if defined BLOOM_FOG && defined NETHER
|
||||
uniform float far;
|
||||
#endif
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
uniform sampler2D depthtex0;
|
||||
#endif
|
||||
|
||||
#ifdef BLOOM_FOG
|
||||
uniform vec3 cameraPosition;
|
||||
#endif
|
||||
|
||||
#ifdef LENSFLARE
|
||||
uniform float aspectRatio;
|
||||
uniform mat4 gbufferProjection;
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
uniform sampler2D colortex4;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined GREEN_SCREEN_LIME || SELECT_OUTLINE == 4
|
||||
uniform sampler2D colortex1;
|
||||
#endif
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
float pw = 1.0 / viewWidth;
|
||||
float ph = 1.0 / viewHeight;
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
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//
|
||||
void DoBSLTonemap(inout vec3 color) {
|
||||
color = T_EXPOSURE * color;
|
||||
color = color / pow(pow(color, vec3(TM_WHITE_CURVE)) + 1.0, vec3(1.0 / TM_WHITE_CURVE));
|
||||
color = pow(color, mix(vec3(T_LOWER_CURVE), vec3(T_UPPER_CURVE), sqrt(color)));
|
||||
|
||||
color = pow(color, vec3(1.0 / 2.2));
|
||||
}
|
||||
|
||||
void linearToRGB(inout vec3 color) {
|
||||
const vec3 k = vec3(0.055);
|
||||
color = mix((vec3(1.0) + k) * pow(color, vec3(1.0 / 2.4)) - k, 12.92 * color, lessThan(color, vec3(0.0031308)));
|
||||
}
|
||||
|
||||
void doColorAdjustments(inout vec3 color) {
|
||||
color = (T_EXPOSURE - 0.40) * color;
|
||||
// color = color / pow(pow(color, vec3(TM_WHITE_CURVE * 0.5)) + 1.0, vec3(1.0 / (TM_WHITE_CURVE * 0.5)));
|
||||
color = pow(color, mix(vec3(T_LOWER_CURVE - 0.20), vec3(T_UPPER_CURVE - 0.30), sqrt(color)));
|
||||
}
|
||||
|
||||
vec3 LottesTonemap(vec3 color) {
|
||||
// Lottes 2016, "Advanced Techniques and Optimization of HDR Color Pipelines"
|
||||
// http://32ipi028l5q82yhj72224m8j.wpengine.netdna-cdn.com/wp-content/uploads/2016/03/GdcVdrLottes.pdf
|
||||
const vec3 a = vec3(1.3);
|
||||
const vec3 d = vec3(0.95);
|
||||
const vec3 hdrMax = vec3(8.0);
|
||||
const vec3 midIn = vec3(0.25);
|
||||
const vec3 midOut = vec3(0.25);
|
||||
|
||||
const vec3 a_d = a * d;
|
||||
const vec3 hdrMaxA = pow(hdrMax, a);
|
||||
const vec3 hdrMaxAD = pow(hdrMax, a_d);
|
||||
const vec3 midInA = pow(midIn, a);
|
||||
const vec3 midInAD = pow(midIn, a_d);
|
||||
const vec3 HM1 = hdrMaxA * midOut;
|
||||
const vec3 HM2 = hdrMaxAD - midInAD;
|
||||
|
||||
const vec3 b = (-midInA + HM1) / (HM2 * midOut);
|
||||
const vec3 c = (hdrMaxAD * midInA - HM1 * midInAD) / (HM2 * midOut);
|
||||
|
||||
color = pow(color, a) / (pow(color, a_d) * b + c);
|
||||
|
||||
doColorAdjustments(color);
|
||||
|
||||
linearToRGB(color);
|
||||
return color;
|
||||
}
|
||||
|
||||
void DoBSLColorSaturation(inout vec3 color) {
|
||||
float grayVibrance = (color.r + color.g + color.b) / 3.0;
|
||||
float graySaturation = grayVibrance;
|
||||
if (T_SATURATION < 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 * T_SATURATION - graySaturation * (T_SATURATION - 1.0);
|
||||
}
|
||||
|
||||
#ifdef BLOOM
|
||||
vec3 GetBloomTile(float lod, vec2 coord, vec2 offset, vec2 ditherAdd) {
|
||||
float scale = exp2(lod);
|
||||
vec2 bloomCoord = coord / scale + offset;
|
||||
bloomCoord += ditherAdd;
|
||||
bloomCoord = clamp(bloomCoord, offset, 1.0 / scale + offset);
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
vec3 bloom = texture2D(colortex3, bloomCoord).rgb;
|
||||
#else
|
||||
vec3 bloom = texture2D(colortex8, bloomCoord).rgb;
|
||||
#endif
|
||||
bloom *= bloom;
|
||||
bloom *= bloom;
|
||||
return bloom * 128.0;
|
||||
}
|
||||
|
||||
void DoBloom(inout vec3 color, vec2 coord, float dither, float lViewPos) {
|
||||
vec2 rescale = 1.0 / vec2(1920.0, 1080.0);
|
||||
vec2 ditherAdd = vec2(0.0);
|
||||
float ditherM = dither - 0.5;
|
||||
if (rescale.x > pw) ditherAdd.x += ditherM * pw;
|
||||
if (rescale.y > ph) ditherAdd.y += ditherM * ph;
|
||||
|
||||
vec3 blur1 = GetBloomTile(2.0, coord, vec2(0.0 , 0.0 ), ditherAdd);
|
||||
vec3 blur2 = GetBloomTile(3.0, coord, vec2(0.0 , 0.26 ), ditherAdd);
|
||||
vec3 blur3 = GetBloomTile(4.0, coord, vec2(0.135 , 0.26 ), ditherAdd);
|
||||
vec3 blur4 = GetBloomTile(5.0, coord, vec2(0.2075 , 0.26 ), ditherAdd);
|
||||
vec3 blur5 = GetBloomTile(6.0, coord, vec2(0.135 , 0.3325), ditherAdd);
|
||||
vec3 blur6 = GetBloomTile(7.0, coord, vec2(0.160625 , 0.3325), ditherAdd);
|
||||
vec3 blur7 = GetBloomTile(8.0, coord, vec2(0.1784375, 0.3325), ditherAdd);
|
||||
|
||||
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 netherBloom = lViewPos / clamp(far, 192.0, 256.0); // consistency9023HFUE85JG
|
||||
netherBloom *= netherBloom;
|
||||
netherBloom *= netherBloom;
|
||||
netherBloom = 1.0 - exp(-8.0 * netherBloom);
|
||||
bloomStrength = mix(bloomStrength * 0.7, bloomStrength * 1.8, netherBloom);
|
||||
#endif
|
||||
|
||||
color = mix(color, blur, bloomStrength);
|
||||
}
|
||||
#endif
|
||||
|
||||
//Includes//
|
||||
#ifdef BLOOM_FOG
|
||||
#include "/spookylib/atmospherics/fog/bloomFog.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef BLOOM
|
||||
#include "/spookylib/util/dither.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef LENSFLARE
|
||||
#include "/spookylib/misc/lensFlare.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec3 color = texture2D(colortex0, texCoord).rgb;
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
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);
|
||||
#else
|
||||
float lViewPos = 0.0;
|
||||
#endif
|
||||
|
||||
float dither = texture2D(noisetex, texCoord * vec2(viewWidth, viewHeight) / 128.0).b;
|
||||
#ifdef TAA
|
||||
dither = fract(dither + 1.61803398875 * mod(float(frameCounter), 3600.0));
|
||||
#endif
|
||||
|
||||
#ifdef BLOOM_FOG
|
||||
color /= GetBloomFog(lViewPos);
|
||||
#endif
|
||||
|
||||
#ifdef BLOOM
|
||||
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
|
||||
|
||||
color = LottesTonemap(color);
|
||||
|
||||
#if defined GREEN_SCREEN_LIME || SELECT_OUTLINE == 4
|
||||
int materialMaskInt = int(texelFetch(colortex1, texelCoord, 0).g * 255.1);
|
||||
#endif
|
||||
|
||||
#ifdef GREEN_SCREEN_LIME
|
||||
if (materialMaskInt == 240) { // Green Screen Lime Blocks
|
||||
color = vec3(0.0, 1.0, 0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SELECT_OUTLINE == 4
|
||||
if (materialMaskInt == 252) { // 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
|
||||
|
||||
#ifdef LENSFLARE
|
||||
DoLensFlare(color, viewPos.xyz, dither);
|
||||
#endif
|
||||
|
||||
DoBSLColorSaturation(color);
|
||||
|
||||
#ifdef VIGNETTE_R
|
||||
vec2 texCoordMin = texCoord.xy - 0.5;
|
||||
float vignette = 1.0 - dot(texCoordMin, texCoordMin) * (1.0 - GetLuminance(color));
|
||||
color *= vignette;
|
||||
#endif
|
||||
|
||||
float filmGrain = dither;
|
||||
color += vec3((filmGrain - 0.25) / 128.0);
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:3 */
|
||||
#else
|
||||
/* DRAWBUFFERS:8 */
|
||||
#endif
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
flat out vec3 upVec, sunVec;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
#if defined BLOOM_FOG || defined LENSFLARE
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,114 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
//Uniforms//
|
||||
uniform float viewWidth, viewHeight;
|
||||
uniform float far, near;
|
||||
|
||||
uniform vec3 cameraPosition, previousCameraPosition;
|
||||
|
||||
uniform mat4 gbufferPreviousProjection, gbufferProjectionInverse;
|
||||
uniform mat4 gbufferPreviousModelView, gbufferModelViewInverse;
|
||||
|
||||
uniform sampler2D colortex2;
|
||||
uniform sampler2D colortex1;
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
uniform sampler2D colortex3;
|
||||
#else
|
||||
uniform sampler2D colortex8;
|
||||
#endif
|
||||
|
||||
//Pipeline Constants//
|
||||
#include "/spookylib/pipelineSettings.glsl"
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
const bool colortex3MipmapEnabled = true;
|
||||
#else
|
||||
const bool colortex8MipmapEnabled = true;
|
||||
#endif
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
float GetLinearDepth(float depth) {
|
||||
return (2.0 * near) / (far + near - depth * (far - near));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#ifdef TAA
|
||||
#include "/spookylib/antialiasing/taa.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
#ifndef LIGHT_COLORING
|
||||
vec3 color = texelFetch(colortex3, texelCoord, 0).rgb;
|
||||
#else
|
||||
vec3 color = texelFetch(colortex8, texelCoord, 0).rgb;
|
||||
#endif
|
||||
|
||||
vec3 temp = vec3(0.0);
|
||||
float depth;
|
||||
|
||||
#ifdef TEMPORAL_FILTER
|
||||
depth = texelFetch(depthtex1, texelCoord, 0).r;
|
||||
#endif
|
||||
|
||||
#ifdef TAA
|
||||
DoTAA(color, temp, depth);
|
||||
#endif
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:32 */
|
||||
#else
|
||||
/* DRAWBUFFERS:82 */
|
||||
#endif
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
gl_FragData[1] = vec4(temp, 1.0);
|
||||
|
||||
#ifdef TEMPORAL_FILTER
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:326 */
|
||||
#else
|
||||
/* DRAWBUFFERS:826 */
|
||||
#endif
|
||||
gl_FragData[2] = vec4(depth, 0.0, 0.0, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,77 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
//Uniforms//
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
uniform sampler2D colortex3;
|
||||
#else
|
||||
uniform sampler2D colortex8;
|
||||
#endif
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef FXAA
|
||||
#include "/spookylib/antialiasing/fxaa.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
#ifndef LIGHT_COLORING
|
||||
vec3 color = texelFetch(colortex3, texelCoord, 0).rgb;
|
||||
#else
|
||||
vec3 color = texelFetch(colortex8, texelCoord, 0).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef FXAA
|
||||
FXAA311(color);
|
||||
#endif
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:3 */
|
||||
#else
|
||||
/* DRAWBUFFERS:8 */
|
||||
#endif
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,569 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
flat in vec3 upVec, sunVec;
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
|
||||
flat in float vlFactor;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float far, near;
|
||||
uniform float viewWidth, viewHeight;
|
||||
uniform float blindness;
|
||||
uniform float darknessFactor;
|
||||
|
||||
uniform float aspectRatio;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D colortex0;
|
||||
uniform sampler2D colortex1;
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
|
||||
#if SSAO_QUALI > 0 || defined PBR_REFLECTIONS
|
||||
uniform mat4 gbufferProjection;
|
||||
#endif
|
||||
|
||||
#ifdef PBR_REFLECTIONS
|
||||
uniform mat4 gbufferModelView;
|
||||
|
||||
uniform sampler2D colortex5;
|
||||
#endif
|
||||
|
||||
#if AURORA_STYLE > 0
|
||||
|
||||
|
||||
uniform float inSnowy;
|
||||
#endif
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
uniform ivec2 eyeBrightness;
|
||||
|
||||
#ifdef REALTIME_SHADOWS
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
#endif
|
||||
|
||||
#ifdef CLOUDS_REIMAGINED
|
||||
uniform sampler2D colortex3;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TEMPORAL_FILTER
|
||||
uniform vec3 previousCameraPosition;
|
||||
|
||||
uniform mat4 gbufferPreviousProjection;
|
||||
uniform mat4 gbufferPreviousModelView;
|
||||
|
||||
uniform sampler2D colortex6;
|
||||
uniform sampler2D colortex7;
|
||||
#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);
|
||||
}
|
||||
|
||||
#if SSAO_QUALI > 0
|
||||
vec2 OffsetDist(float x, int s) {
|
||||
float n = fract(x * 1.414) * 3.1415;
|
||||
return pow2(vec2(cos(n), sin(n)) * x / s);
|
||||
}
|
||||
|
||||
float DoAmbientOcclusion(float z0, float linearZ0, float dither) {
|
||||
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
|
||||
return pow(ao, SSAO_IM);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEMPORAL_FILTER
|
||||
float GetApproxDistance(float depth) {
|
||||
return near * far / (far - depth * far);
|
||||
}
|
||||
|
||||
// Previous frame reprojection from Chocapic13
|
||||
vec2 Reprojection(vec3 pos, vec3 cameraOffset) {
|
||||
pos = pos * 2.0 - 1.0;
|
||||
|
||||
vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0);
|
||||
viewPosPrev /= viewPosPrev.w;
|
||||
viewPosPrev = gbufferModelViewInverse * viewPosPrev;
|
||||
|
||||
vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0);
|
||||
previousPosition = gbufferPreviousModelView * previousPosition;
|
||||
previousPosition = gbufferPreviousProjection * previousPosition;
|
||||
return previousPosition.xy / previousPosition.w * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
vec3 FHalfReprojection(vec3 pos) {
|
||||
pos = pos * 2.0 - 1.0;
|
||||
|
||||
vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0);
|
||||
viewPosPrev /= viewPosPrev.w;
|
||||
viewPosPrev = gbufferModelViewInverse * viewPosPrev;
|
||||
|
||||
return viewPosPrev.xyz;
|
||||
}
|
||||
|
||||
vec2 SHalfReprojection(vec3 playerPos, vec3 cameraOffset) {
|
||||
vec4 proPos = vec4(playerPos + cameraOffset, 1.0);
|
||||
vec4 previousPosition = gbufferPreviousModelView * proPos;
|
||||
previousPosition = gbufferPreviousProjection * previousPosition;
|
||||
return previousPosition.xy / previousPosition.w * 0.5 + 0.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Includes//
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/util/dither.glsl"
|
||||
#include "/spookylib/atmospherics/fog/mainFog.glsl"
|
||||
#include "/spookylib/colors/skyColors.glsl"
|
||||
|
||||
#ifdef PBR_REFLECTIONS
|
||||
#include "/spookylib/materials/materialMethods/reflections.glsl"
|
||||
#endif
|
||||
|
||||
#if AURORA_STYLE > 0
|
||||
#include "/spookylib/atmospherics/auroraBorealis.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
#include "/spookylib/atmospherics/clouds/mainClouds.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
#include "/spookylib/atmospherics/enderStars.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef WORLD_OUTLINE
|
||||
#include "/spookylib/misc/worldOutline.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef DARK_OUTLINE
|
||||
#include "/spookylib/misc/darkOutline.glsl"
|
||||
#endif
|
||||
|
||||
#include "/spookylib/colors/colorMultipliers.glsl"
|
||||
|
||||
#ifdef NIGHT_NEBULA
|
||||
#include "/spookylib/atmospherics/nightNebula.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
|
||||
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);
|
||||
vec3 nViewPos = normalize(viewPos.xyz);
|
||||
vec3 playerPos = ViewToPlayer(viewPos.xyz);
|
||||
|
||||
float dither = texture2D(noisetex, texCoord * vec2(viewWidth, viewHeight) / 128.0).b;
|
||||
#ifdef TAA
|
||||
dither = fract(dither + 1.61803398875 * mod(float(frameCounter), 3600.0));
|
||||
#endif
|
||||
|
||||
atmColorMult = GetAtmColorMult();
|
||||
|
||||
float VdotU = dot(nViewPos, upVec);
|
||||
float VdotS = dot(nViewPos, sunVec);
|
||||
float skyFade = 0.0;
|
||||
vec3 waterRefColor = vec3(0.0);
|
||||
|
||||
#if AURORA_STYLE > 0
|
||||
vec3 auroraBorealis = vec3(0.0);
|
||||
#endif
|
||||
#ifdef NIGHT_NEBULA
|
||||
vec3 nightNebula = vec3(0.0);
|
||||
#endif
|
||||
|
||||
#ifdef TEMPORAL_FILTER
|
||||
vec4 refToWrite = vec4(0.0);
|
||||
#endif
|
||||
|
||||
if (z0 < 1.0) {
|
||||
vec3 texture1 = texelFetch(colortex1, texelCoord, 0).rgb;
|
||||
|
||||
#if SSAO_QUALI > 0 || defined WORLD_OUTLINE || defined TEMPORAL_FILTER
|
||||
float linearZ0 = GetLinearDepth(z0);
|
||||
#endif
|
||||
|
||||
#if SSAO_QUALI > 0
|
||||
float ssao = DoAmbientOcclusion(z0, linearZ0, dither);
|
||||
#else
|
||||
float ssao = 1.0;
|
||||
#endif
|
||||
|
||||
int materialMaskInt = int(texture1.g * 255.1);
|
||||
float intenseFresnel = 0.0;
|
||||
float smoothnessD = texture1.r;
|
||||
vec3 reflectColor = vec3(1.0);
|
||||
|
||||
#ifdef IPBR
|
||||
#include "/spookylib/materials/materialHandling/deferredMaterials.glsl"
|
||||
#else
|
||||
if (materialMaskInt <= 240) {
|
||||
#ifdef CUSTOM_PBR
|
||||
#if RP_MODE == 2 // seuspbr
|
||||
float metalness = materialMaskInt / 240.0;
|
||||
|
||||
intenseFresnel = metalness;
|
||||
color.rgb *= 1.0 - 0.25 * metalness;
|
||||
#elif RP_MODE == 3 // labPBR
|
||||
float metalness = float(materialMaskInt >= 230);
|
||||
|
||||
intenseFresnel = materialMaskInt / 240.0;
|
||||
color.rgb *= 1.0 - 0.25 * metalness;
|
||||
#endif
|
||||
reflectColor = mix(reflectColor, color.rgb / max(color.r + 0.00001, max(color.g, color.b)), metalness);
|
||||
#endif
|
||||
} else {
|
||||
if (materialMaskInt == 254) // No SSAO, No TAA
|
||||
ssao = 1.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
color.rgb *= ssao;
|
||||
|
||||
#ifdef PBR_REFLECTIONS
|
||||
float skyLightFactor = texture1.b;
|
||||
vec3 texture5 = texelFetch(colortex5, texelCoord, 0).rgb;
|
||||
vec3 normalM = mat3(gbufferModelView) * texture5;
|
||||
|
||||
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
|
||||
|
||||
float fresnelFactor = (1.0 - smoothnessD) * 0.7;
|
||||
float fresnelM = max(fresnel - fresnelFactor, 0.0) / (1.0 - fresnelFactor);
|
||||
#ifdef IPBR
|
||||
fresnelM = mix(pow2(fresnelM), fresnelM * 0.75 + 0.25, intenseFresnel);
|
||||
#else
|
||||
fresnelM = mix(pow2(fresnelM), fresnelM * 0.5 + 0.5, intenseFresnel);
|
||||
#endif
|
||||
fresnelM = fresnelM * sqrt1(smoothnessD) - dither * 0.001;
|
||||
|
||||
if (fresnelM > 0.0) {
|
||||
vec3 roughPos = playerPos + cameraPosition;
|
||||
roughPos *= 256.0;
|
||||
vec2 roughCoord = roughPos.xz + roughPos.y;
|
||||
#ifndef TEMPORAL_FILTER
|
||||
float noiseMult = 0.3;
|
||||
#else
|
||||
float noiseMult = 0.3;
|
||||
float blendFactor = 1.0;
|
||||
float writeFactor = 1.0;
|
||||
roughCoord += fract(frameTimeCounter);
|
||||
#endif
|
||||
vec3 roughNoise = vec3(texture2D(noisetex, roughCoord).r, texture2D(noisetex, roughCoord + 0.1).r, texture2D(noisetex, roughCoord + 0.2).r);
|
||||
roughNoise = noiseMult * (roughNoise - vec3(0.5));
|
||||
roughNoise *= pow2(1.0 - smoothnessD);
|
||||
#if defined CUSTOM_PBR || defined IPBR && defined IS_IRIS
|
||||
if (z0 < 0.56) {
|
||||
roughNoise *= 0.1;
|
||||
#ifdef TEMPORAL_FILTER
|
||||
blendFactor = 0.0;
|
||||
writeFactor = 0.0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
normalM += roughNoise;
|
||||
|
||||
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, z0,
|
||||
depthtex0, dither, skyLightFactor, fresnel,
|
||||
smoothnessD, vec3(0.0), vec3(0.0), vec3(0.0), 0.0);
|
||||
|
||||
vec3 colorAdd = reflection.rgb * reflectColor;
|
||||
//float colorMultInv = (0.75 - intenseFresnel * 0.5) * max(reflection.a, skyLightFactor);
|
||||
//float colorMultInv = max(reflection.a, skyLightFactor);
|
||||
float colorMultInv = 1.0;
|
||||
|
||||
#ifdef IPBR
|
||||
vec3 colorP = color;
|
||||
#endif
|
||||
|
||||
#ifndef TEMPORAL_FILTER
|
||||
color *= 1.0 - colorMultInv * fresnelM;
|
||||
color += colorAdd * fresnelM;
|
||||
#else
|
||||
vec3 cameraOffset = cameraPosition - previousCameraPosition;
|
||||
vec2 prvCoord = SHalfReprojection(playerPos, cameraOffset);
|
||||
#if defined IPBR && !defined GENERATED_NORMALS
|
||||
vec2 prvRefCoord = Reprojection(vec3(texCoord, max(refPos.z, z0)), cameraOffset);
|
||||
vec4 oldRef = texture2D(colortex7, prvRefCoord);
|
||||
#else
|
||||
vec2 prvRefCoord = Reprojection(vec3(texCoord, z0), cameraOffset);
|
||||
vec2 prvRefCoord2 = Reprojection(vec3(texCoord, max(refPos.z, z0)), cameraOffset);
|
||||
vec4 oldRef1 = texture2D(colortex7, prvRefCoord);
|
||||
vec4 oldRef2 = texture2D(colortex7, prvRefCoord2);
|
||||
vec3 dif1 = colorAdd - oldRef1.rgb;
|
||||
vec3 dif2 = colorAdd - oldRef2.rgb;
|
||||
float dotDif1 = dot(dif1, dif1);
|
||||
float dotDif2 = dot(dif2, dif2);
|
||||
|
||||
float oldRefMixer = clamp01((dotDif1 - dotDif2) * 500.0);
|
||||
vec4 oldRef = mix(oldRef1, oldRef2, oldRefMixer);
|
||||
#endif
|
||||
|
||||
vec4 newRef = vec4(colorAdd, colorMultInv);
|
||||
float lCameraOffset = length(cameraOffset);
|
||||
ivec2 texelOppositePreCoord = clamp(ivec2((texCoord - 2.0 * (prvCoord - texCoord)) * view), ivec2(0, 0), texelCoord);
|
||||
|
||||
// Reduce blending at speed
|
||||
blendFactor *= float(prvCoord.x > 0.0 && prvCoord.x < 1.0 && prvCoord.y > 0.0 && prvCoord.y < 1.0);
|
||||
float velocity = lCameraOffset * max(16.0 - lViewPos / gbufferProjection[1][1], 3.0);
|
||||
blendFactor *= 0.7 + 0.3 * exp(-velocity);
|
||||
|
||||
// Reduce blending if depth changed
|
||||
float linearZP = GetLinearDepth(texelFetch(colortex6, texelOppositePreCoord, 0).r);
|
||||
float linearZP2 = GetLinearDepth(texture2D(colortex6, texCoord + 1.5 * (prvCoord - texCoord)).r);
|
||||
float linearZDif = max(abs(linearZP - linearZ0), abs(linearZP2 - linearZ0)) * far;
|
||||
blendFactor *= max0(2.0 - linearZDif) * 0.5;
|
||||
//color = mix(vec3(1,1,0), color, max0(2.0 - max0(linearZDif - 1.0)) * 0.5);
|
||||
|
||||
// Reduce blending if normal changed
|
||||
vec3 texture5P = texelFetch(colortex5, texelOppositePreCoord, 0).rgb;
|
||||
vec3 texture5Dif = abs(texture5 - texture5P);
|
||||
if (texture5Dif != clamp(texture5Dif, vec3(-0.004), vec3(0.004))) {
|
||||
blendFactor = 0.0;
|
||||
//color.rgb = vec3(1,0,1);
|
||||
}
|
||||
|
||||
blendFactor = max0(blendFactor); // Prevent first frame NaN
|
||||
newRef = max(newRef, vec4(0.0)); // Prevent random NaNs from persisting
|
||||
refToWrite = mix(newRef, oldRef, blendFactor * 0.95);
|
||||
|
||||
color.rgb *= 1.0 - refToWrite.a * fresnelM;
|
||||
color.rgb += refToWrite.rgb * fresnelM;
|
||||
|
||||
refToWrite *= writeFactor;
|
||||
#endif
|
||||
|
||||
#ifdef IPBR
|
||||
color = max(colorP * max(intenseFresnel, 1.0 - pow2(smoothnessD)) * 0.9, color);
|
||||
#endif
|
||||
|
||||
//if (gl_FragCoord.x > 960) color = vec3(5.25,0,5.25);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WORLD_OUTLINE
|
||||
DoWorldOutline(color, linearZ0);
|
||||
#endif
|
||||
|
||||
waterRefColor = sqrt(color) - 1.0;
|
||||
|
||||
DoFog(color, skyFade, lViewPos, playerPos, VdotU, VdotS, dither);
|
||||
} else { // Sky
|
||||
skyFade = 1.0;
|
||||
|
||||
#ifdef OVERWORLD
|
||||
#if AURORA_STYLE > 0
|
||||
auroraBorealis = GetAuroraBorealis(viewPos.xyz, VdotU, dither);
|
||||
auroraBorealis *= atmColorMult;
|
||||
color.rgb += auroraBorealis;
|
||||
#endif
|
||||
#ifdef NIGHT_NEBULA
|
||||
nightNebula += GetNightNebula(viewPos.xyz, VdotU, VdotS);
|
||||
nightNebula *= atmColorMult;
|
||||
color.rgb += nightNebula;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NETHER
|
||||
color.rgb = netherColor;
|
||||
|
||||
color.rgb *= atmColorMult;
|
||||
#endif
|
||||
#ifdef END
|
||||
color.rgb = endSkyColor;
|
||||
color.rgb += GetEnderStars(viewPos.xyz, VdotU);
|
||||
|
||||
color.rgb *= atmColorMult;
|
||||
#endif
|
||||
}
|
||||
|
||||
float cloudLinearDepth = 1.0;
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
if (z0 > 0.56) {
|
||||
vec4 clouds = GetClouds(cloudLinearDepth, skyFade, playerPos, viewPos.xyz, lViewPos, VdotS, VdotU, dither);
|
||||
|
||||
clouds.rgb *= atmColorMult;
|
||||
|
||||
#if AURORA_STYLE > 0
|
||||
clouds.rgb += auroraBorealis * 0.1;
|
||||
#endif
|
||||
#ifdef NIGHT_NEBULA
|
||||
clouds.rgb += nightNebula * 0.2;
|
||||
#endif
|
||||
|
||||
color = mix(color, clouds.rgb, clouds.a);
|
||||
}
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#ifdef DARK_OUTLINE
|
||||
DoDarkOutline(color, skyFade, z0, dither);
|
||||
#endif
|
||||
|
||||
/*DRAWBUFFERS:054*/
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
gl_FragData[1] = vec4(waterRefColor, 1.0 - skyFade);
|
||||
gl_FragData[2] = vec4(cloudLinearDepth, 0.0, 0.0, 1.0);
|
||||
#ifdef TEMPORAL_FILTER
|
||||
/*DRAWBUFFERS:0547*/
|
||||
gl_FragData[3] = refToWrite;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
flat out vec3 upVec, sunVec;
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
|
||||
flat out float vlFactor;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform sampler2D colortex4;
|
||||
|
||||
#ifdef END
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float frameTimeSmooth;
|
||||
uniform float far;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
|
||||
#if defined LIGHTSHAFTS_ACTIVE && (LIGHTSHAFT_BEHAVIOUR == 1 && SHADOW_QUALITY >= 1 || defined END)
|
||||
vlFactor = texelFetch(colortex4, ivec2(viewWidth-1, viewHeight-1), 0).r;
|
||||
|
||||
#ifdef END
|
||||
if (frameCounter % int(0.06666 / frameTimeSmooth + 0.5) == 0) { // Change speed is not too different above 10 fps
|
||||
vec2 absCamPosXZ = abs(cameraPosition.xz);
|
||||
float maxCamPosXZ = max(absCamPosXZ.x, absCamPosXZ.y);
|
||||
|
||||
if (gl_Fog.start / far > 0.5 || maxCamPosXZ > 350.0) vlFactor = max(vlFactor - OSIEBCA*2, 0.0);
|
||||
else vlFactor = min(vlFactor + OSIEBCA*2, 1.0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,205 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
noperspective in vec2 texCoord;
|
||||
|
||||
//Uniforms//
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
uniform sampler2D colortex3;
|
||||
#else
|
||||
uniform sampler2D colortex3; /*test*//*test*//*test*//*test*/
|
||||
uniform sampler2D colortex8;
|
||||
#endif
|
||||
|
||||
#ifdef UNDERWATER_DISTORTION
|
||||
uniform int isEyeInWater;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
uniform float playerMood;
|
||||
|
||||
//Pipeline Constants//
|
||||
#include "/spookylib/pipelineSettings.glsl"
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//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) {
|
||||
float mult = 0.0125 * IMAGE_SHARPENING;
|
||||
color *= 1.0 + 0.05 * IMAGE_SHARPENING;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
#ifndef LIGHT_COLORING
|
||||
color -= texture2D(colortex3, texCoordM + sharpenOffsets[i]).rgb * mult;
|
||||
#else
|
||||
color -= texture2D(colortex8, texCoordM + sharpenOffsets[i]).rgb * mult;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
float retroNoise (vec2 noise){
|
||||
return fract(sin(dot(noise.xy,vec2(10.998,98.233)))*12433.14159265359);
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#ifdef MC_ANISOTROPIC_FILTERING
|
||||
#include "/spookylib/util/textRendering.glsl"
|
||||
|
||||
void beginTextM(int textSize, vec2 offset) {
|
||||
beginText(ivec2(vec2(viewWidth, viewHeight) * texCoord) / textSize, ivec2(0 + offset.x, viewHeight / textSize - offset.y));
|
||||
text.bgCol = vec4(0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec2 texCoordM = texCoord;
|
||||
|
||||
float randomShutterTime = 24000 * hash1(worldDay * 5); // Effect happens randomly throughout the day
|
||||
int displaceEffect = (int(hash1(worldDay / 2)) % (2 * 24000)) + int(randomShutterTime);
|
||||
if (worldTime > displaceEffect && worldTime < displaceEffect + 100) { // 100 in ticks - 5s, how long the effect will be on
|
||||
float scrollSpeed = 2.0;
|
||||
float stutterSpeed = 0.2;
|
||||
float scroll = (1.0 - step(retroNoise(vec2(frameTimeCounter * 0.00002, 8.0)), 0.9)) * scrollSpeed;
|
||||
float stutter = (1.0 - step(retroNoise(vec2(frameTimeCounter * 0.00005, 9.0)), 0.8)) * stutterSpeed;
|
||||
float stutter2 = (1.0 - step(retroNoise(vec2(frameTimeCounter * 0.00003, 5.0)), 0.7)) * stutterSpeed;
|
||||
float verticalOffset = sin(frameTimeCounter) * scroll + stutter * stutter2;
|
||||
texCoordM.y = mod(texCoordM.y + verticalOffset, 1.10);
|
||||
}
|
||||
|
||||
#ifdef UNDERWATER_DISTORTION
|
||||
if (isEyeInWater == 1)
|
||||
texCoordM += WATER_REFRACTION_INTENSITY * 0.00035 * sin((texCoord.x + texCoord.y) * 25.0 + frameTimeCounter * 3.0);
|
||||
#endif
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
vec3 color = texture2D(colortex3, texCoordM).rgb;
|
||||
#else
|
||||
vec3 color = texture2D(colortex8, texCoordM).rgb;
|
||||
#endif
|
||||
|
||||
vec2 scale = vec2(1.0, viewHeight / viewWidth);
|
||||
vec2 aberration = (texCoordM - 0.5) * (2.0 / vec2(viewWidth, viewHeight)) * scale * max(CHROMA_ABERRATION, playerMood * 10.0);
|
||||
#ifndef LIGHT_COLORING
|
||||
color.rb = vec2(texture2D(colortex3, texCoordM + aberration).r, texture2D(colortex3, texCoordM - aberration).b);
|
||||
#else
|
||||
color.rb = vec2(texture2D(colortex8, texCoordM + aberration).r, texture2D(colortex8, texCoordM - aberration).b);
|
||||
#endif
|
||||
|
||||
#if IMAGE_SHARPENING > 0
|
||||
SharpenImage(color, texCoordM);
|
||||
#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 LIGHT_COLORING
|
||||
if (max(texCoordM.x, texCoordM.y) < 0.25) color = texture2D(colortex3, texCoordM * 4.0).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef MC_ANISOTROPIC_FILTERING
|
||||
color.rgb = mix(color.rgb, vec3(0.0), 0.75);
|
||||
|
||||
beginTextM(8, vec2(6, 10));
|
||||
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
printString((_I, _m, _p, _o, _r, _t, _a, _n, _t, _space, _I, _s, _s, _u, _e, _space));
|
||||
endText(color.rgb);
|
||||
|
||||
beginTextM(4, vec2(15, 30));
|
||||
printLine();
|
||||
text.fgCol = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
printString((
|
||||
_P, _l, _e, _a, _s, _e, _space, _g, _o, _space, _t, _o, _space,
|
||||
_E, _S, _C, _space, _minus, _space, _O, _p, _t, _i, _o, _n, _s, _space, _minus, _space
|
||||
));
|
||||
printLine();
|
||||
printString((
|
||||
_V, _i, _d, _e, _o, _space, _S, _e, _t, _t, _i, _n, _g, _s, _space, _minus, _space,
|
||||
_Q, _u, _a, _l, _i, _t, _y, _space, _minus, _space
|
||||
));
|
||||
printLine();
|
||||
printString((
|
||||
_a, _n, _d, _space, _d, _i, _s, _a, _b, _l, _e, _space,
|
||||
_A, _n, _i, _s, _o, _t, _r, _o, _p, _i, _c, _space, _F, _i, _l, _t, _e, _r, _i, _n, _g, _dot
|
||||
));
|
||||
endText(color.rgb);
|
||||
#endif
|
||||
|
||||
float maxStrength = 0.50;
|
||||
float minStrength = 0.30;
|
||||
const float speed = 10.0;
|
||||
|
||||
vec2 fractCoord = fract(texCoord * fract(sin(frameTimeCounter * speed)));
|
||||
|
||||
maxStrength = clamp(sin(frameTimeCounter * 0.5), minStrength, maxStrength);
|
||||
|
||||
vec3 staticColor = vec3(retroNoise(fractCoord)) * maxStrength;
|
||||
float staticIntensity = 0.0;
|
||||
if (playerMood > 0.9) staticIntensity = (playerMood * 10.0 - 9.0) * 0.75;
|
||||
color *= mix(vec3(1.0), color - staticColor, staticIntensity);
|
||||
|
||||
color.rgb = mix(color.rgb, color.rgb * GetLuminance(color), 0.60);
|
||||
|
||||
//if (gl_FragCoord.x < 479 || gl_FragCoord.x > 1441) color = vec3(0.0);
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
noperspective out vec2 texCoord;
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,79 @@
|
||||
//////////////////////////////////
|
||||
// Complementary Base by EminGT //
|
||||
//////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
flat in vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
uniform sampler2D tex;
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
color *= glColor;
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = color;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
flat out vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
#if HAND_SWAYING > 0
|
||||
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
glColor = gl_Color;
|
||||
|
||||
#if HAND_SWAYING > 0
|
||||
if (gl_ProjectionMatrix[2][2] > -0.5) {
|
||||
#include "/spookylib/misc/handSway.glsl"
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,184 @@
|
||||
//////////////////////////////////
|
||||
// Complementary Base by EminGT //
|
||||
//////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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;
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float nightVision;
|
||||
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
|
||||
|
||||
//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 "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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 shadowMult = vec3(1.0);
|
||||
|
||||
#ifndef GBUFFERS_LINE
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, normal, lmCoord,
|
||||
false, false, false, false,
|
||||
0, 0.0, 0.0, 0.0);
|
||||
#endif
|
||||
|
||||
#if SELECT_OUTLINE != 1
|
||||
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;
|
||||
materialMask = OSIEBCA * 252.0; // Versatile Selection Outline
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:01 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(0.0, materialMask, 0.0, 1.0);
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
//Uniforms//
|
||||
#if defined GBUFFERS_LINE || defined TAA
|
||||
uniform float viewWidth, viewHeight;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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
|
||||
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
|
||||
glColor = gl_Color;
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
eastVec = normalize(gbufferModelView[0].xyz);
|
||||
northVec = normalize(gbufferModelView[2].xyz);
|
||||
sunVec = GetSunVector();
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,118 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
in vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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
|
||||
float lViewPos = length(viewPos);
|
||||
|
||||
#ifdef IPBR
|
||||
float emission = dot(colorP, colorP);
|
||||
|
||||
if (color.a < 0.5) {
|
||||
color.a = 0.101;
|
||||
emission = pow2(pow2(emission)) * 0.1;
|
||||
}
|
||||
|
||||
color.rgb *= color.rgb * emission * 1.75;
|
||||
color.rgb += emission * 0.05;
|
||||
#else
|
||||
color.rgb *= color.rgb * 4.0;
|
||||
#endif
|
||||
|
||||
color.rgb *= 0.5 + 0.5 * exp(- lViewPos * 0.04);
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:01 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
out vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
#ifdef TAA
|
||||
uniform float viewWidth, viewHeight;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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;
|
||||
|
||||
glColor = gl_Color;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,313 @@
|
||||
//////////////////////////////////
|
||||
// Complementary Base by EminGT //
|
||||
//////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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
|
||||
in vec2 signMidCoordPos;
|
||||
flat in vec2 absMidCoordPos;
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
flat in vec3 binormal, tangent;
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
in vec3 viewVector;
|
||||
|
||||
in vec4 vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int blockEntityId;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float nightVision;
|
||||
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM
|
||||
uniform ivec2 atlasSize;
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
uniform sampler2D normals;
|
||||
uniform sampler2D specular;
|
||||
#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 "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/util/dither.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
|
||||
#include "/spookylib/util/miplevel.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/spookylib/materials/materialMethods/generatedNormals.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
#include "/spookylib/materials/materialMethods/coatedTextures.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
#include "/spookylib/materials/materialHandling/customMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
#ifdef GENERATED_NORMALS
|
||||
vec3 colorP = color.rgb;
|
||||
#endif
|
||||
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);
|
||||
|
||||
bool noSmoothLighting = false, noDirectionalShading = false;
|
||||
|
||||
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = 0.0;
|
||||
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0;
|
||||
vec2 lmCoordM = lmCoord;
|
||||
vec3 normalM = normal, shadowMult = vec3(1.0);
|
||||
#ifdef IPBR
|
||||
#include "/spookylib/materials/materialHandling/blockEntityMaterials.glsl"
|
||||
#else
|
||||
#ifdef CUSTOM_PBR
|
||||
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
|
||||
#endif
|
||||
|
||||
if (blockEntityId == 60024) { // End Portal
|
||||
#include "/spookylib/materials/specificMaterials/others/endPortalEffect.glsl"
|
||||
} else if (blockEntityId == 60004) { // Signs
|
||||
noSmoothLighting = true;
|
||||
if (glColor.r + glColor.g + glColor.b <= 2.99 || lmCoord.x > 0.999) { // Sign Text
|
||||
#include "/spookylib/materials/specificMaterials/others/signText.glsl"
|
||||
}
|
||||
} else {
|
||||
noSmoothLighting = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
GenerateNormals(normalM, colorP);
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
CoatTextures(color.rgb, noiseFactor, playerPos);
|
||||
#endif
|
||||
#if BLOOD_MOON > 0
|
||||
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, normalM, lmCoordM,
|
||||
noSmoothLighting, noDirectionalShading, false, false,
|
||||
0, smoothnessG, highlightMult, emission);
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:01 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, 1.0);
|
||||
|
||||
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE >= 2
|
||||
/* DRAWBUFFERS:015 */
|
||||
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 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
|
||||
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
|
||||
|
||||
//Uniforms//
|
||||
#ifdef TAA
|
||||
uniform float viewWidth, viewHeight;
|
||||
#endif
|
||||
|
||||
#if defined IPBR || defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM
|
||||
uniform int blockEntityId;
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM
|
||||
attribute vec4 mc_midTexCoord;
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
attribute vec4 at_tangent;
|
||||
#endif
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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;
|
||||
|
||||
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 (normal != normal) normal = -upVec; // Mod Fix: Fixes Better Nether Fireflies
|
||||
|
||||
#ifdef IPBR
|
||||
if (blockEntityId == 60024) { // End Portal, End Gateway
|
||||
gl_Position.z -= 0.002;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM
|
||||
if (blockEntityId == 60008) { // 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 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
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,173 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.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
|
||||
|
||||
//Uniforms//
|
||||
#if CLOUD_STYLE_DEFINE == 50
|
||||
uniform vec3 skyColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
#ifdef BORDER_FOG
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
#endif
|
||||
#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 "/spookylib/colors/skyColors.glsl"
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
|
||||
#if defined TAA && defined BORDER_FOG
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#include "/spookylib/colors/colorMultipliers.glsl"
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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);
|
||||
|
||||
#ifdef OVERWORLD
|
||||
vec3 cloudLight = mix(vec3(0.8, 1.6, 1.5) * sqrt1(nightFactor), mix(dayDownSkyColor, dayMiddleSkyColor, 0.1), sunFactor);
|
||||
#if BLOOD_MOON > 0
|
||||
cloudLight *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
color.rgb *= 0.5;
|
||||
color.rgb *= sqrt(cloudLight) * (1.2 + 0.4 * noonFactor * invRainFactor);
|
||||
|
||||
atmColorMult = GetAtmColorMult();
|
||||
color.rgb *= atmColorMult;
|
||||
#endif
|
||||
|
||||
#ifdef BORDER_FOG
|
||||
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));
|
||||
float cloudDistance = 375.0;
|
||||
cloudDistance = clamp((cloudDistance - xzMaxDistance) / cloudDistance, 0.0, 1.0);
|
||||
color.a *= clamp01(cloudDistance * 3.0);
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:013 */
|
||||
#else
|
||||
/* DRAWBUFFERS:018 */
|
||||
#endif
|
||||
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
|
||||
|
||||
//Uniforms//
|
||||
#if CLOUD_STYLE_DEFINE == 50
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
|
||||
#ifdef TAA
|
||||
uniform float viewWidth, viewHeight;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#if CLOUD_STYLE_DEFINE == 50
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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;
|
||||
position.xz -= vec2(88.0);
|
||||
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,68 @@
|
||||
//////////////////////////////////
|
||||
// Complementary Base by EminGT //
|
||||
//////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
flat in vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
uniform sampler2D tex;
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
color.rgb *= glColor.rgb;
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = color;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
flat out vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
glColor = gl_Color;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,339 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int entityId;
|
||||
uniform int blockEntityId;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float nightVision;
|
||||
|
||||
|
||||
uniform ivec2 atlasSize;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform vec4 entityColor;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
uniform sampler2D normals;
|
||||
uniform sampler2D specular;
|
||||
#endif
|
||||
|
||||
#ifdef IS_IRIS
|
||||
uniform int currentRenderedItemId;
|
||||
#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 "/spookylib/util/dither.glsl"
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
|
||||
#include "/spookylib/util/miplevel.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/spookylib/materials/materialMethods/generatedNormals.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
#include "/spookylib/materials/materialMethods/coatedTextures.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
#include "/spookylib/materials/materialHandling/customMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
#ifdef GENERATED_NORMALS
|
||||
vec3 colorP = color.rgb;
|
||||
#endif
|
||||
color *= glColor;
|
||||
|
||||
color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a);
|
||||
|
||||
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA
|
||||
vec3 normalM = normal;
|
||||
|
||||
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);
|
||||
|
||||
bool noSmoothLighting = atlasSize.x < 600.0; // To fix fire looking too dim
|
||||
bool noGeneratedNormals = false;
|
||||
float smoothnessG = 0.0, highlightMult = 0.0, emission = 0.0, noiseFactor = 0.75;
|
||||
vec2 lmCoordM = lmCoord;
|
||||
vec3 shadowMult = vec3(1.0);
|
||||
#ifdef IPBR
|
||||
#include "/spookylib/materials/materialHandling/entityMaterials.glsl"
|
||||
|
||||
#ifdef IS_IRIS
|
||||
vec3 maRecolor = vec3(0.0);
|
||||
#include "/spookylib/materials/materialHandling/irisMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
CoatTextures(color.rgb, noiseFactor, playerPos);
|
||||
#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 "/spookylib/materials/specificMaterials/entities/lightningBolt.glsl"
|
||||
} else if (entityId == 50008) { // Item Frame, Glow Item Frame
|
||||
noSmoothLighting = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
normalM = gl_FrontFacing ? normalM : -normalM; // Inverted Normal Workaround
|
||||
|
||||
#if BLOOD_MOON > 0
|
||||
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, normalM, lmCoordM,
|
||||
noSmoothLighting, false, false, true,
|
||||
0, smoothnessG, highlightMult, emission);
|
||||
|
||||
#if defined IPBR && defined IS_IRIS
|
||||
color.rgb += maRecolor;
|
||||
#endif
|
||||
|
||||
#if (defined CUSTOM_PBR || defined IPBR && defined IS_IRIS) && defined PBR_REFLECTIONS
|
||||
#ifdef OVERWORLD
|
||||
skyLightFactor = pow2(max(lmCoord.y - 0.7, 0.0) * 3.33333);
|
||||
#else
|
||||
skyLightFactor = dot(shadowMult, shadowMult) / 3.0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:01 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, 1.0);
|
||||
|
||||
#if BLOCK_REFLECT_QUALITY >= 2 && (RP_MODE >= 2 || defined IS_IRIS)
|
||||
/* DRAWBUFFERS:015 */
|
||||
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 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
|
||||
|
||||
//Uniforms//
|
||||
#ifdef FLICKERING_FIX
|
||||
uniform int entityId;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
#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
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
|
||||
lmCoord.x = min(lmCoord.x, 0.9);
|
||||
//Fixes some servers/mods making entities insanely bright, while also slightly reducing the max blocklight on a normal entity
|
||||
|
||||
glColor = gl_Color;
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
eastVec = normalize(gbufferModelView[0].xyz);
|
||||
northVec = normalize(gbufferModelView[2].xyz);
|
||||
sunVec = GetSunVector();
|
||||
|
||||
#if defined 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 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
|
||||
gl_Position.z -= 0.00015;
|
||||
}
|
||||
|
||||
#ifndef REALTIME_SHADOWS
|
||||
if (glColor.a < 0.5) gl_Position.z += 0.0005;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,300 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float nightVision;
|
||||
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || defined IPBR && defined IS_IRIS
|
||||
uniform ivec2 atlasSize;
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
uniform sampler2D normals;
|
||||
uniform sampler2D specular;
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
uniform int heldItemId;
|
||||
uniform int heldItemId2;
|
||||
#endif
|
||||
|
||||
#ifdef IS_IRIS
|
||||
uniform int currentRenderedItemId;
|
||||
#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 "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
|
||||
#include "/spookylib/util/miplevel.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/spookylib/materials/materialMethods/generatedNormals.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
#include "/spookylib/materials/materialMethods/coatedTextures.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
#include "/spookylib/materials/materialHandling/customMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
|
||||
float smoothnessD = 0.0, skyLightFactor = 0.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA
|
||||
vec3 normalM = normal;
|
||||
if (color.a > 0.00001) {
|
||||
#ifdef GENERATED_NORMALS
|
||||
vec3 colorP = color.rgb;
|
||||
#endif
|
||||
color.rgb *= glColor.rgb;
|
||||
|
||||
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;
|
||||
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 0.6;
|
||||
vec2 lmCoordM = lmCoord;
|
||||
vec3 shadowMult = vec3(0.4);
|
||||
#ifdef IPBR
|
||||
#ifdef IS_IRIS
|
||||
vec3 maRecolor = vec3(0.0);
|
||||
#include "/spookylib/materials/materialHandling/irisMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
CoatTextures(color.rgb, noiseFactor, playerPos);
|
||||
#endif
|
||||
#else
|
||||
#ifdef CUSTOM_PBR
|
||||
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, 0.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BLOOD_MOON > 0
|
||||
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, 0.0, normalM, lmCoordM,
|
||||
noSmoothLighting, false, false, false,
|
||||
0, smoothnessG, highlightMult, emission);
|
||||
|
||||
#if defined IPBR && defined IS_IRIS
|
||||
color.rgb += maRecolor;
|
||||
#endif
|
||||
|
||||
#if (defined CUSTOM_PBR || defined IPBR && defined IS_IRIS) && defined PBR_REFLECTIONS
|
||||
#ifdef OVERWORLD
|
||||
skyLightFactor = pow2(max(lmCoord.y - 0.7, 0.0) * 3.33333);
|
||||
#else
|
||||
skyLightFactor = dot(shadowMult, shadowMult) / 3.0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:01 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, 1.0);
|
||||
|
||||
#if BLOCK_REFLECT_QUALITY >= 2 && (RP_MODE >= 2 || defined IS_IRIS)
|
||||
/* DRAWBUFFERS:015 */
|
||||
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 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
|
||||
|
||||
//Uniforms//
|
||||
#if HAND_SWAYING > 0
|
||||
|
||||
#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
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
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 "/spookylib/misc/handSway.glsl"
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,224 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform float viewWidth, viewHeight;
|
||||
uniform float blindness;
|
||||
uniform float darknessFactor;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
uniform vec3 cameraPosition;
|
||||
#endif
|
||||
|
||||
#if SUN_MOON_STYLE >= 2
|
||||
|
||||
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
|
||||
#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 "/spookylib/util/dither.glsl"
|
||||
|
||||
#ifdef OVERWORLD
|
||||
#include "/spookylib/atmospherics/sky.glsl"
|
||||
#include "/spookylib/atmospherics/stars.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
#include "/spookylib/atmospherics/fog/caveFactor.glsl"
|
||||
#endif
|
||||
|
||||
#include "/spookylib/colors/colorMultipliers.glsl"
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
#if SUN_MOON_STYLE >= 2
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color = vec4(glColor.rgb, 1.0);
|
||||
|
||||
#ifdef OVERWORLD
|
||||
if (vanillaStars < 0.5) {
|
||||
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);
|
||||
|
||||
vec2 starCoord = GetStarCoord(viewPos.xyz, 0.5);
|
||||
color.rgb += GetStars(starCoord, VdotU, VdotS);
|
||||
|
||||
#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)) * (1.0 - 0.4 * rainFactor2);
|
||||
|
||||
if (VdotS > 0.0) {
|
||||
sunMoonMixer = pow2(sunMoonMixer) * GetHorizonFactor(SdotU);
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
sunMoonMixer *= 1.0 - 0.65 * GetCaveFactor();
|
||||
#endif
|
||||
|
||||
color.rgb = mix(color.rgb, vec3(0.9, 0.5, 0.3) * 7.0, 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 = texture2D(noisetex, starCoord).g
|
||||
+ texture2D(noisetex, starCoord * 2.5).g * 0.7
|
||||
+ texture2D(noisetex, starCoord * 5.0).g * 0.5;
|
||||
moonNoise = max0(moonNoise - 0.75) * 1.7;
|
||||
vec3 moonColorSpooky = vec3(0.38, 0.4, 0.5);
|
||||
float moonNoiseIntensity = 1.0;
|
||||
#if BLOOD_MOON > 0
|
||||
moonNoiseIntensity = mix(1.0, 1.5, getBloodMoon(moonPhase, sunVisibility));
|
||||
moonColorSpooky = mix(vec3(0.38, 0.4, 0.5), vec3(1.0, 0.0, 0.0), getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
vec3 moonColor = moonColorSpooky * (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
|
||||
} else discard;
|
||||
#endif
|
||||
|
||||
color.rgb *= GetAtmColorMult();
|
||||
|
||||
if (max(blindness, darknessFactor) > 0.1) color.rgb = vec3(0.0);
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#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
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
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
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,158 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.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
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
uniform vec3 cameraPosition;
|
||||
#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
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#include "/spookylib/colors/lightAndAmbientColors.glsl"
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
#include "/spookylib/atmospherics/fog/caveFactor.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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);
|
||||
|
||||
if (abs(tSize.y - 264.0) < 248.5) { //tSize.y must range from 16 to 512
|
||||
#if SUN_MOON_STYLE >= 2
|
||||
discard;
|
||||
#endif
|
||||
|
||||
if (VdotS > 0.0) { // Sun
|
||||
color.rgb *= dot(color.rgb, color.rgb) * normalize(lightColor) * 0.5;
|
||||
color.rgb *= 0.25 + (0.75 - 0.25 * rainFactor) * sunVisibility2;
|
||||
} else { // Moon
|
||||
color.rgb *= smoothstep1(min1(length(color.rgb))) * 1.3;
|
||||
#if BLOOD_MOON > 0
|
||||
color.rgb = mix(color.rgb, GetLuminance(color.rgb) * 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;
|
||||
color.a *= mix(1.0, 1.0 - 0.8 * rainFactor, heightRelativeToCloud);
|
||||
#endif
|
||||
|
||||
#ifdef NETHER
|
||||
vec4 color = vec4(0.0);
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
vec4 color = vec4(endSkyColor, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#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
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
glColor = gl_Color;
|
||||
|
||||
#ifdef OVERWORLD
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,78 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
in vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
uniform sampler2D tex;
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texCoord) * glColor;
|
||||
|
||||
#ifdef IPBR
|
||||
if (CheckForColor(color.rgb, vec3(224, 121, 250))) { // Enderman Eye Edges
|
||||
color.rgb = vec3(0.8, 0.25, 0.8);
|
||||
}
|
||||
#endif
|
||||
|
||||
color.rgb = pow1_5(color.rgb);
|
||||
color.rgb *= pow2(1.0 + color.b + 0.5 * color.g) * 1.5;
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = color;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
out vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
glColor = gl_Color;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,577 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
flat in int mat;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 lmCoord;
|
||||
in vec2 signMidCoordPos;
|
||||
flat in vec2 absMidCoordPos;
|
||||
flat in vec2 midCoord;
|
||||
in vec3 blockUV;
|
||||
in vec3 atMidBlock;
|
||||
|
||||
flat in vec3 upVec, sunVec, northVec, eastVec;
|
||||
in vec3 normal;
|
||||
|
||||
in vec4 glColorRaw;
|
||||
|
||||
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
flat in vec3 binormal, tangent;
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
in vec3 viewVector;
|
||||
|
||||
in vec4 vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float nightVision;
|
||||
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#if defined IPBR || defined POM
|
||||
uniform ivec2 atlasSize;
|
||||
#endif
|
||||
|
||||
#if RAIN_PUDDLES >= 1
|
||||
#if RAIN_PUDDLES < 3
|
||||
uniform float wetness;
|
||||
uniform float inRainy;
|
||||
#else
|
||||
float wetness = 1.0;
|
||||
float inRainy = 1.0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SHOW_LIGHT_LEVEL == 1
|
||||
uniform int heldItemId;
|
||||
uniform int heldItemId2;
|
||||
#endif
|
||||
|
||||
#if HELD_LIGHTING_MODE == 0 && SHOW_LIGHT_LEVEL == 2
|
||||
uniform int heldBlockLightValue;
|
||||
uniform int heldBlockLightValue2;
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
uniform sampler2D normals;
|
||||
uniform sampler2D specular;
|
||||
#endif
|
||||
|
||||
#ifdef LIGHT_COLORING
|
||||
layout (rgba8) uniform image2D colorimg3;
|
||||
#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;
|
||||
|
||||
vec4 glColor = glColorRaw;
|
||||
|
||||
#ifdef OVERWORLD
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
#else
|
||||
vec3 lightVec = sunVec;
|
||||
#endif
|
||||
|
||||
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
#endif
|
||||
|
||||
//Common Functions//
|
||||
void DoFoliageColorTweaks(inout vec3 color, inout vec3 shadowMult, inout float snowMinNdotU, float lViewPos) {
|
||||
float factor = max(80.0 - lViewPos, 0.0);
|
||||
shadowMult *= 1.0 + 0.004 * noonFactor * factor;
|
||||
|
||||
if (signMidCoordPos.x < 0.0) color.rgb *= 1.08;
|
||||
else color.rgb *= 0.93;
|
||||
|
||||
#ifdef SNOWY_WORLD
|
||||
if (glColor.g - glColor.b > 0.01)
|
||||
snowMinNdotU = min(pow2(pow2(max0(color.g * 2.0 - color.r - color.b))) * 5.0, 0.1);
|
||||
else
|
||||
snowMinNdotU = min(pow2(pow2(max0(color.g * 2.0 - color.r - color.b))) * 3.0, 0.1) * 0.25;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DoBrightBlockTweaks(vec3 color, float minLight, inout vec3 shadowMult, inout float highlightMult) {
|
||||
float factor = mix(minLight, 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 "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES
|
||||
#include "/spookylib/util/miplevel.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/spookylib/materials/materialMethods/generatedNormals.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
#include "/spookylib/materials/materialMethods/coatedTextures.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
#include "/spookylib/materials/materialHandling/customMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
skyLightCheck = pow2(1.0 - min1(lmCoord.y * 2.9 * sunVisibility));
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
|
||||
float smoothnessD = 0.0, materialMask = 0.0, skyLightFactor = 0.0;
|
||||
vec3 normalM = normal;
|
||||
|
||||
#if !defined POM || !defined POM_ALLOW_CUTOUT
|
||||
if (color.a <= 0.00001) discard;
|
||||
#endif
|
||||
|
||||
vec3 colorP = color.rgb;
|
||||
color.rgb *= glColor.rgb;
|
||||
|
||||
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;
|
||||
|
||||
int subsurfaceMode = 0;
|
||||
bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false, noGeneratedNormals = false;
|
||||
float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0, noiseFactor = 1.0, snowMinNdotU = 0.0, snowFactor = 1.0, noPuddles = 0.0;
|
||||
vec2 lmCoordM = lmCoord;
|
||||
vec3 shadowMult = vec3(1.0);
|
||||
|
||||
float lavaNoiseIntensity = 1.0;
|
||||
|
||||
#ifdef EYES
|
||||
vec3 eyes1 = vec3(0.0);
|
||||
vec3 eyes2 = vec3(0.0);
|
||||
float sideRandom = hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.00001, vec3(100)));
|
||||
vec3 blockUVM = blockUV;
|
||||
if(step(0.5, sideRandom) > 0.0) { // Randomly make eyes visible only on either the x or z axis
|
||||
blockUVM.x = 0.0;
|
||||
} else {
|
||||
blockUVM.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((blockUVM.x > 0.15 && blockUVM.x < 0.43 || blockUVM.x < 0.85 && blockUVM.x > 0.57 || blockUVM.z > 0.15 && blockUVM.z < 0.43 || blockUVM.z < 0.85 && blockUVM.z > 0.57) && blockUVM.y > 0.42 && blockUVM.y < 0.58 && abs(clamp01(dot(normal, upVec))) < 0.99) eyes1 = vec3(1.0); // Eye Shape 1 Horizontal
|
||||
if((blockUVM.x > 0.65 && blockUVM.x < 0.8 || blockUVM.x < 0.35 && blockUVM.x > 0.2 || blockUVM.z > 0.65 && blockUVM.z < 0.8 || blockUVM.z < 0.35 && blockUVM.z > 0.2) && blockUVM.y > 0.3 && blockUVM.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
|
||||
|
||||
#ifdef IPBR
|
||||
vec3 maRecolor = vec3(0.0);
|
||||
#include "/spookylib/materials/materialHandling/terrainMaterials.glsl"
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
if (!noGeneratedNormals) GenerateNormals(normalM, colorP);
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
CoatTextures(color.rgb, noiseFactor, playerPos);
|
||||
#endif
|
||||
#else
|
||||
#ifdef CUSTOM_PBR
|
||||
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMask, viewPos, lViewPos);
|
||||
#endif
|
||||
|
||||
if (mat == 10000) { // No directional shading
|
||||
noDirectionalShading = true;
|
||||
} else if (mat == 10003 || mat == 10004) { // Grounded Waving Foliage
|
||||
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true;
|
||||
DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, lViewPos);
|
||||
#ifdef EMISSIVE_BLOOD_MOON_FLOWERS
|
||||
if (mat == 10003) { // Flowers+
|
||||
if (color.b > color.g || color.r * 1.3 > color.g) {
|
||||
float flowerEmissionMult = 0.0;
|
||||
if (color.r > max(color.b * 1.15, color.g * 2.5) * 0.95) flowerEmissionMult = 1.0;
|
||||
emission = 2.0 * flowerEmissionMult;
|
||||
emission *= skyLightCheck * getBloodMoon(moonPhase, sunVisibility);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if (mat == 10008) { // Leaves
|
||||
#include "/spookylib/materials/specificMaterials/terrain/leaves.glsl"
|
||||
} else if (mat == 10012) { // Vine
|
||||
shadowMult = vec3(1.7);
|
||||
centerShadowBias = true;
|
||||
} else if (mat == 10016) { // Non-waving Foliage
|
||||
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true;
|
||||
} else if (mat == 10020 || mat == 10021) { // Upper Waving Foliage
|
||||
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true;
|
||||
DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, lViewPos);
|
||||
#ifdef EMISSIVE_BLOOD_MOON_FLOWERS
|
||||
if (mat == 10021) { // Flowers Upper+
|
||||
if (color.b > color.g || color.r * 1.3 > color.g) {
|
||||
float flowerEmissionMult = 0.0;
|
||||
if (color.r > max(color.b * 1.15, color.g * 2.5) * 0.95) flowerEmissionMult = 1.0;
|
||||
emission = 2.0 * flowerEmissionMult;
|
||||
emission *= skyLightCheck * getBloodMoon(moonPhase, sunVisibility);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if (mat == 10744) { // Cobweb
|
||||
subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true;
|
||||
centerShadowBias = true;
|
||||
} else if (mat == 10396){ // Jack o'Lantern
|
||||
float noiseAdd = hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.000001, vec3(100)));
|
||||
emission *= mix(0.0, 1.0, smoothstep(0.2, 0.9, texture2D(noisetex, vec2(frameTimeCounter * 0.025 + noiseAdd)).r));
|
||||
} else if (mat == 10068 || mat == 10069){ // Lava
|
||||
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 "/spookylib/materials/specificMaterials/terrain/lavaNoise.glsl"
|
||||
color.rgb = max(color.rgb, 0.023); // so black spots still have some textures and aren't fully black, currently not working well, texture still 100% black blob
|
||||
}
|
||||
|
||||
#ifdef SNOWY_WORLD
|
||||
else if (mat == 10132) { // 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
|
||||
|
||||
#ifdef EMISSIVE_BLOOD_MOON_FLOWERS
|
||||
else if (mat == 10733) {
|
||||
if ((color.b > color.g || color.r * 1.3 > color.g) && blockUV.y > 0.4) {
|
||||
float flowerEmissionMult = 0.0;
|
||||
if (color.r > max(color.b * 1.15, color.g * 2.5) * 0.95) flowerEmissionMult = 1.0;
|
||||
emission = 2.0 * flowerEmissionMult;
|
||||
emission *= skyLightCheck * getBloodMoon(moonPhase, sunVisibility);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (lmCoord.x > 0.99999) lmCoordM.x = 0.95;
|
||||
#endif
|
||||
|
||||
#ifdef SNOWY_WORLD
|
||||
snowFactor *= 1000.0 * max(NdotU - 0.9, snowMinNdotU) * max0(lmCoord.y - 0.9) * (0.9 - clamp(lmCoord.x, 0.8, 0.9));
|
||||
if (snowFactor > 0.0001) {
|
||||
const float packSizeSW = 16.0;
|
||||
vec3 worldPos = playerPos + cameraPosition;
|
||||
vec2 noiseCoord = floor(packSizeSW * worldPos.xz + 0.001) / packSizeSW;
|
||||
noiseCoord += floor(packSizeSW * worldPos.y + 0.001) / packSizeSW;
|
||||
float noiseTexture = dot(vec2(0.25, 0.75), texture2D(noisetex, noiseCoord * 0.45).rg);
|
||||
vec3 snowColor = mix(vec3(0.65, 0.8, 0.85), vec3(1.0, 1.0, 1.0), noiseTexture * 0.75 + 0.125);
|
||||
|
||||
color.rgb = mix(color.rgb, snowColor + color.rgb * emission * 0.2, snowFactor);
|
||||
smoothnessG = mix(smoothnessG, 0.25 + 0.25 * noiseTexture, snowFactor);
|
||||
highlightMult = mix(highlightMult, 2.0 - subsurfaceMode * 0.666, snowFactor);
|
||||
smoothnessD = mix(smoothnessD, 0.0, snowFactor);
|
||||
emission *= 1.0 - snowFactor * 0.85;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if RAIN_PUDDLES >= 1
|
||||
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);
|
||||
puddleNormalFactor *= mix(0.0, 1.0, heightRelativeToCloud);
|
||||
float puddleMixer = puddleLightFactor * inRainy * puddleNormalFactor;
|
||||
if (pow2(pow2(wetness)) * 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 = texture2D(noisetex, pNormalCoord1).rgb;
|
||||
vec3 pNormalNoise2 = texture2D(noisetex, pNormalCoord2).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
|
||||
vec2 puddlePosForm = puddlePosNormal * 0.05;
|
||||
float pFormNoise = texture2D(noisetex, puddlePosForm).b * 3.0;
|
||||
pFormNoise += texture2D(noisetex, puddlePosForm * 0.5).b * 5.0;
|
||||
pFormNoise += texture2D(noisetex, puddlePosForm * 0.25).b * 8.0;
|
||||
pFormNoise *= sqrt1(wetness) * 0.5625 + 0.4375;
|
||||
pFormNoise = clamp(pFormNoise - 7.0, 0.0, 1.0);
|
||||
#else
|
||||
float pFormNoise = wetness;
|
||||
#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 "/spookylib/misc/showLightLevels.glsl"
|
||||
#endif
|
||||
|
||||
#if BLOOD_MOON > 0
|
||||
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
|
||||
if (mat != 10068 && mat != 10069) { // 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, texture2D(noisetex, vec2(frameTimeCounter * 0.008 + noiseAdd)).r));
|
||||
}
|
||||
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, normalM, lmCoordM,
|
||||
noSmoothLighting, noDirectionalShading, noVanillaAO, centerShadowBias,
|
||||
subsurfaceMode, smoothnessG, highlightMult, emission);
|
||||
|
||||
#ifdef IPBR
|
||||
color.rgb += maRecolor;
|
||||
#endif
|
||||
|
||||
#ifdef EYES
|
||||
vec2 flickerEyeNoise = texture2D(noisetex, vec2(frameTimeCounter * 0.025 + hash13(mod(floor(worldPos + atMidBlock / 64) + frameTimeCounter * 0.000001, vec3(100))))).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
|
||||
|
||||
#ifdef PBR_REFLECTIONS
|
||||
#ifdef OVERWORLD
|
||||
skyLightFactor = pow2(max(lmCoord.y - 0.7, 0.0) * 3.33333);
|
||||
#else
|
||||
skyLightFactor = dot(shadowMult, shadowMult) / 3.0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
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 == 10008) discard; // disable leaves
|
||||
}
|
||||
|
||||
/* DRAWBUFFERS:01 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(smoothnessD, materialMask, skyLightFactor, 1.0);
|
||||
|
||||
#if BLOCK_REFLECT_QUALITY >= 2 && RP_MODE != 0
|
||||
/* DRAWBUFFERS:015 */
|
||||
gl_FragData[2] = vec4(mat3(gbufferModelViewInverse) * normalM, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
flat out int mat;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 lmCoord;
|
||||
out vec2 signMidCoordPos;
|
||||
flat out vec2 absMidCoordPos;
|
||||
flat out vec2 midCoord;
|
||||
out vec3 blockUV; // useful to hardcode something to a specific pixel coordinate of a block
|
||||
out vec3 atMidBlock;
|
||||
|
||||
flat out vec3 upVec, sunVec, northVec, eastVec;
|
||||
out vec3 normal;
|
||||
|
||||
out vec4 glColorRaw;
|
||||
|
||||
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
flat out vec3 binormal, tangent;
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
out vec3 viewVector;
|
||||
|
||||
out vec4 vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
#ifdef TAA
|
||||
uniform float viewWidth, viewHeight;
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_ANYTHING_TERRAIN
|
||||
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
attribute vec4 mc_Entity;
|
||||
attribute vec4 mc_midTexCoord;
|
||||
attribute vec3 at_midBlock;
|
||||
|
||||
#if RAIN_PUDDLES >= 1 || defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
attribute vec4 at_tangent;
|
||||
#endif
|
||||
|
||||
//Common Variables//
|
||||
vec4 glColor = vec4(1.0);
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_ANYTHING_TERRAIN
|
||||
#include "/spookylib/materials/materialMethods/wavingBlocks.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
blockUV = 0.5 - at_midBlock / 64.0;
|
||||
atMidBlock = at_midBlock;
|
||||
|
||||
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);
|
||||
|
||||
mat = int(mc_Entity.x + 0.5);
|
||||
|
||||
#ifdef WAVING_ANYTHING_TERRAIN
|
||||
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
DoWave(position.xyz, mat);
|
||||
|
||||
#ifdef FLICKERING_FIX
|
||||
//position.y += max0(0.002 - abs(mat - 10256.0)); // Iron Bars
|
||||
#endif
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
|
||||
#ifndef WAVING_LAVA
|
||||
// G8FL735 Fixes Optifine-Iris parity. Optifine has 0.9 gl_Color.rgb on a lot of versions
|
||||
glColorRaw.rgb = min(glColorRaw.rgb, vec3(0.9));
|
||||
#endif
|
||||
|
||||
#ifdef FLICKERING_FIX
|
||||
//if (mat == 10256) gl_Position.z -= 0.00001; // Iron Bars
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
#if RAIN_PUDDLES >= 1 || 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
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,273 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 lmCoord;
|
||||
|
||||
flat in vec3 upVec, sunVec;
|
||||
in vec3 normal;
|
||||
|
||||
flat in vec4 glColor;
|
||||
|
||||
#ifdef CLOUD_SHADOWS
|
||||
flat in vec3 eastVec;
|
||||
|
||||
#if SUN_ANGLE != 0
|
||||
flat in vec3 northVec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float far;
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float nightVision;
|
||||
|
||||
uniform float blindness;
|
||||
uniform float darknessFactor;
|
||||
|
||||
uniform ivec2 atlasSize;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
uniform sampler2D gaux1;
|
||||
#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
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
#include "/spookylib/util/dither.glsl"
|
||||
|
||||
#if MC_VERSION >= 11500
|
||||
#include "/spookylib/atmospherics/fog/mainFog.glsl"
|
||||
#endif
|
||||
|
||||
#include "/spookylib/colors/colorMultipliers.glsl"
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
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 = Bayer64(gl_FragCoord.xy);
|
||||
#ifdef TAA
|
||||
dither = fract(dither + 1.61803398875 * mod(float(frameCounter), 3600.0));
|
||||
#endif
|
||||
|
||||
atmColorMult = GetAtmColorMult();
|
||||
|
||||
#ifdef REDUCE_CLOSE_PARTICLES
|
||||
if (lViewPos - dither - 1.0 < 0.0) discard;
|
||||
#endif
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
float cloudLinearDepth = texelFetch(gaux1, texelCoord, 0).r;
|
||||
|
||||
if (cloudLinearDepth > 0.0) // Because Iris changes the pipeline position of opaque particles
|
||||
if (pow2(cloudLinearDepth + OSIEBCA * dither) * far < min(lViewPos, far)) discard;
|
||||
#endif
|
||||
|
||||
float emission = 0.0, materialMask = OSIEBCA * 254.0; // No SSAO, No TAA
|
||||
vec2 lmCoordM = lmCoord;
|
||||
vec3 shadowMult = vec3(1.0);
|
||||
#ifdef IPBR
|
||||
if (atlasSize.x < 900.0) { // We don't want to detect particles from the block atlas
|
||||
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
|
||||
color.rgb = sqrt3(color.rgb) * 0.45;
|
||||
if (cameraPosition.y > maximumCloudsHeight) discard;
|
||||
#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
|
||||
if (color.a < 0.1 || isEyeInWater == 3) discard;
|
||||
if (cameraPosition.y > maximumCloudsHeight) 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)
|
||||
if (color.a < 0.1 || isEyeInWater == 3) discard;
|
||||
if (cameraPosition.y > maximumCloudsHeight) 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 == 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 *= 0.5;
|
||||
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);
|
||||
} 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(fract(float(frameCounter) * 0.01), fract(float(frameCounter) * 0.015), fract(float(frameCounter) * 0.02));
|
||||
}
|
||||
bool noSmoothLighting = false;
|
||||
#else
|
||||
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
|
||||
if (cameraPosition.y > maximumCloudsHeight) discard;
|
||||
}
|
||||
if (color.b > 0.7 && color.r < 0.28 && color.g < 0.425 && color.g > color.r * 1.4){ // physics mod rain
|
||||
if (cameraPosition.y > maximumCloudsHeight) discard;
|
||||
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)
|
||||
if (cameraPosition.y > maximumCloudsHeight) discard;
|
||||
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);
|
||||
}
|
||||
}
|
||||
bool noSmoothLighting = true;
|
||||
#endif
|
||||
|
||||
#if BLOOD_MOON > 0
|
||||
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, normal, lmCoordM,
|
||||
noSmoothLighting, false, true, false,
|
||||
0, 0.0, 1.0, emission);
|
||||
|
||||
#if MC_VERSION >= 11500
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
|
||||
float VdotU = dot(nViewPos, upVec);
|
||||
float VdotS = dot(nViewPos, sunVec);
|
||||
float sky = 0.0;
|
||||
|
||||
DoFog(color.rgb, sky, lViewPos, playerPos, VdotU, VdotS, dither);
|
||||
#endif
|
||||
|
||||
vec3 translucentMult = mix(vec3(0.666), color.rgb * (1.0 - pow2(pow2(color.a))), color.a);
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:013 */
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(0.0, materialMask, 0.0, 1.0);
|
||||
gl_FragData[2] = vec4(1.0 - translucentMult, 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 lmCoord;
|
||||
|
||||
flat out vec3 upVec, sunVec;
|
||||
out vec3 normal;
|
||||
|
||||
flat out vec4 glColor;
|
||||
|
||||
#ifdef CLOUD_SHADOWS
|
||||
flat out vec3 eastVec;
|
||||
|
||||
#if SUN_ANGLE != 0
|
||||
flat out vec3 northVec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
|
||||
glColor = gl_Color;
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
|
||||
#ifdef FLICKERING_FIX
|
||||
gl_Position.z -= 0.000002;
|
||||
#endif
|
||||
|
||||
#ifdef CLOUD_SHADOWS
|
||||
eastVec = normalize(gbufferModelView[0].xyz);
|
||||
|
||||
#if SUN_ANGLE != 0
|
||||
northVec = normalize(gbufferModelView[2].xyz);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,478 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
flat in int mat;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 lmCoord;
|
||||
|
||||
flat in vec3 upVec, sunVec, northVec, eastVec;
|
||||
in vec3 normal;
|
||||
in vec3 viewVector;
|
||||
|
||||
in vec4 glColor;
|
||||
|
||||
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
flat in vec3 binormal, tangent;
|
||||
#endif
|
||||
|
||||
#if WATER_STYLE >= 2 || defined FANCY_NETHERPORTAL || defined GENERATED_NORMALS || defined POM
|
||||
in vec2 signMidCoordPos;
|
||||
flat in vec2 absMidCoordPos;
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
in vec4 vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
uniform int frameCounter;
|
||||
|
||||
uniform float near;
|
||||
uniform float far;
|
||||
uniform float nightVision;
|
||||
uniform float blindness;
|
||||
uniform float darknessFactor;
|
||||
|
||||
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
uniform float viewWidth;
|
||||
uniform float viewHeight;
|
||||
uniform float aspectRatio;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#if WATER_STYLE >= 2
|
||||
uniform sampler2D gaux4;
|
||||
#endif
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
uniform sampler2D gaux1;
|
||||
#endif
|
||||
|
||||
#if WATER_QUALITY >= 2 || WATER_REFLECT_QUALITY >= 1
|
||||
uniform sampler2D depthtex1;
|
||||
#endif
|
||||
|
||||
#if WATER_REFLECT_QUALITY >= 1 || defined FANCY_NETHERPORTAL
|
||||
uniform mat4 gbufferProjection;
|
||||
#endif
|
||||
|
||||
#if WATER_REFLECT_QUALITY >= 1
|
||||
uniform sampler2D gaux2;
|
||||
#endif
|
||||
|
||||
#if RAIN_PUDDLES >= 1
|
||||
#if RAIN_PUDDLES < 3
|
||||
uniform float inRainy;
|
||||
#else
|
||||
float inRainy = 1.0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || defined POM || WATER_STYLE >= 2
|
||||
uniform ivec2 atlasSize;
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
uniform sampler2D normals;
|
||||
uniform sampler2D specular;
|
||||
#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 && WATER_STYLE == 1 && WATER_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 "/spookylib/util/dither.glsl"
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
#include "/spookylib/lighting/mainLighting.glsl"
|
||||
#include "/spookylib/atmospherics/fog/mainFog.glsl"
|
||||
|
||||
#ifdef OVERWORLD
|
||||
#include "/spookylib/atmospherics/sky.glsl"
|
||||
#endif
|
||||
|
||||
#if WATER_REFLECT_QUALITY >= 2
|
||||
#include "/spookylib/materials/materialMethods/reflections.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#if defined GENERATED_NORMALS || defined COATED_TEXTURES || WATER_STYLE >= 2
|
||||
#include "/spookylib/util/miplevel.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/spookylib/materials/materialMethods/generatedNormals.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_PBR
|
||||
#include "/spookylib/materials/materialHandling/customMaterials.glsl"
|
||||
#endif
|
||||
|
||||
#include "/spookylib/colors/colorMultipliers.glsl"
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 colorP = texture2D(tex, texCoord);
|
||||
vec4 color = colorP * vec4(glColor.rgb, 1.0);
|
||||
|
||||
vec2 screenCoord = gl_FragCoord.xy / vec2(viewWidth, viewHeight);
|
||||
vec3 screenPos = vec3(screenCoord, 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 + 1.61803398875 * mod(float(frameCounter), 3600.0));
|
||||
#endif
|
||||
|
||||
#ifdef LIGHT_COLOR_MULTS
|
||||
lightColorMult = GetLightColorMult();
|
||||
#endif
|
||||
atmColorMult = GetAtmColorMult();
|
||||
|
||||
#ifdef VL_CLOUDS_ACTIVE
|
||||
float cloudLinearDepth = texelFetch(gaux1, texelCoord, 0).r;
|
||||
|
||||
if (pow2(cloudLinearDepth + OSIEBCA * dither) * far < min(lViewPos, far)) discard;
|
||||
#endif
|
||||
|
||||
#if WATER_QUALITY >= 3
|
||||
float materialMask = 0.0;
|
||||
#endif
|
||||
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
vec3 playerPos = ViewToPlayer(viewPos);
|
||||
float VdotU = dot(nViewPos, upVec);
|
||||
float VdotS = dot(nViewPos, sunVec);
|
||||
float VdotN = dot(nViewPos, normal);
|
||||
|
||||
// Materials
|
||||
vec4 translucentMult = vec4(1.0);
|
||||
bool noSmoothLighting = false, noDirectionalShading = false, translucentMultCalculated = false;
|
||||
#ifdef GENERATED_NORMALS
|
||||
bool noGeneratedNormals = false;
|
||||
#endif
|
||||
int subsurfaceMode = 0;
|
||||
float smoothnessG = 0.0, highlightMult = 1.0, reflectMult = 0.0, emission = 0.0;
|
||||
vec2 lmCoordM = lmCoord;
|
||||
vec3 normalM = VdotN > 0.0 ? -normal : normal; // Inverted Iris Water Normal Workaround
|
||||
vec3 geoNormal = normalM;
|
||||
vec3 shadowMult = vec3(1.0);
|
||||
float fresnel = clamp(1.0 + dot(normalM, nViewPos), 0.0, 1.0);
|
||||
#ifdef IPBR
|
||||
#include "/spookylib/materials/materialHandling/translucentMaterials.glsl"
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
if (!noGeneratedNormals) GenerateNormals(normalM, colorP.rgb * colorP.a * 1.5);
|
||||
#endif
|
||||
#else
|
||||
#ifdef CUSTOM_PBR
|
||||
float smoothnessD, materialMaskPh;
|
||||
GetCustomMaterials(color, normalM, lmCoordM, NdotU, shadowMult, smoothnessG, smoothnessD, highlightMult, emission, materialMaskPh, viewPos, lViewPos);
|
||||
reflectMult = smoothnessD;
|
||||
#endif
|
||||
|
||||
if (mat == 31000) { // Water
|
||||
#include "/spookylib/materials/specificMaterials/translucents/water.glsl"
|
||||
} else if (mat == 30020) { // Nether Portal
|
||||
#ifdef FANCY_NETHERPORTAL
|
||||
#include "/spookylib/materials/specificMaterials/translucents/netherPortal.glsl"
|
||||
#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))));
|
||||
|
||||
#if BLOOD_MOON > 0
|
||||
ambientColor *= mix(vec3(1.0), vec3(1.0, 0.0, 0.0) * 3.0, getBloodMoon(moonPhase, sunVisibility));
|
||||
#endif
|
||||
|
||||
// Lighting
|
||||
DoLighting(color, shadowMult, playerPos, viewPos, lViewPos, normalM, lmCoordM,
|
||||
noSmoothLighting, noDirectionalShading, false, false,
|
||||
subsurfaceMode, smoothnessG, highlightMult, emission);
|
||||
|
||||
// Reflections
|
||||
#if WATER_REFLECT_QUALITY > 0
|
||||
#ifdef LIGHT_COLOR_MULTS
|
||||
highlightColor *= lightColorMult;
|
||||
#endif
|
||||
#ifdef MOON_PHASE_INF_REFLECTION
|
||||
highlightColor *= pow2(moonPhaseInfluence);
|
||||
#endif
|
||||
|
||||
highlightColor *= 0.3;
|
||||
|
||||
float fresnelM = (pow2(pow2(fresnel)) * 0.85 + 0.15) * reflectMult;
|
||||
|
||||
float skyLightFactor = pow2(max(lmCoordM.y - 0.7, 0.0) * 3.33333);
|
||||
|
||||
#if WATER_REFLECT_QUALITY >= 2
|
||||
#if defined REALTIME_SHADOWS && WATER_QUALITY >= 2
|
||||
skyLightFactor = max(skyLightFactor, min1(dot(shadowMult, shadowMult)));
|
||||
#endif
|
||||
|
||||
vec4 reflection = GetReflection(normalM, viewPos.xyz, nViewPos, playerPos, lViewPos, -1.0,
|
||||
depthtex1, dither, skyLightFactor, fresnel,
|
||||
smoothnessG, geoNormal, color.rgb, shadowMult, highlightMult);
|
||||
|
||||
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
|
||||
#elif WATER_REFLECT_QUALITY == 1
|
||||
#ifdef OVERWORLD
|
||||
vec4 reflection = vec4(0.0);
|
||||
|
||||
vec3 normalMR = normalM;
|
||||
#ifdef GENERATED_NORMALS
|
||||
normalMR = mix(geoNormal, normalM, 0.05);
|
||||
#endif
|
||||
vec3 nViewPosR = reflect(nViewPos, normalMR);
|
||||
float RVdotU = dot(normalize(nViewPosR), upVec);
|
||||
float RVdotS = dot(normalize(nViewPosR), sunVec);
|
||||
|
||||
vec4 clipPosR = gbufferProjection * vec4(nViewPosR + 0.013 * viewPos, 1.0);
|
||||
vec3 screenPosR = clipPosR.xyz / clipPosR.w * 0.5 + 0.5;
|
||||
|
||||
vec2 rEdge = vec2(0.6, 0.53);
|
||||
vec2 screenPosRM = abs(screenPosR.xy - 0.5);
|
||||
|
||||
if (screenPosRM.x < rEdge.x && screenPosRM.y < rEdge.y) {
|
||||
vec2 edgeFactor = pow2(pow2(pow2(screenPosRM / rEdge)));
|
||||
screenPosR.y += (dither - 0.5) * (0.03 * (edgeFactor.x + edgeFactor.y) + 0.004);
|
||||
|
||||
screenPosR.z = texture2D(depthtex1, screenPosR.xy).x;
|
||||
vec3 viewPosR = ScreenToView(screenPosR);
|
||||
if (lViewPos <= 2.0 + length(viewPosR)) {
|
||||
reflection = texture2D(gaux2, screenPosR.xy);
|
||||
reflection.rgb = pow2(reflection.rgb + 1.0);
|
||||
}
|
||||
|
||||
edgeFactor.x = pow2(edgeFactor.x);
|
||||
edgeFactor = 1.0 - edgeFactor;
|
||||
reflection.a *= edgeFactor.x * edgeFactor.y;
|
||||
}
|
||||
|
||||
reflection.a *= reflection.a;
|
||||
reflection.a *= clamp01((dot(nViewPos, nViewPosR) - 0.45) * 10.0); // Fixes perpendicular ref
|
||||
|
||||
if (reflection.a < 1.0) {
|
||||
vec3 skyReflection = GetLowQualitySky(RVdotU, RVdotS, dither, true, true);
|
||||
skyReflection = mix(color.rgb * 0.5, skyReflection, skyLightFactor);
|
||||
|
||||
skyReflection *= atmColorMult;
|
||||
|
||||
reflection.rgb = mix(skyReflection, reflection.rgb, reflection.a);
|
||||
}
|
||||
|
||||
color.rgb = mix(color.rgb, reflection.rgb, fresnelM);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
////
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
float sky = 0.0;
|
||||
DoFog(color.rgb, sky, lViewPos, playerPos, VdotU, VdotS, dither);
|
||||
color.a *= 1.0 - sky;
|
||||
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:03 */
|
||||
#else
|
||||
/* DRAWBUFFERS:08 */
|
||||
#endif
|
||||
gl_FragData[0] = color;
|
||||
gl_FragData[1] = vec4(1.0 - translucentMult.rgb, translucentMult.a);
|
||||
|
||||
#if WATER_QUALITY >= 3
|
||||
#ifndef LIGHT_COLORING
|
||||
/* DRAWBUFFERS:031 */
|
||||
#else
|
||||
/* DRAWBUFFERS:081 */
|
||||
#endif
|
||||
gl_FragData[2] = vec4(0.0, materialMask, 0.0, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
flat out int mat;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 lmCoord;
|
||||
|
||||
flat out vec3 upVec, sunVec, northVec, eastVec;
|
||||
out vec3 normal;
|
||||
out vec3 viewVector;
|
||||
|
||||
out vec4 glColor;
|
||||
|
||||
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_QUALITY >= 2 || defined GENERATED_NORMALS || defined CUSTOM_PBR
|
||||
flat out vec3 binormal, tangent;
|
||||
#endif
|
||||
|
||||
#if WATER_STYLE >= 2 || defined FANCY_NETHERPORTAL || defined GENERATED_NORMALS || defined POM
|
||||
out vec2 signMidCoordPos;
|
||||
flat out vec2 absMidCoordPos;
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
out vec4 vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
#ifdef TAA
|
||||
uniform float viewWidth, viewHeight;
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_WATER_VERTEX
|
||||
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
attribute vec4 mc_Entity;
|
||||
attribute vec4 mc_midTexCoord;
|
||||
attribute vec4 at_tangent;
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#ifdef TAA
|
||||
#include "/spookylib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_WATER_VERTEX
|
||||
#include "/spookylib/materials/materialMethods/wavingBlocks.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
|
||||
glColor = gl_Color;
|
||||
|
||||
mat = int(mc_Entity.x + 0.5);
|
||||
|
||||
#ifdef WAVING_WATER_VERTEX
|
||||
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
DoWave(position.xyz, mat);
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
eastVec = normalize(gbufferModelView[0].xyz);
|
||||
northVec = normalize(gbufferModelView[2].xyz);
|
||||
sunVec = GetSunVector();
|
||||
|
||||
#if WATER_STYLE >= 2 || RAIN_PUDDLES >= 1 && WATER_STYLE == 1 && WATER_QUALITY >= 2 || 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);
|
||||
#else
|
||||
vec3 binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
|
||||
vec3 tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
|
||||
#endif
|
||||
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
|
||||
#if WATER_STYLE >= 2 || defined FANCY_NETHERPORTAL || defined GENERATED_NORMALS || defined POM
|
||||
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
|
||||
#endif
|
||||
|
||||
gl_Position.z -= 0.0001;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,110 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
flat in vec2 lmCoord;
|
||||
in vec2 texCoord;
|
||||
|
||||
flat in vec3 upVec, sunVec;
|
||||
|
||||
flat in vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform vec3 skyColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
//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 "/spookylib/colors/lightAndAmbientColors.glsl"
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
#include "/spookylib/misc/colorCodedPrograms.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
color *= glColor;
|
||||
|
||||
if (color.a < 0.1 || isEyeInWater == 3) discard;
|
||||
|
||||
if (cameraPosition.y > maximumCloudsHeight) discard;
|
||||
|
||||
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));
|
||||
|
||||
#ifdef COLOR_CODED_PROGRAMS
|
||||
ColorCodeProgram(color);
|
||||
#endif
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = color;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
flat out vec2 lmCoord;
|
||||
out vec2 texCoord;
|
||||
|
||||
flat out vec3 upVec, sunVec;
|
||||
|
||||
flat out vec4 glColor;
|
||||
|
||||
//Uniforms//
|
||||
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||
glColor = gl_Color;
|
||||
|
||||
#ifdef WAVING_RAIN
|
||||
position.xz += (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;
|
||||
#endif
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
sunVec = GetSunVector();
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,274 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////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;
|
||||
|
||||
//Uniforms//
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
#if WATER_CAUSTIC_STYLE >= 3
|
||||
|
||||
|
||||
uniform sampler2D gaux4;
|
||||
#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//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
vec4 color1 = texture2DLod(tex, texCoord, 0); // Shadow Color
|
||||
|
||||
#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 < 31008) {
|
||||
if (mat < 31000) {
|
||||
DoNaturalShadowCalculation(color1, color2);
|
||||
} else {
|
||||
if (mat == 31000) { // 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 = GetLuminance(color1.rgb);
|
||||
color1.rgb = color1.rgb * pow2(wcl) * 1.2;
|
||||
#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
|
||||
#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 = texture2D(noisetex, worldPosM.xz * 0.012 - waterWind).g;
|
||||
waterNoise += texture2D(noisetex, worldPosM.xz * 0.05 + waterWind).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 == 31004)*/ { // 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 < 31020) { // Glass, Glass Pane, Beacon (31008, 31012, 31016)
|
||||
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);
|
||||
} else {
|
||||
DoNaturalShadowCalculation(color1, color2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
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 == 10008) discard; // disable leaves
|
||||
}
|
||||
|
||||
gl_FragData[0] = color1; // 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
|
||||
|
||||
gl_FragData[1] = color2; // 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;
|
||||
|
||||
//Uniforms//
|
||||
uniform mat4 shadowProjection, shadowProjectionInverse;
|
||||
uniform mat4 shadowModelView, shadowModelViewInverse;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
|
||||
#if defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX
|
||||
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
#endif
|
||||
|
||||
//Attributes//
|
||||
attribute vec4 mc_Entity;
|
||||
|
||||
#if defined PERPENDICULAR_TWEAKS || defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX
|
||||
attribute vec4 mc_midTexCoord;
|
||||
#endif
|
||||
|
||||
//Common Variables//
|
||||
#if (defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX) && defined NO_WAVING_INDOORS
|
||||
vec2 lmCoord = vec2(0.0);
|
||||
#endif
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
#include "/spookylib/util/spaceConversion.glsl"
|
||||
|
||||
#if defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX
|
||||
#include "/spookylib/materials/materialMethods/wavingBlocks.glsl"
|
||||
#endif
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
texCoord = gl_MultiTexCoord0.xy;
|
||||
glColor = gl_Color;
|
||||
|
||||
sunVec = GetSunVector();
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
|
||||
mat = int(mc_Entity.x + 0.5);
|
||||
|
||||
position = shadowModelViewInverse * shadowProjectionInverse * ftransform();
|
||||
|
||||
#if defined WAVING_ANYTHING_TERRAIN || defined WAVING_WATER_VERTEX
|
||||
#ifdef NO_WAVING_INDOORS
|
||||
lmCoord = GetLightMapCoordinates();
|
||||
#endif
|
||||
|
||||
DoWave(position.xyz, mat);
|
||||
#endif
|
||||
|
||||
#ifdef PERPENDICULAR_TWEAKS
|
||||
if (mat == 10003 || mat == 10004 || mat == 10016) { // Foliage
|
||||
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
|
||||
vec2 texMinMidCoord = texCoord - midCoord;
|
||||
if (texMinMidCoord.y < 0.0) {
|
||||
vec3 normal = gl_NormalMatrix * gl_Normal;
|
||||
position.xyz += normal * 0.35;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mat == 31000) { // Water
|
||||
position.y += 0.015 * max0(length(position.xyz) - 50.0);
|
||||
}
|
||||
|
||||
gl_Position = shadowProjection * shadowModelView * position;
|
||||
|
||||
float lVertexPos = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
|
||||
float distortFactor = lVertexPos * shadowMapBias + (1.0 - shadowMapBias);
|
||||
gl_Position.xy *= 1.0 / distortFactor;
|
||||
gl_Position.z = gl_Position.z * 0.2;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,46 @@
|
||||
////////////////////////////////////////
|
||||
// Complementary Reimagined by EminGT //
|
||||
////////////////////////////////////////
|
||||
|
||||
//Common//
|
||||
#include "/spookylib/common.glsl"
|
||||
|
||||
//////////Fragment Shader//////////Fragment Shader//////////Fragment Shader//////////
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Pipeline Constants//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////Vertex Shader//////////Vertex Shader//////////Vertex Shader//////////
|
||||
#ifdef VERTEX_SHADER
|
||||
|
||||
//Uniforms//
|
||||
|
||||
//Attributes//
|
||||
|
||||
//Common Variables//
|
||||
|
||||
//Common Functions//
|
||||
|
||||
//Includes//
|
||||
|
||||
//spookyprogram//
|
||||
void main() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user