mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
removed the "cloud cradle" on the horizon. added fake rayleigh scattering for distant clouds. fixed issue where ambient SSS didnt adjust with ambient brightness. added some requested lights to .properties files. added a "original chocapic sky" misc option. removed stonger sunlight sky absorbtion. tweaked border fog and made it on by default
This commit is contained in:
@ -135,13 +135,22 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
||||
vec3 stepTransmittance = exp2(-stepOpticalDepth * rLOG2);
|
||||
vec3 stepTransmittedFraction = clamp01((stepTransmittance - 1.0) / -stepOpticalDepth) ;
|
||||
vec3 stepScatteringVisible = transmittance * stepTransmittedFraction * GroundDarkening ;
|
||||
|
||||
#ifdef ORIGINAL_CHOCAPIC_SKY
|
||||
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector, jSteps) * planetGround;
|
||||
#else
|
||||
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector*0.5+0.1, jSteps) * planetGround;
|
||||
#endif
|
||||
|
||||
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector*0.5+0.1, jSteps) * planetGround;
|
||||
scatteringMoon += sky_coefficientsScattering * (stepAirmass.xy * phaseMoon) * stepScatteringVisible * sky_transmittance(position, moonVector, jSteps) * planetGround;
|
||||
|
||||
// Nice way to fake multiple scattering.
|
||||
scatteringAmbient += sky_coefficientsScattering * stepAirmass.xy * stepScatteringVisible * low_sun;
|
||||
|
||||
#ifdef ORIGINAL_CHOCAPIC_SKY
|
||||
scatteringAmbient += sky_coefficientsScattering * stepAirmass.xy * stepScatteringVisible;
|
||||
#else
|
||||
scatteringAmbient += sky_coefficientsScattering * stepAirmass.xy * stepScatteringVisible * low_sun;
|
||||
#endif
|
||||
|
||||
transmittance *= stepTransmittance ;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ float cloudVol(in vec3 pos){
|
||||
float UniformFog = exp( max(pos.y - fogYstart,0.0) / -25);
|
||||
// UniformFog = 1.0;
|
||||
|
||||
// float RainFog = max(fog_shape*10. - 7.,0.5) * exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)) * 72. * rainStrength * noPuddleAreas * RainFog_amount;
|
||||
float RainFog = (2 + max(fog_shape*10. - 7.,0.5)*2.0) * UniformFog * rainStrength * noPuddleAreas * RainFog_amount;
|
||||
float RainFog = ((2 + max(fog_shape*10. - 7.0,0.5)*2.0)) *UniformFog* rainStrength * noPuddleAreas * RainFog_amount;
|
||||
// float RainFog = (CloudyFog*255) * rainStrength * noPuddleAreas * RainFog_amount;
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
// sandstorms and snowstorms
|
||||
@ -42,10 +42,16 @@ float cloudVol(in vec3 pos){
|
||||
|
||||
TimeOfDayFog(UniformFog, CloudyFog);
|
||||
|
||||
float testfogshapes = clamp(130 - pos.y,0,1) * 100;
|
||||
float noise = densityAtPosFog(samplePos * 12.0);
|
||||
float erosion = 1.0-densityAtPosFog(samplePos2 * (125 - (1-pow(1-noise,5))*25));
|
||||
|
||||
|
||||
// float clumpyFog = max(exp(noise * -5)*2 - (erosion*erosion), 0.0);
|
||||
|
||||
// float testfogshapes = clumpyFog*30;
|
||||
// return testfogshapes;
|
||||
|
||||
return CloudyFog + UniformFog + RainFog;// + testfogshapes;
|
||||
return CloudyFog + UniformFog + RainFog;
|
||||
}
|
||||
|
||||
float phaseRayleigh(float cosTheta) {
|
||||
@ -195,9 +201,9 @@ vec4 GetVolumetricFog(
|
||||
vec3 DirectLight = LightSourcePhased * sh * ((rL* 3.0)*rayL + m);
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz) * (rL + m);
|
||||
|
||||
vec3 lighting = (Atmosphere + DirectLight + Lightning) * lightleakfix;
|
||||
vec3 foglighting = (Atmosphere + DirectLight + Lightning) * lightleakfix;
|
||||
|
||||
color += (lighting - lighting * exp(-(rL+m)*dd*dL)) / ((rL+m)+0.00000001)*absorbance;
|
||||
color += (foglighting - foglighting * exp(-(rL+m)*dd*dL)) / ((rL+m)+0.00000001)*absorbance;
|
||||
absorbance *= clamp(exp(-(rL+m)*dd*dL),0.0,1.0);
|
||||
|
||||
#ifdef RAYMARCH_CLOUDS_WITH_FOG
|
||||
@ -232,12 +238,12 @@ vec4 GetVolumetricFog(
|
||||
float skylightOcclusion = max(exp2((upperLayerOcclusion*upperLayerOcclusion) * -5), 0.75);
|
||||
|
||||
float skyScatter = clamp((CloudBaseHeights - 20 - progressW.y) / 275.0,0.0,1.0);
|
||||
vec3 Lighting = DoCloudLighting(muE, cumulus, SkyLightColor*skylightOcclusion, skyScatter, directLight, directScattering*sh2, directMultiScattering*sh2, 1.0);
|
||||
vec3 cloudlighting = DoCloudLighting(muE, cumulus, SkyLightColor*skylightOcclusion, skyScatter, directLight, directScattering*sh2, directMultiScattering*sh2, 1.0);
|
||||
|
||||
// a horrible approximation of direct light indirectly hitting the lower layer of clouds after scattering through/bouncing off the upper layer.
|
||||
Lighting += sunIndirectScattering * exp((skyScatter*skyScatter) * cumulus * -35.0) * upperLayerOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2));
|
||||
cloudlighting += sunIndirectScattering * exp((skyScatter*skyScatter) * cumulus * -35.0) * upperLayerOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2));
|
||||
|
||||
color += max(Lighting - Lighting*exp(-muE*dd*dL),0.0) * absorbance;
|
||||
color += max(cloudlighting - cloudlighting*exp(-muE*dd*dL),0.0) * absorbance;
|
||||
absorbance *= max(exp(-muE*dd*dL),0.0);
|
||||
}
|
||||
#endif /// VL CLOUDS
|
||||
|
@ -515,6 +515,7 @@ uniform int moonPhase;
|
||||
#define RESOURCEPACK_SKY 0 // [0 1 2]
|
||||
|
||||
// #define BLOOMY_PARTICLES
|
||||
// #define ORIGINAL_CHOCAPIC_SKY
|
||||
|
||||
// fix settings
|
||||
#if RESOURCEPACK_SKY == 0
|
||||
|
@ -52,10 +52,10 @@ float cloudCov(in vec3 pos, vec3 samplePos, float minHeight, float maxHeight){
|
||||
vec2 SampleCoords0 = (samplePos.xz + cloud_movement) / 5000;
|
||||
vec2 SampleCoords1 = (samplePos.xz - cloud_movement) / 500;
|
||||
|
||||
float thedistance = 1.0-clamp(1.0-length((pos-cameraPosition).xz)/15000,0,1);
|
||||
// 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);
|
||||
// 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){
|
||||
@ -63,11 +63,11 @@ float cloudCov(in vec3 pos, vec3 samplePos, float minHeight, float maxHeight){
|
||||
SampleCoords1 = -( (samplePos.zx - cloud_movement*2) / 1500);
|
||||
}
|
||||
|
||||
float CloudSmall = texture2D(noisetex, SampleCoords1 ).r + thedistance;
|
||||
float CloudLarge = texture2D(noisetex, SampleCoords0 ).b + thedistance;
|
||||
float CloudSmall = texture2D(noisetex, SampleCoords1 ).r;
|
||||
float CloudLarge = texture2D(noisetex, SampleCoords0 ).b;
|
||||
|
||||
|
||||
float coverage = abs(pow(CloudLarge,1)*2.0 - 1.2)*0.5 - (1.0-CloudSmall);
|
||||
float coverage = abs(CloudLarge*2.0 - 1.2)*0.5 - (1.0-CloudSmall);
|
||||
|
||||
|
||||
float FirstLayerCoverage = DailyWeather_Cumulus(coverage);
|
||||
@ -184,7 +184,10 @@ vec3 DoCloudLighting(
|
||||
|
||||
vec3 skyLight = skyLightCol;
|
||||
|
||||
skyLight *= mix(1.0, exp2((skyScatter*skyScatter) * densityFaded * -35.0) * lesspowder, distantfog);
|
||||
float skyLightShading = exp2((skyScatter*skyScatter) * densityFaded * -35.0) * lesspowder;
|
||||
// float skyLightShading = exp(skyScatter * densityFaded * -30/2.0 ) * lesspowder;
|
||||
|
||||
skyLight *= mix(1.0, skyLightShading, distantfog);
|
||||
|
||||
vec3 sunLight = exp(sunShadows * -15 + powder ) * sunScatter;
|
||||
sunLight += exp(sunShadows * -3) * sunMultiScatter * (powder*0.7+0.3);
|
||||
@ -258,9 +261,19 @@ 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;
|
||||
|
||||
// use this to blend into the atmosphere's ground.
|
||||
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);
|
||||
|
||||
|
||||
// terrible fake rayleigh scattering
|
||||
vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5)*3;
|
||||
float atmosphere = exp(abs(forg.y) * -5.0);
|
||||
vec3 scatter = exp(-10000.0 * rC * atmosphere) * distantfog;
|
||||
|
||||
directScattering *= scatter;
|
||||
directMultiScattering *= scatter;
|
||||
sunIndirectScattering *= scatter;
|
||||
|
||||
#ifdef Cumulus
|
||||
for(int i = 0; i < maxIT_clouds; i++) {
|
||||
// determine the base of each cloud layer
|
||||
@ -269,7 +282,7 @@ vec4 renderClouds(
|
||||
|
||||
float cumulus = GetCumulusDensity(progress_view, 1, MinHeight_0, MaxHeight_0);
|
||||
|
||||
float fadedDensity = Cumulus_density * clamp(exp( (progress_view.y - (CloudBaseHeights - 70)) / 9.0 ),0.0,1.0);
|
||||
float fadedDensity = Cumulus_density * clamp(exp( (progress_view.y - (CloudBaseHeights - 75)) / 9.0 ),0.0,1.0);
|
||||
|
||||
if(cumulus > 1e-5){
|
||||
float muE = cumulus*fadedDensity;
|
||||
@ -280,7 +293,7 @@ vec4 renderClouds(
|
||||
vec3 shadowSamplePos = progress_view + dV_Sun * (0.1 + j * (0.1 + Dither.x*0.05));
|
||||
float shadow = GetCumulusDensity(shadowSamplePos, 0, MinHeight_0, MaxHeight_0) * Cumulus_density;
|
||||
|
||||
directLight += shadow;
|
||||
directLight += shadow;// / (1 + j);
|
||||
}
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user