DOUBLE LAYER CLOUDS TEST 5. ALOT OF END SHADER WORK DONE. fix a few tiny issues and some tweaks here and there.

This commit is contained in:
Xonk 2023-12-17 22:25:26 -05:00
parent d0c2712da0
commit 08d97f20ff
19 changed files with 299 additions and 339 deletions

View File

@ -59,4 +59,3 @@
block.3000 = minecraft:redstone_wire
layer.translucent = minecraft:glass_pane minecraft:glass
# layer.cutout = minecraft:tripwire minecraft:slime_block minecraft:nether_portal minecraft:honey_block minecraft:ice minecraft:black_stained_glass minecraft:black_stained_glass_pane minecraft:blue_stained_glass minecraft:blue_stained_glass_pane minecraft:brown_stained_glass minecraft:brown_stained_glass_pane minecraft:cyan_stained_glass minecraft:cyan_stained_glass_pane minecraft:gray_stained_glass minecraft:gray_stained_glass_pane minecraft:green_stained_glass minecraft:green_stained_glass_pane minecraft:light_blue_stained_glass minecraft:light_blue_stained_glass_pane minecraft:light_gray_stained_glass minecraft:light_gray_stained_glass_pane minecraft:lime_stained_glass minecraft:lime_stained_glass_pane minecraft:magenta_stained_glass minecraft:magenta_stained_glass_pane minecraft:orange_stained_glass minecraft:orange_stained_glass_pane minecraft:pink_stained_glass minecraft:pink_stained_glass_pane minecraft:purple_stained_glass minecraft:purple_stained_glass_pane minecraft:red_stained_glass minecraft:red_stained_glass_pane minecraft:white_stained_glass minecraft:white_stained_glass_pane minecraft:yellow_stained_glass minecraft:yellow_stained_glass_pane minecraft:glass_pane minecraft:glass

View File

@ -59,15 +59,11 @@ uniform float sunIntensity;
uniform vec3 sunColor;
uniform vec3 nsunColor;
#include "/lib/Shadow_Params.glsl"
#include "/lib/color_transforms.glsl"
#include "/lib/projections.glsl"
#include "/lib/sky_gradient.glsl"
#include "/lib/waterBump.glsl"
#include "/lib/clouds.glsl"
#include "/lib/stars.glsl"
#ifdef OVERWORLD_SHADER
@ -79,6 +75,10 @@ uniform vec3 nsunColor;
uniform float nightVision;
#endif
#ifdef END_SHADER
#include "/lib/end_fog.glsl"
#endif
#include "/lib/diffuse_lighting.glsl"
float blueNoise(){
@ -275,6 +275,7 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
#define PHYSICSMOD_FRAGMENT
#include "/lib/oceans.glsl"
@ -292,6 +293,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
////////////////////////////////
//////////////////////////////// ALBEDO
////////////////////////////////
@ -336,6 +338,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
tangent.z, tangent2.z, normal.z);
vec4 NormalTex = texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).rgba;
NormalTex.xy = NormalTex.xy*2.0-1.0;
NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0) ;
TangentNormal = NormalTex.xy*0.5+0.5;
@ -473,7 +476,22 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif
#ifdef END_SHADER
vec3 AmbientLightColor = vec3(1.0);
float fresnelGlow = pow(clamp(1.5 + dot(WS_normal, normalize(feetPlayerPos))*0.5,0,2),2);
vec3 AmbientLightColor = (vec3(0.5,0.75,1.0) *0.9 + 0.1)* fresnelGlow;
float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0);
vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds);
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
float NdotL = clamp(dot(WS_normal, normalize(-lightPos))*0.5+0.5,0.0,1.0);
NdotL *= NdotL;
Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL;
#endif
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
@ -500,7 +518,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float roughness = max(pow(1.0-SpecularTex.r,2.0),0.05);
float f0 = SpecularTex.g;
roughness = 0.0;
// roughness = 0.0;
// f0 = 0.9;
if (iswater > 0.0 && gl_FragData[0].a < 0.9999999){

View File

@ -446,10 +446,11 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
#ifdef END_SHADER
float GetShading(vec3 WorldPos, vec3 LightPos, vec3 Normal){
float NdotL = clamp(dot(Normal, normalize(-LightPos)),0.0,1.0);
float NdotL = clamp(dot(Normal, normalize(-LightPos))*0.5+0.5,0.0,1.0);
NdotL *= NdotL;
float FogShadow = GetCloudShadow(WorldPos, LightPos);
return EndLightMie(LightPos) * NdotL * FogShadow;
return endFogPhase(LightPos) * NdotL * FogShadow;
}
#endif
@ -503,7 +504,36 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
#include "/lib/indirect_lighting_effects.glsl"
#include "/lib/PhotonGTAO.glsl"
vec4 renderInfiniteWaterPlane(
vec3 FragPosition, inout vec3 oceanNormals
){
float planeHeight = 20 + 0.50;
float total_extinction = 1.0;
vec3 color = vec3(0.0);
//project pixel position into projected shadowmap space
vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) );
vec3 dV_view = normalize(viewPos.xyz); dV_view *= 1.0/abs(dV_view.y);
float mult = length(dV_view);
float startFlip = mix(max(cameraPosition.y - planeHeight,0.0), max(planeHeight - cameraPosition.y,0), clamp(dV_view.y,0,1));
float signFlip = mix(-1.0, 1.0, clamp(cameraPosition.y - planeHeight,0.0,1.0));
if(max(signFlip * normalize(dV_view).y,0.0) > 0.0) return vec4(0,0,0,1);
vec3 progress_view = vec3(0,cameraPosition.y,0) + dV_view/abs(dV_view.y) * startFlip;
oceanNormals = normalize(getWaveHeight((progress_view+cameraPosition).xz,1));
vec3 Lighting = vec3(1);
float object = 1;
color += max(Lighting - Lighting*exp(-mult*object),0.0) * total_extinction;
total_extinction *= max(exp(-mult*object),0.0);
return vec4(color, total_extinction);
}
void main() {
@ -543,6 +573,7 @@ void main() {
lightmap.y = 1.0;
#endif
////// --------------- UNPACK MISC --------------- //////
vec4 SpecularTex = texture2D(colortex8,texcoord);
@ -617,9 +648,11 @@ void main() {
#ifdef OVERWORLD_SHADER
vec3 Background = vec3(0.0);
#if RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0
vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2;
Background += stars(orbitstar) * 10.0;
#endif
#if RESOURCEPACK_SKY == 2
Background += toLinear(texture2D(colortex10, texcoord).rgb * (255.0 * 2.0));
@ -633,7 +666,7 @@ void main() {
#endif
#endif
Background *= exp(-25.0 * pow(clamp(-feetPlayerPos_normalized.y*5.0 + 0.5 ,0.0,1.0),2.0)); // darken the ground in the sky.
// Background *= 1.0 - exp2(-50.0 * pow(clamp(feetPlayerPos_normalized.y+0.025,0.0,1.0),2.0) ); // darken the ground in the sky.
vec3 Sky = skyFromTex(feetPlayerPos_normalized, colortex4)/30.0;
Background += Sky;
@ -802,22 +835,17 @@ void main() {
#ifdef END_SHADER
vec3 LightPos1 = vec3(0); vec3 LightPos2 = vec3(0);
LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition, LightPos1, LightPos2);
vec3 LightCol1 = vec3(0); vec3 LightCol2 = vec3(0);
LightSourceColors(LightCol1, LightCol2);
// LightCol1 *= Flashing;
LightCol2 *= Flashing;
float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0);
vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds);
Direct_lighting += LightCol1 * GetShading(feetPlayerPos+cameraPosition, LightPos1, slopednormal) ;
#if lightsourceCount == 2
Direct_lighting += LightCol2 * GetShading(feetPlayerPos+cameraPosition, LightPos2, slopednormal);
#endif
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
Direct_lighting += lightColors * GetShading(feetPlayerPos+cameraPosition, lightPos, slopednormal) ;
// float RT_Shadows = rayTraceShadow(worldToView(normalize(-LightPos)), viewPos, noise);
// if(!hand) Direct_lighting *= RT_Shadows*RT_Shadows;
#endif
/////////////////////////////////////////////////////////////////////////////////
@ -849,7 +877,8 @@ void main() {
#endif
#ifdef END_SHADER
vec3 AmbientLightColor = vec3(1.0);
float fresnelGlow = pow(clamp(1.5 + dot(normal, feetPlayerPos_normalized)*0.5,0,2),2);
vec3 AmbientLightColor = (vec3(0.5,0.75,1.0) *0.9 + 0.1)* fresnelGlow;
#endif
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
@ -889,12 +918,13 @@ void main() {
if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0);
DirectLightColor *= cloudShadow;
}
#endif
/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// EFFECTS FOR INDIRECT /////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
float SkySSS = 0.0;
#if indirect_effect == 0

View File

@ -253,10 +253,12 @@ void main() {
vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, lightCol.rgb/80.0, averageSkyCol/30.0);
#endif
#if defined NETHER_SHADER || defined END_SHADER || defined FALLBACK_SHADER
#if defined NETHER_SHADER || defined END_SHADER
vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, noise_2);
#endif
// VolumetricFog = vec4(0,0,0,1);
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);
}

