add ambient light that takes clouds into account, clean up Deferred programs, clean up unused texture calls for LUT, make sure fog and stuff are all using the right LUT colors. fix clouds not being in reflections

thats a good days work
This commit is contained in:
Xonk 2023-06-26 00:33:31 -04:00
parent c46ac275df
commit deb49da793
20 changed files with 219 additions and 309 deletions

View File

@ -9,8 +9,11 @@ const bool colortex12MipmapEnabled = true;
// const bool colortex4MipmapEnabled = true;
const bool shadowHardwareFiltering = true;
flat varying vec4 lightCol; //main light source color (rgb),used light source(1=sun,-1=moon)
flat varying vec3 avgAmbient;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec4 lightCol;
flat varying vec3 WsunVec;
flat varying vec2 TAA_Offset;
flat varying float tempOffsets;
@ -389,7 +392,7 @@ vec2 tapLocation_alternate(
}
void ssAO(inout vec3 lighting, inout float sss, vec3 fragpos,float mulfov, vec2 noise, vec3 normal, vec2 texcoord, vec3 ambientCoefs, vec2 lightmap){
void ssAO(inout vec3 lighting, inout float sss, vec3 fragpos,float mulfov, vec2 noise, vec3 normal, vec2 texcoord, vec3 ambientCoefs, vec2 lightmap, bool isleaves){
ivec2 pos = ivec2(gl_FragCoord.xy);
const float tan70 = tan(70.*3.14/180.);
@ -399,8 +402,12 @@ void ssAO(inout vec3 lighting, inout float sss, vec3 fragpos,float mulfov, vec2
float maxR2 = fragpos.z*fragpos.z*mulfov2*2.*5/50.0;
#ifdef Ambient_SSS
float dist3 = clamp(1.0 - exp( fragpos.z*fragpos.z / -50),0,1);
float maxR2_2 = mix(10.0, fragpos.z*fragpos.z*mulfov2*2./50.0, dist3);
// float dist3 = clamp(1.0 - exp( fragpos.z*fragpos.z / -50),0,1);
// float maxR2_2 = mix(10.0, fragpos.z*fragpos.z*mulfov2*2./50.0, dist3);
float maxR2_2 = fragpos.z*fragpos.z*mulfov2*2./50.0;
float dist3 = clamp(1-exp( fragpos.z*fragpos.z / -50),0,1);
if(isleaves) maxR2_2 = mix(10, maxR2_2, dist3);
#endif
float rd = mulfov2 * 0.1 ;
@ -846,7 +853,7 @@ void main() {
DirectLightColor *= clamp(abs(WsunVec.y)*2,0.,1.);
vec3 AmbientLightColor = avgAmbient;
vec3 AmbientLightColor = averageSkyCol_Clouds;
float cloudShadow = 1.0;
@ -1015,7 +1022,7 @@ void main() {
// AO *= mix(1.0 - exp2(-5 * pow(1-vanilla_AO,3)),1.0, pow(newLightmap.x,4));
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ) ;
if (!hand) ssAO(AO, SkySSS, fragpos, 1.0, blueNoise(gl_FragCoord.xy).rg, FlatNormals , texcoord, ambientCoefs, newLightmap.xy);
if (!hand) ssAO(AO, SkySSS, fragpos, 1.0, blueNoise(gl_FragCoord.xy).rg, FlatNormals , texcoord, ambientCoefs, newLightmap.xy, isLeaf);
#endif
@ -1043,11 +1050,13 @@ void main() {
Indirect_lighting *= AO;
#ifdef Ambient_SSS
if (!hand){
#if indirect_effect != 1
if (!hand) ScreenSpace_SSS(SkySSS, fragpos, blueNoise(gl_FragCoord.xy).rg, FlatNormals, isLeaf);
ScreenSpace_SSS(SkySSS, fragpos, blueNoise(gl_FragCoord.xy).rg, FlatNormals, isLeaf);
#endif
Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3) * pow(1.0-clamp(abs(ambientCoefs.y+0.5),0.0,1.0),0.1) ;
// Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3);
}
#endif
@ -1144,18 +1153,13 @@ void main() {
LabEmission(FINAL_COLOR, albedo, SpecularTex.a);
// #endif
// if(lightningBolt) FINAL_COLOR.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0;
if(lightningBolt) FINAL_COLOR.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0;
gl_FragData[0].rgb = FINAL_COLOR;
// if(LabSSS > 0.0) gl_FragData[0].rgb = vec3(0,25,0);
}
////// ----- Apply Clouds ----- //////
// gl_FragData[0].rgb = gl_FragData[0].rgb *cloud.a + cloud.rgb;
////// ----- Under Water Fog ----- //////
if (iswater){
vec3 fragpos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z0));
float Vdiff = distance(fragpos,fragpos0);
@ -1165,7 +1169,7 @@ void main() {
float custom_lightmap_T = pow(texture2D(colortex14, texcoord).a,1.5);
vec3 ambientColVol = (avgAmbient * 8./150./1.5) * max(custom_lightmap_T,MIN_LIGHT_AMOUNT*0.001);
vec3 ambientColVol = (averageSkyCol_Clouds * 8./150./1.5) * max(custom_lightmap_T,MIN_LIGHT_AMOUNT*0.001);
vec3 lightColVol = (lightCol.rgb / 80.) ;
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));

View File

@ -2,9 +2,12 @@
#extension GL_EXT_gpu_shader4 : enable
#include "lib/settings.glsl"
flat varying vec3 WsunVec;
flat varying vec3 avgAmbient;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec4 lightCol;
flat varying vec3 WsunVec;
flat varying float tempOffsets;
flat varying vec2 TAA_Offset;
flat varying vec3 zMults;
@ -58,8 +61,11 @@ void main() {
#ifndef TAA
TAA_Offset = vec2(0.0);
#endif
avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
// sunColor = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
// moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
vec3 sc = texelFetch2D(colortex4,ivec2(6,37),0).rgb;

View File

@ -4,11 +4,14 @@
#include "lib/settings.glsl"
flat varying vec4 lightCol;
flat varying vec3 sunColor;
flat varying vec3 moonColor;
flat varying vec3 avgAmbient2;
flat varying vec4 lightCol;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
@ -16,6 +19,7 @@ flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
flat varying vec3 avgAmbient;
flat varying float tempOffsets;
flat varying float fogAmount;
flat varying float VFAmount;
@ -274,18 +278,17 @@ void main() {
vec3 fragpos = toScreenSpace(vec3(tc/RENDER_SCALE,z));
#ifdef Cloud_Fog
vec4 VL_CLOUDFOG = InsideACloudFog(fragpos, vec2(R2_dither(),blueNoise()), lightCol.rgb/80., moonColor/150., (avgAmbient*2.0) * 8./150./3.);
vec4 VL_CLOUDFOG = InsideACloudFog(fragpos, vec2(R2_dither(),blueNoise()), lightCol.rgb/80., moonColor/150., (averageSkyCol*2.0) * 8./150./3.);
// vec4 rays = vec4(0.0);
// if(rainStrength > 0.0){
// rays = RainRays(vec3(0.0), fragpos, length(fragpos), R2_dither(), (avgAmbient*2.0) * 8./150./3., lightCol.rgb, dot(normalize(fragpos), normalize(sunVec) ));
// VL_CLOUDFOG += rays * rainStrength;
// }
gl_FragData[0] = clamp(VL_CLOUDFOG ,0.0,65000.);
gl_FragData[0] = clamp(VL_CLOUDFOG, 0.0,65000.);
#else
vec4 VL_Fog = getVolumetricRays(fragpos,blueNoise(),avgAmbient);
vec4 VL_Fog = getVolumetricRays(fragpos, blueNoise(), averageSkyCol);
gl_FragData[0] = clamp(VL_Fog,0.0,65000.);
#endif
@ -311,8 +314,7 @@ void main() {
estEyeDepth = max(Water_Top_Layer - cameraPosition.y,0.0);
waterVolumetrics(vl, vec3(0.0), fragpos, estEyeDepth, estEyeDepth, length(fragpos), noise, totEpsilon, scatterCoef, (avgAmbient*8./150./3.*0.5) , lightCol.rgb*8./150./3.0*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)), dot(normalize(fragpos), normalize(sunVec) ));
waterVolumetrics(vl, vec3(0.0), fragpos, estEyeDepth, estEyeDepth, length(fragpos), noise, totEpsilon, scatterCoef, (averageSkyCol_Clouds*8./150./3.*0.5) , lightCol.rgb*8./150./3.0*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)), dot(normalize(fragpos), normalize(sunVec) ));
gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.);
}
}

