DOUBLE LAYER CLOUD TEST #2. tweaked cloud lighting further. tweaked the sky ground. added gradient to fog skylighting. fix hand bug with bloomy fog.

This commit is contained in:
Xonk
2023-12-05 22:06:47 -05:00
parent d90a15e694
commit 72709b914d
13 changed files with 211 additions and 254 deletions

View File

@ -7,7 +7,6 @@ const bool colortex5MipmapEnabled = true;
const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
@ -54,6 +53,7 @@ uniform sampler2D colortex7; //water?
uniform sampler2D colortex8; //Specular
uniform sampler2D colortex9; //Specular
uniform sampler2D colortex10;
uniform sampler2D colortex12;
uniform sampler2D colortex15; // flat normals(rgb), vanillaAO(alpha)
@ -507,7 +507,7 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
void main() {
vec3 DEBUG =vec3( 1.0);
vec3 DEBUG = vec3( 1.0);
////// --------------- SETUP STUFF --------------- //////
vec2 texcoord = gl_FragCoord.xy*texelSize;
@ -640,7 +640,7 @@ void main() {
Background += Sky;
#ifdef VOLUMETRIC_CLOUDS
vec4 Clouds = texture2D_bicubic_offset(colortex0, texcoord*CLOUDS_QUALITY, noise);
vec4 Clouds = texture2D_bicubic_offset(colortex0, texcoord*CLOUDS_QUALITY, noise_2);
Background = Background * Clouds.a + Clouds.rgb;
#endif
@ -793,18 +793,11 @@ void main() {
}
#endif
// #if SSS_TYPE != 0
// Direct_SSS *= 1.0-clamp(NdotL*Shadows,0,1);
// #endif
#ifdef CLOUDS_SHADOWS
cloudShadow = GetCloudShadow(feetPlayerPos);
Shadows *= cloudShadow;
Direct_SSS *= cloudShadow;
#endif
#endif
@ -843,7 +836,6 @@ void main() {
float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.25 + (1.0-lightmap.y) * 0.75) ;
AmbientLightColor *= skylight;
#endif
#ifdef NETHER_SHADER
@ -996,6 +988,7 @@ void main() {
Emission(gl_FragData[0].rgb, albedo, SpecularTex.a);
if(lightningBolt) gl_FragData[0].rgb = vec3(77.0, 153.0, 255.0);
}
#ifdef OVERWORLD_SHADER
@ -1029,6 +1022,7 @@ void main() {
}
#endif
// gl_FragData[0].rgb = vec3(hand);
// gl_FragData[0].rgb = skyCloudsFromTexLOD2(feetPlayerPos_normalized, colortex12, 6).rgb/30;
/* DRAWBUFFERS:3 */
}

View File

@ -126,11 +126,8 @@ void main() {
col = mix(lum * vec3(Purkinje_R, Purkinje_G, Purkinje_B) * Purkinje_Multiplier, col, rodCurve);
// if(texcoord.x > 0.75)col = vec3(1) * ;
#ifndef USE_ACES_COLORSPACE_APPROXIMATION
col = LinearTosRGB(TONEMAP(col));
col = LinearTosRGB(TONEMAP(col));
#else
col = col * ACESInputMat;
col = TONEMAP(col);

View File

@ -28,6 +28,7 @@ uniform int isEyeInWater;
uniform float rainStrength;
uniform ivec2 eyeBrightnessSmooth;
uniform float eyeAltitude;
#include "/lib/color_transforms.glsl"
#include "/lib/color_dither.glsl"
#include "/lib/projections.glsl"

View File

@ -12,7 +12,6 @@ uniform sampler2D colortex0;
uniform sampler2D colortex1;
uniform sampler2D colortex2;
uniform sampler2D colortex3;
// uniform sampler2D colortex4;
uniform sampler2D colortex5;
uniform sampler2D colortex6;
uniform sampler2D colortex7;
@ -20,11 +19,14 @@ uniform sampler2D colortex8;
uniform sampler2D colortex9;
uniform sampler2D colortex10;
uniform sampler2D colortex11;
// uniform sampler2D colortex12;
uniform sampler2D colortex13;
uniform sampler2D colortex15;
uniform vec2 texelSize;
#if defined NETHER_SHADER || defined END_SHADER
uniform sampler2D colortex4;
#endif
flat varying vec4 lightCol; //main light source color (rgb),used light source(1=sun,-1=moon)
flat varying vec3 WsunVec;
@ -360,6 +362,7 @@ void main() {
#ifdef display_LUT
vec2 movedTC = texcoord;
vec3 thingy = texture2D(colortex4,movedTC).rgb / 30;
if(luma(thingy) > 0.0){
color.rgb = thingy;
vl.a = 1.0;

View File

@ -8,14 +8,13 @@ const int colortex2Format = RGBA16F; //forward + transparencies (gbuffer->com
const int colortex3Format = R11F_G11F_B10F; //frame buffer + bloom (deferred6->final)
const int colortex4Format = RGBA16F; //light values and skyboxes (everything)
const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final)
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
const int colortex8Format = RGBA8; // Specular Texture
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
const int colortex8Format = RGBA8; // Specular Texture
const int colortex9Format = RGBA8; // rain in alpha
const int colortex10Format = RGBA16; // resourcepack Skies
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
const int colortex10Format = RGBA16; // resourcepack Skies
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
const int colortex14Format = RGBA8; // a = skylightmap for translucents.
const int colortex14Format = RGBA8; // a = skylightmap for translucents.
const int colortex15Format = RGBA8; // flat normals and vanilla AO
*/
@ -28,7 +27,14 @@ const bool colortex4Clear = false;
const bool colortex5Clear = false;
const bool colortex6Clear = false;
const bool colortex7Clear = false;
const bool colortex8Clear = false;
const bool colortex9Clear = true;
const bool colortex10Clear = false;
const bool colortex11Clear = true;
const bool colortex12Clear = false;
const bool colortex13Clear = false;
const bool colortex14Clear = false;
const bool colortex15Clear = false;
#ifdef SCREENSHOT_MODE
/*

View File

@ -27,7 +27,7 @@ void main() {
vec2 resScale = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.))/vec2(1920.,1080.);
vec2 quarterResTC = gl_FragCoord.xy*2.0*resScale*texelSize;
vec2 texcoord = (gl_FragCoord.xy*2.0*texelSize) * RENDER_SCALE;
vec2 texcoord = (gl_FragCoord.xy*2.0*resScale*texelSize) * RENDER_SCALE;
bool hand = abs(decodeVec2(texture2D(colortex1,texcoord).w).y-0.75) < 0.01 && texture2D(depthtex0,texcoord).x < 1.0;

View File

@ -69,6 +69,7 @@ float blueNoise(){
#ifdef OVERWORLD_SHADER
// uniform sampler2D colortex12;
// const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
#define TEST
@ -102,7 +103,7 @@ float mixhistory = 0.06;
vec3 AmbientLightTint = vec3(AmbientLight_R, AmbientLight_G, AmbientLight_B);
// --- the color of the atmosphere + the average color of the atmosphere.
vec3 skyGroundCol = skyFromTex(vec3(0, -1 ,0), colortex4).rgb ;
vec3 skyGroundCol = skyFromTex(vec3(0, -1 ,0), colortex4).rgb;// * clamp(WsunVec.y*2.0,0.2,1.0);
/// --- Save light values
if (gl_FragCoord.x < 1. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
@ -144,12 +145,11 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
vec2 planetSphere = vec2(0.0);
vec3 sky = vec3(0.0);
vec3 skyAbsorb = vec3(0.0);
// vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = normalize(LightDir);
sky = calculateAtmosphere(averageSkyCol*4000./2.0, viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
// float GroundDarkening = (exp2(-15 * clamp(-viewVector.y,0.0,1.0)) * 0.7+0.3); // darken the ground in the sky.
sky = calculateAtmosphere((averageSkyCol*4000./2.0), viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
// sky = mix(sky, (averageSkyCol + skyAbsorb)*4000./2.0 ,(1.0 - exp(pow(clamp(-viewVector.y+0.5,0.0,1.0),2) * -25)));
// sky = mix(sky, (averageSkyCol + skyAbsorb)*4000./2.0, (1.0 - exp(pow(clamp(-viewVector.y+0.5,0.0,1.0),2) * -25)));
// fade atmosphere conditions for rain away when you pass above the cloud plane.
float heightRelativeToClouds = clamp(1.0 - max(eyeAltitude - Cumulus_height,0.0) / 200.0 ,0.0,1.0);
@ -167,8 +167,6 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
// vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = normalize(LightDir);
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
if(viewVector.y < -0.025) sky = sky * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
@ -180,7 +178,6 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0;
gl_FragData[0] = vec4(sky,1.0);
}
#endif
@ -284,5 +281,4 @@ if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. &&
gl_FragData[0] = vec4(exposure,avgBrightness,avgL2,1.0);
if (gl_FragCoord.x > 14. && gl_FragCoord.x < 15. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(rodExposure,centerDepth,0.0, 1.0);
}

View File

@ -114,9 +114,9 @@ void main() {
/// TOOO DAMN BLUE
// // only need to sample one spot for this
// averageSkyCol += 2.0*skyFromTex(normalize(vec3(0.0,1.0,0.0)),colortex4).rgb/150.;
vec3 minimimlight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.003 + nightVision);
averageSkyCol_Clouds = max(averageSkyCol_Clouds, minimimlight);
averageSkyCol = max(averageSkyCol, minimimlight);
vec3 minimumlight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.003 + nightVision);
averageSkyCol_Clouds = max(averageSkyCol_Clouds, minimumlight);
averageSkyCol = max(averageSkyCol, minimumlight);
////////////////////////////////////////
/// --- SUNLIGHT/MOONLIGHT STUFF --- ///

View File

@ -94,7 +94,8 @@ vec3 sky_transmittance(vec3 position, vec3 direction, const float steps) {
vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 sunVector, vec3 moonVector, out vec2 pid, out vec3 transmittance, const int iSteps, float noise) {
const int jSteps = 4;
// clamp(sunVector.y*2.0,0.0,1.0)
float GroundDarkening = max(exp2(-15 * clamp(-viewVector.y,0.0,1.0)) * 0.7+0.3, clamp(sunVector.y*2.0,0.0,1.0)); // darken the ground in the sky.
vec3 viewPos = (sky_planetRadius + eyeAltitude) * upVector;
vec2 aid = rsi(viewPos, viewVector, sky_atmosphereRadius);
@ -128,9 +129,9 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
vec3 stepAirmass = density * stepSize ;
vec3 stepOpticalDepth = sky_coefficientsAttenuation * stepAirmass ;
vec3 stepTransmittance = exp2(-stepOpticalDepth * rLOG2) ;
vec3 stepTransmittance = exp2(-stepOpticalDepth * rLOG2);
vec3 stepTransmittedFraction = clamp01((stepTransmittance - 1.0) / -stepOpticalDepth) ;
vec3 stepScatteringVisible = transmittance * stepTransmittedFraction ;
vec3 stepScatteringVisible = transmittance * stepTransmittedFraction * GroundDarkening ;
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun ) * stepScatteringVisible * sky_transmittance(position, sunVector*0.5+0.1, jSteps) ;
scatteringMoon += sky_coefficientsScattering * (stepAirmass.xy * phaseMoon) * stepScatteringVisible * sky_transmittance(position, moonVector, jSteps);

View File

@ -125,8 +125,8 @@ vec4 GetVolumetricFog(
// float upGradient = 1.0 - (normalize(wpos).y*0.5 + 0.5);
// skyCol0 *= exp(upGradient * -5.0)*1.5 + 0.5;
// float upGradient = np3.y;
// skyCol0 = max(skyCol0 + skyCol0*upGradient,0.0);
float upGradient = normalize(wpos).y*0.9+0.1;
skyCol0 = max(skyCol0 + skyCol0*upGradient,0.0);
float mu = 1.0;
float muS = mu;
@ -163,10 +163,7 @@ vec4 GetVolumetricFog(
sh *= GetCloudShadow_VLFOG(progressW, WsunVec);
#endif
float densityVol = cloudVol(progressW) * lightleakfix;
float densityVol = cloudVol(progressW) * lightleakfix ;
//Water droplets(fog)
float density = densityVol*mu*300.;
@ -206,202 +203,156 @@ vec4 GetVolumetricFog(
return vec4(vL,absorbance);
}
/*
/// really dumb lmao
vec4 InsideACloudFog(
vec3 viewPosition,
vec2 Dither,
vec3 SunColor,
vec3 MoonColor,
vec3 SkyColor
){
float total_extinction = 1.0;
vec3 color = vec3(0.0);
/// experimental functions to render clouds and fog in 2 passes
float cloudCoverage(in vec3 pos, float minHeight, float maxHeight){
float FinalCloudCoverage = 0.0;
vec3 playerPos = pos - cameraPosition;
vec3 samplePos = pos*vec3(1.0,1./48.,1.0)/4;
// minHeight -= curvature; maxHeight -= curvature;
float thingy = pow(1.0-clamp(1.0-length(playerPos)/2000,0,1),2) * 2.0;
float CloudLarge = texture2D(noisetex, (samplePos.xz+ cloud_movement)/5000.0).b;
float CloudSmall = texture2D(noisetex, (samplePos.xz- cloud_movement)/500.0).r;
float coverage = abs(CloudLarge*2.0 - 1.2)*0.5 - (1.0-CloudSmall);
/////// FIRST LAYER
float layer0 = min(min(coverage + max(Cumulus_coverage,thingy), clamp(maxHeight - pos.y,0,1)), 1.0 - clamp(minHeight - pos.y,0,1));
float Topshape = max(pos.y - (maxHeight - 75),0.0) / 200.0;
Topshape += max(pos.y - (maxHeight - 10),0.0) / 50.0;
float Baseshape = max(minHeight + 12.5 - pos.y, 0.0) / 50.0;
FinalCloudCoverage += max(layer0 - Topshape - Baseshape,0.0);
float erosion = 1.0 - densityAtPos(samplePos * 200);
float noise = erosion * (1.0-FinalCloudCoverage) ;
FinalCloudCoverage = max(FinalCloudCoverage - noise*noise*0.5, 0.0);
return FinalCloudCoverage;
}
vec4 renderVolumetrics(
vec3 viewPosition,
vec2 dither,
vec3 directLightColor,
vec3 skyLightColor
){
int SAMPLES = 30;
vec3 color = vec3(0.0);
float absorbance = 1.0;
//project pixel position into projected shadowmap space
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
//////////////////////////////////////////
////// lighting stuff
//////////////////////////////////////////
float shadowStep = 200.0;
vec3 dV_Sun = WsunVec*shadowStep;
float SdotV = dot(mat3(gbufferModelView)*WsunVec,normalize(viewPosition));
// if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun;
float mieDay = phaseg(SdotV, 0.75);
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
vec3 sunScattering = directLightColor * mieDay * 3.14;
vec3 sunMultiScattering = directLightColor * mieDayMulti * 4.0;
//////////////////////////////////////////
////// raymarching stuff
//////////////////////////////////////////
//project view origin into projected shadowmap space
vec3 start = toShadowSpaceProjected(vec3(0.));
vec3 start = toShadowSpaceProjected(vec3(0.0));
//rayvector into projected shadow map space
//we can use a projected vector because its orthographic projection
//however we still have to send it to curved shadow map space every step
vec3 dV = fragposition-start;
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
vec3 dV = fragposition - start;
// vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
// float maxLength = min(length(dVWorld),16*8)/length(dVWorld);
float maxLength = min(length(dVWorld),far+16)/length(dVWorld);
// float maxLength = min(length(dVWorld), far)/length(dVWorld);
float maxLength = 1.0;
dV *= maxLength;
dVWorld *= maxLength;
float mult = length(dVWorld)/25;
float dL = length(dVWorld);
vec3 progress = start.xyz;
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
float minCloudHeight = Cumulus_height;
float maxCloudHeight = minCloudHeight + 100;
vec3 progress_view = vec3(0.0);
float expFactor = 11.0;
vec3 progress = start.xyz;
////// lighitng stuff
float shadowStep = 200.;
vec3 dV_Sun = normalize(mat3(gbufferModelViewInverse)*sunVec)*shadowStep;
float SdotV = dot(sunVec,normalize(viewPosition));
SkyColor *= clamp(abs(dV_Sun.y)/100.,0.75,1.0);
SunColor = SunColor * clamp(dV_Sun.y ,0.0,1.0);
MoonColor *= clamp(-dV_Sun.y,0.0,1.0);
if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun;
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition;
float heightRelativeToClouds = clamp(1.0 - max(eyeAltitude - (Cumulus_height),0.0) / 100.0 ,0.0,1.0);
float fogSdotV = dot(sunVec,normalize(viewPosition))*lightCol.a;
float fogmie = phaseg(fogSdotV,0.7)*5.0 + 1.0;
for (int i=0; i < SAMPLES; i++) {
// Makes fog more white idk how to simulate it correctly
vec3 Fog_SkyCol = averageSkyCol/ 150. * 5. ; // * max(abs(WsunVec.y)/150.0,0.);
vec3 Fog_SunCol = lightCol.rgb / 80.0;
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLES))/expFactor - 1.0/expFactor)/(1.0-1.0/expFactor);
float dd = pow(expFactor, float(i+dither.x)/float(SAMPLES)) * log(expFactor) / float(SAMPLES)/(expFactor-1.0);
vec3 lightningColor = (lightningEffect / 10) * (max(eyeBrightnessSmooth.y,0)/240.);
#ifndef ReflectedFog
vec3 np3 = normVec(wpos);
float ambfogfade = clamp(exp(np3.y* 2 - 2),0.0,1.0) * 4 ;
lightningColor *= ambfogfade;
#endif
Fog_SkyCol += lightningColor;
float mieDay = phaseg(SdotV, 0.75) * 3.14;
float mieDayMulti = phaseg(SdotV, 0.35) * 2;
vec3 sunContribution = SunColor * mieDay;
vec3 sunContributionMulti = SunColor * mieDayMulti ;
float mieNight = (phaseg(-SdotV,0.8) + phaseg(-SdotV, 0.35)*4);
vec3 moonContribution = MoonColor * mieNight;
float timing = 1.0 - clamp(pow(abs(dV_Sun.y)/150.0,2.0),0.0,1.0);
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
float mie = phaseg(SdotV,0.7)*5.0 + 1.0;
float rayL = phaseRayleigh(SdotV);
#ifdef PER_BIOME_ENVIRONMENT
// recolor change sun and sky color to some color, but make sure luminance is preserved.
BiomeFogColor(Fog_SunCol);
BiomeFogColor(Fog_SkyCol);
#endif
vec3 rC = vec3(fog_coefficientRayleighR*1e-6, fog_coefficientRayleighG*1e-5, fog_coefficientRayleighB*1e-5);
vec3 mC = vec3(fog_coefficientMieR*1e-6, fog_coefficientMieG*1e-6, fog_coefficientMieB*1e-6);
float mu = 1.0;
float muS = mu;
float Shadows_for_Fog = 0.0;
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
for (int i=0;i<VL_SAMPLES;i++) {
float d = (pow(expFactor, float(i+Dither.x)/float(VL_SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float dd = pow(expFactor, float(i+Dither.x)/float(VL_SAMPLES)) * log(expFactor) / float(VL_SAMPLES)/(expFactor-1.0);
progress = start.xyz + d*dV;
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
// progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
float curvature = pow(length(progressW-cameraPosition)/200.0,2.0) * heightRelativeToClouds ;
minCloudHeight -= curvature; maxCloudHeight -= curvature;
//project into biased shadowmap space
float distortFactor = calcDistort(progress.xy);
vec3 pos = vec3(progress.xy*distortFactor, progress.z);
float sh = 1.0;
float sh = 1.0;
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
sh = shadow2D( shadow, pos).x;
sh = shadow2D(shadow, pos).x;
}
Shadows_for_Fog = sh;
float cloud = cloudCoverage(progressW, minCloudHeight, maxCloudHeight);
#ifdef VL_CLOUDS_SHADOWS
Shadows_for_Fog = sh * GetCloudShadow_VLFOG(progressW,WsunVec);
#endif
float UniformFog = clamp(1.0 - (progressW.y-minCloudHeight-100) / 200,0.0,1.0);
float densityVol = cloudVol(progressW);
//Water droplets(fog)
float density = densityVol*mu*300.;
float density = max(cloud, (UniformFog*UniformFog) * 0.00);
//Just air
vec2 airCoef = exp(-max(progressW.y-SEA_LEVEL,0.0)/vec2(8.0e3, 1.2e3)*vec2(6.,7.0)) * 24 * Haze_amount;
//Pbr for air, yolo mix between mie and rayleigh for water droplets
vec3 rL = rC*airCoef.x;
vec3 m = (airCoef.y+density)*mC;
vec3 DirectLight = (Fog_SunCol*Shadows_for_Fog) * (rayL*rL+m*fogmie);
vec3 AmbientLight = Fog_SkyCol * m;
vec3 AtmosphericFog = Fog_SkyCol * (rL+m) ;
// extra fog effects
vec3 rainRays = ((Fog_SunCol/5)*Shadows_for_Fog) * (rayL*phaseg(SdotV,0.7)) * clamp(pow(WsunVec.y,5)*2,0.0,1.0) * rainStrength * noPuddleAreas * RainFog_amount;
vec3 CaveRays = (Fog_SunCol*Shadows_for_Fog) * phaseg(SdotV,0.7) * 0.001 * (1.0 - lightleakfix);
vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * lightleakfix ;
color += (vL0 - vL0 * exp(-(rL+m)*dd*dL)) / ((rL+m)+0.00000001)*total_extinction;
total_extinction *= dot(clamp(exp(-(rL+m)*dd*dL),0.0,1.0), vec3(0.333333));
float horizonfalloff = exp(-(1.0-clamp(normalize(progressW-vec3(cameraPosition.x,0.0,cameraPosition.x)).y+1.0,0,1)));
sunScattering *= horizonfalloff;
sunMultiScattering *= horizonfalloff;
// if(density > 1e-5){
float muE = density * 0.5;
progress_view = progressW;
float cumulus = GetCumulusDensity(progress_view, 1);
float sunLight = 0.0;
float alteredDensity = Cumulus_density * clamp(exp( (progress_view.y - (MaxCumulusHeight - 75)) / 9.0 ),0.0,1.0);
if(cumulus > 1e-5){
float muE = cumulus*alteredDensity;
float Sunlight = 0.0;
float MoonLight = 0.0;
for (int j=0; j < 3; j++){
vec3 shadowSamplePos = progress_view + (dV_Sun * 0.15) * (1 + Dither.y/2 + j);
float shadow = GetCumulusDensity(shadowSamplePos, 0) * Cumulus_density;
Sunlight += shadow / (1 + j);
MoonLight += shadow;
}
Sunlight += (1-sh) * 100.;
MoonLight += (1-sh) * 100.;
#ifdef Altostratus
// cast a shadow from higher clouds onto lower clouds
vec3 HighAlt_shadowPos = progress_view + dV_Sun/abs(dV_Sun.y) * max(AltostratusHeight - progress_view.y,0.0);
float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos);
Sunlight += HighAlt_shadow;
#endif
float ambientlightshadow = 1.0 - clamp(exp((progress_view.y - (MaxCumulusHeight - 50)) / 100.0),0.0,1.0) ;
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view, timing);
S += lightningColor * exp((1.0-cumulus) * -5) * ambientlightshadow;
vec3 Sint = (S - S * exp(-mult*muE)) / muE;
color += max(muE*Sint*total_extinction,0.0);
total_extinction *= max(exp(-mult*muE),0.0);
for (int j=0; j < 3; j++){
vec3 shadowSamplePos = progressW + dV_Sun * (0.1 + j * (0.1 + dither.y*0.05));
float shadow = cloudCoverage(shadowSamplePos, minCloudHeight, maxCloudHeight) * 0.5;
sunLight += shadow;
}
if (total_extinction < 1e-5) break;
sunLight += 2*cloudCoverage(progressW + dV_Sun/abs(dV_Sun.y) * max(minCloudHeight+20 - progressW.y,0.0), minCloudHeight, maxCloudHeight) * exp(-10*cloud);
vec3 lighting = skyLightColor + (sunScattering*exp(-5 * sunLight) + sunMultiScattering*exp(-3 * sunLight)) * sh;
color += max(lighting - lighting*exp(-muE*dd*dL),0.0) * absorbance;
absorbance *= max(exp(-muE*dd*dL),0.0);
if (absorbance < 1e-5) break;
}
return vec4(color, total_extinction);
return vec4(color, absorbance);
}
*/

View File

@ -281,7 +281,7 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
#define colortype 2 // 1 = RGB sliders for sun/moon color. 2 = blackbody. [1 2]
#define sun_illuminance 128000.0 //[0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 150.0 200.0 300.0 400.0 500.0 600.0 700.0 800.0 900.0 1000.0 2000.0 3000.0 4000.0 5000.0 6000.0 7000.0 8000.0 9000.0 10000.0 11000.0 12000.0 13000.0 14000.0 15000.0 20000.0 30000.0 40000.0 50000.0 60000.0 70000.0 80000.0 90000.0 100000.0 150000.0 200000.0 250000.0 300000.0 400000.0 500000.0]
#define Sun_temp 7000 // [1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000]
#define Sun_temp 6300 // [1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000]
#define sunColorR 1.0 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 ]
#define sunColorG 0.91 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 ]
#define sunColorB 0.81 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 ]
@ -350,7 +350,7 @@ uniform int moonPhase;
#define Rain_coverage 1.1 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#define fbmAmount 0.5 // [0.00 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 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.12 1.14 1.16 1.18 1.20 1.22 1.24 1.26 1.28 1.30 1.32 1.34 1.36 1.38 1.40 1.42 1.44 1.46 1.48 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00]
#define fbmAmount 0.4 // [0.00 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 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.12 1.14 1.16 1.18 1.20 1.22 1.24 1.26 1.28 1.30 1.32 1.34 1.36 1.38 1.40 1.42 1.44 1.46 1.48 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00]
#define fbmPower1 3.00 // [1.0 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 5. 6. 7. 8. 9. 10.]
#define fbmPower2 2.50 // [1.00 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 5. 6. 7. 8. 9. 10.]

View File

@ -202,7 +202,7 @@ void DoSpecularReflections(
vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(Roughness), Noise.x);
if(Hand) SamplePoints = normalize(vec3(0.0,0.0,1.0));
#else
vec3 SamplePoints = normalize(vec3(0.0,0.0,1.0));
vec3 SamplePoints = vec3(0.0,0.0,1.0);
#endif
vec3 Ln = reflect(-ViewDir, SamplePoints);

View File

@ -106,10 +106,10 @@ float cloudVol(in vec3 pos,in vec3 samplePos,in float cov, in int LoD, float min
noise += ((1-smallnoise) - max(0.15 - abs(smallnoise * 2.0 - 0.55) * 0.5,0.0)*1.5) * 0.6 * sqrt(noise);
}
noise *= 1.0-cov;
noise *= (1.0-cov);
noise = noise*noise * (upperPlane*0.5+0.5);
noise = noise*noise * (upperPlane*0.7+0.3);
float cloud = max(cov - noise*noise*fbmAmount,0.0);
return cloud;
@ -182,10 +182,12 @@ vec3 DoCloudLighting(
// skyLight *= exp(skyScatter * -10);
vec3 sunLight = exp(sunShadows * -15 + powder ) * sunScatter;
sunLight += exp(sunShadows * -4) * sunMultiScatter * (powder*0.7+0.3);
sunLight += exp(sunShadows * -3) * sunMultiScatter * (powder*0.7+0.3);
// vec3 moonLighting = exp(MoonShadowing * -7 + powder) * moonContribution;
// return skyLight;
// return sunLight;
return skyLight + sunLight;
}
@ -203,11 +205,12 @@ vec4 renderClouds(
float total_extinction = 1.0;
vec3 color = vec3(0.0);
//////////////////////////////////////////
////// lighting stuff
//////////////////////////////////////////
////// lighting stuff
float shadowStep = 200.;
float shadowStep = 200.0;
vec3 dV_Sun = WsunVec*shadowStep;
// vec3 dV_Sun_small = dV_Sun/shadowStep;
float SdotV = dot(mat3(gbufferModelView)*WsunVec,normalize(FragPosition));
// if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun;
@ -217,14 +220,28 @@ vec4 renderClouds(
vec3 sunScattering = SunColor * mieDay * 3.14;
vec3 sunMultiScattering = SunColor * mieDayMulti * 4.0;
SkyColor *= clamp(abs(dV_Sun.y)/100.,0.5,1.0);
vec3 sunIndirectScattering = SunColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(FragPosition)), 0.5);
// SkyColor *= clamp(dV_Sun.y/100.0,0.5,1.0);
SunColor = SunColor * clamp(dV_Sun.y ,0.0,1.0);
MoonColor *= clamp(-dV_Sun.y,0.0,1.0);
//////////////////////////////////////////
////// Raymarching stuff
//////////////////////////////////////////
//project pixel position into projected shadowmap space
vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) );
// maxIT_clouds = int(clamp(maxIT_clouds / sqrt(exp2(viewPos.y)),0.0, maxIT));
maxIT_clouds = int(clamp(maxIT_clouds / sqrt(exp2(viewPos.y)),0.0, maxIT));
// maxIT_clouds = 30;
vec3 dV_view = normalize(viewPos.xyz);
dV_view *= 300/abs(dV_view.y)/maxIT_clouds;
float mult = length(dV_view);
// first cloud layer
float MinHeight_0 = Cumulus_height;
@ -234,26 +251,10 @@ vec4 renderClouds(
float MinHeight_1 = MaxHeight_0 + 50;
float MaxHeight_1 = 100 + MinHeight_1;
float allDensities = Cumulus_density;
float StepSize = 200;
//project pixel position into projected shadowmap space
vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) );
// maxIT_clouds = int(clamp(maxIT_clouds / sqrt(exp2(viewPos.y)),0.0, maxIT));
maxIT_clouds = int(clamp(maxIT_clouds / sqrt(exp2(viewPos.y)),0.0, maxIT));
// maxIT_clouds = 30;
vec3 dV_view = normalize(viewPos.xyz);
// dV_view.y += 0.05; /// cloud plane curvature
dV_view *= 300/abs(dV_view.y)/maxIT_clouds;
float mult = length(dV_view);
float startFlip = mix(max(cameraPosition.y - MaxHeight_0 - 200,0.0), max(MinHeight_0 - cameraPosition.y,0), clamp(dV_view.y,0,1));
vec3 progress_view = dV_view*Dither.x + cameraPosition + dV_view/abs(dV_view.y) * startFlip;
vec3 progress_view = dV_view*Dither.y + cameraPosition + dV_view/abs(dV_view.y) * startFlip;
float allDensities = Cumulus_density;
#ifdef Cumulus
for(int i = 0; i < maxIT_clouds; i++) {
@ -274,48 +275,55 @@ vec4 renderClouds(
// float MoonLight = 0.0;
for (int j=0; j < 3; j++){
vec3 shadowSamplePos = progress_view + dV_Sun * (0.1 + j * (0.1 + Dither.y*0.05));
vec3 shadowSamplePos = progress_view + dV_Sun * (0.1 + j * (0.1 + Dither.x*0.05));
float shadow = GetCumulusDensity(shadowSamplePos, 0, MinHeight_0, MaxHeight_0) * allDensities;
sunLight += shadow;
// MoonLight += shadow;
}
if(max(progress_view.y - MaxHeight_1 + 50,0.0) < 1.0) sunLight += allDensities * 2.0 * GetCumulusDensity(progress_view + dV_Sun/abs(dV_Sun.y) * max((MaxHeight_1 - 30.0) - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0);
if(max(progress_view.y - MaxHeight_1 + 20,0.0) < 1.0) sunLight += allDensities * 2.0 * GetCumulusDensity(progress_view + dV_Sun/abs(dV_Sun.y) * max(MaxHeight_1 - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0);
float upperLayerOcclusion = !isUpperLayer ? allDensities * 2.0 * GetCumulusDensity(progress_view + vec3(0.0,1.0,0.0) * max((MaxHeight_1 - 30.0) - progress_view.y,0.0), 0, MinHeight_0, MaxHeight_0) : 0.0;
float skylightOcclusion = max(exp2((upperLayerOcclusion*upperLayerOcclusion) * -5),0.5);
float skyScatter = clamp((CloudBaseHeights - 20 - progress_view.y) / 275.0,0.0,1.0);
vec3 Lighting = DoCloudLighting(muE, cumulus, SkyColor * skylightOcclusion, skyScatter, sunLight, sunScattering, sunMultiScattering);
vec3 indirectSunlight = sunIndirectScattering * skylightOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2)) * exp((cumulus*cumulus) * -10.0) ;
Lighting += indirectSunlight;
vec3 Lighting = DoCloudLighting(muE, cumulus, SkyColor, skyScatter, sunLight, sunScattering, sunMultiScattering);
// Lighting = vec3(1,0,0) * 30 * cumulus;
// if(max(progress_view.y - MaxHeight_0,0.0) > 0.0) Lighting = vec3(0,1,0) * 30 * cumulus;
// if(max(progress_view.y - MaxHeight_0 - 99,0.0) > 0.0) Lighting = vec3(0,0,1) * 30 * cumulus;
color += max(Lighting - Lighting*exp(-mult*muE),0.0) * total_extinction;
total_extinction *= max(exp(-mult*muE),0.0);
if (total_extinction < 1e-5) break;
}
progress_view += dV_view;
}
#endif
//////////////////////////////////////////
////// fade off in the distance stuff
//////////////////////////////////////////
// return vec4(color, total_extinction);
vec3 normView = normalize(dV_view);
// Assume fog color = sky gradient at long distance
vec4 fogColor = vec4(skyFromTex(normView, colortex4)/30.0, 0.0);
float fog = clamp(abs(max(cameraPosition.y, 255.0) + MaxHeight_0) / max(abs(MinHeight_0-cameraPosition.y),0.00001) * abs(normView.y/1.5),0,1);
fog = 1.0 - clamp(exp((fog*fog) * -35.0),0.0,1.0);
fog = max(1.0 - clamp(exp((fog*fog) * -100.0),0.0,1.0),0.0);
return mix(fogColor, vec4(color, total_extinction), clamp(fog,0.0,1.0));
// return vec4(color, total_extinction);
return mix(fogColor, vec4(color, total_extinction), fog);
}
#endif
float GetCloudShadow(vec3 feetPlayerPos){
#ifdef CLOUDS_SHADOWS
float MinHeight_0 = Cumulus_height;
@ -371,10 +379,10 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
#endif
#ifdef Altostratus
vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(AltostratusHeight - WorldPos.y,0.0);
shadow += GetAltostratusDensity(highShadowStart)*0.5;
#endif
// #ifdef Altostratus
// vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(AltostratusHeight - WorldPos.y,0.0);
// shadow += GetAltostratusDensity(highShadowStart)*0.5;
// #endif
shadow = clamp(shadow,0.0,1.0);
shadow *= shadow;