View File

@ -190,6 +190,7 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths){
if(DistortedAlpha <= 0.001) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents
}
uniform float eyeAltitude;
void main() {
/* DRAWBUFFERS:73 */
@ -294,9 +295,8 @@ void main() {
#endif
}
#ifdef OVERWORLD_SHADER
#ifdef Cave_fog
if (isEyeInWater == 0){
#if defined OVERWORLD_SHADER && defined Cave_fog
if (isEyeInWater == 0 && eyeAltitude < 1500){
float fogdistfade = clamp( pow(length(fragpos) / far, CaveFogFallOff) ,0.0,1.0);
@ -310,12 +310,17 @@ void main() {
#endif
color.rgb = mix(color.rgb, cavefogCol*fogfade, fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ;
// color.rgb = mix(color.rgb, vec3(0.), fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ;
// color.rgb = vec3(CaveFogColor_R,CaveFogColor_G,CaveFogColor_B)*fogfade ;
}
#endif
#endif
#ifdef END_SHADER
if (isEyeInWater == 0){
vec3 hazeColor = vec3(0.3,0.75,1.0) * 0.3;
float hazeDensity = clamp(1.0 - length(fragpos) / max(far, 32.0 * 24.0),0.0,1.0);
color.rgb = mix(hazeColor, color.rgb, hazeDensity) ;
}
#endif
// underwater fog
if (isEyeInWater == 1){
float dirtAmount = Dirt_Amount;

View File

@ -37,6 +37,7 @@ uniform mat4 gbufferModelView;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
uniform float sunElevation;
uniform vec3 sunPosition;
uniform vec3 cameraPosition;
// uniform float far;
uniform ivec2 eyeBrightnessSmooth;
@ -95,6 +96,19 @@ void main() {
gl_FragData[0] = vec4(0.0);
float mixhistory = 0.06;
float accumuteSpeed = texelFetch2D(colortex4, ivec2(5,5), 0).r/150.0;
vec2 pixelPos6 = vec2(5,5);
if (gl_FragCoord.x > pixelPos6.x && gl_FragCoord.x < pixelPos6.x + 1 && gl_FragCoord.y > pixelPos6.y && gl_FragCoord.y < pixelPos6.y + 1){
mixhistory = 0.1;
gl_FragData[0] = vec4(1,0,0,1);
}
if(accumuteSpeed < 1.0) mixhistory = 1.0;
#ifdef OVERWORLD_SHADER
///////////////////////////////
/// --- STORE COLOR LUT --- ///
@ -139,6 +153,8 @@ float mixhistory = 0.06;
/// --- Sky only
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);
@ -167,14 +183,16 @@ 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);
WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition);
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
vec3 suncol = sunColor;
vec3 suncol = lightSourceColor;
#ifdef ambientLight_only
suncol = vec3(0.0);
#endif
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol, moonColor, skyGroundCol/30.0);
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0);
sky = sky*clouds.a + clouds.rgb / 5.0;
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), lightSourceColor*1.75, skyGroundCol/30.0);
@ -184,7 +202,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
}
#endif
#if defined NETHER_SHADER || defined END_SHADER || defined FALLBACK_SHADER
#if defined NETHER_SHADER || defined END_SHADER
vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0);
//Sky gradient with clouds
@ -203,30 +221,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
}
#endif
// /* ---------------------- FOG SHADER ---------------------- */
// vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0);
// //Sky gradient with clouds
// if (gl_FragCoord.x > (fogPos.x - fogPos.x*0.22) && gl_FragCoord.y > 0.4 && gl_FragCoord.x < 535){
// vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.2,1.2);
// vec3 viewVector = cartToSphere(p);
// vec3 BackgroundColor = vec3(0.0);
// vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., fract(frameCounter/1.6180339887), fract(frameCounter/2.6180339887));
// BackgroundColor += VL_Fog.rgb/5.0;
// gl_FragData[0] = vec4(BackgroundColor, 1.0);
// }
#ifdef END_SHADER
/* ---------------------- TIMER ---------------------- */
float flash = 0.0;
float maxWaitTime = 10;
float maxWaitTime = 5;
float Timer = texelFetch2D(colortex4, ivec2(3,1), 0).x/150.0;
Timer -= frameTime;
@ -247,7 +246,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec2 pixelPos1 = vec2(1,1);
if (gl_FragCoord.x > pixelPos1.x && gl_FragCoord.x < pixelPos1.x + 1 && gl_FragCoord.y > pixelPos1.y && gl_FragCoord.y < pixelPos1.y + 1){
mixhistory = clamp(5.0 * frameTime,0.0,1.0);
mixhistory = clamp(4.0 * frameTime,0.0,1.0);
gl_FragData[0] = vec4(flash, 0.0, 0.0, 1.0);
}
@ -259,7 +258,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec3 LastPos = (texelFetch2D(colortex4,ivec2(2,1),0).xyz/150.0) * 2.0 - 1.0;
LastPos += (hash31(frameCounter / 75) * 2.0 - 1.0);
LastPos += (hash31(frameCounter / 50) * 2.0 - 1.0);
LastPos = LastPos * 0.5 + 0.5;
if(Timer > maxWaitTime * 0.7 ){
@ -277,8 +276,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
//Temporally accumulate sky and light values
vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb;
vec3 curr = gl_FragData[0].rgb*150.;
gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.);
//Exposure values
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(exposure, avgBrightness, avgL2,1.0);

