first commit
This commit is contained in:
commit
0f859671ea
308 files changed
+18617
No files matched your search
@@ -0,0 +1,166 @@
|
||||
//FXAA 3.11 from http://blog.simonrodriguez.fr/articles/30-07-2016_implementing_fxaa.html
|
||||
float quality[12] = float[12] (1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 2.0, 2.0, 2.0, 2.0, 4.0, 8.0);
|
||||
|
||||
#if FXAA_EDGE_SENSITIVITY == 0
|
||||
float edgeThreshold = 0.25;
|
||||
float edgeThresholdMin = 0.0625;
|
||||
#elif FXAA_EDGE_SENSITIVITY == 1
|
||||
float edgeThreshold = 0.125;
|
||||
float edgeThresholdMin = 0.0312;
|
||||
#elif FXAA_EDGE_SENSITIVITY == 2
|
||||
float edgeThreshold = 0.063;
|
||||
float edgeThresholdMin = 0.0156;
|
||||
#endif
|
||||
|
||||
vec3 FXAA311(vec3 color) {
|
||||
int iterations = 12;
|
||||
|
||||
vec2 view = 1.0 / vec2(viewWidth, viewHeight);
|
||||
|
||||
float lumaCenter = GetLuminance(color);
|
||||
float lumaDown = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 0.0, -1.0) * view, 0.0).rgb);
|
||||
float lumaUp = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 0.0, 1.0) * view, 0.0).rgb);
|
||||
float lumaLeft = GetLuminance(texture2DLod(colortex1, texCoord + vec2(-1.0, 0.0) * view, 0.0).rgb);
|
||||
float lumaRight = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 1.0, 0.0) * view, 0.0).rgb);
|
||||
|
||||
float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight)));
|
||||
float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight)));
|
||||
|
||||
float lumaRange = lumaMax - lumaMin;
|
||||
|
||||
if (lumaRange > max(edgeThresholdMin, lumaMax * edgeThreshold)) {
|
||||
float lumaDownLeft = GetLuminance(texture2DLod(colortex1, texCoord + vec2(-1.0, -1.0) * view, 0.0).rgb);
|
||||
float lumaUpRight = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 1.0, 1.0) * view, 0.0).rgb);
|
||||
float lumaUpLeft = GetLuminance(texture2DLod(colortex1, texCoord + vec2(-1.0, 1.0) * view, 0.0).rgb);
|
||||
float lumaDownRight = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 1.0, -1.0) * view, 0.0).rgb);
|
||||
|
||||
float lumaDownUp = lumaDown + lumaUp;
|
||||
float lumaLeftRight = lumaLeft + lumaRight;
|
||||
|
||||
float lumaLeftCorners = lumaDownLeft + lumaUpLeft;
|
||||
float lumaDownCorners = lumaDownLeft + lumaDownRight;
|
||||
float lumaRightCorners = lumaDownRight + lumaUpRight;
|
||||
float lumaUpCorners = lumaUpRight + lumaUpLeft;
|
||||
|
||||
float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners ) +
|
||||
abs(-2.0 * lumaCenter + lumaDownUp ) * 2.0 +
|
||||
abs(-2.0 * lumaRight + lumaRightCorners);
|
||||
float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners ) +
|
||||
abs(-2.0 * lumaCenter + lumaLeftRight ) * 2.0 +
|
||||
abs(-2.0 * lumaDown + lumaDownCorners );
|
||||
|
||||
bool isHorizontal = (edgeHorizontal >= edgeVertical);
|
||||
|
||||
float luma1 = isHorizontal ? lumaDown : lumaLeft;
|
||||
float luma2 = isHorizontal ? lumaUp : lumaRight;
|
||||
float gradient1 = luma1 - lumaCenter;
|
||||
float gradient2 = luma2 - lumaCenter;
|
||||
|
||||
bool is1Steepest = abs(gradient1) >= abs(gradient2);
|
||||
float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2));
|
||||
|
||||
float stepLength = isHorizontal ? view.y : view.x;
|
||||
|
||||
float lumaLocalAverage = 0.0;
|
||||
|
||||
if (is1Steepest) {
|
||||
stepLength = - stepLength;
|
||||
lumaLocalAverage = 0.5 * (luma1 + lumaCenter);
|
||||
} else {
|
||||
lumaLocalAverage = 0.5 * (luma2 + lumaCenter);
|
||||
}
|
||||
|
||||
vec2 currentUv = texCoord;
|
||||
if (isHorizontal) {
|
||||
currentUv.y += stepLength * 0.5;
|
||||
} else {
|
||||
currentUv.x += stepLength * 0.5;
|
||||
}
|
||||
|
||||
vec2 offset = isHorizontal ? vec2(view.x, 0.0) : vec2(0.0, view.y);
|
||||
|
||||
vec2 uv1 = currentUv - offset;
|
||||
vec2 uv2 = currentUv + offset;
|
||||
|
||||
float lumaEnd1 = GetLuminance(texture2DLod(colortex1, uv1, 0.0).rgb);
|
||||
float lumaEnd2 = GetLuminance(texture2DLod(colortex1, uv2, 0.0).rgb);
|
||||
lumaEnd1 -= lumaLocalAverage;
|
||||
lumaEnd2 -= lumaLocalAverage;
|
||||
|
||||
bool reached1 = abs(lumaEnd1) >= gradientScaled;
|
||||
bool reached2 = abs(lumaEnd2) >= gradientScaled;
|
||||
bool reachedBoth = reached1 && reached2;
|
||||
|
||||
if (!reached1) {
|
||||
uv1 -= offset;
|
||||
}
|
||||
if (!reached2) {
|
||||
uv2 += offset;
|
||||
}
|
||||
|
||||
if (!reachedBoth) {
|
||||
for(int i = 2; i < iterations; i++) {
|
||||
if (!reached1) {
|
||||
lumaEnd1 = GetLuminance(texture2DLod(colortex1, uv1, 0.0).rgb);
|
||||
lumaEnd1 = lumaEnd1 - lumaLocalAverage;
|
||||
}
|
||||
if (!reached2) {
|
||||
lumaEnd2 = GetLuminance(texture2DLod(colortex1, uv2, 0.0).rgb);
|
||||
lumaEnd2 = lumaEnd2 - lumaLocalAverage;
|
||||
}
|
||||
|
||||
reached1 = abs(lumaEnd1) >= gradientScaled;
|
||||
reached2 = abs(lumaEnd2) >= gradientScaled;
|
||||
reachedBoth = reached1 && reached2;
|
||||
|
||||
if (!reached1) {
|
||||
uv1 -= offset * quality[i];
|
||||
}
|
||||
if (!reached2) {
|
||||
uv2 += offset * quality[i];
|
||||
}
|
||||
|
||||
if (reachedBoth) break;
|
||||
}
|
||||
}
|
||||
|
||||
float distance1 = isHorizontal ? (texCoord.x - uv1.x) : (texCoord.y - uv1.y);
|
||||
float distance2 = isHorizontal ? (uv2.x - texCoord.x) : (uv2.y - texCoord.y);
|
||||
|
||||
bool isDirection1 = distance1 < distance2;
|
||||
float distanceFinal = min(distance1, distance2);
|
||||
|
||||
float edgeThickness = (distance1 + distance2);
|
||||
|
||||
float pixelOffset = - distanceFinal / edgeThickness + 0.5;
|
||||
|
||||
bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage;
|
||||
|
||||
bool correctVariation = ((isDirection1 ? lumaEnd1 : lumaEnd2) < 0.0) != isLumaCenterSmaller;
|
||||
|
||||
float finalOffset = correctVariation ? pixelOffset : 0.0;
|
||||
|
||||
float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners);
|
||||
float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0);
|
||||
float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1;
|
||||
float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * FXAA_SUBPIXEL;
|
||||
|
||||
#ifdef TAA
|
||||
subPixelOffsetFinal *= 0.5;
|
||||
#endif
|
||||
|
||||
finalOffset = max(finalOffset, subPixelOffsetFinal);
|
||||
|
||||
// Compute the final UV coordinates.
|
||||
vec2 finalUv = texCoord;
|
||||
if (isHorizontal) {
|
||||
finalUv.y += finalOffset * stepLength;
|
||||
} else {
|
||||
finalUv.x += finalOffset * stepLength;
|
||||
}
|
||||
|
||||
color = texture2DLod(colortex1, finalUv, 0.0).rgb;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
vec2 neighbourOffsets[8] = vec2[8](
|
||||
vec2( 0.0, -1.0),
|
||||
vec2(-1.0, 0.0),
|
||||
vec2( 1.0, 0.0),
|
||||
vec2( 0.0, 1.0),
|
||||
vec2(-1.0, -1.0),
|
||||
vec2( 1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
vec2( 1.0, 1.0)
|
||||
);
|
||||
|
||||
vec3 GetBlurredColor(vec2 view) {
|
||||
float blurFactor = 0.1667;
|
||||
vec3 color = texture2DLod(colortex1, texCoord + neighbourOffsets[4] * blurFactor / view, 0).rgb;
|
||||
color+= texture2DLod(colortex1, texCoord + neighbourOffsets[5] * blurFactor / view, 0).rgb;
|
||||
color+= texture2DLod(colortex1, texCoord + neighbourOffsets[6] * blurFactor / view, 0).rgb;
|
||||
color+= texture2DLod(colortex1, texCoord + neighbourOffsets[7] * blurFactor / view, 0).rgb;
|
||||
|
||||
color /= 4.0;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
#ifdef TAA_SELECTIVE
|
||||
float GetSkipFlag(float depth, vec2 view) {
|
||||
float skip = texture2D(colortex3, texCoord.xy).b;
|
||||
float skipDepth = depth;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float sampleDepth = texture2D(depthtex1, texCoord + neighbourOffsets[i + 4] / view).r;
|
||||
float sampleSkip = texture2D(colortex3, texCoord + neighbourOffsets[i + 4] / view).b;
|
||||
|
||||
skip = (sampleDepth < skipDepth && sampleSkip == 0) ? 0 : skip;
|
||||
skipDepth = min(skipDepth, sampleDepth);
|
||||
}
|
||||
|
||||
return skip;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Previous frame reprojection from Chocapic13
|
||||
vec2 Reprojection(vec3 pos) {
|
||||
pos = pos * 2.0 - 1.0;
|
||||
|
||||
vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0);
|
||||
viewPosPrev /= viewPosPrev.w;
|
||||
viewPosPrev = gbufferModelViewInverse * viewPosPrev;
|
||||
|
||||
vec3 cameraOffset = cameraPosition - previousCameraPosition;
|
||||
cameraOffset *= float(pos.z > 0.56);
|
||||
|
||||
vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0);
|
||||
previousPosition = gbufferPreviousModelView * previousPosition;
|
||||
previousPosition = gbufferPreviousProjection * previousPosition;
|
||||
return previousPosition.xy / previousPosition.w * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
//Catmull-Rom sampling from Filmic SMAA presentation
|
||||
vec3 textureCatmullRom(sampler2D colortex, vec2 texcoord, vec2 view) {
|
||||
vec2 position = texcoord * view;
|
||||
vec2 centerPosition = floor(position - 0.5) + 0.5;
|
||||
vec2 f = position - centerPosition;
|
||||
vec2 f2 = f * f;
|
||||
vec2 f3 = f * f2;
|
||||
|
||||
float c = 0.7;
|
||||
vec2 w0 = -c * f3 + 2.0 * c * f2 - c * f;
|
||||
vec2 w1 = (2.0 - c) * f3 - (3.0 - c) * f2 + 1.0;
|
||||
vec2 w2 = -(2.0 - c) * f3 + (3.0 - 2.0 * c) * f2 + c * f;
|
||||
vec2 w3 = c * f3 - c * f2;
|
||||
|
||||
vec2 w12 = w1 + w2;
|
||||
vec2 tc12 = (centerPosition + w2 / w12) / view;
|
||||
|
||||
vec2 tc0 = (centerPosition - 1.0) / view;
|
||||
vec2 tc3 = (centerPosition + 2.0) / view;
|
||||
vec4 color = vec4(texture2DLod(colortex, vec2(tc12.x, tc0.y ), 0).gba, 1.0) * (w12.x * w0.y ) +
|
||||
vec4(texture2DLod(colortex, vec2(tc0.x, tc12.y), 0).gba, 1.0) * (w0.x * w12.y) +
|
||||
vec4(texture2DLod(colortex, vec2(tc12.x, tc12.y), 0).gba, 1.0) * (w12.x * w12.y) +
|
||||
vec4(texture2DLod(colortex, vec2(tc3.x, tc12.y), 0).gba, 1.0) * (w3.x * w12.y) +
|
||||
vec4(texture2DLod(colortex, vec2(tc12.x, tc3.y ), 0).gba, 1.0) * (w12.x * w3.y );
|
||||
return color.rgb / color.a;
|
||||
}
|
||||
|
||||
vec3 RGBToYCoCg(vec3 col) {
|
||||
return vec3(
|
||||
col.r * 0.25 + col.g * 0.5 + col.b * 0.25,
|
||||
col.r * 0.5 - col.b * 0.5,
|
||||
col.r * -0.25 + col.g * 0.5 + col.b * -0.25
|
||||
);
|
||||
}
|
||||
|
||||
vec3 YCoCgToRGB(vec3 col) {
|
||||
float n = col.r - col.b;
|
||||
return vec3(n + col.g, col.r + col.b, n - col.g);
|
||||
}
|
||||
|
||||
vec3 ClipAABB(vec3 q,vec3 aabb_min, vec3 aabb_max){
|
||||
vec3 p_clip = 0.5 * (aabb_max + aabb_min);
|
||||
vec3 e_clip = 0.5 * (aabb_max - aabb_min) + 0.00000001;
|
||||
|
||||
vec3 v_clip = q - vec3(p_clip);
|
||||
vec3 v_unit = v_clip.xyz / e_clip;
|
||||
vec3 a_unit = abs(v_unit);
|
||||
float ma_unit = max(a_unit.x, max(a_unit.y, a_unit.z));
|
||||
|
||||
if (ma_unit > 1.0)
|
||||
return vec3(p_clip) + v_clip / ma_unit;
|
||||
else
|
||||
return q;
|
||||
}
|
||||
|
||||
vec3 NeighbourhoodClipping(vec3 color, vec3 tempColor, vec2 view) {
|
||||
vec3 minclr = RGBToYCoCg(color);
|
||||
vec3 maxclr = minclr;
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
vec2 offset = neighbourOffsets[i] * view;
|
||||
vec3 clr = texture2DLod(colortex1, texCoord + offset, 0.0).rgb;
|
||||
|
||||
clr = RGBToYCoCg(clr);
|
||||
minclr = min(minclr, clr); maxclr = max(maxclr, clr);
|
||||
}
|
||||
|
||||
tempColor = RGBToYCoCg(tempColor);
|
||||
tempColor = ClipAABB(tempColor, minclr, maxclr);
|
||||
|
||||
return YCoCgToRGB(tempColor);
|
||||
}
|
||||
|
||||
vec4 TemporalAA(inout vec3 color, float tempData) {
|
||||
vec2 view = vec2(viewWidth, viewHeight);
|
||||
|
||||
vec3 blur = GetBlurredColor(view);
|
||||
float depth = texture2D(depthtex1, texCoord).r;
|
||||
|
||||
#ifdef TAA_SELECTIVE
|
||||
float skip = GetSkipFlag(depth, view);
|
||||
|
||||
if (skip > 0.0) {
|
||||
color = blur;
|
||||
return vec4(tempData, vec3(0.0));
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 coord = vec3(texCoord, depth);
|
||||
vec2 prvCoord = Reprojection(coord);
|
||||
|
||||
vec3 tempColor = textureCatmullRom(colortex2, prvCoord, view);
|
||||
|
||||
if(tempColor == vec3(0.0)) {
|
||||
color = blur;
|
||||
return vec4(tempData, color);
|
||||
}
|
||||
|
||||
vec3 tempColorRaw = tempColor;
|
||||
tempColor = NeighbourhoodClipping(color, tempColor, 1.0 / view);
|
||||
|
||||
#if TAA_MODE == 0
|
||||
vec2 velocity = (texCoord - prvCoord.xy) * view;
|
||||
float blendFactor = float(
|
||||
prvCoord.x > 0.0 && prvCoord.x < 1.0 &&
|
||||
prvCoord.y > 0.0 && prvCoord.y < 1.0
|
||||
);
|
||||
blendFactor *= exp(-length(velocity)) * 0.2 + 0.7;
|
||||
|
||||
color = mix(color, tempColor, blendFactor);
|
||||
#endif
|
||||
|
||||
vec3 outColor = color;
|
||||
|
||||
#if TAA_MODE == 1
|
||||
color = mix(color, tempColor, 0.5);
|
||||
#endif
|
||||
|
||||
return vec4(tempData, outColor);
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
#ifdef OVERWORLD
|
||||
float CloudSampleBase(vec2 coord, vec2 wind, float cloudGradient, float sunCoverage, float dither, float multiplier) {
|
||||
coord.xy *= 0.004;
|
||||
|
||||
#if CLOUD_BASE == 0
|
||||
float noiseBase = texture2D(noisetex, coord * 0.25 + wind).r;
|
||||
#else
|
||||
float noiseBase = texture2D(noisetex, coord * 0.5 + wind).g;
|
||||
noiseBase = pow(1.0 - noiseBase, 2.0) * 0.5 + 0.25;
|
||||
#endif
|
||||
|
||||
float detailZ = floor(cloudGradient * float(CLOUD_THICKNESS)) * 0.04;
|
||||
float noiseDetailLow = texture2D(noisetex, coord.xy * 0.5 - wind * 2.0 + detailZ).b;
|
||||
float noiseDetailHigh = texture2D(noisetex, coord.xy * 0.5 - wind * 2.0 + detailZ + 0.04).b;
|
||||
float noiseDetail = mix(noiseDetailLow, noiseDetailHigh, fract(cloudGradient * float(CLOUD_THICKNESS)));
|
||||
|
||||
float noiseCoverage = abs(cloudGradient - 0.125);
|
||||
noiseCoverage *= cloudGradient > 0.125 ? (2.14 - CLOUD_AMOUNT * 0.1) : 8.0;
|
||||
noiseCoverage = noiseCoverage * noiseCoverage * 4.0;
|
||||
|
||||
float noise = mix(noiseBase, noiseDetail, 0.0476 * CLOUD_DETAIL) * 21.0 - noiseCoverage;
|
||||
noise = mix(noise, 21.0 - noiseCoverage * 2.5, 0.33 * rainStrength);
|
||||
|
||||
noise = max(noise - (sunCoverage * 3.0 + CLOUD_AMOUNT), 0.0);
|
||||
noise *= CLOUD_DENSITY * multiplier;
|
||||
noise *= (1.0 - 0.75 * rainStrength);
|
||||
noise = noise / sqrt(noise * noise + 0.5);
|
||||
|
||||
return noise;
|
||||
}
|
||||
|
||||
float CloudSampleSkybox(vec2 coord, vec2 wind, float cloudGradient, float sunCoverage, float dither) {
|
||||
return CloudSampleBase(coord, wind, cloudGradient, sunCoverage, dither, 0.125);
|
||||
}
|
||||
|
||||
float CloudSampleVolumetric(vec2 coord, vec2 wind, float cloudGradient, float sunCoverage, float dither) {
|
||||
coord.xy /= CLOUD_VOLUMETRIC_SCALE;
|
||||
return CloudSampleBase(coord, wind, cloudGradient, sunCoverage, dither, 0.125);
|
||||
}
|
||||
|
||||
float InvLerp(float v, float l, float h) {
|
||||
return clamp((v - l) / (h - l), 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec4 DrawCloudSkybox(vec3 viewPos, float z, float dither, vec3 lightCol, vec3 ambientCol, bool fadeFaster) {
|
||||
if (z < 1.0) return vec4(0.0);
|
||||
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int samples = CLOUD_THICKNESS * 2;
|
||||
|
||||
float cloud = 0.0, cloudLighting = 0.0;
|
||||
|
||||
float sampleStep = 1.0 / samples;
|
||||
float currentStep = dither * sampleStep;
|
||||
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
float VoU = dot(nViewPos, upVec);
|
||||
float VoL = dot(nViewPos, lightVec);
|
||||
|
||||
float sunCoverage = mix(abs(VoL), max(VoL, 0.0), shadowFade);
|
||||
sunCoverage = pow(clamp(sunCoverage * 2.0 - 1.0, 0.0, 1.0), 12.0) * (1.0 - rainStrength);
|
||||
|
||||
vec2 wind = vec2(
|
||||
frametime * CLOUD_SPEED * 0.0005,
|
||||
sin(frametime * CLOUD_SPEED * 0.001) * 0.005
|
||||
) * CLOUD_HEIGHT / 15.0;
|
||||
|
||||
vec3 cloudColor = vec3(0.0);
|
||||
|
||||
if (VoU > 0.025) {
|
||||
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz);
|
||||
|
||||
float halfVoL = mix(abs(VoL) * 0.8, VoL, shadowFade) * 0.5 + 0.5;
|
||||
float halfVoLSqr = halfVoL * halfVoL;
|
||||
float scattering = pow(halfVoL, 6.0);
|
||||
float noiseLightFactor = (2.0 - 1.5 * VoL * shadowFade) * CLOUD_DENSITY * 0.5;
|
||||
|
||||
for(int i = 0; i < samples; i++) {
|
||||
if (cloud > 0.99) break;
|
||||
vec3 planeCoord = wpos * ((CLOUD_HEIGHT + currentStep * CLOUD_THICKNESS) / wpos.y);
|
||||
vec2 coord = cameraPosition.xz * 0.0625 * 16.0 / CLOUD_VOLUMETRIC_SCALE + planeCoord.xz;
|
||||
|
||||
float noise = CloudSampleSkybox(coord, wind, currentStep, sunCoverage, dither);
|
||||
|
||||
float sampleLighting = pow(currentStep, 1.125 * halfVoLSqr + 0.875) * 0.8 + 0.2;
|
||||
sampleLighting *= 1.0 - pow(noise, noiseLightFactor);
|
||||
|
||||
cloudLighting = mix(cloudLighting, sampleLighting, noise * (1.0 - cloud * cloud));
|
||||
cloud = mix(cloud, 1.0, noise);
|
||||
|
||||
currentStep += sampleStep;
|
||||
}
|
||||
cloudLighting = mix(cloudLighting, 1.0, (1.0 - cloud * cloud) * scattering * 0.5);
|
||||
cloudLighting *= (1.0 - 0.9 * rainStrength);
|
||||
|
||||
cloudColor = mix(
|
||||
ambientCol * (0.3 * sunVisibility + 0.5),
|
||||
lightCol * (0.85 + 1.15 * scattering),
|
||||
cloudLighting
|
||||
);
|
||||
cloudColor *= 1.0 - 0.4 * rainStrength;
|
||||
|
||||
cloud *= clamp(1.0 - exp(-16.0 / max(fogDensity, 0.5) * VoU + 0.5), 0.0, 1.0);
|
||||
|
||||
if (fadeFaster) {
|
||||
cloud *= 1.0 - pow(1.0 - VoU, 4.0);
|
||||
}
|
||||
}
|
||||
cloudColor *= CLOUD_BRIGHTNESS * (0.5 - 0.25 * (1.0 - sunVisibility) * (1.0 - rainStrength));
|
||||
// cloudColor *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
cloudColor *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
cloudColor *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef UNDERGROUND_SKY
|
||||
cloud *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS);
|
||||
#endif
|
||||
|
||||
return vec4(cloudColor, cloud * cloud * CLOUD_OPACITY);
|
||||
}
|
||||
|
||||
vec3 GetReflectedCameraPos(vec3 worldPos, vec3 normal) {
|
||||
vec4 worldNormal = gbufferModelViewInverse * vec4(normal, 1.0);
|
||||
worldNormal.xyz /= worldNormal.w;
|
||||
|
||||
vec3 cameraPos = cameraPosition + 2.0 * worldNormal.xyz * dot(worldPos, worldNormal.xyz);
|
||||
cameraPos = cameraPos + reflect(worldPos, worldNormal.xyz); //bobbing stabilizer, works like magic
|
||||
|
||||
return cameraPos;
|
||||
}
|
||||
|
||||
vec4 DrawCloudVolumetric(vec3 viewPos, vec3 cameraPos, float z, float dither, vec3 lightCol, vec3 ambientCol, inout float cloudViewLength, bool fadeFaster) {
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
vec3 worldPos = (gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz;
|
||||
vec3 nWorldPos = normalize(worldPos);
|
||||
float viewLength = length(viewPos);
|
||||
|
||||
float cloudHeight = CLOUD_HEIGHT * CLOUD_VOLUMETRIC_SCALE + 70;
|
||||
// float cloudHeight = CLOUD_HEIGHT * CLOUD_VOLUMETRIC_SCALE + cameraPosition.y;
|
||||
// float cloudHeight = 63;
|
||||
|
||||
float lowerY = cloudHeight;
|
||||
float upperY = cloudHeight + CLOUD_THICKNESS * CLOUD_VOLUMETRIC_SCALE;
|
||||
|
||||
float lowerPlane = (lowerY - cameraPos.y) / nWorldPos.y;
|
||||
float upperPlane = (upperY - cameraPos.y) / nWorldPos.y;
|
||||
|
||||
float nearestPlane = max(min(lowerPlane, upperPlane), 0.0);
|
||||
float furthestPlane = max(lowerPlane, upperPlane);
|
||||
|
||||
float maxcloudViewLength = cloudViewLength;
|
||||
|
||||
if (furthestPlane < 0) return vec4(0.0);
|
||||
|
||||
float planeDifference = furthestPlane - nearestPlane;
|
||||
|
||||
vec3 startPos = cameraPos + nearestPlane * nWorldPos;
|
||||
|
||||
float scaling = abs(cameraPosition.y - (upperY + lowerY) * 0.5) / ((upperY - lowerY) * 0.5);
|
||||
scaling = clamp((scaling - 1.0) * CLOUD_THICKNESS * 0.125, 0.0, 1.0);
|
||||
|
||||
float sampleLength = CLOUD_THICKNESS * CLOUD_VOLUMETRIC_SCALE / 2.0;
|
||||
sampleLength /= (4.0 * nWorldPos.y * nWorldPos.y) * scaling + 1.0;
|
||||
vec3 sampleStep = nWorldPos * sampleLength;
|
||||
int samples = int(min(planeDifference / sampleLength, 32) + 1);
|
||||
|
||||
vec3 samplePos = startPos + sampleStep * dither;
|
||||
float sampleTotalLength = nearestPlane + sampleLength * dither;
|
||||
|
||||
vec2 wind = vec2(
|
||||
frametime * CLOUD_SPEED * 0.0005,
|
||||
sin(frametime * CLOUD_SPEED * 0.001) * 0.005
|
||||
) * CLOUD_HEIGHT / 15.0;
|
||||
|
||||
float cloud = 0.0;
|
||||
float cloudFaded = 0.0;
|
||||
float cloudLighting = 0.0;
|
||||
|
||||
float VoU = dot(nViewPos, upVec);
|
||||
float VoL = dot(nViewPos, lightVec);
|
||||
|
||||
float sunCoverage = mix(abs(VoL), max(VoL, 0.0), shadowFade);
|
||||
sunCoverage = pow(clamp(sunCoverage * 2.0 - 1.0, 0.0, 1.0), 12.0) * (1.0 - rainStrength);
|
||||
|
||||
float halfVoL = mix(abs(VoL) * 0.8, VoL, shadowFade) * 0.5 + 0.5;
|
||||
float halfVoLSqr = halfVoL * halfVoL;
|
||||
|
||||
float scattering = pow(halfVoL, 6.0);
|
||||
float noiseLightFactor = (2.0 - 1.5 * VoL * shadowFade) * CLOUD_DENSITY * 0.5;
|
||||
|
||||
float viewLengthSoftMin = viewLength - sampleLength * 0.5;
|
||||
float viewLengthSoftMax = viewLength + sampleLength * 0.5;
|
||||
|
||||
float fade = 1.0;
|
||||
float fadeStart = 32.0 / max(fogDensity, 0.5);
|
||||
float fadeEnd = (fadeFaster ? 80.0 : 240.0) / max(fogDensity, 0.5);
|
||||
|
||||
for (int i = 0; i < samples; i++) {
|
||||
if (cloud > 0.99) break;
|
||||
if (sampleTotalLength > viewLengthSoftMax && z < 1.0) break;
|
||||
|
||||
float cloudGradient = InvLerp(samplePos.y, lowerY, upperY);
|
||||
float xzNormalizedDistance = length(samplePos.xz - cameraPos.xz) / CLOUD_VOLUMETRIC_SCALE;
|
||||
|
||||
float noise = CloudSampleVolumetric(samplePos.xz, wind, cloudGradient, sunCoverage, dither);
|
||||
noise *= step(lowerY, samplePos.y) * step(samplePos.y, upperY);
|
||||
|
||||
float sampleLighting = pow(cloudGradient, 1.125 * halfVoLSqr + 0.875) * 0.8 + 0.2;
|
||||
sampleLighting *= 1.0 - pow(noise, noiseLightFactor);
|
||||
|
||||
float sampleFade = InvLerp(xzNormalizedDistance, fadeEnd, fadeStart);
|
||||
fade *= mix(1.0, sampleFade, noise * (1.0 - cloud));
|
||||
noise *= step(xzNormalizedDistance, fadeEnd);
|
||||
|
||||
cloudLighting = mix(cloudLighting, sampleLighting, noise * (1.0 - cloud * cloud));
|
||||
|
||||
if (z < 1.0) {
|
||||
noise *= InvLerp(sampleTotalLength, viewLengthSoftMax, viewLengthSoftMin);
|
||||
}
|
||||
|
||||
cloud = mix(cloud, 1.0, noise);
|
||||
|
||||
if (cloudViewLength == maxcloudViewLength && cloud > 0.5) {
|
||||
cloudViewLength = sampleTotalLength;
|
||||
}
|
||||
|
||||
samplePos += sampleStep;
|
||||
sampleTotalLength += sampleLength;
|
||||
}
|
||||
|
||||
cloudFaded = cloud * fade;
|
||||
|
||||
cloudLighting = mix(cloudLighting, 1.0, (1.0 - cloud * cloud) * scattering * 0.5);
|
||||
cloudLighting *= (1.0 - 0.9 * rainStrength);
|
||||
|
||||
vec3 cloudColor = mix(
|
||||
ambientCol * (0.3 * sunVisibility + 0.5),
|
||||
lightCol * (0.85 + 1.15 * scattering),
|
||||
cloudLighting
|
||||
);
|
||||
|
||||
cloudColor *= 1.0 - 0.4 * rainStrength;
|
||||
cloudColor *= CLOUD_BRIGHTNESS * (0.5 - 0.25 * (1.0 - sunVisibility) * (1.0 - rainStrength));
|
||||
|
||||
cloudFaded *= cloudFaded * CLOUD_OPACITY;
|
||||
|
||||
if (cloudFaded < dither) {
|
||||
cloudViewLength = maxcloudViewLength;
|
||||
}
|
||||
|
||||
return vec4(cloudColor, cloudFaded);
|
||||
}
|
||||
|
||||
float GetNoise(vec2 pos) {
|
||||
return fract(sin(dot(pos, vec2(12.9898, 4.1414))) * 43758.5453);
|
||||
}
|
||||
|
||||
void DrawStars(inout vec3 color, vec3 viewPos) {
|
||||
vec3 wpos = vec3(gbufferModelViewInverse * vec4(viewPos * 100.0, 1.0));
|
||||
vec3 planeCoord = wpos / (wpos.y + length(wpos.xz));
|
||||
vec2 wind = vec2(frametime, 0.0);
|
||||
vec2 coord = planeCoord.xz * 0.4 + cameraPosition.xz * 0.0001 + wind * 0.00125;
|
||||
coord = floor(coord * 1024.0) / 1024.0;
|
||||
|
||||
float VoU = clamp(dot(normalize(viewPos), upVec), 0.0, 1.0);
|
||||
float VoL = dot(normalize(viewPos), sunVec);
|
||||
float multiplier = sqrt(sqrt(VoU)) * 5.0 * (1.0 - rainStrength) * moonVisibility;
|
||||
|
||||
float star = 1.0;
|
||||
if (VoU > 0.0) {
|
||||
star *= GetNoise(coord.xy);
|
||||
star *= GetNoise(coord.xy + 0.10);
|
||||
star *= GetNoise(coord.xy + 0.23);
|
||||
}
|
||||
star = clamp(star - 0.8125, 0.0, 1.0) * multiplier;
|
||||
//star *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
star *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
star *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef UNDERGROUND_SKY
|
||||
star *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS);
|
||||
#endif
|
||||
|
||||
float moonFade = smoothstep(-0.997,-0.992, VoL);
|
||||
star *= moonFade;
|
||||
|
||||
color += star * pow(lightNight, vec3(0.8));
|
||||
}
|
||||
|
||||
#ifdef AURORA
|
||||
#include "/lib/color/auroraColor.glsl"
|
||||
|
||||
float AuroraSample(vec2 coord, vec2 wind, float VoU) {
|
||||
float noise = texture2D(noisetex, coord * 0.0625 + wind * 0.25).b * 3.0;
|
||||
noise+= texture2D(noisetex, coord * 0.03125 + wind * 0.15).b * 3.0;
|
||||
|
||||
noise = max(1.0 - 4.0 * (0.5 * VoU + 0.5) * abs(noise - 3.0), 0.0);
|
||||
|
||||
return noise;
|
||||
}
|
||||
|
||||
vec3 DrawAurora(vec3 viewPos, float dither, int samples) {
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float sampleStep = 1.0 / samples;
|
||||
float currentStep = dither * sampleStep;
|
||||
|
||||
float VoU = dot(normalize(viewPos), upVec);
|
||||
|
||||
float visibility = moonVisibility * (1.0 - rainStrength) * (1.0 - rainStrength);
|
||||
|
||||
#ifdef WEATHER_PERBIOME
|
||||
visibility *= isCold * isCold;
|
||||
#endif
|
||||
|
||||
vec2 wind = vec2(
|
||||
frametime * CLOUD_SPEED * 0.000125,
|
||||
sin(frametime * CLOUD_SPEED * 0.05) * 0.00025
|
||||
);
|
||||
|
||||
vec3 aurora = vec3(0.0);
|
||||
|
||||
if (VoU > 0.0 && visibility > 0.0) {
|
||||
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz);
|
||||
for(int i = 0; i < samples; i++) {
|
||||
vec3 planeCoord = wpos * ((8.0 + currentStep * 7.0) / wpos.y) * 0.004;
|
||||
|
||||
vec2 coord = cameraPosition.xz * 0.00004 + planeCoord.xz;
|
||||
coord += vec2(coord.y, -coord.x) * 0.3;
|
||||
|
||||
float noise = AuroraSample(coord, wind, VoU);
|
||||
|
||||
if (noise > 0.0) {
|
||||
noise *= texture2D(noisetex, coord * 0.125 + wind * 0.25).b;
|
||||
noise *= 0.5 * texture2D(noisetex, coord + wind * 16.0).b + 0.75;
|
||||
noise = noise * noise * 3.0 * sampleStep;
|
||||
noise *= max(sqrt(1.0 - length(planeCoord.xz) * 3.75), 0.0);
|
||||
|
||||
vec3 auroraColor = mix(auroraLowCol, auroraHighCol, pow(currentStep, 0.4));
|
||||
aurora += noise * auroraColor * exp2(-6.0 * i * sampleStep);
|
||||
}
|
||||
currentStep += sampleStep;
|
||||
}
|
||||
}
|
||||
// visibility *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
visibility *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
visibility *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef UNDERGROUND_SKY
|
||||
visibility *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS);
|
||||
#endif
|
||||
|
||||
return aurora * visibility;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,190 @@
|
||||
#ifdef OVERWORLD
|
||||
vec3 GetFogColor(vec3 viewPos) {
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
float lViewPos = length(viewPos) / 64.0;
|
||||
lViewPos = 1.0 - exp(-lViewPos * lViewPos);
|
||||
|
||||
float VoU = clamp(dot(nViewPos, upVec), -1.0, 1.0);
|
||||
float VoL = clamp(dot(nViewPos, sunVec), -1.0, 1.0);
|
||||
|
||||
float density = 0.4;
|
||||
float nightDensity = 1.0;
|
||||
float weatherDensity = 1.5;
|
||||
float groundDensity = 0.08 * (4.0 - 3.0 * sunVisibility) *
|
||||
(10.0 * rainStrength * rainStrength + 1.0);
|
||||
|
||||
float exposure = exp2(timeBrightness * 0.75 - 0.75);
|
||||
float nightExposure = exp2(-3.5);
|
||||
|
||||
float baseGradient = exp(-(VoU * 0.5 + 0.5) * 0.5 / density);
|
||||
|
||||
float groundVoU = clamp(-VoU * 0.5 + 0.5, 0.0, 1.0);
|
||||
float ground = 1.0 - exp(-groundDensity / groundVoU);
|
||||
|
||||
vec3 fog = fogCol * baseGradient / (SKY_I * SKY_I);
|
||||
fog = fog / sqrt(fog * fog + 1.0) * exposure * sunVisibility * (SKY_I * SKY_I);
|
||||
|
||||
float sunMix = (VoL * 0.5 + 0.5) * pow(clamp(1.0 - VoU, 0.0, 1.0), 2.0 - sunVisibility) *
|
||||
pow(1.0 - timeBrightness * 0.6, 3.0);
|
||||
float horizonMix = pow(1.0 - abs(VoU), 2.5) * 0.125;
|
||||
float lightMix = (1.0 - (1.0 - sunMix) * (1.0 - horizonMix)) * lViewPos;
|
||||
|
||||
vec3 lightFog = pow(lightSun, vec3(4.0 - sunVisibility)) * baseGradient;
|
||||
lightFog = lightFog / (1.0 + lightFog * rainStrength);
|
||||
|
||||
fog = mix(
|
||||
sqrt(fog * (1.0 - lightMix)),
|
||||
sqrt(lightFog),
|
||||
lightMix
|
||||
);
|
||||
fog *= fog;
|
||||
|
||||
float nightGradient = exp(-(VoU * 0.5 + 0.5) * 0.35 / nightDensity);
|
||||
vec3 nightFog = lightNight * lightNight * nightGradient * nightExposure;
|
||||
fog = mix(nightFog, fog, sunVisibility * sunVisibility);
|
||||
|
||||
float rainGradient = exp(-(VoU * 0.5 + 0.5) * 0.125 / weatherDensity);
|
||||
vec3 weatherFog = weatherCol.rgb * weatherCol.rgb;
|
||||
weatherFog *= GetLuminance(ambientCol / (weatherFog)) * (0.2 * sunVisibility + 0.2);
|
||||
fog = mix(fog, weatherFog * rainGradient, rainStrength);
|
||||
fog = mix(minLightCol * 0.5, fog * eBS, eBS);
|
||||
|
||||
//fog *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
fog *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
fog *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
return fog;
|
||||
}
|
||||
#endif
|
||||
|
||||
void NormalFog(inout vec3 color, vec3 viewPos) {
|
||||
float viewLength = length(viewPos);
|
||||
|
||||
vec4 worldPos = gbufferModelViewInverse * vec4(viewPos, 1.0);
|
||||
worldPos.xyz /= worldPos.w;
|
||||
|
||||
#if FAR_VANILLA_FOG > 0
|
||||
#if FAR_VANILLA_FOG_STYLE == 0
|
||||
float fogFactor = viewLength;
|
||||
#else
|
||||
float fogFactor = length(worldPos.xz);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef OVERWORLD
|
||||
float fog = viewLength * fogDensity / 1024.0;
|
||||
float clearDay = sunVisibility * (1.0 - rainStrength);
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
fog *= FOG_DENSITY_DH;
|
||||
#endif
|
||||
|
||||
fog *= mix(FOG_DENSITY_INDOOR, mix(1.0, FOG_DENSITY_WEATHER, rainStrength) / mix(1.0 / FOG_DENSITY_NIGHT, 1.0, clearDay) * eBS, eBS);
|
||||
fog = min(fog, (fog - 0.8) * 0.25 + 0.8);
|
||||
|
||||
#ifdef FOG_HEIGHT
|
||||
fog *= exp2(-max(worldPos.y + cameraPosition.y - FOG_HEIGHT_Y, 0.0) / exp2(FOG_HEIGHT_FALLOFF));
|
||||
#endif
|
||||
|
||||
fog = 1.0 - exp(-2.0 * pow(fog, 0.35 * clearDay * eBS + 1.25));
|
||||
|
||||
vec3 fogColor = GetFogColor(viewPos);
|
||||
|
||||
#if FAR_VANILLA_FOG == 1 || FAR_VANILLA_FOG == 3
|
||||
if(isEyeInWater == 0.0){
|
||||
#if MC_VERSION >= 11800
|
||||
float fogOffset = 0.0;
|
||||
#else
|
||||
float fogOffset = 12.0;
|
||||
#endif
|
||||
|
||||
float fogFar = far;
|
||||
float vanillaDensity = 0.2;
|
||||
#ifdef DISTANT_HORIZONS
|
||||
fogFar = dhFarPlane * 0.5;
|
||||
vanillaDensity = 0.4;
|
||||
#endif
|
||||
|
||||
float vanillaFog = 1.0 - (fogFar - (fogFactor + fogOffset)) / (vanillaDensity * fogFar * FOG_DENSITY_VANILLA);
|
||||
vanillaFog = clamp(vanillaFog, 0.0, 1.0);
|
||||
|
||||
if(vanillaFog > 0.0){
|
||||
vec3 vanillaFogColor = GetSkyColor(viewPos, false);
|
||||
|
||||
vanillaFogColor *= 1.0 + nightVision;
|
||||
#ifdef CLASSIC_EXPOSURE
|
||||
vanillaFogColor *= 4.0 - 3.0 * eBS;
|
||||
#endif
|
||||
|
||||
fogColor *= fog;
|
||||
|
||||
fog = mix(fog, 1.0, vanillaFog);
|
||||
if(fog > 0.0) fogColor = mix(fogColor, vanillaFogColor, vanillaFog) / fog;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NETHER
|
||||
float fog = 2.0 * pow(viewLength * fogDensity / 256.0, 1.5);
|
||||
|
||||
#if FAR_VANILLA_FOG == 2 || FAR_VANILLA_FOG == 3
|
||||
#ifndef DISTANT_HORIZONS
|
||||
fog += 6.0 * pow(fogFactor * 1.5 / far, 4.0);
|
||||
#else
|
||||
fog += 6.0 * pow(fogFactor * 3.0 / dhFarPlane, 4.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
fog = 1.0 - exp(-fog);
|
||||
|
||||
vec3 fogColor = netherCol.rgb * 0.0425;
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
float fog = viewLength * fogDensity / 512.0;
|
||||
|
||||
#if FAR_VANILLA_FOG == 2 || FAR_VANILLA_FOG == 3
|
||||
#ifndef DISTANT_HORIZONS
|
||||
fog += 2.0 * pow(fogFactor * 1.5 / far, 4.0);
|
||||
#else
|
||||
fog += 2.0 * pow(fogFactor * 3.0 / dhFarPlane, 4.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
fog = 1.0 - exp(-fog);
|
||||
|
||||
vec3 fogColor = endCol.rgb * 0.003;
|
||||
#ifndef LIGHT_SHAFT
|
||||
fogColor *= 4.0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
color = mix(color, fogColor, fog);
|
||||
}
|
||||
|
||||
void BlindFog(inout vec3 color, vec3 viewPos) {
|
||||
float fog = length(viewPos) * max(blindFactor * 0.2, darknessFactor * 0.075);
|
||||
fog = (1.0 - exp(-6.0 * fog * fog * fog)) * max(blindFactor, darknessFactor);
|
||||
color = mix(color, vec3(0.0), fog);
|
||||
}
|
||||
|
||||
vec3 denseFogColor[2] = vec3[2](
|
||||
vec3(1.0, 0.3, 0.01),
|
||||
vec3(0.1, 0.16, 0.2)
|
||||
);
|
||||
|
||||
void DenseFog(inout vec3 color, vec3 viewPos) {
|
||||
float fog = length(viewPos) * 0.5;
|
||||
fog = (1.0 - exp(-4.0 * fog * fog * fog));
|
||||
color = mix(color, denseFogColor[isEyeInWater - 2], fog);
|
||||
}
|
||||
|
||||
void Fog(inout vec3 color, vec3 viewPos) {
|
||||
NormalFog(color, viewPos);
|
||||
if (isEyeInWater > 1) DenseFog(color, viewPos);
|
||||
if (blindFactor > 0.0 || darknessFactor > 0.0) BlindFog(color, viewPos);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#ifdef OVERWORLD
|
||||
vec3 GetSkyColor(vec3 viewPos, bool isReflection) {
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
|
||||
float VoU = clamp(dot(nViewPos, upVec), -1.0, 1.0);
|
||||
float VoL = clamp(dot(nViewPos, sunVec), -1.0, 1.0);
|
||||
|
||||
float groundDensity = 0.1 * (4.0 - 3.0 * sunVisibility) *
|
||||
(10.0 * rainStrength * rainStrength + 1.0);
|
||||
|
||||
float exposure = exp2(timeBrightness * 0.75 - 0.75 + SKY_EXPOSURE_D);
|
||||
float nightExposure = exp2(-3.5 + SKY_EXPOSURE_N);
|
||||
float weatherExposure = exp2(SKY_EXPOSURE_W);
|
||||
|
||||
float gradientCurve = mix(SKY_HORIZON_F, SKY_HORIZON_N, VoL);
|
||||
float baseGradient = exp(-(1.0 - pow(1.0 - max(VoU, 0.0), gradientCurve)) /
|
||||
SKY_DENSITY_D);
|
||||
|
||||
#if SKY_GROUND > 0
|
||||
float groundVoU = clamp(-VoU * 1.015 - 0.015, 0.0, 1.0);
|
||||
float ground = 1.0 - exp(-groundDensity * max(fogDensity, 0.125) / groundVoU);
|
||||
#if SKY_GROUND == 1
|
||||
if (!isReflection) ground = 1.0;
|
||||
#endif
|
||||
#else
|
||||
float ground = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 sky = skyCol;
|
||||
#ifdef SKY_VANILLA
|
||||
sky = mix(sky, fogCol, pow(1.0 - max(VoU, 0.0), 4.0));
|
||||
#endif
|
||||
sky *= baseGradient / (SKY_I * SKY_I);
|
||||
sky = sky / sqrt(sky * sky + 1.0) * exposure * sunVisibility * (SKY_I * SKY_I);
|
||||
|
||||
float sunMix = (VoL * 0.5 + 0.5) * pow(clamp(1.0 - VoU, 0.0, 1.0), 2.0 - sunVisibility) *
|
||||
pow(1.0 - timeBrightness * 0.6, 3.0);
|
||||
float horizonMix = pow(1.0 - abs(VoU), 2.5) * 0.125;
|
||||
float lightMix = (1.0 - (1.0 - sunMix) * (1.0 - horizonMix));
|
||||
|
||||
vec3 lightSky = pow(lightSun, vec3(4.0 - sunVisibility)) * baseGradient;
|
||||
lightSky = lightSky / (1.0 + lightSky * rainStrength);
|
||||
|
||||
sky = mix(
|
||||
sqrt(sky * (1.0 - lightMix)),
|
||||
sqrt(lightSky),
|
||||
lightMix
|
||||
);
|
||||
sky *= sky;
|
||||
|
||||
float nightGradient = exp(-max(VoU, 0.0) / SKY_DENSITY_N);
|
||||
vec3 nightSky = lightNight * lightNight * nightGradient * nightExposure;
|
||||
sky = mix(nightSky, sky, sunVisibility * sunVisibility);
|
||||
|
||||
float rainGradient = exp(-max(VoU, 0.0) / SKY_DENSITY_W);
|
||||
vec3 weatherSky = weatherCol.rgb * weatherCol.rgb * weatherExposure;
|
||||
weatherSky *= GetLuminance(ambientCol / (weatherSky)) * (0.2 * sunVisibility + 0.2);
|
||||
sky = mix(sky, weatherSky * rainGradient, rainStrength);
|
||||
|
||||
sky *= ground;
|
||||
|
||||
#ifdef UNDERGROUND_SKY
|
||||
float ug = mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS);
|
||||
sky = mix(minLightCol * 0.125, sky, ug);
|
||||
#endif
|
||||
|
||||
// sky *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
sky *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
sky *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
return sky;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,85 @@
|
||||
void RoundSunMoon(inout vec3 color, vec3 viewPos, vec3 sunColor, vec3 moonColor) {
|
||||
vec3 nViewPos = normalize(viewPos);
|
||||
|
||||
float VoL = dot(nViewPos, sunVec);
|
||||
float VoU = dot(nViewPos, upVec);
|
||||
|
||||
if (VoU < -0.1) {
|
||||
return;
|
||||
}
|
||||
|
||||
float isMoon = float(VoL < 0.0);
|
||||
|
||||
float sunMoonSize = (0.007 - 0.004 * isMoon) * ROUND_SUN_MOON_SIZE;
|
||||
|
||||
float sun = pow(smoothstep(1.0 - sunMoonSize, 1.0, abs(VoL)), 3.0);
|
||||
float miniGlare = pow(abs(VoL), 192.0 + 64.0 * isMoon) * (0.05 - 0.04 * isMoon);
|
||||
|
||||
float sunFade = smoothstep(0.0, 1.0, 1.0 - pow(1.0 - max(VoU * 0.98 + 0.02, 0.0), 8.0));
|
||||
float glareFade = smoothstep(0.0, 1.0, 1.0 - pow(1.0 - max(VoU * 0.93 + 0.07, 0.0), 8.0));
|
||||
float rainVisibility = 1.0 - sqrt(rainStrength);
|
||||
|
||||
vec3 moonNormal = vec3(0.0);
|
||||
|
||||
if (sun > 0.0 && isMoon > 0.5 && moonPhase > 0) {
|
||||
const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994));
|
||||
float ang = fract(timeAngle + 0.0001 - 0.25);
|
||||
ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959;
|
||||
|
||||
vec3 nextSunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz);
|
||||
vec3 sunTangent = normalize(nextSunVec - sunVec);
|
||||
vec3 sunBinormal = -cross(sunVec, sunTangent);
|
||||
|
||||
float VoLt = dot(nViewPos, sunTangent);
|
||||
float VoLb = dot(nViewPos, sunBinormal);
|
||||
|
||||
float rad = 0.08 * sqrt(ROUND_SUN_MOON_SIZE);
|
||||
|
||||
float moonNormalX = clamp(VoLt / rad, -1.0, 1.0);
|
||||
float moonNormalY = clamp(VoLb / rad, -1.0, 1.0);
|
||||
float moonNormalZ = sqrt(1.0 - moonNormalX * moonNormalX - moonNormalY * moonNormalY);
|
||||
moonNormal = vec3(moonNormalX, moonNormalY, moonNormalZ);
|
||||
if (sun > 0.0 && (moonNormalX * moonNormalX + moonNormalY * moonNormalY) > 1) color.r += 8.0;
|
||||
|
||||
vec3 moonPhaseVec = moonPhaseVecs[moonPhase];
|
||||
float moonPhase = smoothstep(moonDiffuse[moonPhase].x, moonDiffuse[moonPhase].y, dot(moonNormal, moonPhaseVec));
|
||||
float glaremoonPhase = (1.0 - moonPhase) * pow(sun,0.25);
|
||||
sun *= moonPhase;
|
||||
miniGlare *= 1.0 - glaremoonPhase;
|
||||
}
|
||||
|
||||
sun *= sunFade * rainVisibility;
|
||||
miniGlare *= glareFade * rainVisibility;
|
||||
|
||||
float sunColorPower = pow(1.0 - max(VoU, 0.0), 16.0) * 4.0 * sunVisibility + 1.0;
|
||||
|
||||
vec3 sunCol = pow(sunColor, vec3(sunColorPower)) * sunVisibility * SUN_INTENSITY * SUN_INTENSITY;
|
||||
vec3 moonCol = moonColor * moonVisibility * MOON_INTENSITY * MOON_INTENSITY;
|
||||
vec3 sunMoonCol = mix(sunCol, moonCol, isMoon);
|
||||
|
||||
color += (sun + miniGlare) * sunMoonCol * 4.0;
|
||||
}
|
||||
|
||||
void SunGlare(inout vec3 color, vec3 viewPos, vec3 lightCol) {
|
||||
float VoL = dot(normalize(viewPos), lightVec);
|
||||
float visfactor = 0.05 * (-0.8 * timeBrightness + 1.0) * (3.0 * rainStrength + 1.0);
|
||||
float invvisfactor = 1.0 - visfactor;
|
||||
|
||||
float visibility = clamp(VoL * 0.5 + 0.5, 0.0, 1.0);
|
||||
visibility = visfactor / (1.0 - invvisfactor * visibility) - visfactor;
|
||||
visibility = clamp(visibility * 1.015 / invvisfactor - 0.015, 0.0, 1.0);
|
||||
visibility = mix(1.0, visibility, 0.03125 * eBS + 0.96875) * (1.0 - rainStrength * eBS * 0.875);
|
||||
visibility *= shadowFade * LIGHT_SHAFT_STRENGTH;
|
||||
//visibility *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
visibility *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
visibility *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef LIGHT_SHAFT
|
||||
if (isEyeInWater == 1) color += 0.25 * lightCol * visibility;
|
||||
#else
|
||||
color += 0.25 * lightCol * visibility * (1.0 + 0.25 * isEyeInWater);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
float GetLogarithmicDepth(float dist) {
|
||||
return (far * (dist - near)) / (dist * (far - near));
|
||||
}
|
||||
|
||||
float GetLinearDepth2(float depth) {
|
||||
return 2.0 * near * far / (far + near - (2.0 * depth - 1.0) * (far - near));
|
||||
}
|
||||
|
||||
vec4 DistortShadow(vec4 shadowpos, float distortFactor) {
|
||||
shadowpos.xy *= 1.0 / distortFactor;
|
||||
shadowpos.z = shadowpos.z * 0.2;
|
||||
shadowpos = shadowpos * 0.5 + 0.5;
|
||||
|
||||
return shadowpos;
|
||||
}
|
||||
|
||||
vec4 GetWorldSpace(float shadowdepth, vec2 texCoord) {
|
||||
vec4 viewPos = gbufferProjectionInverse * (vec4(texCoord, shadowdepth, 1.0) * 2.0 - 1.0);
|
||||
viewPos /= viewPos.w;
|
||||
|
||||
vec4 wpos = gbufferModelViewInverse * viewPos;
|
||||
wpos /= wpos.w;
|
||||
|
||||
return wpos;
|
||||
}
|
||||
|
||||
vec4 GetShadowSpace(vec4 wpos) {
|
||||
wpos = shadowModelView * wpos;
|
||||
wpos = shadowProjection * wpos;
|
||||
wpos /= wpos.w;
|
||||
|
||||
float distb = sqrt(wpos.x * wpos.x + wpos.y * wpos.y);
|
||||
float distortFactor = 1.0 - shadowMapBias + distb * shadowMapBias;
|
||||
wpos = DistortShadow(wpos,distortFactor);
|
||||
|
||||
return wpos;
|
||||
}
|
||||
|
||||
//Light shafts from Robobo1221 (modified)
|
||||
vec3 GetLightShafts(float pixeldepth0, float pixeldepth1, vec3 color, float dither) {
|
||||
vec3 vl = vec3(0.0);
|
||||
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 screenPos = vec3(texCoord, pixeldepth0);
|
||||
vec4 viewPos = gbufferProjectionInverse * (vec4(screenPos, 1.0) * 2.0 - 1.0);
|
||||
viewPos /= viewPos.w;
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
float VoL = dot(normalize(viewPos.xyz), lightVec);
|
||||
|
||||
#ifdef OVERWORLD
|
||||
float visfactor = 0.05 * (-0.8 * timeBrightness + 1.0) * (3.0 * rainStrength + 1.0);
|
||||
float invvisfactor = 1.0 - visfactor;
|
||||
|
||||
float visibility = clamp(VoL * 0.5 + 0.5, 0.0, 1.0);
|
||||
visibility = visfactor / (1.0 - invvisfactor * visibility) - visfactor;
|
||||
visibility = clamp(visibility * 1.015 / invvisfactor - 0.015, 0.0, 1.0);
|
||||
visibility = mix(1.0, visibility, 0.03125 * eBS + 0.96875);
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
VoL = pow(VoL * 0.5 + 0.5, 16.0) * 0.75 + 0.25;
|
||||
float visibility = VoL;
|
||||
#endif
|
||||
|
||||
visibility *= 0.14285 * float(pixeldepth0 > 0.56);
|
||||
|
||||
if (visibility > 0.0) {
|
||||
float maxDist = 128.0;
|
||||
|
||||
float depth0 = GetLinearDepth2(pixeldepth0);
|
||||
float depth1 = GetLinearDepth2(pixeldepth1);
|
||||
vec4 worldposition = vec4(0.0);
|
||||
vec4 shadowposition = vec4(0.0);
|
||||
|
||||
vec3 watercol = mix(vec3(1.0),
|
||||
waterColor.rgb / (waterColor.a * waterColor.a),
|
||||
pow(waterAlpha, 0.25));
|
||||
|
||||
for(int i = 0; i < 7; i++) {
|
||||
float minDist = exp2(i + dither) - 0.95;
|
||||
if (minDist >= maxDist) break;
|
||||
|
||||
if (depth1 < minDist || (depth0 < minDist && color == vec3(0.0))) {
|
||||
break;
|
||||
}
|
||||
|
||||
worldposition = GetWorldSpace(GetLogarithmicDepth(minDist), texCoord.st);
|
||||
shadowposition = GetShadowSpace(worldposition);
|
||||
shadowposition.z += 0.0512 / shadowMapResolution;
|
||||
|
||||
if (length(shadowposition.xy * 2.0 - 1.0) < 1.0) {
|
||||
float shadow0 = shadow2D(shadowtex0, shadowposition.xyz).z;
|
||||
|
||||
vec3 shadowCol = vec3(0.0);
|
||||
#ifdef SHADOW_COLOR
|
||||
if (shadow0 < 1.0) {
|
||||
float shadow1 = shadow2D(shadowtex1, shadowposition.xyz).z;
|
||||
if (shadow1 > 0.0) {
|
||||
shadowCol = texture2D(shadowcolor0, shadowposition.xy).rgb;
|
||||
shadowCol *= shadowCol * shadow1;
|
||||
#ifdef WATER_CAUSTICS
|
||||
shadowCol *= 16.0 - 15.0 * (1.0 - (1.0 - shadow0) * (1.0 - shadow0));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
shadow0 *= shadow0;
|
||||
shadowCol *= shadowCol;
|
||||
|
||||
vec3 shadow = clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(16.0));
|
||||
|
||||
if (depth0 < minDist) shadow *= color;
|
||||
else if (isEyeInWater == 1.0) {
|
||||
#ifdef WATER_SHADOW_COLOR
|
||||
shadow *= 0.125 * (1.0 + eBS);
|
||||
#else
|
||||
shadow *= watercol * 0.01 * (1.0 + eBS);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef END
|
||||
vec3 npos = worldposition.xyz + cameraPosition.xyz + vec3(frametime * 4.0, 0, 0);
|
||||
float n3da = texture2D(noisetex, npos.xz / 512.0 + floor(npos.y / 3.0) * 0.35).r;
|
||||
float n3db = texture2D(noisetex, npos.xz / 512.0 + floor(npos.y / 3.0 + 1.0) * 0.35).r;
|
||||
float noise = mix(n3da, n3db, fract(npos.y / 3.0));
|
||||
noise = sin(noise * 28.0 + frametime * 4.0) * 0.25 + 0.5;
|
||||
shadow *= noise;
|
||||
#endif
|
||||
|
||||
vl += shadow;
|
||||
}
|
||||
else{
|
||||
vl += 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
//vl *= voidFade;
|
||||
#if MC_VERSION >= 11800
|
||||
vl *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0);
|
||||
#else
|
||||
vl *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef UNDERGROUND_SKY
|
||||
vl *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS);
|
||||
#endif
|
||||
|
||||
vl = sqrt(vl * visibility);
|
||||
if(dot(vl, vl) > 0.0) vl += (dither - 0.25) / 128.0;
|
||||
}
|
||||
|
||||
return vl;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#if (WATER_MODE == 1 || WATER_MODE == 3) && !defined SKY_VANILLA && (!defined NETHER || !defined NETHER_VANILLA)
|
||||
uniform vec3 fogColor;
|
||||
#endif
|
||||
|
||||
vec4 GetWaterFog(vec3 viewPos) {
|
||||
float fog = length(viewPos) / waterFogRange;
|
||||
fog = 1.0 - exp(-2.0 * fog);
|
||||
|
||||
#if WATER_MODE == 0 || WATER_MODE == 2
|
||||
vec3 waterFogColor = waterColor.rgb * waterColor.a;
|
||||
#elif WATER_MODE == 1 || WATER_MODE == 3
|
||||
vec3 waterFogColor = fogColor * fogColor * 0.125;
|
||||
#endif
|
||||
waterFogColor *= WATER_F * WATER_F * (1.0 - max(blindFactor, darknessFactor));
|
||||
|
||||
#ifdef OVERWORLD
|
||||
vec3 waterFogTint = lightCol * eBS * shadowFade * 0.9 + 0.1;
|
||||
#endif
|
||||
#ifdef NETHER
|
||||
vec3 waterFogTint = netherCol.rgb;
|
||||
#endif
|
||||
#ifdef END
|
||||
vec3 waterFogTint = endCol.rgb;
|
||||
#endif
|
||||
waterFogTint = sqrt(waterFogTint * length(waterFogTint));
|
||||
|
||||
return vec4(waterFogColor * waterFogTint, fog);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#if defined WEATHER_PERBIOME && defined OVERWORLD
|
||||
float fogDensity = FOG_DENSITY * mix(
|
||||
1.0,
|
||||
(
|
||||
FOG_DENSITY_COLD * isCold +
|
||||
FOG_DENSITY_DRY * (isDesert + isMesa + isSavanna) +
|
||||
FOG_DENSITY_DAMP * (isSwamp + isMushroom + isJungle)
|
||||
) / max(weatherWeight, 0.0001),
|
||||
weatherWeight
|
||||
);
|
||||
|
||||
#else
|
||||
float fogDensity = FOG_DENSITY;
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
vec3 auroraLowColSqrt = vec3(AURORA_LR, AURORA_LG, AURORA_LB) * AURORA_LI / 255.0;
|
||||
vec3 auroraLowCol = auroraLowColSqrt * auroraLowColSqrt;
|
||||
vec3 auroraHighColSqrt = vec3(AURORA_HR, AURORA_HG, AURORA_HB) * AURORA_HI / 255.0;
|
||||
vec3 auroraHighCol = auroraHighColSqrt * auroraHighColSqrt;
|
||||
@@ -0,0 +1,2 @@
|
||||
vec3 blocklightColSqrt = vec3(BLOCKLIGHT_R, BLOCKLIGHT_G, BLOCKLIGHT_B) * BLOCKLIGHT_I / 255.0;
|
||||
vec3 blocklightCol = blocklightColSqrt * blocklightColSqrt;
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifdef OVERWORLD
|
||||
#include "lightColor.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef NETHER
|
||||
#include "netherColor.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
#include "endColor.glsl"
|
||||
#endif
|
||||
|
||||
vec3 minLightColSqrt = vec3(MINLIGHT_R, MINLIGHT_G, MINLIGHT_B) * MINLIGHT_I / 255.0;
|
||||
vec3 minLightCol = minLightColSqrt * minLightColSqrt * 0.04;
|
||||
@@ -0,0 +1,2 @@
|
||||
vec4 endColSqrt = vec4(vec3(END_R, END_G, END_B) / 255.0, 1.0) * END_I;
|
||||
vec4 endCol = endColSqrt * endColSqrt;
|
||||
@@ -0,0 +1,69 @@
|
||||
vec3 lightMorning = vec3(LIGHT_MR, LIGHT_MG, LIGHT_MB) * LIGHT_MI / 255.0;
|
||||
vec3 lightDay = vec3(LIGHT_DR, LIGHT_DG, LIGHT_DB) * LIGHT_DI / 255.0;
|
||||
vec3 lightEvening = vec3(LIGHT_ER, LIGHT_EG, LIGHT_EB) * LIGHT_EI / 255.0;
|
||||
vec3 lightNight = vec3(LIGHT_NR, LIGHT_NG, LIGHT_NB) * LIGHT_NI * 0.3 / 255.0;
|
||||
|
||||
vec3 ambientMorning = vec3(AMBIENT_MR, AMBIENT_MG, AMBIENT_MB) * AMBIENT_MI / 255.0;
|
||||
vec3 ambientDay = vec3(AMBIENT_DR, AMBIENT_DG, AMBIENT_DB) * AMBIENT_DI / 255.0;
|
||||
vec3 ambientEvening = vec3(AMBIENT_ER, AMBIENT_EG, AMBIENT_EB) * AMBIENT_EI / 255.0;
|
||||
vec3 ambientNight = vec3(AMBIENT_NR, AMBIENT_NG, AMBIENT_NB) * AMBIENT_NI * 0.3 / 255.0;
|
||||
|
||||
#ifdef WEATHER_PERBIOME
|
||||
uniform float isDesert, isMesa, isCold, isSwamp, isMushroom, isSavanna, isJungle;
|
||||
|
||||
vec4 weatherRain = vec4(vec3(WEATHER_RR, WEATHER_RG, WEATHER_RB) / 255.0, 1.0) * WEATHER_RI;
|
||||
vec4 weatherCold = vec4(vec3(WEATHER_CR, WEATHER_CG, WEATHER_CB) / 255.0, 1.0) * WEATHER_CI;
|
||||
vec4 weatherDesert = vec4(vec3(WEATHER_DR, WEATHER_DG, WEATHER_DB) / 255.0, 1.0) * WEATHER_DI;
|
||||
vec4 weatherBadlands = vec4(vec3(WEATHER_BR, WEATHER_BG, WEATHER_BB) / 255.0, 1.0) * WEATHER_BI;
|
||||
vec4 weatherSwamp = vec4(vec3(WEATHER_SR, WEATHER_SG, WEATHER_SB) / 255.0, 1.0) * WEATHER_SI;
|
||||
vec4 weatherMushroom = vec4(vec3(WEATHER_MR, WEATHER_MG, WEATHER_MB) / 255.0, 1.0) * WEATHER_MI;
|
||||
vec4 weatherSavanna = vec4(vec3(WEATHER_VR, WEATHER_VG, WEATHER_VB) / 255.0, 1.0) * WEATHER_VI;
|
||||
vec4 weatherJungle = vec4(vec3(WEATHER_JR, WEATHER_JG, WEATHER_JB) / 255.0, 1.0) * WEATHER_JI;
|
||||
|
||||
float weatherWeight = isCold + isDesert + isMesa + isSwamp + isMushroom + isSavanna + isJungle;
|
||||
|
||||
vec4 weatherCol = mix(
|
||||
weatherRain,
|
||||
(
|
||||
weatherCold * isCold + weatherDesert * isDesert + weatherBadlands * isMesa +
|
||||
weatherSwamp * isSwamp + weatherMushroom * isMushroom + weatherSavanna * isSavanna +
|
||||
weatherJungle * isJungle
|
||||
) / max(weatherWeight, 0.0001),
|
||||
weatherWeight
|
||||
);
|
||||
|
||||
#else
|
||||
vec4 weatherCol = vec4(vec3(WEATHER_RR, WEATHER_RG, WEATHER_RB) / 255.0, 1.0) * WEATHER_RI;
|
||||
#endif
|
||||
|
||||
float mefade = 1.0 - clamp(abs(timeAngle - 0.5) * 8.0 - 1.5, 0.0, 1.0);
|
||||
float dfade = 1.0 - pow(1.0 - timeBrightness, 1.5);
|
||||
|
||||
vec3 CalcSunColor(vec3 morning, vec3 day, vec3 evening) {
|
||||
vec3 me = mix(morning, evening, mefade);
|
||||
return mix(me, day, dfade);
|
||||
}
|
||||
|
||||
vec3 CalcLightColor(vec3 sun, vec3 night, vec3 weatherCol) {
|
||||
vec3 c = mix(night, sun, sunVisibility);
|
||||
c = mix(c, dot(c, vec3(0.299, 0.587, 0.114)) * weatherCol, rainStrength);
|
||||
return c * c;
|
||||
}
|
||||
|
||||
vec3 lightSun = mix(mix(lightMorning, lightEvening, mefade), lightDay, dfade);
|
||||
|
||||
vec3 ambientSun = mix(mix(ambientMorning, ambientEvening, mefade), ambientDay, dfade);
|
||||
|
||||
vec3 lightColRaw = mix(lightNight, lightSun, sunVisibility);
|
||||
vec3 lightColSqrt = mix(lightColRaw, dot(lightColRaw, vec3(0.299, 0.587, 0.114)) * weatherCol.rgb, rainStrength);
|
||||
vec3 lightCol = lightColSqrt * lightColSqrt;
|
||||
|
||||
vec3 ambientColRaw = mix(ambientNight, ambientSun, sunVisibility);
|
||||
vec3 ambientColSqrt = mix(ambientColRaw, dot(ambientColRaw, vec3(0.299, 0.587, 0.114)) * weatherCol.rgb, rainStrength);
|
||||
vec3 ambientCol = ambientColSqrt * ambientColSqrt;
|
||||
|
||||
// vec3 lightSun = CalcSunColor(lightMorning, lightDay, lightEvening);
|
||||
// vec3 ambientSun = CalcSunColor(ambientMorning, ambientDay, ambientEvening);
|
||||
|
||||
// vec3 lightCol = CalcLightColor(lightSun, lightNight, weatherCol.rgb);
|
||||
// vec3 ambientCol = CalcLightColor(ambientSun, ambientNight, weatherCol.rgb);
|
||||
@@ -0,0 +1,28 @@
|
||||
vec4 netherNether = vec4(vec3(NETHER_NR, NETHER_NG, NETHER_NB) / 255.0, 1.0) * NETHER_NI;
|
||||
vec4 netherValley = vec4(vec3(NETHER_VR, NETHER_VG, NETHER_VB) / 255.0, 1.0) * NETHER_VI;
|
||||
vec4 netherCrimson = vec4(vec3(NETHER_CR, NETHER_CG, NETHER_CB) / 255.0, 1.0) * NETHER_CI;
|
||||
vec4 netherWarped = vec4(vec3(NETHER_WR, NETHER_WG, NETHER_WB) / 255.0, 1.0) * NETHER_WI;
|
||||
vec4 netherBasalt = vec4(vec3(NETHER_BR, NETHER_BG, NETHER_BB) / 255.0, 1.0) * NETHER_BI;
|
||||
|
||||
#ifdef NETHER_VANILLA
|
||||
uniform vec3 fogColor;
|
||||
vec4 netherColSqrt = vec4(normalize(fogColor + 0.0001), length(fogColor));
|
||||
#else
|
||||
#ifdef WEATHER_PERBIOME
|
||||
uniform float isValley, isCrimson, isWarped, isBasalt;
|
||||
float nBiomeWeight = isValley + isCrimson + isWarped + isBasalt;
|
||||
|
||||
vec4 netherColSqrt = mix(
|
||||
netherNether,
|
||||
(
|
||||
netherValley * isValley + netherCrimson * isCrimson +
|
||||
netherWarped * isWarped + netherBasalt * isBasalt
|
||||
) / max(nBiomeWeight, 0.0001),
|
||||
nBiomeWeight
|
||||
);
|
||||
#else
|
||||
vec4 netherColSqrt = netherNether;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec4 netherCol = netherColSqrt * netherColSqrt;
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifdef SKY_VANILLA
|
||||
uniform vec3 skyColor;
|
||||
uniform vec3 fogColor;
|
||||
|
||||
vec3 skyCol = pow(skyColor, vec3(2.2)) * SKY_I * SKY_I;
|
||||
#ifdef SKY_VANILLA_USE_FOG
|
||||
vec3 fogCol = pow(fogColor, vec3(2.2)) * SKY_I * SKY_I;
|
||||
#else
|
||||
vec3 fogCol = skyCol;
|
||||
#endif
|
||||
#else
|
||||
vec3 skyColSqrt = vec3(SKY_R, SKY_G, SKY_B) * SKY_I / 255.0;
|
||||
vec3 skyCol = skyColSqrt * skyColSqrt;
|
||||
vec3 fogCol = skyCol;
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
vec3 GetMetalCol(float f0) {
|
||||
int metalidx = int(f0 * 255.0);
|
||||
|
||||
if (metalidx == 230) return vec3(0.24867, 0.22965, 0.21366);
|
||||
if (metalidx == 231) return vec3(0.88140, 0.57256, 0.11450);
|
||||
if (metalidx == 232) return vec3(0.81715, 0.82021, 0.83177);
|
||||
if (metalidx == 233) return vec3(0.27446, 0.27330, 0.27357);
|
||||
if (metalidx == 234) return vec3(0.84430, 0.48677, 0.22164);
|
||||
if (metalidx == 235) return vec3(0.36501, 0.35675, 0.37653);
|
||||
if (metalidx == 236) return vec3(0.42648, 0.37772, 0.31138);
|
||||
if (metalidx == 237) return vec3(0.91830, 0.89219, 0.83662);
|
||||
return vec3(1.0);
|
||||
}
|
||||
|
||||
vec3 GetSpecularColor(float skylight, float metalness, vec3 baseReflectance){
|
||||
vec3 specularColor = vec3(0.0);
|
||||
#ifdef OVERWORLD
|
||||
vec3 lightME = mix(lightMorning, lightEvening, mefade);
|
||||
vec3 lightDaySpec = mix(sqrt(lightME), sqrt(lightDay), dfade * 0.7);
|
||||
vec3 lightNightSpec = sqrt(lightNight * LIGHT_NI * 0.2);
|
||||
specularColor = mix(lightNightSpec, lightDaySpec * lightDaySpec, sunVisibility);
|
||||
specularColor *= specularColor * skylight;
|
||||
#endif
|
||||
#ifdef END
|
||||
specularColor = endCol.rgb * 0.35;
|
||||
#endif
|
||||
|
||||
specularColor = pow(specularColor, vec3(1.0 - 0.5 * metalness)) *
|
||||
pow(max(length(specularColor), 0.0001), 0.5 * metalness);
|
||||
|
||||
return specularColor;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
vec4 waterColorSqrt = vec4(vec3(WATER_R, WATER_G, WATER_B) / 255.0, 1.0) * WATER_I;
|
||||
vec4 waterColor = waterColorSqrt * waterColorSqrt;
|
||||
|
||||
const float waterAlpha = WATER_A;
|
||||
const float waterFogRange = 64.0 / WATER_FOG_DENSITY;
|
||||
@@ -0,0 +1,95 @@
|
||||
vec2 OffsetDist(float x) {
|
||||
float n = fract(x * 8.0) * 3.1415;
|
||||
return vec2(cos(n), sin(n)) * x;
|
||||
}
|
||||
|
||||
float AmbientOcclusion(float dither) {
|
||||
float ao = 0.0;
|
||||
|
||||
float depth = texture2D(depthtex0, texCoord).r;
|
||||
if(depth >= 1.0) return 1.0;
|
||||
|
||||
float hand = float(depth < 0.56);
|
||||
depth = GetLinearDepth(depth);
|
||||
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float currentStep = 0.198 * dither + 0.01;
|
||||
|
||||
float radius = 0.5;
|
||||
float fovScale = gbufferProjection[1][1] / 1.37;
|
||||
float distScale = max((far - near) * depth + near, 5.0);
|
||||
vec2 scale = radius * vec2(1.0 / aspectRatio, 1.0) * fovScale / distScale;
|
||||
float mult = (0.7 / radius) * (far - near) * (hand > 0.5 ? 1024.0 : 1.0);
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
vec2 offset = OffsetDist(currentStep) * scale;
|
||||
float angle = 0.0, dist = 0.0;
|
||||
|
||||
for(int i = 0; i < 2; i++){
|
||||
float sampleDepth = GetLinearDepth(texture2D(depthtex0, texCoord + offset).r);
|
||||
float aoSample = (depth - sampleDepth) * mult / currentStep;
|
||||
angle += clamp(0.5 - aoSample, 0.0, 1.0);
|
||||
dist += clamp(0.25 * aoSample - 1.0, 0.0, 1.0);
|
||||
offset = -offset;
|
||||
}
|
||||
|
||||
ao += clamp(angle + dist, 0.0, 1.0);
|
||||
currentStep += 0.198;
|
||||
}
|
||||
ao *= 0.2;
|
||||
|
||||
return ao;
|
||||
}
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float DHAmbientOcclusion(float dither) {
|
||||
float ao = 0.0;
|
||||
|
||||
float depth = texture2D(dhDepthTex0, texCoord).r;
|
||||
if(depth >= 1.0) return 1.0;
|
||||
|
||||
depth = GetDHLinearDepth(depth);
|
||||
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float currentStep = 0.198 * dither + 0.01;
|
||||
|
||||
float radius = 4.0;
|
||||
float fovScale = gbufferProjection[1][1] / 1.37;
|
||||
float distScale = max((dhFarPlane - dhNearPlane) * depth + dhNearPlane, 5.0);
|
||||
vec2 scale = radius * vec2(1.0 / aspectRatio, 1.0) * fovScale / distScale;
|
||||
float mult = (0.7 / radius) * (dhFarPlane - dhNearPlane);
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
vec2 offset = OffsetDist(currentStep) * scale;
|
||||
float angle = 0.0, dist = 0.0;
|
||||
|
||||
for(int i = 0; i < 2; i++){
|
||||
float sampleDepth = GetDHLinearDepth(texture2D(dhDepthTex0, texCoord + offset).r);
|
||||
float aoSample = (depth - sampleDepth) * mult / currentStep;
|
||||
angle += clamp(0.5 - aoSample, 0.0, 1.0);
|
||||
dist += clamp(0.25 * aoSample - 1.0, 0.0, 1.0);
|
||||
offset = -offset;
|
||||
}
|
||||
|
||||
ao += clamp(angle + dist, 0.0, 1.0);
|
||||
currentStep += 0.198;
|
||||
}
|
||||
ao *= 0.2;
|
||||
|
||||
return ao;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
vec2 Reprojection(vec3 pos) {
|
||||
pos = pos * 2.0 - 1.0;
|
||||
|
||||
vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0);
|
||||
viewPosPrev /= viewPosPrev.w;
|
||||
viewPosPrev = gbufferModelViewInverse * viewPosPrev;
|
||||
|
||||
vec3 cameraOffset = cameraPosition - previousCameraPosition;
|
||||
cameraOffset *= float(pos.z > 0.56);
|
||||
|
||||
vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0);
|
||||
previousPosition = gbufferPreviousModelView * previousPosition;
|
||||
previousPosition = gbufferPreviousProjection * previousPosition;
|
||||
return previousPosition.xy / previousPosition.w * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
vec3 ApplyMultiColoredBlocklight(vec3 blocklightCol, vec3 screenPos) {
|
||||
if (screenPos.z > 0.56) {
|
||||
screenPos.xy = Reprojection(screenPos);
|
||||
}
|
||||
vec3 coloredLight = texture2DLod(colortex9, screenPos.xy, 2).rgb;
|
||||
|
||||
#ifndef MCBL_LEGACY_COLOR
|
||||
vec3 coloredLightNormalized = coloredLight + 0.000001;
|
||||
coloredLightNormalized = normalize(coloredLightNormalized * coloredLightNormalized) * 0.875 + 0.125;
|
||||
coloredLightNormalized *= GetLuminance(blocklightCol) * 1.7;
|
||||
float coloredLightMix = min((coloredLight.r + coloredLight.g + coloredLight.b) * 2048.0, 1.0);
|
||||
#else
|
||||
vec3 coloredLightNormalized = normalize(coloredLight + 0.00001);
|
||||
coloredLightNormalized *= GetLuminance(blocklightCol) / GetLuminance(coloredLightNormalized);
|
||||
float coloredLightMix = min((coloredLight.r + coloredLight.g + coloredLight.b) * 256.0, 1.0);
|
||||
#endif
|
||||
|
||||
return mix(blocklightCol, coloredLightNormalized, coloredLightMix);
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
#if defined OVERWORLD || defined END
|
||||
#include "/lib/lighting/shadows.glsl"
|
||||
#endif
|
||||
|
||||
void GetLighting(inout vec3 albedo, out vec3 shadow, vec3 viewPos, vec3 worldPos, vec3 normal,
|
||||
vec2 lightmap, float smoothLighting, float NoL, float vanillaDiffuse,
|
||||
float parallaxShadow, float emission, float subsurface, float basicSubsurface) {
|
||||
#if EMISSIVE == 0 || (!defined ADVANCED_MATERIALS && EMISSIVE == 1)
|
||||
emission = 0.0;
|
||||
#endif
|
||||
|
||||
#ifndef SSS
|
||||
subsurface = 0.0;
|
||||
#endif
|
||||
|
||||
#ifndef BASIC_SSS
|
||||
basicSubsurface = 0.0;
|
||||
#endif
|
||||
|
||||
#if defined OVERWORLD || defined END
|
||||
#ifdef SHADOW
|
||||
if (NoL > 0.0 || basicSubsurface > 0.0) {
|
||||
shadow = GetShadow(worldPos, normal, NoL, basicSubsurface, lightmap.y);
|
||||
}
|
||||
shadow *= parallaxShadow;
|
||||
shadow = max(shadow, vec3(0.0));
|
||||
NoL = clamp(NoL * 1.01 - 0.01, 0.0, 1.0);
|
||||
#else
|
||||
shadow = GetShadow(worldPos, normal, NoL, basicSubsurface, lightmap.y);
|
||||
#endif
|
||||
|
||||
#ifdef SHADOW_CLOUD
|
||||
float cloudShadow = GetCloudShadow(worldPos);
|
||||
shadow *= cloudShadow;
|
||||
#endif
|
||||
|
||||
float scattering = 0.0;
|
||||
if (basicSubsurface > 0.0){
|
||||
float VoL = clamp(dot(normalize(viewPos.xyz), lightVec) * 0.5 + 0.5, 0.0, 1.0);
|
||||
scattering = pow(VoL, 16.0) * (1.0 - rainStrength) * basicSubsurface * shadowFade;
|
||||
NoL = mix(NoL, 1.0, sqrt(basicSubsurface) * 0.7);
|
||||
NoL = mix(NoL, 1.0, scattering);
|
||||
}
|
||||
|
||||
#ifdef SHADOW
|
||||
vec3 fullShadow = max(shadow * NoL, vec3(0.0));
|
||||
#else
|
||||
vec3 fullShadow = vec3(shadow);
|
||||
#ifdef OVERWORLD
|
||||
float timeBrightnessAbs = abs(sin(timeAngle * 6.28318530718));
|
||||
fullShadow *= 0.25 + 0.5 * (1.0 - (1.0 - timeBrightnessAbs) * (1.0 - timeBrightnessAbs));
|
||||
fullShadow *= mix(pow(vanillaDiffuse, 1.0 + timeBrightnessAbs), 1.0, basicSubsurface * 0.4);
|
||||
#else
|
||||
fullShadow *= 0.75;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
if (subsurface > 0.0){
|
||||
vec3 subsurfaceShadow = GetSubsurfaceShadow(worldPos, subsurface, lightmap.y);
|
||||
|
||||
float VoL = clamp(dot(normalize(viewPos.xyz), lightVec) * 0.5 + 0.5, 0.0, 1.0);
|
||||
float scattering = pow(VoL, 16.0) * (1.0 - rainStrength) * shadowFade;
|
||||
|
||||
vec3 subsurfaceColor = normalize(albedo + 0.00001) * 1.2;
|
||||
subsurfaceColor = mix(subsurfaceColor, vec3(1.0), pow(subsurfaceShadow, vec3(4.0)));
|
||||
subsurfaceColor = mix(subsurfaceColor, vec3(4.0), scattering) * sqrt(subsurface);
|
||||
|
||||
fullShadow = mix(subsurfaceColor * subsurfaceShadow, vec3(1.0), fullShadow);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OVERWORLD
|
||||
float shadowMult = (1.0 - 0.95 * rainStrength) * shadowFade;
|
||||
vec3 sceneLighting = mix(ambientCol * lightmap.y, lightCol, fullShadow * shadowMult);
|
||||
sceneLighting *= lightmap.y * lightmap.y * (1.0 + scattering * shadow);
|
||||
|
||||
#ifdef CLASSIC_EXPOSURE
|
||||
sceneLighting *= 4.0 - 3.0 * eBS;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
vec3 sceneLighting = endCol.rgb * (0.04 * fullShadow + 0.015);
|
||||
#endif
|
||||
|
||||
#else
|
||||
vec3 sceneLighting = netherColSqrt.rgb * 0.07;
|
||||
#endif
|
||||
|
||||
float newLightmap = pow(lightmap.x, 10.0) * 1.6 + lightmap.x * 0.6;
|
||||
vec3 blockLighting = blocklightCol * newLightmap * newLightmap;
|
||||
|
||||
vec3 minLighting = minLightCol * (1.0 - lightmap.y * lightmap.y);
|
||||
|
||||
#ifdef TOON_LIGHTMAP
|
||||
minLighting *= floor(smoothLighting * 8.0 + 1.001) / 4.0;
|
||||
smoothLighting = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 albedoNormalized = normalize(albedo.rgb + 0.00001);
|
||||
vec3 emissiveLighting = mix(albedoNormalized, vec3(1.0), emission * 0.5);
|
||||
emissiveLighting *= emission * 4.0;
|
||||
|
||||
float lightFlatten = clamp(1.0 - pow(1.0 - emission, 128.0), 0.0, 1.0);
|
||||
vanillaDiffuse = mix(vanillaDiffuse, 1.0, lightFlatten);
|
||||
smoothLighting = mix(smoothLighting, 1.0, lightFlatten);
|
||||
|
||||
float nightVisionLighting = nightVision * 0.25;
|
||||
|
||||
#ifdef ALBEDO_BALANCING
|
||||
float albedoLength = length(albedo.rgb);
|
||||
albedoLength /= sqrt((albedoLength * albedoLength) * 0.25 * (1.0 - lightFlatten) + 1.0);
|
||||
albedo.rgb = albedoNormalized * albedoLength;
|
||||
#endif
|
||||
|
||||
//albedo = vec3(0.5);
|
||||
albedo *= max(sceneLighting + blockLighting + emissiveLighting + nightVisionLighting + minLighting, vec3(0.0));
|
||||
albedo *= vanillaDiffuse * smoothLighting * smoothLighting;
|
||||
|
||||
#ifdef DESATURATION
|
||||
#ifdef OVERWORLD
|
||||
float desatAmount = 1.0 - sqrt(max(sqrt(length(fullShadow / 3.0)) * lightmap.y, lightmap.y)) *
|
||||
sunVisibility * (1.0 - rainStrength * 0.7);
|
||||
desatAmount*= smoothstep(0.25, 1.0, (1.0 - lightmap.x) * (1.0 - lightmap.x)) * (1.0 - lightFlatten);
|
||||
desatAmount = 1.0 - desatAmount;
|
||||
|
||||
vec3 desatNight = normalize(lightNight * lightNight + 0.000001);
|
||||
vec3 desatWeather = normalize(weatherCol.rgb * weatherCol.rgb + 0.000001);
|
||||
|
||||
float desatNWMix = (1.0 - sunVisibility) * (1.0 - rainStrength);
|
||||
|
||||
vec3 desatColor = mix(desatWeather, desatNight, desatNWMix);
|
||||
desatColor = mix(vec3(0.4), desatColor, sqrt(lightmap.y)) * 1.7;
|
||||
#endif
|
||||
|
||||
#ifdef NETHER
|
||||
float desatAmount = 1.0 - smoothstep(0.25, 1.0, (1.0 - lightmap.x) * (1.0 - lightmap.x)) * (1.0 - lightFlatten);
|
||||
|
||||
vec3 desatColor = normalize(netherColSqrt.rgb + 0.000001) * 1.7;
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
float desatAmount = 1.0 - smoothstep(0.25, 1.0, (1.0 - lightmap.x) * (1.0 - lightmap.x)) * (1.0 - lightFlatten);
|
||||
|
||||
vec3 desatColor = normalize(endCol.rgb + 0.000001) * 1.7;
|
||||
#endif
|
||||
|
||||
vec3 desatAlbedo = mix(albedo, GetLuminance(albedo) * desatColor, 1.0 - DESATURATION_FACTOR * 0.4);
|
||||
|
||||
albedo = mix(desatAlbedo, albedo, desatAmount);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
#ifdef SHADOW
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
|
||||
#ifdef SHADOW_COLOR
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
uniform sampler2D shadowcolor0;
|
||||
#endif
|
||||
|
||||
// uniform sampler2D shadowtex0;
|
||||
|
||||
// #ifdef SHADOW_COLOR
|
||||
// uniform sampler2D shadowtex1;
|
||||
// uniform sampler2D shadowcolor0;
|
||||
// #endif
|
||||
|
||||
vec2 shadowOffsets[9] = vec2[9](
|
||||
vec2( 0.0, 0.0),
|
||||
vec2( 0.0, 1.0),
|
||||
vec2( 0.7, 0.7),
|
||||
vec2( 1.0, 0.0),
|
||||
vec2( 0.7,-0.7),
|
||||
vec2( 0.0,-1.0),
|
||||
vec2(-0.7,-0.7),
|
||||
vec2(-1.0, 0.0),
|
||||
vec2(-0.7, 0.7)
|
||||
);
|
||||
|
||||
float biasDistribution[10] = float[10](
|
||||
0.0, 0.057, 0.118, 0.184, 0.255, 0.333, 0.423, 0.529, 0.667, 1.0
|
||||
);
|
||||
|
||||
float getShadow(sampler2D shadowtex, vec2 shadowPosXY, float shadowPosZ) {
|
||||
float shadow = texture2D(shadowtex,shadowPosXY).x;
|
||||
shadow = clamp((shadow - shadowPosZ)*16384.0+0.5,0.0,1.0);
|
||||
return shadow;
|
||||
}
|
||||
|
||||
float texture2DShadow2x2(sampler2D shadowtex, vec3 shadowPos) {
|
||||
shadowPos.xy -= 0.5 / shadowMapResolution;
|
||||
vec2 frac = fract(shadowPos.xy * shadowMapResolution);
|
||||
shadowPos.xy = (floor(shadowPos.xy * shadowMapResolution) + 0.5) / shadowMapResolution;
|
||||
|
||||
float shadow0 = getShadow(shadowtex,shadowPos.st + vec2(0.0, 0.0) / shadowMapResolution, shadowPos.z);
|
||||
float shadow1 = getShadow(shadowtex,shadowPos.st + vec2(0.0, 1.0) / shadowMapResolution, shadowPos.z);
|
||||
float shadow2 = getShadow(shadowtex,shadowPos.st + vec2(1.0, 0.0) / shadowMapResolution, shadowPos.z);
|
||||
float shadow3 = getShadow(shadowtex,shadowPos.st + vec2(1.0, 1.0) / shadowMapResolution, shadowPos.z);
|
||||
|
||||
float shadowx0 = mix(shadow0, shadow1, frac.y);
|
||||
float shadowx1 = mix(shadow2, shadow3, frac.y);
|
||||
|
||||
float shadow = mix(shadowx0, shadowx1, frac.x);
|
||||
|
||||
return shadow;
|
||||
}
|
||||
|
||||
float texture2DShadow(sampler2D shadowtex, vec3 shadowPos) {
|
||||
return texture2DShadow2x2(shadowtex, shadowPos);
|
||||
}
|
||||
|
||||
float texture2DShadow(sampler2DShadow shadowtex, vec3 shadowPos) {
|
||||
return shadow2D(shadowtex, shadowPos).x;
|
||||
}
|
||||
|
||||
vec3 DistortShadow(vec3 worldPos, float distortFactor) {
|
||||
worldPos.xy /= distortFactor;
|
||||
worldPos.z *= 0.2;
|
||||
return worldPos * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
float GetCurvedBias(int i, float dither) {
|
||||
return mix(biasDistribution[i], biasDistribution[i+1], dither);
|
||||
}
|
||||
|
||||
float InterleavedGradientNoise() {
|
||||
float n = 52.9829189 * fract(0.06711056 * gl_FragCoord.x + 0.00583715 * gl_FragCoord.y);
|
||||
return fract(n + frameCounter * 1.618);
|
||||
}
|
||||
|
||||
vec3 SampleBasicShadow(vec3 shadowPos, float subsurface) {
|
||||
float shadow0 = texture2DShadow(shadowtex0, vec3(shadowPos.st, shadowPos.z));
|
||||
|
||||
vec3 shadowCol = vec3(0.0);
|
||||
#ifdef SHADOW_COLOR
|
||||
if (shadow0 < 1.0) {
|
||||
shadowCol = texture2D(shadowcolor0, shadowPos.st).rgb *
|
||||
texture2DShadow(shadowtex1, vec3(shadowPos.st, shadowPos.z));
|
||||
#ifdef WATER_CAUSTICS
|
||||
shadowCol *= 4.0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
shadow0 *= mix(shadow0, 1.0, subsurface);
|
||||
shadowCol *= shadowCol;
|
||||
|
||||
return clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(16.0));
|
||||
}
|
||||
|
||||
vec3 SampleFilteredShadow(vec3 shadowPos, float offset, float subsurface) {
|
||||
float shadow0 = 0.0;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
vec2 shadowOffset = shadowOffsets[i] * offset;
|
||||
shadow0 += texture2DShadow(shadowtex0, vec3(shadowPos.st + shadowOffset, shadowPos.z));
|
||||
}
|
||||
shadow0 /= 9.0;
|
||||
|
||||
vec3 shadowCol = vec3(0.0);
|
||||
#ifdef SHADOW_COLOR
|
||||
if (shadow0 < 0.999) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
vec2 shadowOffset = shadowOffsets[i] * offset;
|
||||
vec3 shadowColSample = texture2D(shadowcolor0, shadowPos.st + shadowOffset).rgb *
|
||||
texture2DShadow(shadowtex1, vec3(shadowPos.st + shadowOffset, shadowPos.z));
|
||||
#ifdef WATER_CAUSTICS
|
||||
shadowColSample *= 4.0;
|
||||
#endif
|
||||
shadowCol += shadowColSample;
|
||||
}
|
||||
shadowCol /= 9.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
shadow0 *= mix(shadow0, 1.0, subsurface);
|
||||
shadowCol *= shadowCol;
|
||||
|
||||
return clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(16.0));
|
||||
}
|
||||
|
||||
vec3 GetShadow(vec3 worldPos, vec3 normal, float NoL, float subsurface, float skylight) {
|
||||
#if SHADOW_PIXEL > 0
|
||||
worldPos = (floor((worldPos + cameraPosition) * SHADOW_PIXEL + 0.01) + 0.5) /
|
||||
SHADOW_PIXEL - cameraPosition;
|
||||
#endif
|
||||
|
||||
vec3 shadowPos = ToShadow(worldPos);
|
||||
|
||||
float distb = sqrt(dot(shadowPos.xy, shadowPos.xy));
|
||||
float distortFactor = distb * shadowMapBias + (1.0 - shadowMapBias);
|
||||
|
||||
#if SHADOW_BIAS == 1
|
||||
if (subsurface == 0) {
|
||||
float distortNBias = distortFactor * shadowDistance / 256.0;
|
||||
distortNBias *= distortNBias;
|
||||
|
||||
vec3 worldNormal = (gbufferModelViewInverse * vec4(normal, 0.0)).xyz;
|
||||
worldPos += worldNormal * distortNBias * 8192.0 / shadowMapResolution;
|
||||
shadowPos = ToShadow(worldPos);
|
||||
|
||||
distb = sqrt(dot(shadowPos.xy, shadowPos.xy));
|
||||
distortFactor = distb * shadowMapBias + (1.0 - shadowMapBias);
|
||||
}
|
||||
#endif
|
||||
|
||||
shadowPos = DistortShadow(shadowPos, distortFactor);
|
||||
|
||||
bool doShadow = shadowPos.x > 0.0 && shadowPos.x < 1.0 &&
|
||||
shadowPos.y > 0.0 && shadowPos.y < 1.0;
|
||||
|
||||
#ifdef OVERWORLD
|
||||
doShadow = doShadow && skylight > 0.001;
|
||||
#endif
|
||||
|
||||
if (!doShadow) return vec3(1.0);
|
||||
|
||||
float bias = 0.0;
|
||||
float offset = 1.0 / shadowMapResolution;
|
||||
|
||||
#if SHADOW_BIAS == 0
|
||||
float biasFactor = sqrt(1.0 - NoL * NoL) / NoL;
|
||||
float distortBias = distortFactor * shadowDistance / 256.0;
|
||||
distortBias *= 8.0 * distortBias;
|
||||
float distanceBias = sqrt(dot(worldPos.xyz, worldPos.xyz)) * 0.005;
|
||||
|
||||
bias = (distortBias * biasFactor + distanceBias + 0.05) / shadowMapResolution;
|
||||
#else
|
||||
bias = 0.35 / shadowMapResolution;
|
||||
#endif
|
||||
|
||||
if (subsurface > 0.0) {
|
||||
float blurFadeIn = clamp(distb * 20.0, 0.0, 1.0);
|
||||
float blurFadeOut = 1.0 - clamp(distb * 10.0 - 2.0, 0.0, 1.0);
|
||||
float blurMult = blurFadeIn * blurFadeOut * (1.0 - NoL);
|
||||
blurMult = blurMult * 1.5 + 1.0;
|
||||
|
||||
offset = 0.0007 * blurMult;
|
||||
bias = 0.0002;
|
||||
}
|
||||
|
||||
#if SHADOW_PIXEL > 0
|
||||
bias += 0.0025 / SHADOW_PIXEL;
|
||||
#endif
|
||||
|
||||
shadowPos.z -= bias;
|
||||
|
||||
#ifdef SHADOW_FILTER
|
||||
vec3 shadow = SampleFilteredShadow(shadowPos, offset, subsurface);
|
||||
#else
|
||||
vec3 shadow = SampleBasicShadow(shadowPos, subsurface);
|
||||
#endif
|
||||
|
||||
return shadow;
|
||||
}
|
||||
|
||||
vec3 GetSubsurfaceShadow(vec3 worldPos, float subsurface, float skylight) {
|
||||
float gradNoise = InterleavedGradientNoise();
|
||||
|
||||
vec3 shadowPos = ToShadow(worldPos);
|
||||
|
||||
float distb = sqrt(dot(shadowPos.xy, shadowPos.xy));
|
||||
float distortFactor = distb * shadowMapBias + (1.0 - shadowMapBias);
|
||||
shadowPos = DistortShadow(shadowPos, distortFactor);
|
||||
|
||||
vec3 subsurfaceShadow = vec3(0.0);
|
||||
|
||||
vec3 offsetScale = vec3(0.002 / distortFactor, 0.002 / distortFactor, 0.001) * (subsurface * 0.75 + 0.25);
|
||||
|
||||
for(int i = 0; i < 12; i++) {
|
||||
gradNoise = fract(gradNoise + 1.618);
|
||||
float rot = gradNoise * 6.283;
|
||||
float dist = (i + gradNoise) / 12.0;
|
||||
|
||||
vec2 offset2D = vec2(cos(rot), sin(rot)) * dist;
|
||||
float offsetZ = -(dist * dist + 0.025);
|
||||
|
||||
vec3 offset = vec3(offset2D, offsetZ) * offsetScale;
|
||||
|
||||
vec3 samplePos = shadowPos + offset;
|
||||
float shadow0 = texture2DShadow(shadowtex0, samplePos);
|
||||
|
||||
vec3 shadowCol = vec3(0.0);
|
||||
#ifdef SHADOW_COLOR
|
||||
if (shadow0 < 1.0) {
|
||||
shadowCol = texture2D(shadowcolor0, samplePos.st).rgb *
|
||||
texture2DShadow(shadowtex1, samplePos);
|
||||
#ifdef WATER_CAUSTICS
|
||||
shadowCol *= 4.0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
subsurfaceShadow += clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(1.0));
|
||||
}
|
||||
subsurfaceShadow /= 12.0;
|
||||
subsurfaceShadow *= subsurfaceShadow;
|
||||
|
||||
return subsurfaceShadow;
|
||||
}
|
||||
#else
|
||||
vec3 GetShadow(vec3 worldPos, vec3 normal, float NoL, float subsurface, float skylight) {
|
||||
#ifdef OVERWORLD
|
||||
float skylightShadow = smoothstep(0.866,1.0,skylight);
|
||||
skylightShadow *= skylightShadow;
|
||||
|
||||
return vec3(skylightShadow);
|
||||
#else
|
||||
return vec3(1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 GetSubsurfaceShadow(vec3 worldPos, float subsurface, float skylight) {
|
||||
return vec3(0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
float GetCloudShadow(vec3 worldPos) {
|
||||
vec2 wind = vec2(
|
||||
frametime * CLOUD_SPEED * 0.0005,
|
||||
sin(frametime * CLOUD_SPEED * 0.001) * 0.005
|
||||
) * CLOUD_HEIGHT / 15.0;
|
||||
|
||||
vec3 coveragePos = worldPos;
|
||||
worldPos += cameraPosition;
|
||||
|
||||
vec3 worldLightVec = (gbufferModelViewInverse * vec4(lightVec, 0.0)).xyz;
|
||||
|
||||
float cloudHeight = CLOUD_HEIGHT * CLOUD_VOLUMETRIC_SCALE + 70;
|
||||
worldPos.xz += worldLightVec.xz / worldLightVec.y * max(cloudHeight - worldPos.y, 0.0);
|
||||
coveragePos.xz += worldLightVec.xz / worldLightVec.y * -coveragePos.y;
|
||||
|
||||
float scaledThickness = CLOUD_THICKNESS * CLOUD_VOLUMETRIC_SCALE;
|
||||
float cloudFadeOut = 1.0 - clamp((worldPos.y - cloudHeight) / scaledThickness, 0.0, 1.0);
|
||||
float coverageFadeOut = 1.0 - clamp((cameraPosition.y - cloudHeight) / scaledThickness, 0.0, 1.0);
|
||||
|
||||
vec2 coord = worldPos.xz / CLOUD_VOLUMETRIC_SCALE;
|
||||
|
||||
float sunCoverageSize = CLOUD_VOLUMETRIC_SCALE * 3.0 / worldLightVec.y;
|
||||
float sunCoverage = max(1.0 - length(coveragePos.xz) / sunCoverageSize, 0.0) * coverageFadeOut;
|
||||
|
||||
coord.xy *= 0.004;
|
||||
|
||||
#if CLOUD_BASE == 0
|
||||
float noiseBase = texture2D(noisetex, coord * 0.25 + wind).r;
|
||||
#else
|
||||
float noiseBase = texture2D(noisetex, coord * 0.5 + wind).g;
|
||||
noiseBase = pow(1.0 - noiseBase, 2.0) * 0.5 + 0.25;
|
||||
#endif
|
||||
|
||||
float noise = mix(noiseBase, 1.0, 0.33 * rainStrength) * 21.0;
|
||||
|
||||
noise = max(noise - (sunCoverage * 3.0 + CLOUD_AMOUNT), 0.0);
|
||||
noise *= CLOUD_DENSITY * 0.125;
|
||||
noise *= (1.0 - 0.75 * rainStrength);
|
||||
noise = noise / sqrt(noise * noise + 0.5);
|
||||
noise *= cloudFadeOut;
|
||||
|
||||
return 1.0 - noise * CLOUD_OPACITY * 0.85;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,100 @@
|
||||
// End Portal fix by fayer3#2332 (Modified)
|
||||
vec3[8] colors = vec3[](
|
||||
vec3(0.3472479, 0.6559956, 0.7387838) * 1.5,
|
||||
vec3(0.6010780, 0.7153565, 1.060625 ),
|
||||
vec3(0.4221090, 0.8135094, 0.9026056),
|
||||
vec3(0.3492291, 1.0241201, 1.8612821),
|
||||
vec3(0.7543085, 0.8238697, 0.6803233),
|
||||
vec3(0.4144472, 0.5648165, 0.8037 ),
|
||||
vec3(0.508905 , 0.6719649, 0.9982805),
|
||||
vec3(0.5361914, 0.4476583, 0.8008522));
|
||||
color.rgb = vec3(0.4214321, 0.4722309, 1.9922364) * 0.08;
|
||||
|
||||
float dither = Bayer64(gl_FragCoord.xy);
|
||||
#ifdef TAA
|
||||
dither = fract(dither + 1.61803398875 * mod(float(frameCounter), 3600.0));
|
||||
int repeat = 4;
|
||||
#else
|
||||
int repeat = 8;
|
||||
#endif
|
||||
float dismult = 0.5;
|
||||
for (int j = 0; j < repeat; j++) {
|
||||
float add = float(j + dither) * 0.0625 / float(repeat);
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
float colormult = 0.9/(30.0+i);
|
||||
float rotation = (i - 0.1 * i + 0.71 * i - 11 * i + 21) * 0.01 + i * 0.01;
|
||||
float Cos = cos(radians(rotation));
|
||||
float Sin = sin(radians(rotation));
|
||||
vec2 offset = vec2(0.0, 1.0/(3600.0/24.0)) * pow(16.0 - i, 2.0) * 0.004;
|
||||
|
||||
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos * (i * dismult + 1), 1.0)).xyz);
|
||||
if (abs(NdotU) > 0.9) {
|
||||
wpos.xz /= wpos.y;
|
||||
wpos.xz *= 0.06 * sign(- playerPos.y);
|
||||
wpos.xz *= abs(playerPos.y) + i * dismult + add;
|
||||
wpos.xz -= cameraPosition.xz * 0.05;
|
||||
} else {
|
||||
vec3 absPos = abs(playerPos);
|
||||
if (abs(dot(normal, eastVec)) > 0.9) {
|
||||
wpos.xz = wpos.yz / wpos.x;
|
||||
wpos.xz *= 0.06 * sign(- playerPos.x);
|
||||
wpos.xz *= abs(playerPos.x) + i * dismult + add;
|
||||
wpos.xz -= cameraPosition.yz * 0.05;
|
||||
} else {
|
||||
wpos.xz = wpos.yx / wpos.z;
|
||||
wpos.xz *= 0.06 * sign(- playerPos.z);
|
||||
wpos.xz *= abs(playerPos.z) + i * dismult + add;
|
||||
wpos.xz -= cameraPosition.yx * 0.05;
|
||||
}
|
||||
}
|
||||
vec2 pos = wpos.xz;
|
||||
|
||||
vec2 wind = fract((frameTimeCounter + 984.0) * (i + 8) * 0.125 * offset);
|
||||
vec2 coord = mat2(Cos, Sin, -Sin, Cos) * pos + wind;
|
||||
if (mod(float(i), 4) < 1.5) coord = coord.yx + vec2(-1.0, 1.0) * wind.y;
|
||||
|
||||
vec3 psample = pow(texture2D(tex, coord).rgb, vec3(0.85)) * colors[i-1] * colormult;
|
||||
color.rgb += psample * length(psample.rgb) * (3000.0 / repeat);
|
||||
}
|
||||
}
|
||||
color.rgb *= vec3(0.09, 0.077, 0.07);
|
||||
emission = 10.0;
|
||||
noDirectionalShading = true;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.0;
|
||||
#endif
|
||||
|
||||
#ifdef PORTAL_EDGE_EFFECT
|
||||
//vec3 voxelPos = SceneToVoxel(mix(playerPos, vec3(0.0), -0.02)); // Fixes weird parallax offset
|
||||
vec3 voxelPos = SceneToVoxel(playerPos);
|
||||
|
||||
float portalOffset = 0.08333 * dither;
|
||||
vec3[4] portalOffsets = vec3[](
|
||||
vec3( portalOffset, 0, portalOffset),
|
||||
vec3( portalOffset, 0,-portalOffset),
|
||||
vec3(-portalOffset, 0, portalOffset),
|
||||
vec3(-portalOffset, 0,-portalOffset)
|
||||
);
|
||||
|
||||
float edge = 0.0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int voxel = int(texelFetch(voxel_sampler, ivec3(voxelPos + portalOffsets[i]), 0).r);
|
||||
if (voxel == 58 || voxel == 255) { // End Portal Frame or Bedrock
|
||||
edge = 1.0; break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef END
|
||||
// No edge effect in the middle of the return fountain
|
||||
vec2 var1 = abs(playerPos.xz + cameraPosition.xz - 0.5);
|
||||
float var2 = max(var1.x, var1.y);
|
||||
if (var2 > 1.0)
|
||||
#endif
|
||||
|
||||
{
|
||||
vec4 edgeColor = vec4(vec3(0.3, 0.6, 0.7), 1.0);
|
||||
color = mix(color, edgeColor, edge);
|
||||
emission = mix(emission, 5.0, edge);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
normalM = upVec;
|
||||
|
||||
highlightMult = 0.0;
|
||||
shadowMult = vec3(0.0);
|
||||
|
||||
#if MC_VERSION >= 11700
|
||||
if (lmCoord.x > 0.99) { // Glowing Sign Text
|
||||
lmCoordM = vec2(0.0);
|
||||
|
||||
emission = 1.0;
|
||||
|
||||
color.rgb *= length(color.rgb) + 0.5;
|
||||
} else // Normal Sign Text
|
||||
#endif
|
||||
color.rgb *= 5.0;
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = pow2(pow2(color.r)) * 0.65;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.5;
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
smoothnessG = color.r * 0.4;
|
||||
|
||||
smoothnessD = color.r * 0.3;
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = pow2(pow2(color.g)) * 0.75;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = pow2(pow2(color.g)) * 0.7;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = pow2(color.r) * 0.7;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.77;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = color.r * 0.7;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
smoothnessG = pow2(pow2(pow2(color.g))) * 12.0;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
smoothnessG = pow2(color.r) * 0.7;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
@@ -0,0 +1,7 @@
|
||||
smoothnessG = pow2(pow2(pow2(color.g))) * 12.0;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.77;
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
smoothnessG = pow2(pow2(color.g)) * 8.0;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = pow2(color.g) * 0.7;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.77;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = color.r;
|
||||
smoothnessD = color.r;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.33;
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
smoothnessG = color.r;
|
||||
smoothnessD = color.r * 0.65;
|
||||
@@ -0,0 +1,3 @@
|
||||
smoothnessG = pow2(pow2(color.g));
|
||||
smoothnessD = smoothnessG;
|
||||
smoothnessG = max(smoothnessG, 0.3 * color.g * float(color.g > color.b * 1.5));
|
||||
@@ -0,0 +1,10 @@
|
||||
materialMask = OSIEBCA * 2.0; // Copper Fresnel
|
||||
smoothnessG = pow2(pow2(color.r)) + pow2(max0(color.g - color.r * 0.5)) * 0.3;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
color.rgb *= 0.6 + 0.7 * GetLuminance(color.rgb);
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.5;
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
noSmoothLighting = true;
|
||||
|
||||
vec3 hsvColor = rgb2hsv(color.rgb);
|
||||
if (abs(hsvColor.r - 0.09722) < 0.04305 && hsvColor.b > 0.7) { // Active Light Part
|
||||
smoothnessG = 0.75;
|
||||
smoothnessD = 0.35;
|
||||
|
||||
float blockRes = absMidCoordPos.x * atlasSize.x;
|
||||
vec2 signMidCoordPosM = (floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0;
|
||||
float dotsignMidCoordPos = dot(signMidCoordPosM, signMidCoordPosM);
|
||||
float lBlockPosM = pow2(max0(1.0 - 1.7 * pow2(pow2(dotsignMidCoordPos))));
|
||||
|
||||
emission = pow2(lmCoordM.x) + 0.3 * color.r;
|
||||
emission *= (0.7 + 2.0 * pow2(lBlockPosM));
|
||||
} else if (color.r > 2.5 * (color.g + color.b)) { // Middle Redstone Part
|
||||
emission = 4.0;
|
||||
color.rgb *= color.rgb;
|
||||
} else { // Copper Base
|
||||
#include "/lib/materials/specificMaterials/terrain/copperBlock.glsl"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
float lColor = length(color.rgb);
|
||||
smoothnessG = lColor * 0.2;
|
||||
smoothnessD = lColor * 0.15;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "/lib/materials/specificMaterials/terrain/obsidian.glsl"
|
||||
|
||||
highlightMult *= 0.5;
|
||||
|
||||
float factor0 = sqrt2(max0(color.b - color.g * 6.0));
|
||||
float factor1 = pow2(color.b);
|
||||
emission = 1.35 + pow2(pow2(factor1)) * 7.5;
|
||||
emission *= factor0;
|
||||
color.r *= 1.15;
|
||||
|
||||
maRecolor = vec3(factor0 * min(max0(factor1 * 0.7 - 0.1) * 1.3, 0.5));
|
||||
@@ -0,0 +1,8 @@
|
||||
smoothnessG = pow2(color.g) * 1.5;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#if COLORED_LIGHTING == 0
|
||||
/* Tweak to make caves with Glow Lichen look better lit and closer to vanilla Minecraft. */
|
||||
lmCoordM = pow(lmCoordM + 0.0001, vec2(0.65));
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
materialMask = OSIEBCA; // Intense Fresnel
|
||||
|
||||
float factor = max(max(color.g, 0.8),max(color.b, 0.8));
|
||||
float factor2 = pow2(factor);
|
||||
#ifdef GBUFFERS_TERRAIN
|
||||
float factor4 = pow2(factor2);
|
||||
#else
|
||||
float factor4 = factor2;
|
||||
#endif
|
||||
|
||||
smoothnessG = factor - pow2(pow2(color.g)) * 0.4;
|
||||
highlightMult = 3.0 * max(pow2(factor4), 0.2);
|
||||
|
||||
smoothnessD = factor4 * 0.75;
|
||||
|
||||
#if MC_VERSION < 11300
|
||||
highlightMult *= 2.0;
|
||||
smoothnessD /= 0.75;
|
||||
#endif
|
||||
|
||||
color.rgb *= 0.7 + 0.4 * GetLuminance(color.rgb);
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.5;
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
smoothnessG = color.r * 0.1 + 0.1;
|
||||
@@ -0,0 +1,14 @@
|
||||
materialMask = OSIEBCA; // Intense Fresnel
|
||||
|
||||
float factor = pow2(sqrt2(GetLuminance(color.rgb)));
|
||||
float factor2 = pow2(factor);
|
||||
float factor4 = pow2(factor2);
|
||||
|
||||
smoothnessG = factor - factor4 * 0.4;
|
||||
highlightMult = 3.0 * factor4;
|
||||
|
||||
smoothnessD = factor4 * 0.75;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.5;
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
// End Portal Frame:Green Parts
|
||||
smoothnessG = 0.25;
|
||||
smoothnessD = 0.45;
|
||||
@@ -0,0 +1,7 @@
|
||||
float factor = pow2(pow2(color.r));
|
||||
smoothnessG = factor * 0.65;
|
||||
smoothnessD = smoothnessG * 0.6;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
noSmoothLighting = true; noDirectionalShading = true;
|
||||
lmCoordM = vec2(1.0, 0.0);
|
||||
|
||||
float blockRes = absMidCoordPos.x * atlasSize.x;
|
||||
vec2 signMidCoordPosM = abs((floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0);
|
||||
float value = 1.0 - max(signMidCoordPosM.x, signMidCoordPosM.y);
|
||||
emission = 0.3 + value + pow(dot(color.rgb, color.rgb) * 0.33, frogPow);
|
||||
emission *= 1.7;
|
||||
|
||||
color.rgb = pow2(color.rgb);
|
||||
@@ -0,0 +1,20 @@
|
||||
materialMask = OSIEBCA * 3.0; // Gold Fresnel
|
||||
|
||||
#ifdef GBUFFERS_TERRAIN
|
||||
float colorG2 = pow2(max(color.g, color.r));
|
||||
#else
|
||||
float colorG2 = color.g;
|
||||
#endif
|
||||
float colorG4 = pow2(colorG2);
|
||||
float factor = max(color.g, 0.8);
|
||||
|
||||
smoothnessG = min1(factor - colorG4 * 0.2);
|
||||
highlightMult = 3.5 * max(colorG4, 0.7);
|
||||
|
||||
smoothnessD = colorG4;
|
||||
|
||||
color.rgb *= 0.5 + 0.4 * GetLuminance(color.rgb);
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.33;
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifdef GBUFFERS_TERRAIN
|
||||
smoothnessG = pow2(pow2(color.r * 3));
|
||||
#else
|
||||
smoothnessG = pow2(color.r * 3);
|
||||
#endif
|
||||
highlightMult = smoothnessG * 3.0;
|
||||
smoothnessD = smoothnessG;
|
||||
materialMask = OSIEBCA; // Intense Fresnel
|
||||
|
||||
color.rgb *= 0.8+ .5 * GetLuminance(color.rgb);
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.33;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = color.b;
|
||||
smoothnessD = color.b;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.66;
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
smoothnessG = pow2(color.b) * 0.8;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.5;
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
// Tweak to prevent the animation of lava causing brightness pulsing
|
||||
vec3 avgColor = vec3(0.0);
|
||||
ivec2 itexCoordC = ivec2(midCoord * atlasSize + 0.0001);
|
||||
for (int x = -8; x < 8; x += 2) {
|
||||
for (int y = -8; y < 8; y += 2) {
|
||||
avgColor += texelFetch(tex, itexCoordC + ivec2(x, y), 0).rgb;
|
||||
}
|
||||
}
|
||||
color.rgb /= max(GetLuminance(avgColor) * 0.0390625, 0.001);
|
||||
|
||||
#ifdef NETHER
|
||||
vec3 worldPos = playerPos + cameraPosition;
|
||||
vec2 lavaPos = (floor(worldPos.xz * 16.0) + worldPos.y * 32.0) * 0.000666;
|
||||
vec2 wind = vec2(frameTimeCounter * 0.012, 0.0);
|
||||
|
||||
float noiseSample = texture2D(noisetex, lavaPos + wind).g;
|
||||
noiseSample = noiseSample - 0.5;
|
||||
noiseSample *= 0.1;
|
||||
color.rgb = pow(color.rgb, vec3(1.0 + noiseSample));
|
||||
#endif
|
||||
|
||||
noDirectionalShading = true;
|
||||
lmCoordM = vec2(0.0);
|
||||
emission = GetLuminance(color.rgb) * 6.5;
|
||||
|
||||
maRecolor = vec3(clamp(pow2(pow2(pow2(smoothstep1(emission * 0.28)))), 0.12, 0.4) * 1.3) * vec3(1.0, vec2(0.7));
|
||||
|
||||
#if RAIN_PUDDLES >= 1
|
||||
noPuddles = 1.0;
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
subsurfaceMode = 2;
|
||||
|
||||
#ifdef GBUFFERS_TERRAIN
|
||||
materialMask = OSIEBCA * 253.0; // Reduced Edge TAA
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
doTileRandomisation = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IPBR
|
||||
float factor = min1(pow2(color.g - 0.15 * (color.r + color.b)) * 2.5);
|
||||
smoothnessG = factor * 0.5;
|
||||
highlightMult = factor * 4.0 + 2.0;
|
||||
float fresnel = clamp(1.0 + dot(normalM, normalize(viewPos)), 0.0, 1.0);
|
||||
highlightMult *= 1.0 - pow2(pow2(fresnel));
|
||||
#endif
|
||||
|
||||
#ifdef SNOWY_WORLD
|
||||
snowMinNdotU = min(pow2(pow2(color.g)), 0.1);
|
||||
color.rgb = color.rgb * 0.5 + 0.5 * (color.rgb / glColor.rgb);
|
||||
#endif
|
||||
|
||||
#if SHADOW_QUALITY > -1 && SHADOW_QUALITY < 3
|
||||
shadowMult = vec3(sqrt1(max0(max(lmCoordM.y, min1(lmCoordM.x * 2.0)) - 0.95) * 20.0));
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
smoothnessG = pow2(color.r * 2.0);
|
||||
smoothnessG = min1(smoothnessG);
|
||||
highlightMult = smoothnessG * 2.0;
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.33;
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
#if MC_VERSION >= 11300
|
||||
smoothnessG = pow2(color.r) * 1.5;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
#else
|
||||
smoothnessG = color.r * 0.4 + 0.2;
|
||||
#endif
|
||||
smoothnessD = smoothnessG;
|
||||
@@ -0,0 +1,3 @@
|
||||
smoothnessG = pow2(pow2(color.g)) * 2.5;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
@@ -0,0 +1,13 @@
|
||||
materialMask = OSIEBCA; // Intense Fresnel
|
||||
|
||||
float factor = max0(0.3 - abs(color.r - 0.3)) * 1.5;
|
||||
|
||||
smoothnessG = factor;
|
||||
highlightMult = 2.0 + min1(smoothnessG * 2.0) * 1.5;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
|
||||
smoothnessD = min1(factor + 0.07);
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 1.25;
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
smoothnessG = color.g * 0.25;
|
||||
@@ -0,0 +1,19 @@
|
||||
materialMask = OSIEBCA; // Intense Fresnel
|
||||
|
||||
float factor = color.g;
|
||||
float factor2 = pow2(factor);
|
||||
float factor4 = pow2(factor2);
|
||||
float factor8 = pow2(factor4);
|
||||
|
||||
smoothnessG = factor - factor8 * 0.5;
|
||||
highlightMult = 3.5 * factor8;
|
||||
|
||||
smoothnessD = factor8;
|
||||
|
||||
#ifdef GBUFFERS_TERRAIN
|
||||
DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult);
|
||||
#endif
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.5;
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
materialMask = OSIEBCA * 2.0; // Copper Fresnel
|
||||
smoothnessG = pow2(color.r + color.g * 0.25) * 0.4;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = min1(smoothnessG * smoothnessG * 2.0);
|
||||
@@ -0,0 +1,3 @@
|
||||
materialMask = OSIEBCA * 3.0; // Gold Fresnel
|
||||
smoothnessG = pow2(pow2(color.g));
|
||||
smoothnessD = 0.5 * (smoothnessG + color.b);
|
||||
@@ -0,0 +1,3 @@
|
||||
materialMask = OSIEBCA; // Intense Fresnel
|
||||
smoothnessG = pow2(pow2(color.r)) * 0.7;
|
||||
smoothnessD = smoothnessG * 0.6;
|
||||
@@ -0,0 +1,11 @@
|
||||
materialMask = OSIEBCA * 5.0; // Redstone Fresnel
|
||||
|
||||
float factor = pow2(color.r);
|
||||
smoothnessG = 0.4;
|
||||
highlightMult = factor + 0.2;
|
||||
|
||||
smoothnessD = factor * 0.5 + 0.1;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.77;
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
noSmoothLighting = true; noDirectionalShading = true;
|
||||
lmCoordM.x = min(lmCoordM.x * 0.9, 0.77);
|
||||
|
||||
if (color.r > 0.65) {
|
||||
emission = (3.5 - 2.25 * color.g) * 0.97;
|
||||
color.rgb *= color.rgb;
|
||||
} else if (color.r > color.g * 2.0) {
|
||||
materialMask = OSIEBCA * 5.0; // Redstone Fresnel
|
||||
|
||||
float factor = pow2(color.r);
|
||||
smoothnessG = 0.4;
|
||||
highlightMult = factor + 0.4;
|
||||
|
||||
smoothnessD = factor * 0.7 + 0.3;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
smoothnessG = (1.0 - pow(color.g, 64.0) * 0.3) * 0.4;
|
||||
highlightMult = 2.0;
|
||||
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef GBUFFERS_TERRAIN
|
||||
DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult);
|
||||
#endif
|
||||
|
||||
#if RAIN_PUDDLES >= 1
|
||||
noPuddles = 1.0;
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
smoothnessG = pow2(pow2(color.g)) * 1.5;
|
||||
smoothnessG = min1(smoothnessG);
|
||||
smoothnessD = smoothnessG;
|
||||
|
||||
#ifdef COATED_TEXTURES
|
||||
noiseFactor = 0.77;
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
float fovmult = gbufferProjection[1][1] / 1.37373871;
|
||||
|
||||
float BaseLens(vec2 lightPos, float size, float dist, float hardness) {
|
||||
vec2 lensCoord = (texCoord + (lightPos * dist - 0.5)) * vec2(aspectRatio, 1.0);
|
||||
float lens = clamp(1.0 - length(lensCoord) / (size * fovmult), 0.0, 1.0 / hardness) * hardness;
|
||||
lens *= lens; lens *= lens;
|
||||
return lens;
|
||||
}
|
||||
|
||||
float OverlapLens(vec2 lightPos, float size, float dista, float distb) {
|
||||
return BaseLens(lightPos, size, dista, 2.0) * BaseLens(lightPos, size, distb, 2.0);
|
||||
}
|
||||
|
||||
float PointLens(vec2 lightPos, float size, float dist) {
|
||||
return BaseLens(lightPos, size, dist, 1.5) + BaseLens(lightPos, size * 4.0, dist, 1.0) * 0.5;
|
||||
}
|
||||
|
||||
float RingLensTransform(float lensFlare) {
|
||||
return pow(1.0 - pow(1.0 - pow(lensFlare, 0.25), 10.0), 5.0);
|
||||
}
|
||||
float RingLens(vec2 lightPos, float size, float distA, float distB) {
|
||||
float lensFlare1 = RingLensTransform(BaseLens(lightPos, size, distA, 1.0));
|
||||
float lensFlare2 = RingLensTransform(BaseLens(lightPos, size, distB, 1.0));
|
||||
|
||||
float lensFlare = clamp(lensFlare2 - lensFlare1, 0.0, 1.0);
|
||||
lensFlare *= sqrt(lensFlare);
|
||||
return lensFlare;
|
||||
}
|
||||
|
||||
float AnamorphicLens(vec2 lightPos, float size, float dist) {
|
||||
vec2 lensCoord = abs(texCoord + (lightPos.xy * dist - 0.5)) * vec2(aspectRatio * 0.07, 2.0);
|
||||
float lens = clamp(1.0 - length(pow(lensCoord / (size * fovmult), vec2(0.85))) * 4.0, 0.0, 1.0);
|
||||
lens *= lens * lens;
|
||||
return lens;
|
||||
}
|
||||
|
||||
vec3 RainbowLens(vec2 lightPos, float size, float dist, float rad) {
|
||||
vec2 lensCoord = (texCoord + (lightPos * dist - 0.5)) * vec2(aspectRatio,1.0);
|
||||
float lens = clamp(1.0 - length(lensCoord) / (size * fovmult), 0.0, 1.0);
|
||||
|
||||
vec3 rainbowLens =
|
||||
(smoothstep(0.0, rad, lens) - smoothstep(rad, rad * 2.0, lens)) * vec3(1.0, 0.0, 0.0) +
|
||||
(smoothstep(rad * 0.5, rad * 1.5, lens) - smoothstep(rad * 1.5, rad * 2.5, lens)) * vec3(0.0, 1.0, 0.0) +
|
||||
(smoothstep(rad, rad * 2.0, lens) - smoothstep(rad * 2.0, rad * 3.0, lens)) * vec3(0.0, 0.0, 1.0)
|
||||
;
|
||||
|
||||
return rainbowLens;
|
||||
}
|
||||
|
||||
vec3 LensTint(vec3 lens, float truePos) {
|
||||
float isMoon = truePos * 0.5 + 0.5;
|
||||
|
||||
float visibility = mix(sunVisibility,moonVisibility, isMoon);
|
||||
lens = mix(lens, GetLuminance(lens) * lightNight, isMoon * 0.98);
|
||||
return lens * visibility;
|
||||
}
|
||||
|
||||
void LensFlare(inout vec3 color, vec2 lightPos, float truePos, float multiplier) {
|
||||
float falloffBase = length(lightPos * vec2(aspectRatio, 1.0));
|
||||
float falloffIn = pow(clamp(falloffBase * 10.0, 0.0, 1.0), 2.0);
|
||||
float falloffOut = clamp(falloffBase * 3.0 - 1.5, 0.0, 1.0);
|
||||
|
||||
if (falloffOut < 0.999) {
|
||||
vec3 lensFlare = (
|
||||
BaseLens(lightPos, 0.3, -0.45, 1.0) * vec3(2.2, 1.2, 0.1) * 0.07 +
|
||||
BaseLens(lightPos, 0.3, 0.10, 1.0) * vec3(2.2, 0.4, 0.1) * 0.03 +
|
||||
BaseLens(lightPos, 0.3, 0.30, 1.0) * vec3(2.2, 0.2, 0.1) * 0.04 +
|
||||
BaseLens(lightPos, 0.3, 0.50, 1.0) * vec3(2.2, 0.4, 2.5) * 0.05 +
|
||||
BaseLens(lightPos, 0.3, 0.70, 1.0) * vec3(1.8, 0.4, 2.5) * 0.06 +
|
||||
BaseLens(lightPos, 0.3, 0.95, 1.0) * vec3(0.1, 0.2, 2.5) * 0.10 +
|
||||
|
||||
OverlapLens(lightPos, 0.18, -0.30, -0.41) * vec3(2.5, 1.2, 0.1) * 0.010 +
|
||||
OverlapLens(lightPos, 0.16, -0.18, -0.29) * vec3(2.5, 0.5, 0.1) * 0.020 +
|
||||
OverlapLens(lightPos, 0.15, 0.06, 0.19) * vec3(2.5, 0.2, 0.1) * 0.015 +
|
||||
OverlapLens(lightPos, 0.14, 0.15, 0.28) * vec3(1.8, 0.1, 1.2) * 0.015 +
|
||||
OverlapLens(lightPos, 0.16, 0.24, 0.37) * vec3(1.0, 0.1, 2.5) * 0.015 +
|
||||
|
||||
PointLens(lightPos, 0.03, -0.55) * vec3(2.5, 1.6, 0.0) * 0.20 +
|
||||
PointLens(lightPos, 0.02, -0.40) * vec3(2.5, 1.0, 0.0) * 0.15 +
|
||||
PointLens(lightPos, 0.04, 0.43) * vec3(2.5, 0.6, 0.6) * 0.20 +
|
||||
PointLens(lightPos, 0.02, 0.60) * vec3(0.2, 0.6, 2.5) * 0.15 +
|
||||
PointLens(lightPos, 0.03, 0.67) * vec3(0.2, 1.6, 2.5) * 0.25 +
|
||||
|
||||
RingLens(lightPos, 0.25, 0.43, 0.45) * vec3(0.10, 0.35, 2.50) * 1.5 +
|
||||
RingLens(lightPos, 0.18, 0.98, 0.99) * vec3(0.15, 1.00, 2.55) * 2.5
|
||||
) * (falloffIn - falloffOut) + (
|
||||
AnamorphicLens(lightPos, 1.0, -1.0) * vec3(0.3,0.7,1.0) * 0.35 +
|
||||
RainbowLens(lightPos, 0.525, -1.0, 0.2) * 0.05 +
|
||||
RainbowLens(lightPos, 2.0, 4.0, 0.1) * 0.05
|
||||
) * (1.0 - falloffOut);
|
||||
|
||||
lensFlare = LensTint(lensFlare, truePos);
|
||||
|
||||
color = mix(color, vec3(1.0), lensFlare * multiplier * multiplier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
void Outline(vec3 color, bool secondPass, out vec4 outerOutline, out vec4 innerOutline) {
|
||||
float ph = ceil(viewHeight / 1440.0) / viewHeight;
|
||||
float pw = ph / aspectRatio;
|
||||
|
||||
float oOutlineMask = 1.0, iOutlineMask = 1.0, iBevel = 1.0;
|
||||
vec3 oOutlineColor = vec3(0.0), iOutlineColor = color;
|
||||
|
||||
float z = texture2D(depthtex0, texCoord).r;
|
||||
float linZ = GetLinearDepth(z);
|
||||
float minZ = z, maxZ = z;
|
||||
|
||||
int sampleCount = viewHeight >= 720.0 ? 12 : 4;
|
||||
|
||||
#ifdef RETRO_FILTER
|
||||
ph = RETRO_FILTER_SIZE / viewHeight;
|
||||
pw = ph / aspectRatio;
|
||||
sampleCount = 4;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < sampleCount; i++) {
|
||||
vec2 offset = vec2(pw, ph) * outlineOffsets[i];
|
||||
float linSampleZSum = 0.0, linSampleZDiff = 0.0;
|
||||
|
||||
for (int j = 0; j < 2; j++) {
|
||||
float sampleZ = texture2D(depthtex0, texCoord + offset).r;
|
||||
float linSampleZ = GetLinearDepth(sampleZ);
|
||||
|
||||
#ifdef OUTLINE_OUTER_COLOR
|
||||
if((GetLinearDepth(minZ) - 0.125 / far) > linSampleZ) {
|
||||
oOutlineColor = texture2D(colortex0, texCoord + offset).rgb;
|
||||
}
|
||||
#endif
|
||||
|
||||
linSampleZSum += linSampleZ;
|
||||
if(j == 0) linSampleZDiff = linSampleZ;
|
||||
else linSampleZDiff -= linSampleZ;
|
||||
|
||||
minZ = min(minZ, sampleZ);
|
||||
maxZ = max(maxZ, sampleZ);
|
||||
offset = -offset;
|
||||
}
|
||||
|
||||
#ifdef OUTLINE_OUTER
|
||||
oOutlineMask *= clamp(1.0 - (linZ * 2.0 - linSampleZSum) * far * 0.25, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef OUTLINE_INNER
|
||||
linSampleZSum -= abs(linSampleZDiff) * 0.5;
|
||||
iOutlineMask *= clamp(1.125 + (linZ * 2.0 - linSampleZSum) * 32.0 * far, 0.0, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ALPHA_BLEND == 0
|
||||
oOutlineColor *= oOutlineColor;
|
||||
#endif
|
||||
|
||||
oOutlineColor = sqrt(oOutlineColor) * 0.35;
|
||||
oOutlineColor *= oOutlineColor;
|
||||
oOutlineMask = 1.0 - oOutlineMask;
|
||||
|
||||
iOutlineColor = sqrt(iOutlineColor) * 1.2;
|
||||
iOutlineColor *= iOutlineColor;
|
||||
iOutlineMask = 1.0 - iOutlineMask;
|
||||
|
||||
vec4 viewPos = gbufferProjectionInverse * (vec4(texCoord.x, texCoord.y, minZ, 1.0) * 2.0 - 1.0);
|
||||
viewPos /= viewPos.w;
|
||||
|
||||
if (oOutlineMask > 0.001) {
|
||||
Fog(oOutlineColor, viewPos.xyz);
|
||||
if (isEyeInWater == 1.0 && secondPass) {
|
||||
vec4 waterFog = GetWaterFog(viewPos.xyz);
|
||||
oOutlineColor = mix(oOutlineColor, waterFog.rgb, waterFog.a);
|
||||
}
|
||||
}
|
||||
|
||||
outerOutline = vec4(oOutlineColor, oOutlineMask);
|
||||
innerOutline = vec4(iOutlineColor, iOutlineMask);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
vec3 GetN(int idx) {
|
||||
if (idx == 230) return vec3(2.9114, 2.9497, 2.5845);
|
||||
if (idx == 231) return vec3(0.18299, 0.42108, 1.3734);
|
||||
if (idx == 232) return vec3(1.3456, 0.96521, 0.61722);
|
||||
if (idx == 233) return vec3(3.1071, 3.1812, 2.3230);
|
||||
if (idx == 234) return vec3(0.27105, 0.67693, 1.3164);
|
||||
if (idx == 235) return vec3(1.9100, 1.8300, 1.4400);
|
||||
if (idx == 236) return vec3(2.3757, 2.0847, 1.8453);
|
||||
if (idx == 237) return vec3(0.15943, 0.14512, 0.13547);
|
||||
return vec3(0.0);
|
||||
}
|
||||
|
||||
vec3 GetK(int idx) {
|
||||
if (idx == 230) return vec3(3.0893, 2.9318, 2.7670);
|
||||
if (idx == 231) return vec3(3.4242, 2.3459, 1.7704);
|
||||
if (idx == 232) return vec3(7.4746, 6.3995, 5.3031);
|
||||
if (idx == 233) return vec3(3.3314, 3.3291, 3.1350);
|
||||
if (idx == 234) return vec3(3.6092, 2.6248, 2.2921);
|
||||
if (idx == 235) return vec3(3.5100, 3.4000, 3.1800);
|
||||
if (idx == 236) return vec3(4.2655, 3.7153, 3.1365);
|
||||
if (idx == 237) return vec3(3.9291, 3.1900, 2.3808);
|
||||
return vec3(1.0);
|
||||
}
|
||||
|
||||
vec3 ComplexFresnel(float fresnel, float f0) {
|
||||
int metalidx = int(f0 * 255.0);
|
||||
vec3 k = GetK(metalidx);
|
||||
vec3 n = GetN(metalidx);
|
||||
float f = 1.0 - fresnel;
|
||||
|
||||
vec3 k2 = k * k;
|
||||
vec3 n2 = n * n;
|
||||
float f2 = f * f;
|
||||
|
||||
vec3 rs_num = n2 + k2 - 2 * n * f + f2;
|
||||
vec3 rs_den = n2 + k2 + 2 * n * f + f2;
|
||||
vec3 rs = rs_num / rs_den;
|
||||
|
||||
vec3 rp_num = (n2 + k2) * f2 - 2 * n * f + 1;
|
||||
vec3 rp_den = (n2 + k2) * f2 + 2 * n * f + 1;
|
||||
vec3 rp = rp_num / rp_den;
|
||||
|
||||
vec3 fresnel3 = clamp(0.5 * (rs + rp), vec3(0.0), vec3(1.0));
|
||||
fresnel3 *= fresnel3;
|
||||
|
||||
return fresnel3;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
float GetPuddles(vec3 worldPos, vec2 coord, float skylight, float NoU, float wetness) {
|
||||
if (wetness < 0.001) return 0.0;
|
||||
|
||||
worldPos = (worldPos + cameraPosition) * 0.005;
|
||||
|
||||
float height = texture2DGradARB(normals, coord, dcdx, dcdy).a;
|
||||
height = mix(1.0, height, PARALLAX_DEPTH);
|
||||
height = smoothstep(1.0, 0.95, height) * 0.1 - 0.05;
|
||||
float noise = texture2D(noisetex, worldPos.xz * 0.5 ).r * 0.375;
|
||||
noise+= texture2D(noisetex, worldPos.xz * 0.125).r * 0.625;
|
||||
noise = noise + height + (wetness * REFLECTION_RAIN_AMOUNT - 0.5);
|
||||
|
||||
float puddles = smoothstep(0.4, 0.6, noise);
|
||||
|
||||
#ifdef WEATHER_PERBIOME
|
||||
float weatherWeight = isCold + isDesert + isMesa + isSavanna;
|
||||
puddles *= 1.0 - weatherWeight;
|
||||
#endif
|
||||
|
||||
puddles *= clamp(skylight * 32.0 - 31.0, 0.0, 1.0) * clamp(NoU, 0.0, 1.0);
|
||||
|
||||
return puddles;
|
||||
}
|
||||
|
||||
float rand(vec2 worldPos){
|
||||
return fract(sin(dot(worldPos, vec2(12.9898, 4.1414))) * 43758.5453);
|
||||
}
|
||||
|
||||
vec2 getpos(vec2 i){
|
||||
return vec2(rand(i), rand(i + 1.0)) * 0.5 + 0.25;
|
||||
}
|
||||
|
||||
float GetRipple(vec3 worldPos, vec2 offset) {
|
||||
vec2 ppos = worldPos.xz + offset * 0.1 + frametime * 0.01;
|
||||
ppos = vec2(ppos.x * 0.7 + ppos.y * 0.7, ppos.x * -0.7 + ppos.y * 0.7) * 0.8;
|
||||
vec2 ppossh = ppos + vec2(fract(0.618 * floor(ppos.y)) * sin(frametime * 0.05), 0.0);
|
||||
vec2 pposfr = fract(ppossh);
|
||||
vec2 pposfl = floor(ppossh);
|
||||
|
||||
float val = texture2D(noisetex, ppos / 64.0 + frametime * 0.007).r * 0.125;
|
||||
val += texture2D(noisetex, ppos / 64.0 - frametime * 0.005).r * 0.125;
|
||||
|
||||
float seed = rand(pposfl);
|
||||
float rippleTime = frametime * 1.7 + fract(seed * 1.618);
|
||||
float rippleSeed = seed + floor(rippleTime) * 1.618;
|
||||
vec2 ripplePos = getpos(pposfl + rippleSeed);
|
||||
float ripple = clamp(1.0 - 4.0 * length(pposfr - ripplePos), 0.0, 1.0);
|
||||
ripple = clamp(ripple + fract(rippleTime) - 1.0, 0.0, 1.0);
|
||||
ripple = sin(min(ripple * 6.0 * 3.1415, 3.0 * 3.1415)) * pow(1.0 - fract(rippleTime), 2.0);
|
||||
val += ripple * 0.3;
|
||||
|
||||
//if(pposfr.x < 0.01 || pposfr.y < 0.01) val += 0.85;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
vec3 GetPuddleNormal(vec3 worldPos, vec3 viewPos, mat3 tbn) {
|
||||
vec3 puddlePos = worldPos + cameraPosition;
|
||||
float normalOffset = 0.1;
|
||||
|
||||
float fresnel = pow(clamp(1.0 + dot(normalize(normal), normalize(viewPos)), 0.0, 1.0), 7.5);
|
||||
float normalStrength = 0.35 * (1.0 - fresnel);
|
||||
|
||||
float h1 = GetRipple(puddlePos, vec2( normalOffset, 0.0));
|
||||
float h2 = GetRipple(puddlePos, vec2(-normalOffset, 0.0));
|
||||
float h3 = GetRipple(puddlePos, vec2(0.0, normalOffset));
|
||||
float h4 = GetRipple(puddlePos, vec2(0.0, -normalOffset));
|
||||
|
||||
float xDelta = (h2 - h1) / normalOffset;
|
||||
float yDelta = (h4 - h3) / normalOffset;
|
||||
|
||||
vec3 normalMap = vec3(xDelta, yDelta, 1.0 - (xDelta * xDelta + yDelta * yDelta));
|
||||
normalMap = normalMap * normalStrength + vec3(0.0, 0.0, 1.0 - normalStrength);
|
||||
|
||||
return clamp(normalize(normalMap * tbn), vec3(-1.0), vec3(1.0));
|
||||
}
|
||||
|
||||
void ApplyPuddleToMaterial(float puddles, inout vec4 albedo, inout float smoothness, inout float f0, float porosity) {
|
||||
float puddleSmoothness = sqrt(1.0 - 0.75 * porosity);
|
||||
float puddleDarkening = (0.5 * porosity + 0.15);
|
||||
|
||||
smoothness = mix(smoothness, 1.0, puddles * puddleSmoothness);
|
||||
f0 = max(f0, puddles * 0.02);
|
||||
|
||||
albedo.rgb *= 1.0 - (puddles * puddleDarkening);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
vec3 nvec3(vec4 pos) {
|
||||
return pos.xyz/pos.w;
|
||||
}
|
||||
|
||||
vec4 nvec4(vec3 pos) {
|
||||
return vec4(pos.xyz, 1.0);
|
||||
}
|
||||
|
||||
float cdist(vec2 coord) {
|
||||
return max(abs(coord.x - 0.5), abs(coord.y - 0.5)) * 1.85;
|
||||
}
|
||||
|
||||
#if REFLECTION_MODE == 0
|
||||
float errMult = 1.0;
|
||||
#elif REFLECTION_MODE == 1
|
||||
float errMult = 1.3;
|
||||
#else
|
||||
float errMult = 1.6;
|
||||
#endif
|
||||
|
||||
vec4 Raytrace(sampler2D depthtex, vec3 viewPos, vec3 normal, float dither, out float border,
|
||||
int maxf, float stp, float ref, float inc) {
|
||||
vec3 pos = vec3(0.0);
|
||||
float dist = 0.0;
|
||||
|
||||
#ifdef TAA
|
||||
#if TAA_MODE == 0
|
||||
dither = fract(dither + frameCounter * 0.618);
|
||||
#else
|
||||
dither = fract(dither + frameCounter * 0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 start = viewPos + normal * 0.075;
|
||||
|
||||
vec3 vector = stp * reflect(normalize(viewPos), normalize(normal));
|
||||
viewPos += vector;
|
||||
vec3 tvector = vector;
|
||||
|
||||
int sr = 0;
|
||||
|
||||
for(int i = 0; i < 30; i++) {
|
||||
pos = nvec3(gbufferProjection * nvec4(viewPos)) * 0.5 + 0.5;
|
||||
if (pos.x < -0.05 || pos.x > 1.05 || pos.y < -0.05 || pos.y > 1.05) break;
|
||||
|
||||
vec3 rfragpos = vec3(pos.xy, texture2D(depthtex,pos.xy).r);
|
||||
rfragpos = nvec3(gbufferProjectionInverse * nvec4(rfragpos * 2.0 - 1.0));
|
||||
dist = abs(dot(normalize(start - rfragpos), normal));
|
||||
|
||||
float err = length(viewPos - rfragpos);
|
||||
float lVector = length(vector) * pow(length(tvector), 0.1) * errMult;
|
||||
if (err < lVector) {
|
||||
sr++;
|
||||
if (sr >= maxf) break;
|
||||
tvector -= vector;
|
||||
vector *= ref;
|
||||
}
|
||||
vector *= inc;
|
||||
tvector += vector;
|
||||
viewPos = start + tvector * (0.025 * dither + 0.975);
|
||||
}
|
||||
|
||||
border = cdist(pos.st);
|
||||
|
||||
#ifdef REFLECTION_PREVIOUS
|
||||
//Previous frame reprojection from Chocapic13
|
||||
vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos * 2.0 - 1.0, 1.0);
|
||||
viewPosPrev /= viewPosPrev.w;
|
||||
|
||||
viewPosPrev = gbufferModelViewInverse * viewPosPrev;
|
||||
|
||||
vec4 previousPosition = viewPosPrev + vec4(cameraPosition - previousCameraPosition, 0.0);
|
||||
previousPosition = gbufferPreviousModelView * previousPosition;
|
||||
previousPosition = gbufferPreviousProjection * previousPosition;
|
||||
pos.xy = previousPosition.xy / previousPosition.w * 0.5 + 0.5;
|
||||
#endif
|
||||
|
||||
return vec4(pos, dist);
|
||||
}
|
||||
|
||||
vec4 BasicReflect(vec3 viewPos, vec3 normal, out float border) {
|
||||
vec3 reflectedViewPos = reflect(viewPos, normal) + normal * dot(viewPos, normal) * 0.5;
|
||||
|
||||
vec3 pos = nvec3(gbufferProjection * nvec4(reflectedViewPos)) * 0.5 + 0.5;
|
||||
|
||||
border = cdist(pos.st);
|
||||
|
||||
return vec4(pos, 0.0);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifdef REFLECTION_PREVIOUS
|
||||
#define colortexR colortex5
|
||||
#else
|
||||
#define colortexR colortex0
|
||||
#endif
|
||||
|
||||
vec4 RoughReflection(vec3 viewPos, vec3 normal, float dither, float smoothness) {
|
||||
vec4 color = vec4(0.0);
|
||||
float border = 0.0;
|
||||
|
||||
vec4 pos = Raytrace(depthtex0, viewPos, normal, dither, border, 6, 0.5, 0.1, 1.8);
|
||||
border = clamp(13.333 * (1.0 - border) * (0.9 * smoothness + 0.1), 0.0, 1.0);
|
||||
|
||||
float fovScale = gbufferProjection[1][1] / 1.37;
|
||||
|
||||
if (pos.z < 1.0 - 1e-5) {
|
||||
#ifdef REFLECTION_ROUGH
|
||||
float dist = 0.03125 * pow(1.0 - smoothness, 2.0) * pos.a * fovScale;
|
||||
float lod = log2(viewHeight * dist);
|
||||
#else
|
||||
float lod = 0.0;
|
||||
#endif
|
||||
|
||||
if (lod < 1.0) {
|
||||
color.a = texture2DLod(colortex6, pos.st, 1.0).b;
|
||||
if (color.a > 0.001) color.rgb = texture2DLod(colortexR, pos.st, 1.0).rgb;
|
||||
#ifdef REFLECTION_PREVIOUS
|
||||
color.rgb = pow(color.rgb * 2.0, vec3(8.0));
|
||||
#else
|
||||
#if ALPHA_BLEND == 0
|
||||
color.rgb = pow(color.rgb, vec3(2.2));
|
||||
#endif
|
||||
#endif
|
||||
}else{
|
||||
for(int i = -2; i <= 2; i++) {
|
||||
for(int j = -2; j <= 2; j++) {
|
||||
vec2 refOffset = vec2(i, j) * exp2(lod - 1.0) / vec2(viewWidth, viewHeight);
|
||||
vec2 refCoord = pos.st + refOffset;
|
||||
float alpha = texture2DLod(colortex6, refCoord, lod).b;
|
||||
if (alpha > 0.001) {
|
||||
vec3 ssrSample = texture2DLod(colortexR, refCoord, max(lod - 1.0, 0.0)).rgb;
|
||||
|
||||
#ifdef REFLECTION_PREVIOUS
|
||||
ssrSample = pow(ssrSample * 2.0, vec3(8.0));
|
||||
#else
|
||||
#if ALPHA_BLEND == 0
|
||||
ssrSample = pow(ssrSample, vec3(2.2));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
color.rgb += ssrSample;
|
||||
color.a += alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
color /= 25.0;
|
||||
}
|
||||
|
||||
//Fog(color.rgb, (gbufferProjectionInverse * pos).xyz);
|
||||
|
||||
color *= color.a;
|
||||
color.a = clamp(color.a * 2.0 - 1.0, 0.0, 1.0) * border;
|
||||
// color.a = pos.a * float(border > 0.0);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
vec4 SimpleReflection(vec3 viewPos, vec3 normal, float dither, out float reflectionMask) {
|
||||
vec4 color = vec4(0.0);
|
||||
float border = 0.0;
|
||||
reflectionMask = 0.0;
|
||||
|
||||
vec4 pos = Raytrace(depthtex1, viewPos, normal, dither, border, 4, 1.0, 0.1, 2.0);
|
||||
border = clamp(13.333 * (1.0 - border), 0.0, 1.0);
|
||||
|
||||
#ifdef REFLECTION_SKYBOX
|
||||
float zThreshold = 1.0 + 1e-5;
|
||||
#else
|
||||
float zThreshold = 1.0;
|
||||
#endif
|
||||
|
||||
if (pos.z < zThreshold) {
|
||||
#if MC_VERSION > 10800
|
||||
color = texture2D(gaux2, pos.st);
|
||||
#else
|
||||
color = texture2DLod(gaux2, pos.st, 0);
|
||||
#endif
|
||||
reflectionMask = color.a;
|
||||
|
||||
#ifdef REFLECTION_SKYBOX
|
||||
color.a = 1.0;
|
||||
#endif
|
||||
|
||||
color.a *= border;
|
||||
reflectionMask *= border;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
vec4 DHReflection(vec3 viewPos, vec3 normal, float dither, out float reflectionMask) {
|
||||
vec4 color = vec4(0.0);
|
||||
float border = 0.0;
|
||||
reflectionMask = 0.0;
|
||||
|
||||
vec4 pos = BasicReflect(viewPos, normal, border);
|
||||
border = clamp(13.333 * (1.0 - border), 0.0, 1.0);
|
||||
|
||||
#ifdef REFLECTION_SKYBOX
|
||||
float zThreshold = 1.0 + 1e-5;
|
||||
#else
|
||||
float zThreshold = 1.0;
|
||||
#endif
|
||||
|
||||
if (pos.z < zThreshold) {
|
||||
#if MC_VERSION > 10800
|
||||
color = texture2D(gaux2, pos.st);
|
||||
#else
|
||||
color = texture2DLod(gaux2, pos.st, 0);
|
||||
#endif
|
||||
reflectionMask = color.a;
|
||||
|
||||
#ifdef REFLECTION_SKYBOX
|
||||
color.a = 1.0;
|
||||
#endif
|
||||
|
||||
color.a *= border;
|
||||
reflectionMask *= border;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -0,0 +1,488 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
/*
|
||||
You can edit this file to enable, disable, and tweak features.
|
||||
Make sure to make a copy of this file before editing as backup.
|
||||
|
||||
#define with a name only is a toggleable feature.
|
||||
Adding double slash (//) disables a feature
|
||||
#define FEATURE -> feature is enabled
|
||||
//#define FEATURE -> feature is disabled
|
||||
|
||||
#define with a name and value is either a multi option feature or a parameter.
|
||||
Parameter tends to contain lots of values, some starts with const int/float.
|
||||
Use the values provided within the squared bracket comment (//[...]),
|
||||
Do not add double slash on these lines, as it may cause errors.
|
||||
#define MULTI_OPTION_FEATURE 0 //[0 1 2] -> 0 is the current value
|
||||
#define PARAMETER 1.00 //[0.00 0.25 ... 1.75 2.00] -> 1.00 is the current value
|
||||
|
||||
Read lang/en_US.lang to get the description of what every option does.
|
||||
Please don't edit anything from Undefine section and onwards.
|
||||
*/
|
||||
|
||||
//Shader Options//
|
||||
|
||||
#define ABOUT 0 //[0]
|
||||
|
||||
//Lighting//
|
||||
#define SHADOW
|
||||
const int shadowMapResolution = 2048; //[512 1024 1536 2048 3072 4096 8192]
|
||||
const float shadowDistance = 256.0; //[128.0 192.0 256.0 384.0 512.0 768.0 1024.0]
|
||||
#define SHADOW_COLOR
|
||||
#define SHADOW_FILTER
|
||||
const float sunPathRotation = -40.0; //[-85.0 -80.0 -75.0 -70.0 -65.0 -60.0 -55.0 -50.0 -45.0 -40.0 -35.0 -30.0 -25.0 -20.0 -15.0 -10.0 -5.0 0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 80.0 85.0]
|
||||
const float shadowMapBias = 1.0 - 25.6 / shadowDistance;
|
||||
|
||||
#define SHADOW_ENTITY
|
||||
#define SHADOW_BLOCK_ENTITY
|
||||
#define SHADOW_VEGETATION
|
||||
#define SHADOW_CLOUD
|
||||
#define SHADOW_BIAS 0 //[0 1]
|
||||
#define SHADOW_PIXEL 0 //[0 16 32 64 128]
|
||||
|
||||
#define AO
|
||||
#define AO_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define DESATURATION
|
||||
#define DESATURATION_FACTOR 1.5 //[2.0 1.5 1.0 0.5 0.0]
|
||||
#define MULTICOLORED_BLOCKLIGHT
|
||||
//#define DYNAMIC_HANDLIGHT
|
||||
//#define WHITE_WORLD
|
||||
|
||||
#define MCBL_ANTI_BLEED
|
||||
//#define MCBL_LEGACY_COLOR
|
||||
|
||||
//Material//
|
||||
//#define ADVANCED_MATERIALS
|
||||
#define MATERIAL_FORMAT 1 //[0 1 2]
|
||||
|
||||
#define REFLECTION 2 //[0 1 2]
|
||||
#define REFLECTION_TRANSLUCENT
|
||||
#define REFLECTION_SPECULAR
|
||||
#define REFLECTION_ROUGH
|
||||
#define REFLECTION_RAIN
|
||||
#define REFLECTION_RAIN_AMOUNT 1.0 //[0.4 0.5 0.6 0.7 1.0]
|
||||
//#define REFLECTION_PREVIOUS
|
||||
//#define SPECULAR_HIGHLIGHT_ROUGH
|
||||
//#define ALBEDO_METAL
|
||||
#define REFLECTION_MODE 1 //[0 1 2]
|
||||
#define REFLECTION_SKY_FALLOFF 1 //[1 2 4 8 16]
|
||||
//#define REFLECTION_SKYBOX
|
||||
|
||||
#define PARALLAX
|
||||
#define PARALLAX_DEPTH 0.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50]
|
||||
#define PARALLAX_QUALITY 128 //[16 32 64 128 256 512]
|
||||
#define PARALLAX_DISTANCE 64 //[8 16 32 48 64 80 96 112 128]
|
||||
#define SELF_SHADOW
|
||||
#define SELF_SHADOW_ANGLE 2.0 //[0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0]
|
||||
#define SELF_SHADOW_QUALITY 8 //[8 16 32]
|
||||
#define SELF_SHADOW_STRENGTH 16 //[4 8 16 32 64]
|
||||
//#define DIRECTIONAL_LIGHTMAP
|
||||
#define DIRECTIONAL_LIGHTMAP_STRENGTH 1.0 //[2.0 1.4 1.0 0.7 0.5]
|
||||
#define GENERATED_NORMALS
|
||||
#define GENERATED_NORMAL_MULT 100 //[25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 250 300 400]
|
||||
#define GENERATED_NORMAL_THRESHOLD 0.05 //[0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20]
|
||||
#define GENERATED_NORMAL_CLAMP 0.20 //[0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40]
|
||||
#define GENERATED_NORMAL_RESOLUTION 128 //[16 32 64 128 256 512]
|
||||
#define NORMAL_DAMPENING
|
||||
#define NORMAL_PLANTS
|
||||
|
||||
#define SSS
|
||||
#define BASIC_SSS
|
||||
#define EMISSIVE 2 //[0 1 2]
|
||||
#define REFRACTION 0 //[0 1 2]
|
||||
#define ALBEDO_BALANCING
|
||||
#define ALPHA_BLEND 0 //[0 1]
|
||||
#define ENTITY_FLASH
|
||||
|
||||
//Atmospherics//
|
||||
#define LIGHT_SHAFT
|
||||
#define LIGHT_SHAFT_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define WEATHER_PERBIOME
|
||||
#define WEATHER
|
||||
#define WEATHER_OPACITY 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00]
|
||||
|
||||
#define SKY_DENSITY_D 0.35 //[0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00]
|
||||
#define SKY_EXPOSURE_D 0.00 //[-1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00]
|
||||
#define SKY_DENSITY_N 0.65 //[0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00]
|
||||
#define SKY_EXPOSURE_N 0.00 //[-1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00]
|
||||
#define SKY_DENSITY_W 1.50 //[1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00]
|
||||
#define SKY_EXPOSURE_W 0.00 //[-1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00]
|
||||
#define SKY_HORIZON_N 1.00 //[0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50]
|
||||
#define SKY_HORIZON_F 1.50 //[0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50]
|
||||
#define SKY_DESATURATION
|
||||
#define SKY_GROUND 2 //[0 1 2]
|
||||
//#define UNDERGROUND_SKY
|
||||
//#define SHADER_END_SKY
|
||||
//#define SKY_DEFERRED
|
||||
|
||||
#define CLOUDS 2 //[0 1 2 3]
|
||||
#define CLOUD_BASE 0 //[0 1]
|
||||
#define CLOUD_DENSITY 4 //[1 2 4 6 8]
|
||||
#define CLOUD_AMOUNT 10.0 //[12.0 11.0 10.0 9.0 8.0]
|
||||
#define CLOUD_HEIGHT 10.0 //[5.0 7.5 10.0 12.5 15.0]
|
||||
#define CLOUD_THICKNESS 5 //[2 4 5 7 10]
|
||||
#define CLOUD_DETAIL 1.0 //[0.3 0.7 1.0 1.3 1.7]
|
||||
#define CLOUD_SPEED 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.50 3.00 3.50 4.00]
|
||||
#define CLOUD_OPACITY 1.0 //[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
#define CLOUD_BRIGHTNESS 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define CLOUD_VOLUMETRIC_SCALE 12.4 //[6.0 12.4 16.0]
|
||||
|
||||
#define FOG_DENSITY 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_HEIGHT
|
||||
#define FAR_VANILLA_FOG 2 //[0 1 2 3]
|
||||
|
||||
#define FOG_DENSITY_NIGHT 4.00 //[1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00]
|
||||
#define FOG_DENSITY_WEATHER 1.50 //[1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_DENSITY_COLD 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_DENSITY_DRY 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_DENSITY_DAMP 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_DENSITY_INDOOR 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_DENSITY_DH 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00]
|
||||
|
||||
#define FOG_HEIGHT_Y 62 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 62 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 136 144 152 160 168 172 180 188 192]
|
||||
#define FOG_HEIGHT_FALLOFF 7.00 //[3.00 3.50 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00]
|
||||
|
||||
#define FAR_VANILLA_FOG_STYLE 0 //[0 1]
|
||||
#define FOG_DENSITY_VANILLA 1.00 //[0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00]
|
||||
#define FOG_VANILLA_CLOUD 3 //[0 1 2 3]
|
||||
|
||||
//#define ROUND_SUN_MOON
|
||||
#define ROUND_SUN_MOON_SIZE 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50]
|
||||
#define STARS
|
||||
//#define AURORA
|
||||
#define SKYBOX_INTENSITY 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define SKYBOX_OPACITY 0.50 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00]
|
||||
#define SUN_INTENSITY 1.50 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00]
|
||||
#define MOON_INTENSITY 1.50 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00]
|
||||
|
||||
//Water//
|
||||
#define WATER_MODE 0 //[0 1 2 3]
|
||||
#define WATER_ALPHA_MODE 0 //[0 1]
|
||||
#define WATER_SHADOW_MODE 0 //[0 1 2 3]
|
||||
#define WATER_NORMALS 1 //[0 1 2]
|
||||
#define WATER_PARALLAX
|
||||
//#define WATER_SHADOW_COLOR
|
||||
//#define WATER_CAUSTICS
|
||||
#define WATER_BUMP 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define WATER_DETAIL 0.25 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50]
|
||||
#define WATER_SHARPNESS 0.2 //[0.8 0.5 0.2]
|
||||
#define WATER_SPEED 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.50 3.00 3.50 4.00]
|
||||
#define WATER_FOG 0 //[0 1]
|
||||
#define WATER_FOG_DENSITY 1.00 //[0.25 0.50 0.75 1.00 1.50 2.00 2.50 3.00 3.50 4.00]
|
||||
#define WATER_CAUSTICS_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define WATER_PIXEL 0 //[0 16 32 64 128]
|
||||
|
||||
//Post Effects//
|
||||
//#define DOF
|
||||
#define DOF_STRENGTH 8.0 //[1.0 2.0 4.0 8.0 16.0 32.0 64.0 128.0 256.0 384.0 512.0]
|
||||
//#define MOTION_BLUR
|
||||
#define MOTION_BLUR_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define BLOOM
|
||||
#define BLOOM_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00]
|
||||
#define BLOOM_CONTRAST 0 //[-4 -3 -2 -1 0 1 2 3 4]
|
||||
#define BLOOM_RADIUS 5 //[1 2 3 4 5 6 7]
|
||||
#define LENS_FLARE
|
||||
#define LENS_FLARE_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
#define VIGNETTE
|
||||
#define VIGNETTE_STRENGTH 1.06 //[0.26 0.51 0.72 0.91 1.06 1.19 1.28 1.36 1.40 1.41]
|
||||
//#define DIRTY_LENS
|
||||
#define CHROMATIC_ABERRATION 0 //[0 1 2]
|
||||
#define UNDERWATER_DISTORTION
|
||||
|
||||
//Anti-aliasing
|
||||
#define FXAA
|
||||
//#define TAA
|
||||
|
||||
#define FXAA_SUBPIXEL 0.75 //[0.00 0.25 0.50 0.75 1.00]
|
||||
#define FXAA_EDGE_SENSITIVITY 1 //[0 1 2]
|
||||
|
||||
#define TAA_MODE 0 //[0 1]
|
||||
//#define TAA_SELECTIVE
|
||||
|
||||
//Color//
|
||||
#define LIGHT_MR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_MG 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_MB 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_MI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define AMBIENT_MR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_MG 204 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_MB 144 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_MI 0.35 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define LIGHT_DR 196 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_DG 220 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_DB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_DI 1.40 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define AMBIENT_DR 120 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_DG 172 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_DB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_DI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define LIGHT_ER 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_EG 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_EB 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_EI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define AMBIENT_ER 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_EG 204 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_EB 144 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_EI 0.35 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define LIGHT_NR 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_NG 192 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_NB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define LIGHT_NI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define AMBIENT_NR 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_NG 192 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_NB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AMBIENT_NI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define MINLIGHT_R 128 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define MINLIGHT_G 128 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define MINLIGHT_B 128 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define MINLIGHT_I 0.70 //[0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00]
|
||||
|
||||
#define BLOCKLIGHT_R 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define BLOCKLIGHT_G 212 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define BLOCKLIGHT_B 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define BLOCKLIGHT_I 0.85 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define SKY_R 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define SKY_G 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define SKY_B 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define SKY_I 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WATER_R 64 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WATER_G 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WATER_B 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WATER_I 0.35 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
#define WATER_A 0.70 //[0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00]
|
||||
#define WATER_F 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_RR 176 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_RG 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_RB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_RI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_CR 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_CG 240 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_CB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_CI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_DR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_DG 232 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_DB 180 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_DI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_BR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_BG 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_BB 176 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_BI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_SR 200 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_SG 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_SB 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_SI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_MR 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_MG 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_MB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_MI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_VR 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_VG 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_VB 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_VI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define WEATHER_JR 176 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_JG 232 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_JB 232 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define WEATHER_JI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define AURORA_LR 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AURORA_LG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AURORA_LB 180 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AURORA_LI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define AURORA_HR 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AURORA_HG 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AURORA_HB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define AURORA_HI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define NETHER_NR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_NG 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_NB 32 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_NI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define NETHER_VR 104 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_VG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_VB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_VI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define NETHER_CR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_CG 32 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_CB 24 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_CI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define NETHER_WR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_WG 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_WB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_WI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define NETHER_BR 236 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_BG 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_BB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define NETHER_BI 0.55 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define END_R 192 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define END_G 196 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define END_B 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define END_I 0.90 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
//#define SKY_VANILLA
|
||||
#define SKY_VANILLA_USE_FOG
|
||||
//#define NETHER_VANILLA
|
||||
//#define EMISSIVE_RECOLOR
|
||||
|
||||
//Tonemap & Color Grading//
|
||||
#define EXPOSURE 0.00 //[-2.00 -1.75 -1.50 -1.25 -1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00]
|
||||
|
||||
//#define AUTO_EXPOSURE
|
||||
//#define CLASSIC_EXPOSURE
|
||||
#define AUTO_EXPOSURE_RADIUS 0.7 //[0.002 0.04 0.18 0.35 0.7]
|
||||
#define AUTO_EXPOSURE_SPEED 0.033 //[0.0033 0.01 0.033 0.1 0.33]
|
||||
|
||||
//#define COLOR_GRADING
|
||||
|
||||
#define TONEMAP_LOWER_CURVE 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5]
|
||||
#define TONEMAP_UPPER_CURVE 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5]
|
||||
#define TONEMAP_WHITE_CURVE 2.0 //[1.0 1.5 2.0 2.5 3.0 3.5 4.0]
|
||||
#define TONEMAP_WHITE_PATH 1.00 //[0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00]
|
||||
|
||||
#define SATURATION 1.00 //[0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00]
|
||||
#define VIBRANCE 1.00 //[0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00]
|
||||
|
||||
#define CG_RR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_RG 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_RB 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_RI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
#define CG_RM 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_RC 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define CG_GR 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_GG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_GB 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_GI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
#define CG_GM 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_GC 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define CG_BR 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_BG 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_BB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_BI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
#define CG_BM 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_BC 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
|
||||
#define CG_TR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_TG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_TB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255]
|
||||
#define CG_TI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00]
|
||||
#define CG_TM 0.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
|
||||
//Extras//
|
||||
#define OUTLINE 0 //[0 1 2 3 4]
|
||||
//#define TOON_LIGHTMAP
|
||||
//#define RETRO_FILTER
|
||||
#define RETRO_FILTER_SIZE 2 //[2 3 4 5 6 7 8]
|
||||
//#define WORLD_CURVATURE
|
||||
#define WORLD_CURVATURE_SIZE 256 //[-256 -512 -1024 -2048 -4096 4096 2048 1024 512 256 128 64 32 16]
|
||||
|
||||
//Animations//
|
||||
//#define WORLD_TIME_ANIMATION
|
||||
#define ANIMATION_SPEED 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.50 3.00 3.50 4.00 5.00 6.00 7.00 8.00]
|
||||
#define WAVING_GRASS
|
||||
#define WAVING_CROP
|
||||
#define WAVING_PLANT
|
||||
#define WAVING_TALL_PLANT
|
||||
#define WAVING_LEAF
|
||||
#define WAVING_VINE
|
||||
#define WAVING_WATER
|
||||
#define WAVING_LAVA
|
||||
#define WAVING_FIRE
|
||||
#define WAVING_LANTERN
|
||||
|
||||
//Undefine//
|
||||
#ifdef NETHER
|
||||
#undef LIGHT_SHAFT
|
||||
#undef LENS_FLARE
|
||||
#undef SKY_VANILLA
|
||||
#undef REFLECTION_RAIN
|
||||
#endif
|
||||
|
||||
#ifdef END
|
||||
#undef LENS_FLARE
|
||||
#undef REFLECTION_RAIN
|
||||
#endif
|
||||
|
||||
#ifndef SHADOW
|
||||
#undef LIGHT_SHAFT
|
||||
#endif
|
||||
|
||||
//Outline Params//
|
||||
#if OUTLINE > 0
|
||||
#define OUTLINE_ENABLED
|
||||
#endif
|
||||
|
||||
#if OUTLINE == 1
|
||||
#define OUTLINE_OUTER
|
||||
#endif
|
||||
|
||||
#if OUTLINE == 2
|
||||
#define OUTLINE_OUTER
|
||||
#define OUTLINE_OUTER_COLOR
|
||||
#endif
|
||||
|
||||
#if OUTLINE == 3
|
||||
#define OUTLINE_OUTER
|
||||
#define OUTLINE_OUTER_COLOR
|
||||
#define OUTLINE_INNER
|
||||
#endif
|
||||
|
||||
#if OUTLINE == 4
|
||||
#define OUTLINE_INNER
|
||||
#endif
|
||||
|
||||
//Retro Filter Removes AA//
|
||||
#ifdef RETRO_FILTER
|
||||
#undef FXAA
|
||||
#undef TAA
|
||||
#endif
|
||||
|
||||
//Normal Skip for 1.15 - 1.16 G7//
|
||||
#if MC_VERSION >= 11500 && MC_VERSION < 11605
|
||||
#define NORMAL_SKIP
|
||||
#endif
|
||||
|
||||
//Multi-colored Unavailable on 1.16.5 and below//
|
||||
#if MC_VERSION < 11605
|
||||
// #undef MULTICOLORED_BLOCKLIGHT //not working properly for some reason
|
||||
#endif
|
||||
|
||||
//Show In Shader Options//
|
||||
#ifdef SHADOW_ENTITY
|
||||
#endif
|
||||
|
||||
#ifdef SHADOW_BLOCK_ENTITY
|
||||
#endif
|
||||
|
||||
#ifdef TAA_SELECTIVE
|
||||
#endif
|
||||
|
||||
#ifdef SKY_DEFERRED
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
mat3 GetLightmapTBN(vec3 viewPos) {
|
||||
mat3 lightmapTBN = mat3(normalize(dFdx(viewPos)), normalize(dFdy(viewPos)), vec3(0.0));
|
||||
lightmapTBN[2] = cross(lightmapTBN[0], lightmapTBN[1]);
|
||||
|
||||
return lightmapTBN;
|
||||
}
|
||||
|
||||
float DirectionalLightmap(float lightmap, float lightmapRaw, vec3 normal, mat3 lightmapTBN) {
|
||||
if (lightmap < 0.001) return lightmap;
|
||||
|
||||
vec2 deriv = vec2(dFdx(lightmapRaw), dFdy(lightmapRaw)) * 256.0;
|
||||
vec3 dir = normalize(vec3(
|
||||
deriv.x * lightmapTBN[0] +
|
||||
0.0005 * lightmapTBN[2] +
|
||||
deriv.y * lightmapTBN[1]
|
||||
));
|
||||
|
||||
float pwr = clamp(dot(normal, dir), -1.0, 1.0);
|
||||
if (abs(pwr) > 0.0)
|
||||
pwr = pow(abs(pwr), DIRECTIONAL_LIGHTMAP_STRENGTH) * sign(pwr) * lightmap;
|
||||
if (length(deriv) > 0.001)
|
||||
lightmap = pow(lightmap, max(1.0 - pwr, 0.001));
|
||||
|
||||
return lightmap;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
const float normalThreshold = GENERATED_NORMAL_THRESHOLD;
|
||||
const float normalClamp = GENERATED_NORMAL_CLAMP;
|
||||
const float packSizeGN = GENERATED_NORMAL_RESOLUTION;
|
||||
|
||||
#ifndef GBUFFERS_HAND
|
||||
const float normalMult = GENERATED_NORMAL_MULT * 0.05;
|
||||
#else
|
||||
const float normalMult = GENERATED_NORMAL_MULT * 0.03;
|
||||
#endif
|
||||
|
||||
float GetDif(float lOriginalAlbedo, vec2 offsetCoord) {
|
||||
#ifndef GBUFFERS_WATER
|
||||
float lNearbyAlbedo = length(texture2D(texture, offsetCoord).rgb);
|
||||
#else
|
||||
vec4 textureSample = texture2D(texture, offsetCoord);
|
||||
float lNearbyAlbedo = length(textureSample.rgb * textureSample.a * 1);
|
||||
#endif
|
||||
|
||||
#ifdef GBUFFERS_ENTITIES
|
||||
lOriginalAlbedo = abs(lOriginalAlbedo - 1.0);
|
||||
lNearbyAlbedo = abs(lNearbyAlbedo - 1.0);
|
||||
#endif
|
||||
|
||||
float dif = lOriginalAlbedo - lNearbyAlbedo;
|
||||
|
||||
#ifdef GBUFFERS_ENTITIES
|
||||
dif = -dif;
|
||||
#endif
|
||||
|
||||
#ifndef GBUFFERS_WATER
|
||||
if (dif > 0.0) dif = max(dif - normalThreshold, 0.0);
|
||||
else dif = min(dif + normalThreshold, 0.0);
|
||||
#endif
|
||||
|
||||
return clamp(dif, -normalClamp, normalClamp);
|
||||
}
|
||||
|
||||
void GenerateNormals(inout vec3 normal, vec3 color) {
|
||||
#ifndef ENTITY_GN_AND_CT
|
||||
#if defined GBUFFERS_ENTITIES || defined GBUFFERS_HAND
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec2 absMidCoordPos2 = absMidCoordPos * 4.0;
|
||||
float lOriginalAlbedo = length(color.rgb);
|
||||
|
||||
float normalMult = max0(1 - mipDelta) * normalMult;
|
||||
|
||||
#ifndef SAFER_GENERATED_NORMALS
|
||||
vec2 offsetR = 16.0 / atlasSizeM;
|
||||
#else
|
||||
vec2 offsetR = max(absMidCoordPos2.x, absMidCoordPos2.y) * vec2(float(atlasSizeM.y) / float(atlasSizeM.x), 1);
|
||||
#endif
|
||||
offsetR /= packSizeGN;
|
||||
|
||||
vec2 midCoord = texCoord - midCoordPos;
|
||||
vec2 maxOffsetCoord = midCoord + absMidCoordPos;
|
||||
vec2 minOffsetCoord = midCoord - absMidCoordPos;
|
||||
if (normalMult > 0.0) {
|
||||
vec3 normalMap = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
vec2 offsetCoord = texCoord + vec2( 0.0, offsetR.y);
|
||||
if (offsetCoord.y < maxOffsetCoord.y)
|
||||
normalMap.y += GetDif(lOriginalAlbedo, offsetCoord);
|
||||
|
||||
offsetCoord = texCoord + vec2( offsetR.x, 0.0);
|
||||
if (offsetCoord.x < maxOffsetCoord.x)
|
||||
normalMap.x += GetDif(lOriginalAlbedo, offsetCoord);
|
||||
|
||||
offsetCoord = texCoord + vec2( 0.0,-offsetR.y);
|
||||
if (offsetCoord.y > minOffsetCoord.y)
|
||||
normalMap.y -= GetDif(lOriginalAlbedo, offsetCoord);
|
||||
|
||||
offsetCoord = texCoord + vec2(-offsetR.x, 0.0);
|
||||
if (offsetCoord.x > minOffsetCoord.x)
|
||||
normalMap.x -= GetDif(lOriginalAlbedo, offsetCoord);
|
||||
|
||||
normalMap.xy *= normalMult;
|
||||
normalMap.xy = clamp(normalMap.xy, vec2(-1.0), vec2(1.0));
|
||||
|
||||
if (normalMap.xy != vec2(0.0, 0.0))
|
||||
normal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//GGX area light approximation from Decima Engine: Advances in Lighting and AA presentation
|
||||
float GetNoHSquared(float radiusTan, float NoL, float NoV, float VoL) {
|
||||
float radiusCos = 1.0 / sqrt(1.0 + radiusTan * radiusTan);
|
||||
|
||||
float RoL = 2.0 * NoL * NoV - VoL;
|
||||
if (RoL >= radiusCos)
|
||||
return 1.0;
|
||||
|
||||
float rOverLengthT = radiusCos * radiusTan / sqrt(1.0 - RoL * RoL);
|
||||
float NoTr = rOverLengthT * (NoV - RoL * NoL);
|
||||
float VoTr = rOverLengthT * (2.0 * NoV * NoV - 1.0 - RoL * VoL);
|
||||
|
||||
float triple = sqrt(clamp(1.0 - NoL * NoL - NoV * NoV - VoL * VoL + 2.0 * NoL * NoV * VoL, 0.0, 1.0));
|
||||
|
||||
float NoBr = rOverLengthT * triple, VoBr = rOverLengthT * (2.0 * triple * NoV);
|
||||
float NoLVTr = NoL * radiusCos + NoV + NoTr, VoLVTr = VoL * radiusCos + 1.0 + VoTr;
|
||||
float p = NoBr * VoLVTr, q = NoLVTr * VoLVTr, s = VoBr * NoLVTr;
|
||||
float xNum = q * (-0.5 * p + 0.25 * VoBr * NoLVTr);
|
||||
float xDenom = p * p + s * ((s - 2.0 * p)) + NoLVTr * ((NoL * radiusCos + NoV) * VoLVTr * VoLVTr +
|
||||
q * (-0.5 * (VoLVTr + VoL * radiusCos) - 0.5));
|
||||
float twoX1 = 2.0 * xNum / (xDenom * xDenom + xNum * xNum);
|
||||
float sinTheta = twoX1 * xDenom;
|
||||
float cosTheta = 1.0 - twoX1 * xNum;
|
||||
NoTr = cosTheta * NoTr + sinTheta * NoBr;
|
||||
VoTr = cosTheta * VoTr + sinTheta * VoBr;
|
||||
|
||||
float newNoL = NoL * radiusCos + NoTr;
|
||||
float newVoL = VoL * radiusCos + VoTr;
|
||||
float NoH = NoV + newNoL;
|
||||
float HoH = 2.0 * newVoL + 2.0;
|
||||
return clamp(NoH * NoH / HoH, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float GGXTrowbridgeReitz(float NoHsqr, float roughness){
|
||||
float roughnessSqr = roughness * roughness;
|
||||
float distr = NoHsqr * (roughnessSqr - 1.0) + 1.0;
|
||||
return roughnessSqr / (3.14159 * distr * distr);
|
||||
}
|
||||
|
||||
float SchlickGGX(float NoL, float NoV, float roughness){
|
||||
float k = roughness * 0.5;
|
||||
|
||||
float smithL = 0.5 / (NoL * (1.0 - k) + k);
|
||||
float smithV = 0.5 / (NoV * (1.0 - k) + k);
|
||||
|
||||
return smithL * smithV;
|
||||
}
|
||||
|
||||
vec3 SphericalGaussianFresnel(float HoL, vec3 baseReflectance){
|
||||
float fresnel = exp2(((-5.55473 * HoL) - 6.98316) * HoL);
|
||||
return fresnel * (1.0 - baseReflectance) + baseReflectance;
|
||||
}
|
||||
|
||||
vec3 GGX(vec3 normal, vec3 viewPos, float smoothness, vec3 baseReflectance, float sunSize) {
|
||||
float roughness = max(1.0 - smoothness, 0.025); roughness *= roughness;
|
||||
viewPos = -viewPos;
|
||||
|
||||
vec3 halfVec = normalize(lightVec + viewPos);
|
||||
|
||||
float HoL = clamp(dot(halfVec, lightVec), 0.0, 1.0);
|
||||
float NoL = clamp(dot(normal, lightVec), 0.0, 1.0);
|
||||
float NoV = clamp(dot(normal, viewPos), -1.0, 1.0);
|
||||
float VoL = dot(lightVec, viewPos);
|
||||
|
||||
float NoHsqr = GetNoHSquared(sunSize, NoL, NoV, VoL);
|
||||
if (NoV < 0.0){
|
||||
NoHsqr = dot(normal, halfVec);
|
||||
NoHsqr *= NoHsqr;
|
||||
}
|
||||
NoV = max(NoV, 0.0);
|
||||
|
||||
float D = GGXTrowbridgeReitz(NoHsqr, roughness);
|
||||
vec3 F = SphericalGaussianFresnel(HoL, baseReflectance);
|
||||
float G = SchlickGGX(NoL, NoV, roughness);
|
||||
|
||||
float Fl = max(length(F), 0.001);
|
||||
vec3 Fn = F / Fl;
|
||||
|
||||
float specular = D * Fl * G;
|
||||
vec3 specular3 = specular / (1.0 + 0.03125 / 4.0 * specular) * Fn * NoL;
|
||||
|
||||
#ifndef SPECULAR_HIGHLIGHT_ROUGH
|
||||
specular3 *= 1.0 - roughness * roughness;
|
||||
#endif
|
||||
|
||||
return specular3;
|
||||
}
|
||||
|
||||
vec3 GetSpecularHighlight(vec3 normal, vec3 viewPos, float smoothness, vec3 baseReflectance,
|
||||
vec3 specularColor, vec3 shadow, float smoothLighting) {
|
||||
if (dot(shadow, shadow) < 0.00001) return vec3(0.0);
|
||||
#ifndef SPECULAR_HIGHLIGHT_ROUGH
|
||||
if (smoothness < 0.00002) return vec3(0.0);
|
||||
#endif
|
||||
|
||||
smoothLighting *= smoothLighting;
|
||||
|
||||
#ifdef END
|
||||
smoothness *= 0.75;
|
||||
#endif
|
||||
|
||||
vec3 specular = GGX(normal, normalize(viewPos), smoothness, baseReflectance,
|
||||
(0.025 * sunVisibility + 0.05) * ROUND_SUN_MOON_SIZE);
|
||||
specular *= shadow * shadowFade * smoothLighting;
|
||||
specular *= (1.0 - rainStrength) * (1.0 - rainStrength);
|
||||
|
||||
return specular * specularColor;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
void GetMaterials(out float smoothness, out float skyOcclusion, out vec3 normal, out vec3 fresnel3,
|
||||
vec2 coord) {
|
||||
vec3 specularData = texture2D(colortex3, coord).rgb;
|
||||
|
||||
smoothness = specularData.r;
|
||||
smoothness *= smoothness;
|
||||
smoothness /= 2.0 - smoothness;
|
||||
|
||||
skyOcclusion = specularData.g;
|
||||
#if REFLECTION_SKY_FALLOFF > 1
|
||||
skyOcclusion = clamp(1.0 - (1.0 - skyOcclusion) * REFLECTION_SKY_FALLOFF, 0.0, 1.0);
|
||||
#endif
|
||||
skyOcclusion *= skyOcclusion;
|
||||
|
||||
normal = DecodeNormal(texture2D(colortex6, coord).xy);
|
||||
|
||||
fresnel3 = texture2D(colortex7, coord).rgb * smoothness;
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
void GetMaterials(out float smoothness, out float metalness, out float f0, inout float emission,
|
||||
inout float subsurface, out float porosity, out float ao, out vec3 normalMap,
|
||||
vec2 newCoord, vec2 dcdx, vec2 dcdy)
|
||||
{
|
||||
float emissionMat = 0.0;
|
||||
|
||||
|
||||
|
||||
#if MATERIAL_FORMAT == 0
|
||||
#ifdef PARALLAX
|
||||
vec4 specularMap = texture2DGradARB(specular, newCoord, dcdx, dcdy);
|
||||
#else
|
||||
vec4 specularMap = texture2D(specular, texCoord);
|
||||
#endif
|
||||
|
||||
smoothness = specularMap.r;
|
||||
|
||||
f0 = 0.04;
|
||||
metalness = specularMap.g;
|
||||
|
||||
emissionMat = specularMap.b * specularMap.b;
|
||||
|
||||
porosity = 0.5 - 0.5 * smoothness;
|
||||
subsurface = specularMap.a > 0.0 ? 1.0 - specularMap.a : 0.0;
|
||||
|
||||
#ifdef PARALLAX
|
||||
normalMap = texture2DGradARB(normals, newCoord, dcdx, dcdy).xyz * 2.0 - 1.0;
|
||||
#else
|
||||
normalMap = texture2D(normals, texCoord).xyz * 2.0 - 1.0;
|
||||
#endif
|
||||
ao = 1.0;
|
||||
|
||||
if (normalMap.x + normalMap.y < -1.999) normalMap = vec3(0.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#if MATERIAL_FORMAT == 1
|
||||
vec4 specularMap = texture2DLod(specular, newCoord, 0);
|
||||
smoothness = specularMap.r;
|
||||
|
||||
f0 = specularMap.g;
|
||||
metalness = f0 >= 0.9 ? 1.0 : 0.0;
|
||||
|
||||
emissionMat = specularMap.a < 1.0 ? clamp(specularMap.a * 1.004 - 0.004, 0.0, 1.0) : 0.0;
|
||||
emissionMat *= emissionMat;
|
||||
|
||||
porosity = specularMap.b <= 0.251 ? specularMap.b * 3.984 : 0.0;
|
||||
subsurface = specularMap.b > 0.251 ? clamp(specularMap.b * 1.335 - 0.355, 0.0, 1.0) : 0.0;
|
||||
|
||||
#ifdef PARALLAX
|
||||
normalMap = vec3(texture2DGradARB(normals, newCoord, dcdx, dcdy).xy, 0.0) * 2.0 - 1.0;
|
||||
ao = texture2DGradARB(normals, newCoord, dcdx, dcdy).z;
|
||||
#else
|
||||
normalMap = vec3(texture2D(normals, texCoord).xy, 0.0) * 2.0 - 1.0;
|
||||
ao = texture2D(normals, texCoord).z;
|
||||
#endif
|
||||
|
||||
if (normalMap.x + normalMap.y > -1.999) {
|
||||
if (length(normalMap.xy) > 1.0) normalMap.xy = normalize(normalMap.xy);
|
||||
normalMap.z = sqrt(1.0 - dot(normalMap.xy, normalMap.xy));
|
||||
normalMap = normalize(clamp(normalMap, vec3(-1.0), vec3(1.0)));
|
||||
}else{
|
||||
normalMap = vec3(0.0, 0.0, 1.0);
|
||||
ao = 1.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EMISSIVE == 2
|
||||
emission = mix(emissionMat, 1.0, emission);
|
||||
#else
|
||||
emission = emissionMat;
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_DAMPENING
|
||||
mipx = dcdx * atlasSize;
|
||||
mipy = dcdy * atlasSize;
|
||||
mipDelta = max(dot(mipx, mipx), dot(mipy, mipy));
|
||||
miplevel = max(0.25 * log2(mipDelta), 0.0);
|
||||
|
||||
normalMap = normalize(mix(vec3(0.0, 0.0, 1.0), normalMap, 1.0 / exp2(miplevel)));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if MATERIAL_FORMAT == 2
|
||||
vec4 specularMap = texture2DLod(specular, newCoord, 0);
|
||||
smoothness = specularMap.r;
|
||||
|
||||
f0 = specularMap.g;
|
||||
metalness = f0 >= 0.9 ? 1.0 : 0.0;
|
||||
|
||||
emissionMat = specularMap.a < 1.0 ? clamp(specularMap.a * 1.004 - 0.004, 0.0, 1.0) : 0.0;
|
||||
emissionMat *= emissionMat;
|
||||
|
||||
porosity = specularMap.b <= 0.251 ? specularMap.b * 3.984 : 0.0;
|
||||
subsurface = specularMap.b > 0.251 ? clamp(specularMap.b * 1.335 - 0.355, 0.0, 1.0) : 0.0;
|
||||
|
||||
#ifdef PARALLAX
|
||||
normalMap = vec3(texture2DGradARB(normals, newCoord, dcdx, dcdy).xy, 0.0) * 2.0 - 1.0;
|
||||
ao = texture2DGradARB(normals, newCoord, dcdx, dcdy).z;
|
||||
#else
|
||||
normalMap = vec3(texture2D(normals, texCoord).xy, 0.0) * 2.0 - 1.0;
|
||||
ao = texture2D(normals, texCoord).z;
|
||||
#endif
|
||||
|
||||
if (normalMap.x + normalMap.y > -1.999) {
|
||||
if (length(normalMap.xy) > 1.0) normalMap.xy = normalize(normalMap.xy);
|
||||
normalMap.z = sqrt(1.0 - dot(normalMap.xy, normalMap.xy));
|
||||
normalMap = normalize(clamp(normalMap, vec3(-1.0), vec3(1.0)));
|
||||
}else{
|
||||
normalMap = vec3(0.0, 0.0, 1.0);
|
||||
ao = 1.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EMISSIVE == 2
|
||||
emission = mix(emissionMat, 1.0, emission);
|
||||
#else
|
||||
emission = emissionMat;
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_DAMPENING
|
||||
mipx = dcdx * atlasSize;
|
||||
mipy = dcdy * atlasSize;
|
||||
mipDelta = max(dot(mipx, mipx), dot(mipy, mipy));
|
||||
miplevel = max(0.25 * log2(mipDelta), 0.0);
|
||||
|
||||
normalMap = normalize(mix(vec3(0.0, 0.0, 1.0), normalMap, 1.0 / exp2(miplevel)));
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// if (blockEntityId < 60028) {
|
||||
// if (blockEntityId < 60012) {
|
||||
// if (blockEntityId < 60004) {
|
||||
// if (blockEntityId == 10548) { // Enchanting Table:Book
|
||||
// smoothnessG = pow2(color.g) * 0.35;
|
||||
|
||||
// if (color.b < 0.0001 && color.r > color.g) {
|
||||
// emission = color.g * 4.0;
|
||||
// }
|
||||
// } else if (blockEntityId == 60000) { //
|
||||
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId == 60004) { // Signs
|
||||
// noSmoothLighting = true;
|
||||
|
||||
// if (glColor.r + glColor.g + glColor.b <= 2.99 || lmCoord.x > 0.999) { // Sign Text
|
||||
// #include "/lib/materials/specificMaterials/others/signText.glsl"
|
||||
// }
|
||||
|
||||
// #ifdef COATED_TEXTURES
|
||||
// noiseFactor = 0.66;
|
||||
// #endif
|
||||
// } else /*if (blockEntityId == 60008)*/ { // Chest
|
||||
// noSmoothLighting = true;
|
||||
|
||||
// smoothnessG = pow2(color.g);
|
||||
|
||||
// #ifdef COATED_TEXTURES
|
||||
// noiseFactor = 0.66;
|
||||
// #endif
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId < 60020) {
|
||||
// if (blockEntityId == 60012) { // Ender Chest
|
||||
// noSmoothLighting = true;
|
||||
|
||||
// float factor = min(pow2(color.g), 0.25);
|
||||
// smoothnessG = factor * 2.0;
|
||||
|
||||
// if (color.g > color.r || color.b > color.g)
|
||||
// emission = pow2(factor) * 20.0;
|
||||
// emission += 0.35;
|
||||
|
||||
// #ifdef COATED_TEXTURES
|
||||
// noiseFactor = 0.66;
|
||||
// #endif
|
||||
// } else /*if (blockEntityId == 60016)*/ { // Shulker Box+, Banner+, Head+, Bed+
|
||||
// noSmoothLighting = true;
|
||||
// #ifdef COATED_TEXTURES
|
||||
// noiseFactor = 0.2;
|
||||
// #endif
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId == 60020) { // Conduit
|
||||
// noSmoothLighting = true;
|
||||
// lmCoordM.x = 0.9;
|
||||
|
||||
// if (color.b > color.r) { // Conduit:Wind, Conduit:Blue Pixels of The Eye
|
||||
// emission = color.r * 16.0;
|
||||
// } else if (color.r > color.b * 2.5) { // Conduit:Red Pixels of The Eye
|
||||
// emission = 20.0;
|
||||
// color.rgb *= vec3(1.0, 0.25, 0.1);
|
||||
// }
|
||||
// } else /*if (blockEntityId == 60024)*/ { // End Portal, End Gateway
|
||||
// #include "/lib/materials/specificMaterials/others/endPortalEffect.glsl"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId < 60044) {
|
||||
// if (blockEntityId < 60036) {
|
||||
// if (blockEntityId == 60028) { //
|
||||
|
||||
// } else /*if (blockEntityId == 60032)*/ { // Bell
|
||||
// if (color.r + color.g > color.b + 0.5) { // Bell:Golden Part
|
||||
// #include "/lib/materials/specificMaterials/terrain/goldBlock.glsl"
|
||||
// } else {
|
||||
// #include "/lib/materials/specificMaterials/terrain/stone.glsl"
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId == 60036) { //
|
||||
|
||||
// } else /*if (blockEntityId == 60040)*/ { //
|
||||
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId < 60052) {
|
||||
// if (blockEntityId == 60044) { //
|
||||
|
||||
// } else /*if (blockEntityId == 60048)*/ { //
|
||||
|
||||
// }
|
||||
// } else {
|
||||
// if (blockEntityId == 60052) { //
|
||||
|
||||
// } else if (blockEntityId == 60056) { //
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,76 @@
|
||||
vec4 ReadNormal(vec2 coord) {
|
||||
coord = fract(coord) * vTexCoordAM.pq + vTexCoordAM.st;
|
||||
return texture2DGradARB(normals, coord, dcdx, dcdy);
|
||||
}
|
||||
|
||||
vec2 GetParallaxCoord(vec2 texCoord, float parallaxFade, out float surfaceDepth) {
|
||||
vec2 coord = vTexCoord.st;
|
||||
surfaceDepth = 1.0;
|
||||
|
||||
if (viewVector != viewVector) {
|
||||
return texCoord;
|
||||
}
|
||||
|
||||
float sampleStep = 1.0 / PARALLAX_QUALITY;
|
||||
float currentStep = 1.0;
|
||||
|
||||
vec2 scaledDir = viewVector.xy * PARALLAX_DEPTH / -viewVector.z;
|
||||
vec2 stepDir = scaledDir * sampleStep * (1.0 - parallaxFade);
|
||||
|
||||
vec3 normalMap = ReadNormal(coord).xyz * 2.0 - 1.0;
|
||||
float normalCheck = normalMap.x + normalMap.y;
|
||||
if (parallaxFade >= 1.0 || normalCheck < -1.999) return texCoord;
|
||||
|
||||
float depth = ReadNormal(coord).a;
|
||||
|
||||
for(int i = 0; i < PARALLAX_QUALITY; i++){
|
||||
if (currentStep <= depth) break;
|
||||
coord += stepDir;
|
||||
depth = ReadNormal(coord).a;
|
||||
currentStep -= sampleStep;
|
||||
}
|
||||
|
||||
coord = fract(coord.st) * vTexCoordAM.pq + vTexCoordAM.st;
|
||||
surfaceDepth = currentStep;
|
||||
|
||||
return coord;
|
||||
}
|
||||
|
||||
float GetParallaxShadow(float surfaceDepth, float parallaxFade, vec2 coord, vec3 lightVec,
|
||||
mat3 tbn) {
|
||||
float parallaxshadow = 1.0;
|
||||
if(parallaxFade >= 1.0) return 1.0;
|
||||
|
||||
float height = surfaceDepth;
|
||||
if(height > 1.0 - 0.5 / PARALLAX_QUALITY) return 1.0;
|
||||
|
||||
vec3 parallaxdir = tbn * lightVec;
|
||||
parallaxdir.xy *= PARALLAX_DEPTH * SELF_SHADOW_ANGLE;
|
||||
vec2 newvTexCoord = (coord - vTexCoordAM.st) / vTexCoordAM.pq;
|
||||
float sampleStep = 0.32 / SELF_SHADOW_QUALITY;
|
||||
|
||||
vec2 ptexCoord = fract(newvTexCoord + parallaxdir.xy * sampleStep) *
|
||||
vTexCoordAM.pq + vTexCoordAM.st;
|
||||
|
||||
float texHeight = texture2DGradARB(normals, coord, dcdx, dcdy).a;
|
||||
float texHeightOffset = texture2DGradARB(normals, ptexCoord, dcdx, dcdy).a;
|
||||
|
||||
float texFactor = clamp((height - texHeightOffset) / sampleStep + 1.0, 0.0, 1.0);
|
||||
|
||||
height = mix(height, texHeight, texFactor);
|
||||
|
||||
for(int i = 0; i < SELF_SHADOW_QUALITY; i++) {
|
||||
float currentHeight = height + parallaxdir.z * sampleStep * i;
|
||||
vec2 parallaxCoord = fract(newvTexCoord + parallaxdir.xy * i * sampleStep) *
|
||||
vTexCoordAM.pq + vTexCoordAM.st;
|
||||
float offsetHeight = texture2DGradARB(normals, parallaxCoord, dcdx, dcdy).a;
|
||||
float sampleShadow = clamp(1.0 - (offsetHeight - currentHeight) * SELF_SHADOW_STRENGTH, 0.0, 1.0);
|
||||
parallaxshadow = min(parallaxshadow, sampleShadow);
|
||||
if (parallaxshadow < 0.01) break;
|
||||
}
|
||||
parallaxshadow *= parallaxshadow;
|
||||
|
||||
parallaxshadow = mix(parallaxshadow, 1.0, parallaxFade);
|
||||
|
||||
return parallaxshadow;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
float min1(float x) {
|
||||
return min(x, 1.0);
|
||||
}
|
||||
float max0(float x) {
|
||||
return max(x, 0.0);
|
||||
}
|
||||
float clamp01(float x) {
|
||||
return clamp(x, 0.0, 1.0);
|
||||
}
|
||||
vec2 clamp01(vec2 x) {
|
||||
return clamp(x, vec2(0.0), vec2(1.0));
|
||||
}
|
||||
vec3 clamp01(vec3 x) {
|
||||
return clamp(x, vec3(0.0), vec3(1.0));
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef INCLUDE_DFDX_DFDY
|
||||
#define INCLUDE_DFDX_DFDY
|
||||
|
||||
vec2 dcdx = dFdx(texCoord.xy);
|
||||
vec2 dcdy = dFdy(texCoord.xy);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
//Dithering from Jodie
|
||||
float Bayer2(vec2 a) {
|
||||
a = floor(a);
|
||||
return fract(a.x * 0.5 + a.y * a.y * 0.75);
|
||||
}
|
||||
|
||||
#define Bayer4(a) (Bayer2(a * 0.5) * 0.25 + Bayer2(a))
|
||||
#define Bayer8(a) (Bayer4(a * 0.5) * 0.25 + Bayer2(a))
|
||||
|
||||
float BayerCloud2(vec2 a) {
|
||||
a = floor(a);
|
||||
return fract(a.x * 0.5 + a.y * 0.75);
|
||||
}
|
||||
|
||||
#define BayerCloud4(a) (BayerCloud2(a * 0.5) * 0.25 + BayerCloud2(a))
|
||||
#define BayerCloud8(a) (BayerCloud4(a * 0.5) * 0.25 + BayerCloud2(a))
|
||||
@@ -0,0 +1,15 @@
|
||||
//Spheremap Transform from https://aras-p.info/texts/CompactNormalStorage.html
|
||||
vec2 EncodeNormal(vec3 n) {
|
||||
float f = sqrt(n.z * 8.0 + 8.0);
|
||||
return n.xy / f + 0.5;
|
||||
}
|
||||
|
||||
vec3 DecodeNormal(vec2 enc) {
|
||||
vec2 fenc = enc * 4.0 - 2.0;
|
||||
float f = dot(fenc,fenc);
|
||||
float g = sqrt(1.0 - f / 4.0);
|
||||
vec3 n;
|
||||
n.xy = fenc * g;
|
||||
n.z = 1.0 - f / 2.0;
|
||||
return n;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//Jitter offset from Chocapic13
|
||||
uniform float framemod8;
|
||||
uniform float framemod2;
|
||||
|
||||
vec2 jitterOffsets8[8] = vec2[8](
|
||||
vec2( 0.125,-0.375),
|
||||
vec2(-0.125, 0.375),
|
||||
vec2( 0.625, 0.125),
|
||||
vec2( 0.375,-0.625),
|
||||
vec2(-0.625, 0.625),
|
||||
vec2(-0.875,-0.125),
|
||||
vec2( 0.375,-0.875),
|
||||
vec2( 0.875, 0.875)
|
||||
);
|
||||
vec2 jitterOffsets2[2] = vec2[2](
|
||||
vec2( 1.0, 0.0),
|
||||
vec2( 0.0, 1.0)
|
||||
);
|
||||
|
||||
vec2 TAAJitter(vec2 coord, float w) {
|
||||
#if TAA_MODE == 0
|
||||
vec2 offset = jitterOffsets8[int(framemod8)] * (w / vec2(viewWidth, viewHeight));
|
||||
#else
|
||||
vec2 offset = jitterOffsets2[int(framemod2)] * (w / vec2(viewWidth, viewHeight));
|
||||
#endif
|
||||
return coord + offset;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
void DepthOutline(inout float z, sampler2D depthtex) {
|
||||
float ph = ceil(viewHeight / 1440.0) / viewHeight;
|
||||
float pw = ph / aspectRatio;
|
||||
|
||||
int sampleCount = viewHeight >= 720.0 ? 12 : 4;
|
||||
|
||||
#ifdef RETRO_FILTER
|
||||
ph = RETRO_FILTER_SIZE / viewHeight;
|
||||
pw = ph / aspectRatio;
|
||||
sampleCount = 4;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < sampleCount; i++) {
|
||||
vec2 offset = vec2(pw, ph) * outlineOffsets[i];
|
||||
for (int j = 0; j < 2; j++) {
|
||||
z = min(z, texture2D(depthtex, texCoord + offset).r);
|
||||
offset = -offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
float GetOutlineMask() {
|
||||
float ph = ceil(viewHeight / 1440.0) / viewHeight;
|
||||
float pw = ph / aspectRatio;
|
||||
|
||||
int sampleCount = viewHeight >= 720.0 ? 12 : 4;
|
||||
|
||||
#ifdef RETRO_FILTER
|
||||
ph = RETRO_FILTER_SIZE / viewHeight;
|
||||
pw = ph / aspectRatio;
|
||||
sampleCount = 4;
|
||||
#endif
|
||||
|
||||
float mask = 0.0;
|
||||
for (int i = 0; i < sampleCount; i++) {
|
||||
vec2 offset = vec2(pw, ph) * outlineOffsets[i];
|
||||
for (int j = 0; j < 2; j++){
|
||||
mask += float(texture2D(depthtex0, texCoord + offset).r <
|
||||
texture2D(depthtex1, texCoord + offset).r);
|
||||
offset = -offset;
|
||||
}
|
||||
}
|
||||
|
||||
return float(mask > 0.5);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
vec2 outlineOffsets[12] = vec2[12](
|
||||
vec2( 0.0, 1.0),
|
||||
vec2( 1.0, 0.0),
|
||||
vec2( 1.0, 1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
vec2( 2.0, 0.0),
|
||||
vec2( 0.0, 2.0),
|
||||
vec2( 2.0, 1.0),
|
||||
vec2( 1.0, 2.0),
|
||||
vec2(-1.0, 2.0),
|
||||
vec2(-2.0, 1.0),
|
||||
vec2( 2.0, 2.0),
|
||||
vec2(-2.0, 2.0)
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
vec3 ToNDC(vec3 pos) {
|
||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x,
|
||||
gbufferProjectionInverse[1].y,
|
||||
gbufferProjectionInverse[2].zw);
|
||||
vec3 p3 = pos * 2.0 - 1.0;
|
||||
vec4 viewPos = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
vec3 ToWorld(vec3 pos) {
|
||||
return mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz;
|
||||
}
|
||||
|
||||
vec3 ToShadow(vec3 pos) {
|
||||
vec3 shadowpos = mat3(shadowModelView) * pos + shadowModelView[3].xyz;
|
||||
return projMAD(shadowProjection, shadowpos);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
const float pi = 3.1415927;
|
||||
float pi2wt = 6.2831854 * (frametime * 24.0);
|
||||
|
||||
float GetNoise(vec2 pos) {
|
||||
return fract(sin(dot(pos, vec2(12.9898, 4.1414))) * 43758.5453);
|
||||
}
|
||||
|
||||
float Noise2D(vec2 pos) {
|
||||
vec2 flr = floor(pos);
|
||||
vec2 frc = fract(pos);
|
||||
frc = frc * frc * (3.0 - 2.0 * frc);
|
||||
|
||||
float n00 = GetNoise(flr);
|
||||
float n01 = GetNoise(flr + vec2(0.0, 1.0));
|
||||
float n10 = GetNoise(flr + vec2(1.0, 0.0));
|
||||
float n11 = GetNoise(flr + vec2(1.0, 1.0));
|
||||
|
||||
float n0 = mix(n00, n01, frc.y);
|
||||
float n1 = mix(n10, n11, frc.y);
|
||||
|
||||
return mix(n0, n1, frc.x) - 0.5;
|
||||
}
|
||||
|
||||
vec3 CalcMove(vec3 pos, float density, float speed, vec2 mult) {
|
||||
pos = pos * density + frametime * speed;
|
||||
vec3 wave = vec3(Noise2D(pos.yz), Noise2D(pos.xz + 0.333), Noise2D(pos.xy + 0.667));
|
||||
return wave * vec3(mult, mult.x);
|
||||
}
|
||||
|
||||
float CalcLilypadMove(vec3 worldpos) {
|
||||
float wave = sin(2 * pi * (frametime * 0.7 + worldpos.x * 0.14 + worldpos.z * 0.07)) +
|
||||
sin(2 * pi * (frametime * 0.5 + worldpos.x * 0.10 + worldpos.z * 0.20));
|
||||
return wave * 0.0125;
|
||||
}
|
||||
|
||||
float CalcLavaMove(vec3 worldpos) {
|
||||
float fy = fract(worldpos.y + 0.005);
|
||||
|
||||
if (fy > 0.01) {
|
||||
float wave = sin(pi * (frametime * 0.7 + worldpos.x * 0.14 + worldpos.z * 0.07)) +
|
||||
sin(pi * (frametime * 0.5 + worldpos.x * 0.10 + worldpos.z * 0.20));
|
||||
return wave * 0.0125;
|
||||
} else return 0.0;
|
||||
}
|
||||
|
||||
vec3 CalcLanternMove(vec3 position) {
|
||||
vec3 frc = fract(position);
|
||||
frc = vec3(frc.x - 0.5, fract(frc.y - 0.001) - 1.0, frc.z - 0.5);
|
||||
vec3 flr = position - frc;
|
||||
float offset = flr.x * 2.4 + flr.y * 2.7 + flr.z * 2.2;
|
||||
|
||||
float rmult = pi * 0.016;
|
||||
float rx = sin(frametime + offset) * rmult;
|
||||
float ry = sin(frametime * 1.7 + offset) * rmult;
|
||||
float rz = sin(frametime * 1.4 + offset) * rmult;
|
||||
mat3 rotx = mat3(
|
||||
1, 0, 0,
|
||||
0, cos(rx), -sin(rx),
|
||||
0, sin(rx), cos(rx)
|
||||
);
|
||||
mat3 roty = mat3(
|
||||
cos(ry), 0, sin(ry),
|
||||
0, 1, 0,
|
||||
-sin(ry), 0, cos(ry)
|
||||
);
|
||||
mat3 rotz = mat3(
|
||||
cos(rz), -sin(rz), 0,
|
||||
sin(rz), cos(rz), 0,
|
||||
0, 0, 1
|
||||
);
|
||||
frc = rotx * roty * rotz * frc;
|
||||
|
||||
return flr + frc - position;
|
||||
}
|
||||
|
||||
vec3 WavingBlocks(vec3 position, int blockID, float istopv) {
|
||||
vec3 wave = vec3(0.0);
|
||||
vec3 worldpos = position + cameraPosition;
|
||||
|
||||
#ifdef WAVING_GRASS
|
||||
if (blockID == 100 && istopv > 0.9)
|
||||
wave += CalcMove(worldpos, 0.35, 1.0, vec2(0.25, 0.06));
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_CROP
|
||||
if (blockID == 104 && (istopv > 0.9 || fract(worldpos.y + 0.0675) > 0.01))
|
||||
wave += CalcMove(worldpos, 0.35, 1.0, vec2(0.15, 0.06));
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_PLANT
|
||||
if (blockID == 101 && (istopv > 0.9 || fract(worldpos.y + 0.005) > 0.01))
|
||||
wave += CalcMove(worldpos, 0.7, 1.35, vec2(0.12, 0.00));
|
||||
if (blockID == 107 || blockID == 207)
|
||||
wave += CalcMove(worldpos, 0.5, 1.25, vec2(0.06, 0.00));
|
||||
if (blockID == 108)
|
||||
wave.y += CalcLilypadMove(worldpos);
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_TALL_PLANT
|
||||
if (blockID == 102 && (istopv > 0.9 || fract(worldpos.y + 0.005) > 0.01) ||
|
||||
blockID == 103)
|
||||
wave += CalcMove(worldpos, 0.35, 1.15, vec2(0.15, 0.06));
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_LEAF
|
||||
if (blockID == 105)
|
||||
wave += CalcMove(worldpos, 0.25, 1.0, vec2(0.08, 0.08));
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_VINE
|
||||
if (blockID == 106)
|
||||
wave += CalcMove(worldpos, 0.35, 1.25, vec2(0.06, 0.06));
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_LAVA
|
||||
if (blockID == 203)
|
||||
wave.y += CalcLavaMove(worldpos);
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_FIRE
|
||||
if (blockID == 204 && istopv > 0.9)
|
||||
wave += CalcMove(worldpos, 1.0, 1.5, vec2(0.0, 0.37));
|
||||
#endif
|
||||
|
||||
#ifdef WAVING_LANTERN
|
||||
if (blockID == 206)
|
||||
wave += CalcLanternMove(worldpos);
|
||||
#endif
|
||||
|
||||
position += wave;
|
||||
|
||||
return position;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
float WorldCurvature(vec2 pos) {
|
||||
return dot(pos, pos) / WORLD_CURVATURE_SIZE;
|
||||
}
|
||||
Reference in new issue
Block a user