first commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#include "/lib/shaderSettings/bloom.glsl"
|
||||
#ifdef CAVE_FOG
|
||||
#include "/lib/atmospherics/fog/caveFactor.glsl"
|
||||
#endif
|
||||
|
||||
const float rainBloomAdd = 8.0;
|
||||
const float nightBloomAdd = 3.0;
|
||||
const float caveBloomAdd = 14.0;
|
||||
const float waterBloomAdd = 14.0;
|
||||
|
||||
#ifdef BORDER_FOG
|
||||
const float netherBloomAdd = 14.0;
|
||||
#else
|
||||
const float netherBloomAdd = 3.0;
|
||||
#endif
|
||||
|
||||
float GetBloomFog(float lViewPos) {
|
||||
#ifdef OVERWORLD
|
||||
float bloomFog = pow2(pow2(1.0 - exp(-lViewPos * (0.02 + 0.04 * float(isEyeInWater == 1)))));
|
||||
|
||||
float bloomFogMult;
|
||||
if (isEyeInWater != 1) {
|
||||
bloomFogMult = (rainFactor2 * rainBloomAdd + nightBloomAdd * (1.0 - sunFactor)) * eyeBrightnessM;
|
||||
#ifdef CAVE_FOG
|
||||
bloomFogMult += GetCaveFactor() * caveBloomAdd;
|
||||
#endif
|
||||
} else {
|
||||
bloomFogMult = waterBloomAdd;
|
||||
}
|
||||
#elif defined NETHER
|
||||
float farM = min(renderDistance, NETHER_VIEW_LIMIT); // consistency9023HFUE85JG
|
||||
float bloomFog = lViewPos / clamp(farM, 96.0, 256.0);
|
||||
bloomFog *= bloomFog * bloomFog;
|
||||
bloomFog = 1.0 - exp(-8.0 * bloomFog);
|
||||
bloomFog *= float(isEyeInWater == 0);
|
||||
|
||||
float bloomFogMult = netherBloomAdd;
|
||||
#else
|
||||
float bloomFog = 0.0;
|
||||
float bloomFogMult = 0.0;
|
||||
#endif
|
||||
|
||||
bloomFogMult *= BLOOM_STRENGTH * 8.33333;
|
||||
|
||||
return 1.0 + bloomFog * bloomFogMult;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef INCLUDE_CAVE_FACTOR
|
||||
#define INCLUDE_CAVE_FACTOR
|
||||
#define CAVE_FOG_R_NEW 0.13 // [0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00]
|
||||
#define CAVE_FOG_G_NEW 0.13 // [0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00]
|
||||
#define CAVE_FOG_B_NEW 0.15 // [0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00]
|
||||
#define CAVE_FOG_I 1.00 //[0.20 0.25 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.0]
|
||||
|
||||
float GetCaveFactor() {
|
||||
return clamp(1.0 - cameraPosition.y / oceanAltitude, 0.0, 1.0 - eyeBrightnessM);
|
||||
}
|
||||
|
||||
vec3 caveFogColorRaw = vec3(CAVE_FOG_R_NEW, CAVE_FOG_G_NEW, CAVE_FOG_B_NEW) * CAVE_FOG_I;
|
||||
#if CAVE_LIGHTING < 100
|
||||
vec3 caveFogColor = caveFogColorRaw * 0.7;
|
||||
#elif CAVE_LIGHTING == 100
|
||||
vec3 caveFogColor = caveFogColorRaw * (0.7 + 0.3 * vsBrightness); // Default
|
||||
#elif CAVE_LIGHTING > 100
|
||||
vec3 caveFogColor = caveFogColorRaw;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
vec3 GetColoredLightFog(vec3 nPlayerPos, vec3 translucentMult, float lViewPos, float lViewPos1, float dither, float vlFactor) {
|
||||
vec3 lightFog = vec3(0.0);
|
||||
|
||||
float stepMult = 8.0;
|
||||
|
||||
#ifdef CAVE_SMOKE
|
||||
float caveFactor = GetCaveFactor() * (1.0 - clamp01(isEyeInWater));
|
||||
#endif
|
||||
|
||||
float maxDist = min(effectiveACTdistance * 0.5, far);
|
||||
int sampleCount = int(maxDist / stepMult + 0.001);
|
||||
vec3 traceAdd = nPlayerPos * stepMult;
|
||||
vec3 tracePos = traceAdd * dither;
|
||||
|
||||
for (int i = 0; i < sampleCount; i++) {
|
||||
tracePos += traceAdd;
|
||||
|
||||
float lTracePos = length(tracePos);
|
||||
if (lTracePos > lViewPos1) break;
|
||||
if (any(greaterThan(abs(tracePos * 2.0), vec3(voxelVolumeSize)))) break;
|
||||
|
||||
vec3 voxelPos = SceneToVoxel(tracePos);
|
||||
voxelPos = clamp01(voxelPos / vec3(voxelVolumeSize));
|
||||
|
||||
vec4 lightVolume = GetLightVolume(voxelPos);
|
||||
vec3 lightSample = lightVolume.rgb;
|
||||
|
||||
#if defined END && END_CENTER_LIGHTING > 0 && MC_VERSION >= 10900 && defined END_CENTER_LIGHTING_AFFECT_BLOCKLIGHT
|
||||
vec3 endCenterCol = saturateColors(vec3(END_CENTER_LIGHTING_R, END_CENTER_LIGHTING_G, END_CENTER_LIGHTING_B), 1.1);
|
||||
vec3 endCenterPos = vec3(0.5, 60.5, 0.5) - (tracePos + cameraPositionBest);
|
||||
endCenterPos.y *= 0.66; // Make it a pill-shaped point light
|
||||
float rawDistance = length(endCenterPos);
|
||||
float endCenterLightDist = exp(-rawDistance * 0.62) * 100;
|
||||
lightSample = mix(lightSample, clamp01(saturateColors(endCenterCol, 1.3)), clamp01(endCenterLightDist) * (1.0 - vlFactor));
|
||||
#endif
|
||||
|
||||
float lTracePosM = length(
|
||||
vec3(
|
||||
tracePos.x,
|
||||
#if COLORED_LIGHTING_INTERNAL <= 512
|
||||
tracePos.y * 2.0,
|
||||
#elif COLORED_LIGHTING_INTERNAL == 768
|
||||
tracePos.y * 3.0,
|
||||
#elif COLORED_LIGHTING_INTERNAL == 1024
|
||||
tracePos.y * 4.0,
|
||||
#endif
|
||||
tracePos.z
|
||||
)
|
||||
);
|
||||
lightSample *= max0(1.0 - lTracePosM / maxDist);
|
||||
lightSample *= pow2(min1(lTracePos * 0.03125));
|
||||
|
||||
#ifdef CAVE_SMOKE
|
||||
if (caveFactor > 0.00001) {
|
||||
vec3 smokePos = 0.0025 * (tracePos + cameraPosition);
|
||||
vec3 smokeWind = frameTimeCounter * vec3(0.006, 0.003, 0.0);
|
||||
float smoke = Noise3D(smokePos + smokeWind)
|
||||
* Noise3D(smokePos * 3.0 - smokeWind)
|
||||
* Noise3D(smokePos * 9.0 + smokeWind);
|
||||
smoke = smoothstep1(smoke);
|
||||
lightSample *= mix(1.0, smoke * 16.0, caveFactor);
|
||||
lightSample += caveFogColor * pow2(smoke) * 0.05 * caveFactor;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (lTracePos > lViewPos) lightSample *= translucentMult;
|
||||
lightFog += lightSample;
|
||||
}
|
||||
|
||||
#ifdef NETHER
|
||||
lightFog *= netherColor * 5.0;
|
||||
#endif
|
||||
|
||||
lightFog *= 1.0 - maxBlindnessDarkness;
|
||||
lightFog = pow(lightFog / sampleCount, vec3(0.25));
|
||||
|
||||
return lightFog;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#if !defined END_CENTER_FOG
|
||||
#define END_CENTER_FOG
|
||||
float doEndCenterFog(vec3 ro, vec3 rayDir, float wsdist, float falloff) { // Thanks to FoZy STYLE
|
||||
vec3 d = ro - vec3(0.5, 60.5, 0.5); // Light source vector
|
||||
d.y *= 0.7;
|
||||
rayDir.y *= 0.7;
|
||||
|
||||
float a = falloff * dot(rayDir, rayDir);
|
||||
float b = 2.0 * falloff * dot(rayDir, d);
|
||||
float c = 1.0 + falloff * dot(d, d);
|
||||
|
||||
float sqrtDiscr = max(0.001, sqrt(4.0 * a * c - b * b));
|
||||
float upper = (2.0 * a * wsdist + b) / sqrtDiscr;
|
||||
float lower = b / sqrtDiscr;
|
||||
|
||||
return 2.0 * (atan(upper) - atan(lower)) / sqrtDiscr;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,277 @@
|
||||
#include "/lib/shaderSettings/mainFog.glsl"
|
||||
#ifdef ATM_COLOR_MULTS
|
||||
#include "/lib/colors/colorMultipliers.glsl"
|
||||
#endif
|
||||
#ifdef MOON_PHASE_INF_ATMOSPHERE
|
||||
#include "/lib/colors/moonPhaseInfluence.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef BORDER_FOG
|
||||
#ifdef OVERWORLD
|
||||
#include "/lib/atmospherics/sky.glsl"
|
||||
#elif defined NETHER || defined END
|
||||
#include "/lib/colors/skyColors.glsl"
|
||||
#endif
|
||||
|
||||
void DoBorderFog(inout vec4 color, inout float skyFade, float lPos, float VdotU, float VdotS, float dither) {
|
||||
#ifdef OVERWORLD
|
||||
float fog = lPos / renderDistance;
|
||||
fog = pow2(pow2(fog));
|
||||
#ifndef DISTANT_HORIZONS
|
||||
fog = pow2(pow2(fog));
|
||||
#endif
|
||||
fog = 1.0 - exp(-BORDER_FOG_DISTANCE_OVERWORLD * fog);
|
||||
#endif
|
||||
#ifdef NETHER
|
||||
float farM = min(renderDistance, NETHER_VIEW_LIMIT); // consistency9023HFUE85JG
|
||||
float fog = lPos / farM;
|
||||
fog = fog * 0.3 + 0.7 * pow(fog * BORDER_FOG_DISTANCE_NETHER / 3, 256.0 / max(farM, 256.0));
|
||||
#endif
|
||||
#ifdef END
|
||||
float fog = lPos / renderDistance;
|
||||
fog = pow2(pow2(fog));
|
||||
fog = 1.0 - exp(-BORDER_FOG_DISTANCE_END * fog);
|
||||
#endif
|
||||
|
||||
#ifdef IRIS_FEATURE_FADE_VARIABLE
|
||||
#if defined GBUFFERS_WATER || defined DEFERRED1
|
||||
float chunkFadeM = mix(1.0, chunkFade, pow2(clamp01(lPos * 0.015))); // don't do fade very close to the player
|
||||
fog = mix(1.0, fog, chunkFadeM);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (fog > 0.0) {
|
||||
fog = clamp(fog, 0.0, 1.0);
|
||||
|
||||
#ifdef OVERWORLD
|
||||
vec3 fogColorM = GetSky(VdotU, VdotS, dither, true, false);
|
||||
#define BORDER_FOG_DENSITY BORDER_FOG_DENSITY_OVERWORLD
|
||||
#elif defined NETHER
|
||||
vec3 fogColorM = netherColor;
|
||||
#define BORDER_FOG_DENSITY BORDER_FOG_DENSITY_NETHER
|
||||
#else
|
||||
vec3 fogColorM = endSkyColor;
|
||||
#define BORDER_FOG_DENSITY BORDER_FOG_DENSITY_END
|
||||
#endif
|
||||
|
||||
#ifdef ATM_COLOR_MULTS
|
||||
fogColorM *= atmColorMult;
|
||||
#endif
|
||||
#ifdef MOON_PHASE_INF_ATMOSPHERE
|
||||
fogColorM *= moonPhaseInfluence;
|
||||
#endif
|
||||
|
||||
fog *= BORDER_FOG_DENSITY;
|
||||
color = mix(color, vec4(fogColorM, 0.0), fog);
|
||||
|
||||
#ifndef GBUFFERS_WATER
|
||||
skyFade = fog;
|
||||
#else
|
||||
skyFade = fog * (1.0 - isEyeInWater);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
#include "/lib/atmospherics/fog/caveFactor.glsl"
|
||||
|
||||
void DoCaveFog(inout vec4 color, float lViewPos) {
|
||||
float fog = GetCaveFactor() * (0.9 - 0.9 * exp(- lViewPos * 0.015 * CAVE_FOG_DENSITY));
|
||||
|
||||
color = mix(color, vec4(caveFogColor, 0.0), fog);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ATMOSPHERIC_FOG
|
||||
#include "/lib/colors/lightAndAmbientColors.glsl"
|
||||
#include "/lib/colors/skyColors.glsl"
|
||||
|
||||
// SRATA: Atm. fog starts reducing above this altitude
|
||||
// CRFTM: Atm. fog continues reducing for this meters
|
||||
#ifdef OVERWORLD
|
||||
#define atmFogSRATA ATM_FOG_ALTITUDE + 0.1
|
||||
#ifndef DISTANT_HORIZONS
|
||||
float atmFogCRFTM = 60.0;
|
||||
#else
|
||||
float atmFogCRFTM = 90.0;
|
||||
#endif
|
||||
|
||||
vec3 GetAtmFogColor(float altitudeFactorRaw, float VdotS) {
|
||||
vec3 atmFogColor = vec3(ATMOSPHERIC_FOG_R_NEW, ATMOSPHERIC_FOG_G_NEW, ATMOSPHERIC_FOG_B_NEW) * ATMOSPHERIC_FOG_I;
|
||||
#ifdef RADIOACTIVE_ATMOSPHERIC_FOG
|
||||
atmFogColor *= GetLuminance(atmFogColor) * 10;
|
||||
#endif
|
||||
|
||||
float nightFogMult = 2.5 - 0.625 * max(pow2(pow2(altitudeFactorRaw)), rainFactor);
|
||||
float dayNightFogBlend = pow(invNightFactor, 4.0 - VdotS - 2.5 * sunVisibility2);
|
||||
return atmFogColor * mix(
|
||||
nightUpSkyColor * (nightFogMult - dayNightFogBlend * nightFogMult),
|
||||
dayDownSkyColor * (0.9 + 0.3 * noonFactor),
|
||||
dayNightFogBlend
|
||||
);
|
||||
}
|
||||
#else
|
||||
float atmFogSRATA = 55.1;
|
||||
float atmFogCRFTM = 30.0;
|
||||
#endif
|
||||
|
||||
float GetAtmFogAltitudeFactor(float altitude) {
|
||||
float altitudeFactor = pow2(1.0 - clamp(altitude - atmFogSRATA, 0.0, atmFogCRFTM) / atmFogCRFTM);
|
||||
#ifndef LIGHTSHAFTS_ACTIVE
|
||||
altitudeFactor = mix(altitudeFactor, 1.0, rainFactor * 0.2);
|
||||
#endif
|
||||
return altitudeFactor;
|
||||
}
|
||||
|
||||
void DoAtmosphericFog(inout vec4 color, vec3 playerPos, float lViewPos, float VdotS) {
|
||||
#ifndef DISTANT_HORIZONS
|
||||
float renDisFactor = min1(192.0 / renderDistance);
|
||||
|
||||
#if ATM_FOG_DISTANCE != 100
|
||||
#define ATM_FOG_DISTANCE_M 100.0 / ATM_FOG_DISTANCE;
|
||||
renDisFactor *= ATM_FOG_DISTANCE_M;
|
||||
#endif
|
||||
float fog = 1.0 - exp(-pow(lViewPos * (0.001 - 0.0007 * rainFactor), 2.0 - rainFactor2) * lViewPos * renDisFactor);
|
||||
#else
|
||||
float fog = pow2(1.0 - exp(-max0(lViewPos - 40.0) * (0.7 + 0.7 * rainFactor) / ATM_FOG_DISTANCE));
|
||||
#endif
|
||||
|
||||
float atmFogA = 1.0;
|
||||
atmFogA *= ATMOSPHERIC_FOG_DENSITY * ATM_FOG_MULT;
|
||||
fog *= atmFogA - 0.1 - 0.15 * invRainFactor;
|
||||
|
||||
float altitudeFactorRaw = GetAtmFogAltitudeFactor(playerPos.y + cameraPosition.y);
|
||||
|
||||
#ifndef DISTANT_HORIZONS
|
||||
float altitudeFactor = altitudeFactorRaw * 0.9 + 0.1;
|
||||
#else
|
||||
float altitudeFactor = altitudeFactorRaw * 0.8 + 0.2;
|
||||
#endif
|
||||
|
||||
#ifdef OVERWORLD
|
||||
altitudeFactor *= 1.0 - 0.75 * GetAtmFogAltitudeFactor(cameraPosition.y) * invRainFactor;
|
||||
|
||||
#if defined SPECIAL_BIOME_WEATHER || RAIN_STYLE == 2
|
||||
if (isEyeInWater == 0) {
|
||||
#if RAIN_STYLE == 2
|
||||
float factor = 1.0;
|
||||
#else
|
||||
float factor = max(inSnowy, inDry);
|
||||
#endif
|
||||
|
||||
float fogFactor = 4.0;
|
||||
#ifdef SPECIAL_BIOME_WEATHER
|
||||
fogFactor += 2.0 * inDry;
|
||||
#endif
|
||||
fogFactor *= 0.5 + 0.5 * sunVisibility;
|
||||
|
||||
float fogIntense = pow2(1.0 - exp(-lViewPos * fogFactor / ATM_FOG_DISTANCE));
|
||||
fog = mix(fog, fogIntense / altitudeFactor, 0.8 * rainFactor * factor);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
fog *= 0.2 + 0.8 * sqrt2(eyeBrightnessM);
|
||||
fog *= 1.0 - GetCaveFactor();
|
||||
#else
|
||||
fog *= eyeBrightnessM;
|
||||
#endif
|
||||
#else
|
||||
fog *= 0.5;
|
||||
#endif
|
||||
|
||||
fog *= altitudeFactor;
|
||||
|
||||
if (fog > 0.0) {
|
||||
fog = clamp(fog, 0.0, 1.0);
|
||||
|
||||
#ifdef OVERWORLD
|
||||
vec3 fogColorM = GetAtmFogColor(altitudeFactorRaw, VdotS);
|
||||
#else
|
||||
vec3 fogColorM = endSkyColor * 1.5;
|
||||
#endif
|
||||
|
||||
#ifdef ATM_COLOR_MULTS
|
||||
fogColorM *= atmColorMult;
|
||||
#endif
|
||||
#ifdef MOON_PHASE_INF_ATMOSPHERE
|
||||
fogColorM *= moonPhaseInfluence;
|
||||
#endif
|
||||
|
||||
color = mix(color, vec4(fogColorM, 0.0), fog);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "/lib/atmospherics/fog/waterFog.glsl"
|
||||
|
||||
void DoWaterFog(inout vec4 color, float lViewPos) {
|
||||
float fog = GetWaterFog(lViewPos);
|
||||
color = mix(color, vec4(waterFogColor, 0), fog);
|
||||
}
|
||||
|
||||
void DoLavaFog(inout vec4 color, float lViewPos) {
|
||||
float fog = (lViewPos * 3.0 - gl_Fog.start) * gl_Fog.scale;
|
||||
|
||||
#ifdef LESS_LAVA_FOG
|
||||
fog = sqrt(fog) * 0.4;
|
||||
#endif
|
||||
|
||||
fog = 1.0 - exp(-fog);
|
||||
|
||||
fog = clamp(fog, 0.0, 1.0);
|
||||
color = mix(color, vec4(fogColor * 5.0, 0.0), fog);
|
||||
}
|
||||
|
||||
void DoPowderSnowFog(inout vec4 color, float lViewPos) {
|
||||
float fog = lViewPos;
|
||||
|
||||
#ifdef LESS_LAVA_FOG
|
||||
fog = sqrt(fog) * 0.4;
|
||||
#endif
|
||||
|
||||
fog *= fog;
|
||||
fog = 1.0 - exp(-fog);
|
||||
|
||||
fog = clamp(fog, 0.0, 1.0);
|
||||
color = mix(color, vec4(fogColor, 0.0), fog);
|
||||
}
|
||||
|
||||
void DoBlindnessFog(inout vec4 color, float lViewPos) {
|
||||
float fog = lViewPos * 0.3 * blindness;
|
||||
fog *= fog;
|
||||
fog = 1.0 - exp(-fog);
|
||||
|
||||
fog = clamp(fog, 0.0, 1.0);
|
||||
color *= 1.0 - fog;
|
||||
}
|
||||
|
||||
void DoDarknessFog(inout vec4 color, float lViewPos) {
|
||||
float fog = lViewPos * 0.075 * darknessFactor;
|
||||
fog *= fog;
|
||||
fog *= fog;
|
||||
color *= exp(-fog);
|
||||
}
|
||||
|
||||
void DoFog(inout vec4 color, inout float skyFade, float lViewPos, vec3 playerPos, float VdotU, float VdotS, float dither, bool isReflection, float lBlockPos) {
|
||||
#ifdef CAVE_FOG
|
||||
DoCaveFog(color, lViewPos);
|
||||
#endif
|
||||
#ifdef ATMOSPHERIC_FOG
|
||||
float lViewPosAtm = lViewPos;
|
||||
// Reduce fog if the reflecting block is already behind fog, and fogging the reflection would result in too much fog
|
||||
if (isReflection) lViewPosAtm *= 0.2 + 0.8 * sqrt1(max0(1.0 - lBlockPos / lViewPos));
|
||||
DoAtmosphericFog(color, playerPos, lViewPosAtm, VdotS);
|
||||
#endif
|
||||
#ifdef BORDER_FOG
|
||||
DoBorderFog(color, skyFade, max(length(playerPos.xz), abs(playerPos.y)), VdotU, VdotS, dither);
|
||||
#endif
|
||||
|
||||
if (isEyeInWater == 1) DoWaterFog(color, lViewPos);
|
||||
else if (isEyeInWater == 2) DoLavaFog(color, lViewPos);
|
||||
else if (isEyeInWater == 3) DoPowderSnowFog(color, lViewPos);
|
||||
|
||||
if (blindness > 0.00001) DoBlindnessFog(color, lViewPos);
|
||||
if (darknessFactor > 0.00001) DoDarknessFog(color, lViewPos);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef INCLUDE_WATER_FOG
|
||||
#define INCLUDE_WATER_FOG
|
||||
|
||||
float GetWaterFog(float lViewPos) {
|
||||
#if WATER_FOG_MULT != 100
|
||||
#define WATER_FOG_MULT_M WATER_FOG_MULT * 0.01;
|
||||
lViewPos *= WATER_FOG_MULT_M;
|
||||
#endif
|
||||
|
||||
#if LIGHTSHAFT_QUALI > 0 && SHADOW_QUALITY > -1
|
||||
float fog = lViewPos / 48.0;
|
||||
fog *= fog;
|
||||
#else
|
||||
float fog = lViewPos / 32.0;
|
||||
#endif
|
||||
|
||||
return 1.0 - exp(-fog);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user