View File

@ -41,6 +41,7 @@ uniform float rainStrength;
// uniform int worldTime;
vec3 sunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
// vec3 sunVec = normalize(LightDir);
#include "/lib/sky_gradient.glsl"
@ -105,15 +106,10 @@ void main() {
averageSkyCol_Clouds += 2.0*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.;
// pos = normalize(vec3(0,1,0));
// pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90);
averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.; // please dont do an infinite feedback loop....
averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.;
}
/// 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.;
// only need to sample one spot for this
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);
@ -141,6 +137,8 @@ void main() {
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
// WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
//////////////////////////////

View File

@ -93,7 +93,7 @@ void main() {
vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1));
vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80., moonColor/150., averageSkyCol/30.0);
vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80.0, averageSkyCol/30.0);
gl_FragData[0] = VolumetricClouds;

View File

@ -145,6 +145,9 @@ screen.Fog = Fog Settings
option.CaveFogColor_G = Fog G
option.CaveFogColor_B = Fog B
screen.END_AND_NETHER_FOG = Nether/End Fog
option.END_STORM_DENSTIY = End Storm Density
option.PLUME_DENSITY = Nether Smoke Density
screen.Clouds = Cloud Settings
option.VOLUMETRIC_CLOUDS = Volumetric Clouds
@ -503,3 +506,6 @@ option.RESOURCEPACK_SKY.comment = Toggle resourcepack sky support. Configure set
option.MATERIAL_AO.comment = Toggle the use of ambient occlusion based on what the resourcepack provides. §aPERFORMANCE COST:§r very low
option.WATER_WAVE_STRENGTH.comment = configure how strong the waves appear.
option.MOONPHASE_BASED_MOONLIGHT.comment = §bWhat is this?§r every night, the moon has different lighting. This setting adjusts the moonlight brightness based on how much of the moon is glowing. §aPERFORMANCE COST:§r nearly nothing
option.END_STORM_DENSTIY.comment = §bWhat is this?§r This is the dark cloudy fog in the end. Confingure the density of the end storm.
option.PLUME_DENSITY.comment = §bWhat is this?§r This is the thick, glowing smoke towers in the nether. Confingure the density of the nether smoke.