View File

@ -3,6 +3,9 @@
#include "lib/settings.glsl"
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec4 lightCol;
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
@ -69,10 +72,12 @@ void main() {
#endif
vec3 sc = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
sunColor = texelFetch2D(colortex4,ivec2(12,37),0).rgb;
moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
avgAmbient = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
sunColor = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2-1.;
lightCol.rgb = sc;

View File

@ -208,7 +208,7 @@ void main() {
vec4 TranslucentShader = texture2D(colortex2,texcoord);
float lightleakfix = clamp((eyeBrightnessSmooth.y )/240.0,0.0,1.0);
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
vec2 tempOffset = TAA_Offset;
@ -261,8 +261,21 @@ void main() {
//cave fog
#ifdef Cave_fog
if (isEyeInWater == 0){
// float fogdistfade = clamp( pow(length(fragpos) / far, CaveFogFallOff) ,0.0,1.0);
// float fogfade = clamp( exp(clamp(np3.y * 0.5 + 0.5,0,1) * -3.0) ,0.0,1.0);
float fogdistfade = clamp( pow(length(fragpos) / far, CaveFogFallOff) ,0.0,1.0);
fogdistfade = fogdistfade*0.95 + clamp( pow(1.0 - exp((length(fragpos) / far) * -5), 2.0) ,0.0,1.0)*0.05;
float fogfade = clamp( exp(clamp(np3.y * 0.5 + 0.5,0,1) * -3.0) ,0.0,1.0);
// vl.a *= 1-fogdistfade ;
// float fogdistfade = clamp( pow(1.0 - exp((length(fragpos) / far) * -5), 2.0) ,0.0,1.0);
// // float fogfade = clamp( exp(clamp(np3.y * 0.35 + 0.35,0,1) * -5.0) ,0.0,1.0) * 0.1;
color.rgb = mix(color.rgb, vec3(CaveFogColor_R,CaveFogColor_G,CaveFogColor_B)*fogfade + (blueNoise()-0.5)*0.01, fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ;
// color.rgb = vec3(CaveFogColor_R,CaveFogColor_G,CaveFogColor_B)*fogfade ;
}
@ -300,9 +313,9 @@ void main() {
color.rgb *= mix(1.0, (1.0-darknessLightFactor*2.0) * clamp(1.0-pow(length(fragpos2)*(darknessFactor*0.07),2.0),0.0,1.0), darknessFactor);
#ifdef display_LUT
vec2 movedTC = texcoord ;
vec2 movedTC = texcoord ;
vec3 thingy = texture2D(colortex4,movedTC).rgb / 150. * 5.0;
if(texcoord.x < 0.45 && luma(thingy) > 0.0 ) color.rgb = thingy;
if(luma(thingy) > 0.0 ) color.rgb = thingy;
#endif
gl_FragData[0].r = vl.a; // pass fog alpha so bloom can do bloomy fog

View File

@ -39,11 +39,12 @@ void main() {
#ifdef TAA_UPSCALING
gl_Position.xy = (gl_Position.xy*0.5+0.5)*RENDER_SCALE*2.0-1.0;
#endif
TAA_Offset = offsets[frameCounter%8];
#ifndef TAA
TAA_Offset = vec2(0.0);
TAA_Offset = vec2(0.0);
#endif
vec3 sc = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2-1.;
lightCol.rgb = sc;

View File

@ -5,27 +5,19 @@
//Prepares sky textures (2 * 256 * 256), computes light values and custom lightmaps
#define ReflectedFog
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
flat varying float avgL2;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec3 lightSourceColor;
flat varying vec3 sunColor;
flat varying vec3 sunColorCloud;
flat varying vec3 moonColor;
flat varying vec3 moonColorCloud;
flat varying vec3 zenithColor;
flat varying vec3 avgSky;
flat varying float avgL2;
flat varying vec2 tempOffsets;
flat varying float exposure;
flat varying float rodExposure;
flat varying float avgBrightness;
flat varying float exposureF;
flat varying float fogAmount;
flat varying float VFAmount;
flat varying float centerDepth;
// uniform sampler2D colortex4;
@ -116,85 +108,40 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
void main() {
/* DRAWBUFFERS:4 */
gl_FragData[0] = vec4(0.0);
float minLight = (MIN_LIGHT_AMOUNT + nightVision*5) * 0.007/ (exposure + rodExposure/(rodExposure+1.0)*exposure*1.);
// vec3 minLight_col = MIN_LIGHT_AMOUNT * 0.007/ (exposure + rodExposure/(rodExposure+1.0)*exposure*1.) * vec3(0.8,0.9,1.0);
//Lightmap for forward shading (contains average integrated sky color across all faces + torch + min ambient)
vec3 avgAmbient = (ambientUp + ambientLeft + ambientRight + ambientB + ambientF + ambientDown)/6.;
// avgAmbient *= blackbody(ambient_temp);
if (gl_FragCoord.x < 17. && gl_FragCoord.y < 17.){
float torchLut = clamp(16.0-gl_FragCoord.x,0.5,15.5);
torchLut = torchLut+0.712;
float torch_lightmap = max(1.0/torchLut/torchLut - 1/17.212/17.212,0.0);
torch_lightmap = pow(torch_lightmap*2.5,1.5)*TORCH_AMOUNT*10.;
float sky_lightmap = (Slightmap[int(gl_FragCoord.y)]-14.0)/235.;
sky_lightmap = pow(sky_lightmap,1.4);
vec3 ambient = (ambientUp * blackbody(ambient_temp))*sky_lightmap+torch_lightmap*vec3(TORCH_R,TORCH_G,TORCH_B)*TORCH_AMOUNT;
gl_FragData[0] = vec4(max(ambient*Ambient_Mult,minLight/5),1.0);
}
//Lightmap for deferred shading (contains only torch + min ambient)
if (gl_FragCoord.x < 17. && gl_FragCoord.y > 19. && gl_FragCoord.y < 19.+17. ){
float torchLut = clamp(16.0-gl_FragCoord.x,0.5,15.5);
torchLut = torchLut+0.712;
float torch_lightmap = max(1.0/torchLut/torchLut - 1/17.212/17.212,0.0);
float ambient = pow(torch_lightmap*2.5,1.5)*TORCH_AMOUNT*10.;
float sky_lightmap = (Slightmap[int(gl_FragCoord.y-19.0)]-14.0)/235./150.;
gl_FragData[0] = vec4(sky_lightmap,ambient,minLight,1.0)*Ambient_Mult;
}
//Save light values
if (gl_FragCoord.x < 1. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(ambientUp * blackbody(ambient_temp) ,1.0);
gl_FragData[0] = vec4(averageSkyCol_Clouds * blackbody(ambient_temp),1.0);
if (gl_FragCoord.x > 1. && gl_FragCoord.x < 2. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(ambientUp ,1.0);
if (gl_FragCoord.x > 2. && gl_FragCoord.x < 3. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(ambientLeft ,1.0);
if (gl_FragCoord.x > 3. && gl_FragCoord.x < 4. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(ambientRight ,1.0);
if (gl_FragCoord.x > 4. && gl_FragCoord.x < 5. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(ambientB ,1.0);
if (gl_FragCoord.x > 5. && gl_FragCoord.x < 6. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(ambientF ,1.0);
gl_FragData[0] = vec4(averageSkyCol,1.0);
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(lightSourceColor,1.0);
if (gl_FragCoord.x > 7. && gl_FragCoord.x < 8. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(avgAmbient ,1.0);
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(sunColor,1.0);
if (gl_FragCoord.x > 9. && gl_FragCoord.x < 10. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(moonColor,1.0);
if (gl_FragCoord.x > 11. && gl_FragCoord.x < 12. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(avgSky ,1.0);
if (gl_FragCoord.x > 12. && gl_FragCoord.x < 13. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(sunColorCloud,1.0);
if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(moonColorCloud,1.0);
//Sky gradient (no clouds)
gl_FragData[0] = vec4(moonColor,1.0);
const float pi = 3.141592653589793238462643383279502884197169;
//Sky gradient (no clouds)
if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.,1.))/256.+tempOffsets/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.,1.))/256.+tempOffsets/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
vec2 planetSphere = vec2(0.0);
vec3 sky = vec3(0.0);
vec3 skyAbsorb = vec3(0.0);
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
sky = calculateAtmosphere(avgSky*4000./2.0, viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
sky = calculateAtmosphere(averageSkyCol*4000./2.0, viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
#ifdef AEROCHROME_MODE
sky *= vec3(0.0, 0.18, 0.35);
#endif
// sky = mix(sky, vec3(0.5,0.5,0.5)*avgSky * 4000., clamp(1 - viewVector.y,0.0,1.0) * rainStrength );
// sky *= max(abs(viewVector.y+0.05),0.25);
gl_FragData[0] = vec4(sky/4000.*Sky_Brightness,1.0);
}
@ -203,18 +150,18 @@ 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 skytex = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150. ;
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150. ;
if(viewVector.y < -0.025) skytex = skytex * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
if(viewVector.y < -0.025) sky = sky * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), sunColorCloud, moonColor, ambientUp*5.0);
// skytex = skytex*clouds.a + clouds.rgb/5.0;
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), sunColor, moonColor, averageSkyCol*5.0);
sky = sky*clouds.a + clouds.rgb/5.0;
vec4 VL_Fog = getVolumetricRays(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), ambientUp);
skytex = skytex*VL_Fog.a + VL_Fog.rgb*20;
vec4 VL_Fog = getVolumetricRays(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), averageSkyCol);
sky = sky*VL_Fog.a + VL_Fog.rgb*20;
gl_FragData[0] = vec4(skytex,1.0);
gl_FragData[0] = vec4(sky,1.0);
}
//Temporally accumulate sky and light values

View File

@ -1,29 +1,22 @@
#version 120
#extension GL_EXT_gpu_shader4 : enable
#include "lib/settings.glsl"
#include "lib/res_params.glsl"
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
flat varying vec3 zenithColor;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec3 sunColor;
flat varying vec3 sunColorCloud;
flat varying vec3 moonColor;
flat varying vec3 moonColorCloud;
flat varying vec3 lightSourceColor;
flat varying vec3 avgSky;
flat varying vec3 zenithColor;
flat varying vec2 tempOffsets;
flat varying float exposure;
flat varying float avgBrightness;
flat varying float exposureF;
flat varying float rodExposure;
flat varying float fogAmount;
flat varying float VFAmount;
flat varying float avgL2;
flat varying float centerDepth;
@ -31,64 +24,28 @@ uniform sampler2D colortex4;
uniform sampler2D colortex6;
uniform sampler2D depthtex0;
flat varying vec3 WsunVec;
uniform mat4 gbufferModelViewInverse;
uniform vec3 sunPosition;
uniform vec2 texelSize;
uniform float rainStrength;
uniform float sunElevation;
uniform float nightVision;
uniform float eyeAltitude;
uniform float near;
uniform float far;
uniform float frameTime;
uniform float eyeAltitude;
uniform int frameCounter;
uniform float rainStrength;
// uniform int worldTime;
vec3 sunVec = normalize(mat3(gbufferModelViewInverse) *sunPosition);
#include "lib/sky_gradient.glsl"
#include "/lib/util.glsl"
#include "/lib/ROBOBO_sky.glsl"
vec3 rodSample(vec2 Xi)
{
float r = sqrt(1.0f - Xi.x*Xi.y);
float phi = 2 * 3.14159265359 * Xi.y;
return normalize(vec3(cos(phi) * r, sin(phi) * r, Xi.x)).xzy;
}
vec3 cosineHemisphereSample(vec2 Xi)
{
float r = sqrt(Xi.x);
float theta = 2.0 * 3.14159265359 * Xi.y;
float x = r * cos(theta);
float y = r * sin(theta);
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
}
float luma(vec3 color) {
return dot(color,vec3(0.21, 0.72, 0.07));
}
vec2 tapLocation(int sampleNumber,int nb, float nbRot,float jitter)
{
float alpha = float(sampleNumber+jitter)/nb;
float angle = (jitter+alpha) * (nbRot * 6.28);
float ssR = alpha;
float sin_v, cos_v;
sin_v = sin(angle);
cos_v = cos(angle);
return vec2(cos_v, sin_v)*ssR;
}
//Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
@ -106,42 +63,46 @@ void main() {
gl_Position.xy = gl_Position.xy*vec2(18.+258*2,258.)*texelSize;
gl_Position.xy = gl_Position.xy*2.-1.0;
tempOffsets = R2_samples(frameCounter%10000);
///////////////////////////////////
/// --- AMBIENT LIGHT STUFF --- ///
///////////////////////////////////
ambientUp = vec3(0.0);
ambientDown = vec3(0.0);
ambientLeft = vec3(0.0);
ambientRight = vec3(0.0);
ambientB = vec3(0.0);
ambientF = vec3(0.0);
avgSky = vec3(0.0);
//Integrate sky light for each block side
int maxIT = 20;
averageSkyCol_Clouds = vec3(0.0);
averageSkyCol = vec3(0.0);
vec2 sample3x3[9] = vec2[](
vec2(-1.0, 0.0),
vec2( 0.0, 0.0),
vec2( 1.0, 0.0),
vec2(-1.0, -0.5),
vec2( 0.0, -0.5),
vec2( 1.0, -0.5),
vec2(-1.0, -1.0),
vec2( 0.0, -1.0),
vec2( 1.0, -1.0)
);
// sample in a 3x3 pattern to get a good area for average color
vec3 pos = normalize(vec3(0,1,0));
int maxIT = 9;
for (int i = 0; i < maxIT; i++) {
vec2 ij = R2_samples((frameCounter%1000)*maxIT+i);
vec3 pos = normalize(rodSample(ij));
pos.xy += normalize(sample3x3[i] * vec2(1.0,0.5));
averageSkyCol_Clouds += 2.0*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.;
pos = normalize(vec3(0,1,0));
}
// only need to sample one spot for this
averageSkyCol += 2.0*skyFromTex(normalize(vec3(0.0,1.0,0.0)),colortex4).rgb/150.;
vec3 samplee = 1.72*skyFromTex(pos,colortex4).rgb/maxIT/150.;
avgSky += samplee/1.72;
ambientUp += samplee*(pos.y+abs(pos.x)/7.+abs(pos.z)/7.);
ambientLeft += samplee*(clamp(-pos.x,0.0,1.0)+clamp(pos.y/7.,0.0,1.0)+abs(pos.z)/7.);
ambientRight += samplee*(clamp(pos.x,0.0,1.0)+clamp(pos.y/7.,0.0,1.0)+abs(pos.z)/7.);
ambientB += samplee*(clamp(pos.z,0.0,1.0)+abs(pos.x)/7.+clamp(pos.y/7.,0.0,1.0));
ambientF += samplee*(clamp(-pos.z,0.0,1.0)+abs(pos.x)/7.+clamp(pos.y/7.,0.0,1.0));
ambientDown += samplee*(clamp(pos.y/6.,0.0,1.0)+abs(pos.x)/7.+abs(pos.z)/7.);
/*
ambientUp += samplee*(pos.y);
ambientLeft += samplee*(clamp(-pos.x,0.0,1.0));
ambientRight += samplee*(clamp(pos.x,0.0,1.0));
ambientB += samplee*(clamp(pos.z,0.0,1.0));
ambientF += samplee*(clamp(-pos.z,0.0,1.0));
ambientDown += samplee*(clamp(pos.y/6.,0.0,1.0))*0;
*/
}
////////////////////////////////////////
/// --- SUNLIGHT/MOONLIGHT STUFF --- ///
////////////////////////////////////////
vec2 planetSphere = vec2(0.0);
vec3 sky = vec3(0.0);
@ -156,56 +117,19 @@ void main() {
sunColor = calculateAtmosphere(vec3(0.0), sunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.0);
sunColor = sunColorBase/4000. * skyAbsorb;
skyAbsorb = vec3(1.0);
float dSun = 0.03;
vec3 modSunVec = sunVec*(1.0-dSun)+vec3(0.0,dSun,0.0);
vec3 modSunVec2 = sunVec*(1.0-dSun)+vec3(0.0,dSun,0.0);
if (modSunVec2.y > modSunVec.y) modSunVec = modSunVec2;
sunColorCloud = calculateAtmosphere(vec3(0.0), modSunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.);
sunColorCloud = sunColorBase/4000. * skyAbsorb ;
skyAbsorb = vec3(1.0);
moonColor = calculateAtmosphere(vec3(0.0), -sunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.5);
moonColor = moonColorBase/4000.0*skyAbsorb;
skyAbsorb = vec3(1.0);
modSunVec = -sunVec*(1.0-dSun)+vec3(0.0,dSun,0.0);
modSunVec2 = -sunVec*(1.0-dSun)+vec3(0.0,dSun,0.0);
if (modSunVec2.y > modSunVec.y) modSunVec = modSunVec2;
moonColorCloud = calculateAtmosphere(vec3(0.0), modSunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.5);
moonColorCloud = moonColorBase/4000.0*0.55;
// #ifndef CLOUDS_SHADOWS
// sunColor *= (1.0-rainStrength*vec3(0.96,0.95,0.94));
// moonColor *= (1.0-rainStrength*vec3(0.96,0.95,0.94));
// #endif
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
float lightDir = float( sunVis >= 1e-5)*2.0-1.0;
//Fake bounced sunlight
vec3 bouncedSun = lightSourceColor*0.1/5.0*0.5*clamp(lightDir*sunVec.y,0.0,1.0)*clamp(lightDir*sunVec.y,0.0,1.0);
vec3 cloudAmbientSun = (sunColorCloud)*0.007;
vec3 cloudAmbientMoon = (moonColorCloud)*0.007;
ambientUp += bouncedSun*clamp(-lightDir*sunVec.y+4.,0.,4.0) + cloudAmbientSun*clamp(sunVec.y+2.,0.,4.0) + cloudAmbientMoon*clamp(-sunVec.y+2.,0.,4.0);
ambientLeft += bouncedSun*clamp(lightDir*sunVec.x+4.,0.0,4.) + cloudAmbientSun*clamp(-sunVec.x+2.,0.0,4.)*0.7 + cloudAmbientMoon*clamp(sunVec.x+2.,0.0,4.)*0.7;
ambientRight += bouncedSun*clamp(-lightDir*sunVec.x+4.,0.0,4.) + cloudAmbientSun*clamp(sunVec.x+2.,0.0,4.)*0.7 + cloudAmbientMoon*clamp(-sunVec.x+2.,0.0,4.)*0.7;
ambientB += bouncedSun*clamp(-lightDir*sunVec.z+4.,0.0,4.) + cloudAmbientSun*clamp(sunVec.z+2.,0.0,4.)*0.7 + cloudAmbientMoon*clamp(-sunVec.z+2.,0.0,4.)*0.7;
ambientF += bouncedSun*clamp(lightDir*sunVec.z+4.,0.0,4.) + cloudAmbientSun*clamp(-sunVec.z+2.,0.0,4.)*0.7 + cloudAmbientMoon*clamp(sunVec.z+2.,0.0,4.)*0.7;
ambientDown += bouncedSun*clamp(lightDir*sunVec.y+4.,0.0,4.)*0.7 + cloudAmbientSun*clamp(-sunVec.y+2.,0.0,4.)*0.5 + cloudAmbientMoon*clamp(sunVec.y+2.,0.0,4.)*0.5;
avgSky += bouncedSun*5.;
vec3 rainNightBoost = moonColorCloud*0.005;
ambientUp += rainNightBoost;
ambientLeft += rainNightBoost;
ambientRight += rainNightBoost;
ambientB += rainNightBoost;
ambientF += rainNightBoost;
ambientDown += rainNightBoost;
avgSky += rainNightBoost;
//////////////////////////////
/// --- EXPOSURE STUFF --- ///
//////////////////////////////
float avgLuma = 0.0;
float m2 = 0.0;

View File

@ -4,14 +4,17 @@
//Computes volumetric clouds at variable resolution (default 1/4 res)
uniform float far;
uniform float near;
flat varying vec4 lightCol;
flat varying vec3 sunColor;
flat varying vec3 moonColor;
flat varying vec3 avgAmbient;
flat varying float tempOffsets;
flat varying vec3 averageSkyCol_Clouds;
flat varying float tempOffsets;
uniform float far;
uniform float near;
uniform sampler2D depthtex0;
// uniform sampler2D colortex4;
uniform sampler2D noisetex;
@ -92,7 +95,7 @@ void main() {
vec3 fragpos = toScreenSpace(vec3(halfResTC*texelSize,1));
vec4 currentClouds = renderClouds(fragpos,vec2(R2_dither(),blueNoise2()), lightCol.rgb/80., moonColor/150., (avgAmbient*2.0)* 8./150./3.);
vec4 currentClouds = renderClouds(fragpos,vec2(R2_dither(),blueNoise2()), sunColor/80., moonColor/150., (averageSkyCol_Clouds*2.0)* 8./150./3.);
gl_FragData[0] = currentClouds;

View File

@ -2,57 +2,38 @@
#extension GL_EXT_gpu_shader4 : enable
#include "lib/settings.glsl"
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 sunColor;
flat varying vec3 moonColor;
flat varying vec4 lightCol;
flat varying vec3 avgAmbient;
flat varying float tempOffsets;
flat varying float tempOffsets;
flat varying vec3 WsunVec;
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
uniform mat4 gbufferModelViewInverse;
uniform vec3 sunPosition;
uniform float sunElevation;
uniform sampler2D colortex4;
uniform int frameCounter;
#include "/lib/util.glsl"
#include "/lib/res_params.glsl"
void main() {
// TAA_Offset = offsets[frameCounter%8];
// #ifndef TAA
// TAA_Offset = vec2(0.0);
// #endif
tempOffsets = HaltonSeq2(frameCounter%10000);
gl_Position = ftransform();
gl_Position.xy = (gl_Position.xy*0.5+0.5)*clamp(CLOUDS_QUALITY+0.01,0.0,1.0)*2.0-1.0;
#ifdef TAA_UPSCALING
gl_Position.xy = (gl_Position.xy*0.5+0.5)*RENDER_SCALE*2.0-1.0;
#endif
sunColor = texelFetch2D(colortex4,ivec2(12,37),0).rgb;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
sunColor = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
// avgAmbient = texelFetch2D(colortex4,ivec2(11,37),0).rgb;
vec3 sc = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2-1.;
lightCol.rgb = sc;
WsunVec = lightCol.a*normalize(mat3(gbufferModelViewInverse) *sunPosition);
WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) *sunPosition);
// ambientUp = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
// ambientDown = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
// ambientLeft = texelFetch2D(colortex4,ivec2(2,37),0).rgb;
// ambientRight = texelFetch2D(colortex4,ivec2(3,37),0).rgb;
// ambientB = texelFetch2D(colortex4,ivec2(4,37),0).rgb;
// ambientF = texelFetch2D(colortex4,ivec2(5,37),0).rgb;
avgAmbient = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
}

View File

@ -556,12 +556,33 @@ void main() {
gl_FragData[2].rg = SpecularTex.rg;
#ifdef LabPBR_Emissives
gl_FragData[2].a = SpecularTex.a;
#else
gl_FragData[2].a = EMISSIVE;
// #ifdef LabPBR_Emissives
// gl_FragData[2].a = SpecularTex.a;
// if(SpecularTex.a <= 0.0) gl_FragData[2].a = EMISSIVE;
// #else
// gl_FragData[2].a = SpecularTex.a;
// if(SpecularTex.a <= 0.0) gl_FragData[2].a = EMISSIVE;
// // gl_FragData[2].a = EMISSIVE;
// #endif
#if EMISSIVE_TYPE == 0
gl_FragData[2].a = 0.0;
#endif
#if EMISSIVE_TYPE == 1
gl_FragData[2].a = EMISSIVE
#endif
#if EMISSIVE_TYPE == 2
gl_FragData[2].a = SpecularTex.a;
if(SpecularTex.a <= 0.0) gl_FragData[2].a = EMISSIVE;
#endif
#if EMISSIVE_TYPE == 3
gl_FragData[2].a = SpecularTex.a;
#endif
#if SSS_TYPE == 0
gl_FragData[2].b = 0.0;
@ -584,9 +605,9 @@ void main() {
#ifdef ENTITIES
if(LIGHTNING > 0) gl_FragData[2].a = 0.5;
#endif
// #ifdef ENTITIES
// if(LIGHTNING > 0) gl_FragData[2].a = 0.9;
// #endif
////////////////////////////////
//////////////////////////////// ALBEDO

View File

@ -248,7 +248,7 @@ void main() {
// if(NameTags > 0) EMISSIVE = 0.9;
// normal block lightsources
if(mc_Entity.x == 10005) EMISSIVE = 0.3;
if(mc_Entity.x == 10005) EMISSIVE = 0.9;
// special cases light lightning and beacon beams...
#ifdef ENTITIES

View File

@ -21,6 +21,12 @@ value.SSS_TYPE.2 = Hardcoded + LabSSS
value.SSS_TYPE.3 = LabSSS only
option.SSS_TYPE.comment = Hardcoded means that the shader defines what gets SSS or not. LabSSS means that the resourcepack defines what gets SSS or not. RTX is no SSS at all lmao. i had to steal this formatting, RRe36
option.EMISSIVE_TYPE = Emission Mode
value.EMISSIVE_TYPE.0 = No emission
value.EMISSIVE_TYPE.1 = Hardcoded only
value.EMISSIVE_TYPE.2 = Hardcoded + Lab Emission
value.EMISSIVE_TYPE.3 = Lab Emission only
option.EMISSIVE_TYPE.comment = Hardcoded means that the shader defines what gets emission or not. Lab emission means that the resourcepack defines what gets emission or not. RTX is no SSS at all lmao. i had to steal this formatting, RRe36

View File

@ -124,7 +124,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
// float low_sun = clamp(pow(1.0-sunVector.y,10.0) + 1.0,1.0, 2.0);
float high_sun = clamp(pow(sunVector.y+0.6,5),0.0,1.0) * 3.0; // make sunrise less blue, and allow sunset to be bluer
float low_sun = clamp(((1.0-abs(sunVector.y))*3.) - high_sun,1.0,2.5) ;
float low_sun = clamp(((1.0-abs(sunVector.y))*3.) - high_sun,1.0,2.0) ;
for (int i = 0; i < iSteps; ++i, position += increment) {
vec3 density = sky_density(length(position));

View File

@ -10,31 +10,18 @@ vec3 DoAmbientLighting (vec3 SkyColor, vec3 TorchColor, vec2 Lightmap, float sky
// Lightmap.x = 0.0;
// Lightmap.y = 1.0;
// old torchlight curves
// vec3 TorchLight = TorchColor * pow(1.0-pow(1.0-clamp(Lightmap.x,0.0,1.0) ,0.1),2);
// TorchLight = clamp(exp(TorchLight * 30) - 1.0,0.0,5.0);
// TorchLight *= TORCH_AMOUNT;
float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5; //pow(TorchLM/4.5,10)*2.5 + pow(Lightmap.x,1.5)*0.5;
vec3 TorchLight = TorchColor * TorchLM * 0.75;
TorchLight *= TORCH_AMOUNT;
// old skylight curves
// SkyColor = (SkyColor * 2.0 * ambient_brightness) * 8./150./3.;
// vec3 SkyLight = max(SkyColor * min(pow(Lightmap.y,3.0),1.0), vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01)) ;
SkyColor = (SkyColor * 2.0 * ambient_brightness) * 8./150./3.;
SkyColor += vec3(Lightning_R,Lightning_G,Lightning_B) * 25.0 * skyLightDir * lightningFlash ;
// SkyColor += vec3(0.7,0.9,1.0) * skyLightDir * lightningFlash;
SkyColor += vec3(Lightning_R,Lightning_G,Lightning_B) * 25.0 * skyLightDir * lightningFlash ;
float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5;
vec3 SkyLight = max(SkyColor * skyLM, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01));
return SkyLight * skyLightDir + TorchLight;
}
@ -53,8 +40,6 @@ vec3 DoAmbientLighting_Nether(vec3 FogColor, vec3 TorchColor, float Lightmap, ve
vec3 TorchLight = TorchColor * clamp(pow(Lightmap,3.0),0.0,1.0);
vec3 LavaGlow = vec3(TORCH_R,TORCH_G,TORCH_B);
LavaGlow *= pow(clamp(1.0-max(Normal.y,0.0) + dot(Normal,np3),0.0,1.0),3.0);
LavaGlow *= clamp(exp2(-max((WorldPos.y - 50.0) / 5,0.0)),0.0,1.0);

View File

@ -145,6 +145,7 @@
//#define SPECULARTEX
// #define LabPBR_Emissives
#define EMISSIVE_TYPE 2 // [0 1 2 3]
#define Emissive_Brightness 10.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.]
#define Emissive_Curve 2.0 // yes i blatantly copied kappa here. [1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
@ -159,9 +160,8 @@
#define MAX_DIST 25.0 // [5.0 10.0 15.0 20.0 25.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 125.0 150.0 200.0 400.0] //Increases distance at which POM is calculated
// #define Porosity
#define Sub_surface_scattering // (place the flashlight on your hand example here)
#define SSS_TYPE 1 // [0 1 2 3]
#define SSS_TYPE 2 // [0 1 2 3]
#define Ambient_SSS // subsurface scattering from the sky's light. If SSAO is enabled, this costs very little performance.
#define ambientsss_brightness 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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define Strong_SSS_strength 45 // [ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2 3 4 5 6 7 8 9 10 15 20 30 35 40 45 50]

View File

@ -13,6 +13,10 @@ vec3 skyFromTex(vec3 pos,sampler2D sampler){
vec2 p = sphereToCarte(pos);
return texture2D(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb;
}
vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
vec2 p = sphereToCarte(pos);
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb;
}
float w0(float a)
{
return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0);

View File

@ -305,7 +305,7 @@ vec4 renderClouds(
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);
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view, 1);
S += lightningColor * exp((1.0-cumulus) * -10) * ambientlightshadow;
vec3 Sint = (S - S * exp(-mult*muE)) / muE;

View File

@ -117,6 +117,7 @@ vec4 getVolumetricRays(
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
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)/float(VL_SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float dd = pow(expFactor, float(i+dither)/float(VL_SAMPLES)) * log(expFactor) / float(VL_SAMPLES)/(expFactor-1.0);
@ -155,9 +156,9 @@ vec4 getVolumetricRays(
// extra fog effects
vec3 rainRays = (sunColor*sh) * (rayL*phaseg(SdotV,0.5)) * clamp(pow(WsunVec.y,5)*2,0.0,1) * rainStrength * noPuddleAreas * RainFog_amount * 0.5;
vec3 CaveRays = (sunColor*sh) * phaseg(SdotV,0.7) * 0.001 * (1.0 - max(eyeBrightnessSmooth.y,0)/240.);
vec3 CaveRays = (sunColor*sh) * phaseg(SdotV,0.7) * 0.001 * (1.0 - lightleakfix);
vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * max(eyeBrightnessSmooth.y,0)/240. ;
vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * lightleakfix ;
vL += (vL0 - vL0 * exp(-(rL+m)*dd*dL)) / ((rL+m)+0.00000001)*absorbance;
@ -218,9 +219,15 @@ vec4 InsideACloudFog(
if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun;
vec3 Fog_SkyCol = SkyColor;
vec3 Fog_SunCol = SunColor;
float fogSdotV = dot(sunVec,normalize(fragpos))*lightCol.a;
float fogmie = phaseg(fogSdotV,0.7)*5.0 + 1.0;
// 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;
vec3 lightningColor = vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0 * lightningFlash * max(eyeBrightnessSmooth.y,0)/240.;
#ifdef ReflectedFog
lightningColor *= 0.01;
@ -265,6 +272,7 @@ vec4 InsideACloudFog(
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++) {
@ -300,15 +308,15 @@ vec4 InsideACloudFog(
vec3 rL = rC*airCoef.x;
vec3 m = (airCoef.y+density)*mC;
vec3 DirectLight = (Fog_SunCol*Shadows_for_Fog) * (rayL*rL+m*mie);
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.5)) * 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 - max(eyeBrightnessSmooth.y,0)/240.);
vec3 CaveRays = (Fog_SunCol*Shadows_for_Fog) * phaseg(SdotV,0.7) * 0.001 * (1.0 - lightleakfix);
vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * max(eyeBrightnessSmooth.y,0)/240. ;
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));

View File

@ -41,7 +41,7 @@ alphaTest.gbuffers_skytextured=false
alphaTest.gbuffers_hand=true
sliders = Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness WeatherDay Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength Cloud_Height Dynamic_sky_day ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B cloud_speed Rain_coverage override_R override_G override_B override_Cloudy_Fog_Density override_cloudyfog_fade override_fog override_Uniform_Fog_Density override_uniformfog_fade override_Bloomy_Fog override_Sun_Strength Moon_temp Haze_amount UniformFog_amount CloudyFog_amount TimeOfDayFog_multiplier RainFog_amount CaveFog_amount uniformfog_fade cloudyfog_fade cloudray_amount Swamp_cloudyfog_height Jungle_cloudyfog_fade Swamp_uniformfog_height Jungle_uniformfog_fade noise_mode Distant_shadow_quality ambient_temp Sun_temp Puddle_Size Cloud_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength Swamp_Sun_Strength Jungle_Sun_Strength Swamp_Bloomy_Fog Jungle_Bloomy_Fog Swamp_Mie Jungle_Mie Swamp_cloudyfog_Density Jungle_Cloudy_Fog_Density Swamp_UniformFog_Density Jungle_Uniform_Fog_Density Swamp_Bloomy_Fog Jungle_Bloomy_Fog Swamp_Mie Jungle_Mie Swamp_R Swamp_G Swamp_B Jungle_R Jungle_G Jungle_B Jungle_fog_strength Swamp_fog_strength Lush_fog_strength Snells_Window_Width self_shadow_samples Shadow_brightness Cloud_top_cutoff Cloud_base_cutoff Cloud_fade_amount BLOOMY_FOG FOG_RAIN_MULTIPLIER FOG_TOD_MULTIPLIER CLOUDY_FOG_AMOUNT BASE_FOG_AMOUNT WAVY_SPEED WAVY_STRENGTH ANTI_GHOSTING BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Ambient_Mult Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation SKY_BRIGHTNESS_DAY SKY_BRIGHTNESS_NIGHT BLEND_FACTOR FLICKER_REDUCTION MOTION_REJECTION VL_SAMPLES Exposure_Speed POM_MAP_RES POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL ATMOSPHERIC_DENSITY CLOUDS_SHADOWS_STRENGTH moon_illuminance moonColorR moonColorG moonColorB fog_mieg1 fog_mieg2 fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius SSAO_SAMPLES Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Mie_Phase Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK RENDER_SCALE_X RENDER_SCALE_Y VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ cloudDensity cloudCoverage fbmAmount fbmPower1 fbmPower2 cloudMieG cloudMieG2 cloudMie2Multiplier Strong_SSS_strength Medium_SSS_strength Weak_SSS_strength Shadow_brightness Roughness_Threshold Sun_specular_Strength reflection_quality Roughness_Strength SSS_mode DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS
sliders = EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness WeatherDay Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength Cloud_Height Dynamic_sky_day ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B cloud_speed Rain_coverage override_R override_G override_B override_Cloudy_Fog_Density override_cloudyfog_fade override_fog override_Uniform_Fog_Density override_uniformfog_fade override_Bloomy_Fog override_Sun_Strength Moon_temp Haze_amount UniformFog_amount CloudyFog_amount TimeOfDayFog_multiplier RainFog_amount CaveFog_amount uniformfog_fade cloudyfog_fade cloudray_amount Swamp_cloudyfog_height Jungle_cloudyfog_fade Swamp_uniformfog_height Jungle_uniformfog_fade noise_mode Distant_shadow_quality ambient_temp Sun_temp Puddle_Size Cloud_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength Swamp_Sun_Strength Jungle_Sun_Strength Swamp_Bloomy_Fog Jungle_Bloomy_Fog Swamp_Mie Jungle_Mie Swamp_cloudyfog_Density Jungle_Cloudy_Fog_Density Swamp_UniformFog_Density Jungle_Uniform_Fog_Density Swamp_Bloomy_Fog Jungle_Bloomy_Fog Swamp_Mie Jungle_Mie Swamp_R Swamp_G Swamp_B Jungle_R Jungle_G Jungle_B Jungle_fog_strength Swamp_fog_strength Lush_fog_strength Snells_Window_Width self_shadow_samples Shadow_brightness Cloud_top_cutoff Cloud_base_cutoff Cloud_fade_amount BLOOMY_FOG FOG_RAIN_MULTIPLIER FOG_TOD_MULTIPLIER CLOUDY_FOG_AMOUNT BASE_FOG_AMOUNT WAVY_SPEED WAVY_STRENGTH ANTI_GHOSTING BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Ambient_Mult Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation SKY_BRIGHTNESS_DAY SKY_BRIGHTNESS_NIGHT BLEND_FACTOR FLICKER_REDUCTION MOTION_REJECTION VL_SAMPLES Exposure_Speed POM_MAP_RES POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL ATMOSPHERIC_DENSITY CLOUDS_SHADOWS_STRENGTH moon_illuminance moonColorR moonColorG moonColorB fog_mieg1 fog_mieg2 fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius SSAO_SAMPLES Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Mie_Phase Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK RENDER_SCALE_X RENDER_SCALE_Y VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ cloudDensity cloudCoverage fbmAmount fbmPower1 fbmPower2 cloudMieG cloudMieG2 cloudMie2Multiplier Strong_SSS_strength Medium_SSS_strength Weak_SSS_strength Shadow_brightness Roughness_Threshold Sun_specular_Strength reflection_quality Roughness_Strength SSS_mode DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS
screen.columns=2
screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds] [Misc_Settings] [Climate] <empty> <empty> PhysicsMod_support
@ -188,7 +188,7 @@ screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds]
screen.LabPBR = [Reflections] [Subsurface_Scattering] [Emissives] [POM] [Porosity]
screen.Emissives.columns = 1
screen.Emissives = LabPBR_Emissives Emissive_Brightness Emissive_Curve
screen.Emissives = EMISSIVE_TYPE Emissive_Brightness Emissive_Curve
screen.Porosity.columns = 1
screen.Porosity = Puddles Puddle_Size Porosity