View File

@ -1,3 +0,0 @@
#if Cumulus_coverage == 1.0
variable.float.VariableCoverage = 1.0
#endif

View File

@ -1,16 +0,0 @@
vec3 cloud2D(vec3 viewPos,vec3 col){
vec3 wpos = viewPos;
float wind = frameTimeCounter/200.;
vec2 intersection = ((2000.0-cameraPosition.y)*wpos.xz*inversesqrt(wpos.y+cameraPosition.y/512.-50./512.) + cameraPosition.xz+wind)/40000.;
float phase = pow(clamp(dot(viewPos,sunVec),0.,1.),2.)*0.5+0.5;
float fbm = clamp((texture2D(noisetex,intersection*vec2(1.,1.5)).a + texture2D(noisetex,intersection*vec2(2.,7.)+wind*0.4).a/2.)-0.5*(1.0-rainStrength),0.,1.) ;
return mix(col,6.*(vec3(0.9,1.2,1.5)*skyIntensityNight*0.02*(1.0-rainStrength*0.9)+17.*phase*nsunColor*skyIntensity*0.7*(1.0-rainStrength*0.9)),0.0*(fbm*fbm)*(fbm*fbm)*(fbm*clamp(wpos.y*0.9,0.,1.)));
}

View File

@ -63,35 +63,33 @@ SOFTWARE.*/
//----------------------------------------------------------------------------------------
// vec3 RandomPosition = hash31(frameTimeCounter);
float vortexBoundRange = 300.0;
vec3 ManualLightPos = vec3(ORB_X, ORB_Y, ORB_Z);
// int switcher = frameCounter % 2 == 0 ? 0 : 1;
vec3 LightSourcePosition(vec3 worldPos, vec3 cameraPos, float vortexBounds){
// float OneOrZero = int(mod(gl_FragCoord.x*gl_FragCoord.y + switcher, 2));
// this is static so it can just sit in one place
vec3 vortexPos = worldPos - vec3(0.0,200.0,0.0);
void LightSourcePosition(vec3 WorldPos, vec3 CameraPos, inout vec3 Pos1, inout vec3 Pos2){
vec3 lightningPos = worldPos - cameraPos - ManualLightPos;
Pos1 = WorldPos - vec3(0,200,0);
// Pos2 = WorldPos - vec3(-50,100,0);
// Pos1 = mix(Pos1, Pos2, OneOrZero);
// snap-to coordinates in worldspace.
float cellSize = 200.0;
lightningPos += fract(cameraPos/cellSize)*cellSize - cellSize*0.5;
// make the position offset to random places (RNG.xyz from non-clearing buffer).
vec3 randomOffset = (texelFetch2D(colortex4,ivec2(2,1),0).xyz / 150.0) * 2.0 - 1.0;
lightningPos -= randomOffset * 2.5;
#ifdef THE_ORB
cellSize = 200.0;
vec3 orbpos = worldPos - cameraPos - ManualLightPos;// - vec3(sin(frameTimeCounter), cos(frameTimeCounter), cos(frameTimeCounter))*100;
orbpos += fract(cameraPos/cellSize)*cellSize - cellSize*0.5;
vec3 Origin = WorldPos - CameraPos - ManualLightPos;
float cellSize = 200;
vec3 cellPos = CameraPos ;
Origin += fract(cellPos/cellSize)*cellSize - cellSize*0.5;
// Origin -= vec3(sin(frameTimeCounter),0,-cos(frameTimeCounter)) * 20;
vec3 randomPos = texelFetch2D(colortex4,ivec2(2,1),0).xyz / 150.0;
Origin -= (randomPos * 2.0 - 1.0);
// Pos1 = mix(Pos1, Origin, OneOrZero);
Pos2 = Origin;
return orbpos;
#else
return mix(lightningPos, vortexPos, vortexBounds);
#endif
}
float densityAtPosFog(in vec3 pos){
@ -134,39 +132,41 @@ void VolumeBounds(inout float Volume, vec3 Origin){
float thickness = 50.0 * radius;
float Torus = (thickness - clamp( pow( length( vec2(length(Origin.xz) - radius, Origin2.y) ),2.0) - radius, 0.0, thickness) ) / thickness;
Origin2.xz *= 0.3;
Origin2.xz *= 0.5;
Origin2.y -= 100;
float orb = clamp((1.0 - length(Origin2) / 15.0) * 1.5,0.0,1.0);
Volume = max(Volume - Bounds - Torus, orb);
float orb = clamp((1.0 - length(Origin2) / 15.0) * 1.0,0.0,1.0);
Volume = max(Volume - Bounds - Torus, 0);
}
// create the volume shape
float cloudVol(in vec3 pos){
float fogShape(in vec3 pos){
float vortexBounds = clamp(vortexBoundRange - length(pos), 0.0,1.0);
vec3 samplePos = pos*vec3(1.0,1.0/48.0,1.0);
float fogYstart = -60;
float Output = 0.0;
vec3 samplePos = pos*vec3(1.0,1./48.,1.0);
// this is below down where you fall to your death.
float voidZone = max(exp2(-1.0 * sqrt(max(pos.y - -60,0.0))) ,0.0) ;
// swirly swirly :DDDDDDDDDDD
SwirlAroundOrigin(samplePos, pos);
float NoisePlane = texture2D(noisetex, samplePos.xz/1024 ).b;
float MainShape = clamp(max(0.5 - densityAtPosFog(samplePos * 16),0.0) * 2,0.0,1.0);
float Erosion = abs(0.6 - densityAtPosFog(samplePos * (160. - MainShape*50) - vec3(0,frameTimeCounter*3,0) ));
float noise = densityAtPosFog(samplePos * 12.0);
float erosion = 1.0-densityAtPosFog((samplePos - frameTimeCounter/20) * (124 + (1-noise)*7));
Output = MainShape;
Output = max(Output - Erosion*0.5,0.0);
float clumpyFog = max(exp(noise * -mix(10,4,vortexBounds))*mix(2,1,vortexBounds) - erosion*0.3, 0.0);
// apply limts
VolumeBounds(Output, pos);
VolumeBounds(clumpyFog, pos);
// Output = max(max(100 - pos.y,0.0) - NoisePlane * 50 ,0.0);
return Output;
return clumpyFog + voidZone;
}
float EndLightMie(vec3 LightPos){
float endFogPhase(vec3 LightPos){
float mie = exp(length(LightPos) / -150);
mie *= mie;
@ -176,49 +176,50 @@ float EndLightMie(vec3 LightPos){
return mie;
}
void LightSourceColors(inout vec3 Color1, inout vec3 Color2){
// Color1 = vec3(0.7,0.88,1.0);
// Color2 = vec3(ORB_R,ORB_G,ORB_B);
Color1 = vec3(1.0,0.5,1.0);
Color2 = vec3(0.0,0.5,1.0);
vec3 LightSourceColors(float vortexBounds, float lightningflash){
// Color1 = mix(Color1, Color2, OneOrZero);
// vec3 vortexColor = vec3(0.7,0.88,1.0);
// vec3 lightningColor = vec3(ORB_R,ORB_G,ORB_B);
vec3 vortexColor = vec3(0.5,0.68,1.0);
vec3 lightningColor = vec3(1.0,0.3,0.2) * lightningflash;
#ifdef THE_ORB
return vec3(ORB_R, ORB_G, ORB_B) * ORB_ColMult;
#else
return mix(lightningColor, vortexColor, vortexBounds);
#endif
}
vec3 LightSourceLighting( vec3 WorldPos, vec3 LightPos, float Dither, float VolumeDensity, vec3 LightColor, float Phase ){
vec3 LightSourceLighting(vec3 startPos, vec3 lightPos, float noise, float density, vec3 lightColor, float vortexBound){
float Mie = EndLightMie(LightPos);
float Shadow = 0.0;
// vec3 shadowSamplePos = WorldPos - LightPos * 0.05;
float phase = endFogPhase(lightPos);
float shadow = 0.0;
for (int j = 0; j < 3; j++){
// shadowSamplePos -= LightPos * 0.25 * Dither * min(j,1);
vec3 shadowSamplePos = WorldPos - LightPos * (0.05 + j * (0.25 + Dither*0.15));
Shadow += cloudVol(shadowSamplePos);
vec3 shadowSamplePos = startPos - lightPos * (0.05 + j * (0.25 + noise*0.15));
shadow += fogShape(shadowSamplePos);
}
vec3 FinalLighting = LightColor * Mie * exp(Shadow * -5.0) ;
vec3 finalLighting = lightColor * phase * exp(shadow * -10.0);
FinalLighting += LightColor * exp2(-5 * max(2.5-Shadow,0.0) * vec3(1.2,1.0,0.8+VolumeDensity*0.4)) * (Mie*Mie) * clamp((1.0 - length(LightPos) / 100.0),0.0,1.0);
finalLighting += lightColor * phase*phase * (1.0-exp((shadow*shadow*shadow) * vec3(0.6,2.0,2) * -1)) * (1.0 - exp(-density*density));
return FinalLighting;
return finalLighting;
}
#define lightsourceCount 2 // [1 2]
vec4 GetVolumetricFog(
vec3 viewPos,
vec3 viewPosition,
float dither,
float dither2
){
/// ------------- RAYMARCHING STUFF ------------- \\\
int SAMPLES = 16;
vec3 vL = vec3(0.0);
float absorbance = 1.0;
//project pixel position into projected shadowmap space
vec3 wpos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
@ -232,87 +233,63 @@ vec4 GetVolumetricFog(
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
float maxLength = min(length(dVWorld),32.0 * 12.0)/length(dVWorld);
dV *= maxLength;
dVWorld *= maxLength;
float dL = length(dVWorld);
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition;
/// ------------- COLOR/LIGHTING STUFF ------------- \\\
vec3 color = vec3(0.0);
vec3 absorbance = vec3(1.0);
vec3 fogcolor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.05)) ;
vec3 LightCol1 = vec3(0); vec3 LightCol2 = vec3(0);
LightSourceColors(LightCol1, LightCol2);
float Flashing = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
// LightCol1 *= Flashing;
LightCol2 *= Flashing;
vec3 LightPos1 = vec3(0); vec3 LightPos2 = vec3(0);
LightSourcePosition(cameraPosition, cameraPosition, LightPos1, LightPos2);
float Phase1 = sqrt(1.0 - clamp( dot(normalize(dVWorld), normalize(-LightPos1)),0.0,1.0));
Phase1 = exp(Phase1 * -5.0) * 10;
float Phase2 = sqrt(1.0 - clamp( dot(normalize(dVWorld), normalize(-LightPos2)),0.0,1.0));
Phase2 = exp(Phase2 * -5.0) * 10;
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
float expFactor = 11.0;
for (int i=0;i<SAMPLES;i++) {
float d = (pow(expFactor, float(i+dither)/float(SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float dd = pow(expFactor, float(i+dither)/float(SAMPLES)) * log(expFactor) / float(SAMPLES)/(expFactor-1.0);
vec3 progress = start.xyz + d*dV;
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
// vec3 LightPos1 = vec3(0); vec3 LightPos2 = vec3(0);
LightSourcePosition(progressW, cameraPosition, LightPos1, LightPos2);
// determine where the vortex area ends and chaotic lightning area begins.
float vortexBounds = clamp(vortexBoundRange - length(progressW), 0.0,1.0);
float VolumeDensity = max(cloudVol(progressW),0.0);
// float VolumeDensity = 0.0;
float Density = max(VolumeDensity,0.0);
vec3 lightPosition = LightSourcePosition(progressW, cameraPosition, vortexBounds);
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
float volumeDensity = fogShape(progressW);
// volumeDensity += max(1.0 - length(vec3(lightPosition.x,lightPosition.y*2,lightPosition.z))/50,0.0) * vortexBounds;
////////////////////////////////////////////////////////////////
///////////////////////// AMBIENT LIGHT ////////////////////////
////////////////////////////////////////////////////////////////
float clearArea = 1.0-min(max(1.0 - length(progressW - cameraPosition) / 100,0.0),1.0);
float density = min(volumeDensity * clearArea, END_STORM_DENSTIY);
vec3 vL0 = fogcolor * exp2(VolumeDensity * -25) * 0.1 ;
///// ----- air lighting, the haze
float distanceFog = max(1.0 - length(progressW - cameraPosition) / max(far, 32.0 * 13.0),0.0);
float hazeDensity = min(exp2(distanceFog * -25)+0.0005,1.0);
vec3 hazeColor = vec3(0.3,0.75,1.0) * 0.3;
color += (hazeColor - hazeColor*exp(-hazeDensity*dd*dL)) * absorbance;
////////////////////////////////////////////////////////////////
/////////////////////// MAIN LIGHTSOURCE ///////////////////////
////////////////////////////////////////////////////////////////
vec3 Light1 = vec3(0); vec3 Light2 = vec3(0);
///// ----- main lighting
vec3 voidLighting = vec3(1.0,0.0,0.8) * 0.1 * (1-exp(volumeDensity * -25)) * max(exp2(-1 * sqrt(max(progressW.y - -60,0.0))),0.0) ;
vec3 ambient = vec3(0.5,0.75,1.0) * 0.2 * (exp((volumeDensity*volumeDensity) * -50) * 0.9 + 0.1);
float shadows = 0;
vec3 lightsources = LightSourceLighting(progressW, lightPosition, dither2, volumeDensity, lightColors, vortexBounds);
vec3 lighting = lightsources + ambient + voidLighting;
Density += clamp((1.0 - length(LightPos1) / 10.0) * 10 ,0.0,1.0); // THE ORRRRRRRRRRRRRRRRRRRRRRRRRRB
Light1 = LightSourceLighting(progressW, LightPos1, dither2, VolumeDensity, LightCol1, Phase1);
#if lightsourceCount == 2
Density += clamp((1.0 - length(LightPos2) / 10.0) * 10 ,0.0,1.0); // THE ORRRRRRRRRRRRRRRRRRRRRRRRRRB
Light2 += LightSourceLighting(progressW, LightPos2, dither2, VolumeDensity, LightCol2, Phase2);
#ifdef THE_ORB
density += min(50.0*max(1.0 - length(lightPosition)/10,0.0),1.0);
#endif
vL0 += Light1 + Light2;
////////////////////////////////////////////////////////////////
/////////////////////////// FINALIZE ///////////////////////////
////////////////////////////////////////////////////////////////
float AirDensity = 0.002;
// AirDensity = 0.0;
vec3 vL1 = vec3(0.5,0.75,1.0) * 0.5;
// vL1 += Light1 + Light2;
vL += (vL1 - vL1*exp2(-AirDensity*dd*dL)) * absorbance;
vL += (vL0 - vL0*exp(-Density*dd*dL)) * absorbance;
absorbance *= exp2(-(AirDensity+Density)*dd*dL);
if (absorbance < 1e-5) break;
///// ----- blend
color += (lighting - lighting*exp(-(density)*dd*dL)) * absorbance;
absorbance *= exp(-max(density,hazeDensity)*dd*dL);
}
return vec4(vL, absorbance);
return vec4(color, absorbance);
}
float GetCloudShadow(vec3 WorldPos, vec3 LightPos){
@ -320,11 +297,10 @@ float GetCloudShadow(vec3 WorldPos, vec3 LightPos){
for (int i=0; i < 3; i++){
vec3 shadowSamplePos = WorldPos - LightPos * (0.1 + pow(i,0.75)*0.25);
// vec3 shadowSamplePos = WorldPos - LightPos * i * 0.5;
float Cast = cloudVol(shadowSamplePos);
vec3 shadowSamplePos = WorldPos - LightPos * (pow(i,0.75)*0.25);
float Cast = fogShape(shadowSamplePos)*END_STORM_DENSTIY;
Shadow += Cast;
}
return clamp(exp(-Shadow*5.0),0.0,1.0);
return clamp(exp(Shadow * -5.0),0.0,1.0);
}

View File

@ -1,54 +0,0 @@
vec4 GetVolumetricFog(
vec3 viewPos,
float dither,
float dither2
){
int SAMPLES = 16;
vec3 vL = vec3(0.0);
float absorbance = 1.0;
//project pixel position into projected shadowmap space
vec3 wpos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
//project view origin into projected shadowmap space
vec3 start = toShadowSpaceProjected(vec3(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);
float maxLength = min(length(dVWorld),far)/length(dVWorld);
dV *= maxLength;
dVWorld *= maxLength;
float dL = length(dVWorld);
float expFactor = 11.0;
for (int i=0;i<SAMPLES;i++) {
float d = (pow(expFactor, float(i+dither)/float(SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float dd = pow(expFactor, float(i+dither)/float(SAMPLES)) * log(expFactor) / float(SAMPLES)/(expFactor-1.0);
vec3 progress = start.xyz + d*dV;
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
// do main lighting
float Density = 0.05;
Density *= pow(normalize(-wpos).y*0.5+0.5,3.0);
// vec3 vL0 = vec3(0.8,0.5,1) * 0.05 * pow(normalize(wpos).y*0.5+0.5,2.0)*2.0;
vec3 vL0 = vec3(0.8,1.0,0.5) * 0.05 ;
vL += (vL0 - vL0*exp(-Density*dd*dL)) * absorbance;
absorbance *= exp(-(Density)*dd*dL);
if (absorbance < 1e-5) break;
}
return vec4(vL, absorbance);
}

View File

@ -343,7 +343,7 @@ uniform int moonPhase;
#define Cumulus_density 0.5 // [0.01 0.F02 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.00]
#define Cumulus_height 250 // [-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 700 800 900 1000]
#define Cumulus2_coverage 0.7 // [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 Cumulus2_coverage 0.3 // [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 Altostratus
@ -462,7 +462,7 @@ uniform int moonPhase;
// ----- END RELATED SETTINGS ----- //
//////////////////////////////////////
#define END_STORM_DENSTIY 1.0 // [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 END_STORM_DENSTIY 1.0 // [0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
// #define DEBUG_endfog
// #define THE_ORB
@ -492,6 +492,8 @@ uniform int moonPhase;
// #define PhysicsMod_support // WARNING: this may or may not visually mess up the whole shader on AMD devices. if you dont see any weirdness then it's fine
#define PLANET_GROUND_BRIGHTNESS 1.0 // [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 CompSky_R 0.0 // [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 CompSky_G 0.0 // [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 CompSky_B 0.0 // [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 ]

View File

@ -53,16 +53,22 @@ float cloudCov(in vec3 pos, vec3 samplePos, float minHeight, float maxHeight){
float thedistance = 1.0-clamp(1.0-length((pos-cameraPosition).xz)/15000,0,1);
float heightRelativeToClouds = clamp(1.0 - max(cameraPosition.y - maxHeight,0.0) / 200.0 ,0.0,1.0);
thedistance = mix(0.0, thedistance, heightRelativeToClouds);
/// when the coordinates reach a certain height, alter the sample coordinates
if(max(pos.y - (maxHeight + 80),0.0) > 0.0){
SampleCoords0 = -( (samplePos.zx + cloud_movement*2) / 15000);
SampleCoords1 = -( (samplePos.zx - cloud_movement*2) / 1500);
}
float CloudLarge = texture2D(noisetex, SampleCoords0 ).b+thedistance;
float CloudSmall = texture2D(noisetex, SampleCoords1 ).r + thedistance;
float CloudLarge = texture2D(noisetex, SampleCoords0 ).b + thedistance;
float coverage = abs(pow(CloudLarge,1)*2.0 - 1.2)*0.5 - (1.0-CloudSmall);
float FirstLayerCoverage = DailyWeather_Cumulus(coverage);
/////// FIRST LAYER
@ -91,7 +97,6 @@ float cloudCov(in vec3 pos, vec3 samplePos, float minHeight, float maxHeight){
float cloudVol(in vec3 pos,in vec3 samplePos,in float cov, in int LoD, float minHeight, float maxHeight){
float upperPlane = 1.0 - clamp(pos.y - (maxHeight + 80),0.0,1.0);
float noise = 0.0 ;
float totalWeights = 0.0;
float pw = log(fbmPower1);
@ -99,6 +104,7 @@ float cloudVol(in vec3 pos,in vec3 samplePos,in float cov, in int LoD, float min
samplePos.xz -= cloud_movement/4;
// WIND
samplePos.xz += pow( max(pos.y - (minHeight+20), 0.0) / 20.0,1.50) * upperPlane;
noise += (1.0-densityAtPos(samplePos * mix(100.0,200.0,upperPlane)) ) * mix(2.0,1.0,upperPlane);
@ -147,11 +153,9 @@ float GetAltostratusDensity(vec3 pos){
}
#ifndef CLOUDSHADOWSONLY
uniform sampler2D colortex4; //Skybox
//Mie phase function
float phaseg(float x, float g){
float gg = g * g;
@ -172,8 +176,6 @@ vec3 DoCloudLighting(
vec3 sunMultiScatter,
float distantfog
// float moonShadows,
// vec3 moonScatter
){
// float powder = 1.0 - exp((CloudShape*CloudShape) * -800);
float powder = 1.0 - exp(densityFaded * -10);
@ -194,8 +196,7 @@ vec3 DoCloudLighting(
vec4 renderClouds(
vec3 FragPosition,
vec2 Dither,
vec3 SunColor,
vec3 MoonColor,
vec3 LightColor,
vec3 SkyColor
){
@ -205,21 +206,24 @@ vec4 renderClouds(
float total_extinction = 1.0;
vec3 color = vec3(0.0);
float heightRelativeToClouds = clamp(1.0 - max(cameraPosition.y - (Cumulus_height+150),0.0) / 200.0 ,0.0,1.0);
//////////////////////////////////////////
////// lighting stuff
//////////////////////////////////////////
float shadowStep = 200.0;
vec3 dV_Sun = WsunVec*shadowStep;
float SdotV = dot(mat3(gbufferModelView)*WsunVec, normalize(FragPosition));
float mieDay = phaseg(SdotV, 0.75);
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
vec3 sunScattering = SunColor * mieDay * 3.14;
vec3 sunMultiScattering = SunColor * mieDayMulti * 4.0;
vec3 directScattering = LightColor * mieDay * 3.14;
vec3 directMultiScattering = LightColor * mieDayMulti * 4.0;
vec3 sunIndirectScattering = SunColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(FragPosition)), 0.5);
vec3 sunIndirectScattering = LightColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(FragPosition)), 0.5);
//////////////////////////////////////////
@ -234,7 +238,8 @@ vec4 renderClouds(
vec3 dV_view = normalize(viewPos.xyz);
dV_view.y += 0.05;
dV_view.y += 0.05 * heightRelativeToClouds;
dV_view *= 300/abs(dV_view.y)/maxIT_clouds;
@ -252,51 +257,41 @@ vec4 renderClouds(
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.y + cameraPosition + dV_view/abs(dV_view.y) * startFlip;
float allDensities = Cumulus_density;
vec3 forg = normalize(dV_view);
float distantfog = max(1.0 - clamp(exp2(pow(abs(forg.y),1.5) * -35.0),0.0,1.0),0.0);
// sunScattering *= distantfog;
// sunMultiScattering *= distantfog;
#ifdef Cumulus
for(int i = 0; i < maxIT_clouds; i++) {
// determine the base of each cloud layer
bool isUpperLayer = max(progress_view.y - MinHeight_1,0.0) > 0.0;
float CloudBaseHeights = isUpperLayer ? 200.0 + MaxHeight_0 : MaxHeight_0;
// if(isUpperLayer) allDensities = 0.25;
float cumulus = GetCumulusDensity(progress_view, 1, MinHeight_0, MaxHeight_0);
float fadedDensity = allDensities * clamp(exp( (progress_view.y - (CloudBaseHeights - 70)) / 9.0 ),0.0,1.0);
float fadedDensity = Cumulus_density * clamp(exp( (progress_view.y - (CloudBaseHeights - 70)) / 9.0 ),0.0,1.0);
if(cumulus > 1e-5){
float muE = cumulus*fadedDensity;
float sunLight = 0.0;
// float MoonLight = 0.0;
float directLight = 0.0;
for (int j=0; j < 3; j++){
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;
float shadow = GetCumulusDensity(shadowSamplePos, 0, MinHeight_0, MaxHeight_0) * Cumulus_density;
sunLight += shadow;
// MoonLight += shadow;
directLight += 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 + 50,0.0) < 1.0) directLight += Cumulus_density * 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);
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 + (1.0-distantfog)*0.5);
float upperLayerOcclusion = !isUpperLayer ? Cumulus_density * 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.75 + (1.0-distantfog)*0.25);
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, distantfog);
// 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, directLight, directScattering, directMultiScattering, distantfog);
// a horrible approximation of direct light indirectly hitting the lower layer of clouds after scattering through/bouncing off the upper layer.
Lighting += sunIndirectScattering * skylightOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2)) * exp((cumulus*cumulus) * -10.0) ; ;
color += max(Lighting - Lighting*exp(-mult*muE),0.0) * total_extinction;
@ -307,7 +302,6 @@ vec4 renderClouds(
progress_view += dV_view;
}
#endif
return vec4(color, total_extinction);
}
@ -351,6 +345,7 @@ float GetCloudShadow(vec3 feetPlayerPos){
return 1.0;
#endif
}
float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
#ifdef CLOUDS_SHADOWS
float MinHeight_0 = Cumulus_height;

View File

@ -1,5 +1,5 @@
float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves
vec2 movement = vec2(frameTimeCounter*0.05);// *0;
vec2 movement = vec2(frameTimeCounter*0.05);
vec2 pos = posxz ;
float caustic = 1.0;
float weightSum = 0.0;

View File

@ -66,7 +66,7 @@ alphaTest.gbuffers_skybasic=false
alphaTest.gbuffers_skytextured=false
sliders = FOG_START_HEIGHT Cumulus2_coverage WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE 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 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 ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB 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 BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB 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 Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount 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 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 fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH
sliders = PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT Cumulus2_coverage WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE 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 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 ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB 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 BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB 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 Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount 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 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 fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH
screen.columns=2
screen = \
@ -189,8 +189,8 @@ PhysicsMod_support [LabPBR]
VL_SAMPLES RainFog_amount \
BLOOMY_FOG [TOD_fog] \
BorderFog [Cave_Fog] \
Cloud_Fog PER_BIOME_ENVIRONMENT \
FOG_START_HEIGHT
FOG_START_HEIGHT [END_AND_NETHER_FOG] \
PER_BIOME_ENVIRONMENT
@ -203,8 +203,8 @@ PhysicsMod_support [LabPBR]
screen.Fog_Color.columns=1
screen.Fog_Color = fog_coefficientRayleighR fog_coefficientRayleighG fog_coefficientRayleighB fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB
screen.NETHER_END_FOG.columns=2
screen.NETHER_END_FOG = PLUME_DENSITY END_STORM_DENSTIY
screen.END_AND_NETHER_FOG.columns=2
screen.END_AND_NETHER_FOG = END_STORM_DENSTIY PLUME_DENSITY
### WATER
screen.Water.columns=2
@ -241,7 +241,7 @@ PhysicsMod_support [LabPBR]
######## MISC SETTINGS
screen.Misc_Settings.columns=1
screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS
screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS
screen.the_orb.columns = 1
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B