mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
add "atmosphere ground" setting. this is to make the dark bottom of the sky optional.
This commit is contained in:
@ -95,7 +95,12 @@ vec3 sky_transmittance(vec3 position, vec3 direction, const float steps) {
|
||||
vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 sunVector, vec3 moonVector, out vec2 pid, out vec3 transmittance, const int iSteps, float noise) {
|
||||
const int jSteps = 4;
|
||||
|
||||
float planetGround = exp(-100 * pow(max(-viewVector.y*5 + 0.1,0.0),2)); // darken the ground in the sky.
|
||||
#ifdef SKY_GROUND
|
||||
float planetGround = exp(-100 * pow(max(-viewVector.y*5 + 0.1,0.0),2)); // darken the ground in the sky.
|
||||
#else
|
||||
float planetGround = pow(clamp(viewVector.y+1.0,0.0,1.0),2); // darken the ground in the sky.
|
||||
#endif
|
||||
|
||||
float GroundDarkening = max(planetGround * 0.7+0.3,clamp(sunVector.y*2.0,0.0,1.0));
|
||||
|
||||
vec3 viewPos = (sky_planetRadius + eyeAltitude) * upVector;
|
||||
|
@ -319,6 +319,7 @@ uniform int moonPhase;
|
||||
|
||||
#endif
|
||||
|
||||
#define SKY_GROUND
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
|
@ -434,8 +434,13 @@ vec4 renderClouds(
|
||||
|
||||
// use this to blend into the atmosphere's ground.
|
||||
vec3 approxdistance = normalize(dV_view);
|
||||
float distantfog = mix(1.0, max(1.0 - clamp(exp2(pow(abs(approxdistance.y),1.5) * -35.0),0.0,1.0),0.0), heightRelativeToClouds);
|
||||
// distantfog = 1;
|
||||
#ifdef SKY_GROUND
|
||||
float distantfog = mix(1.0, max(1.0 - clamp(exp2(pow(abs(approxdistance.y),1.5) * -35.0),0.0,1.0),0.0), heightRelativeToClouds);
|
||||
#else
|
||||
float distantfog = 1.0;
|
||||
float distantfog2 = mix(1.0, max(1.0 - clamp(exp(pow(abs(approxdistance.y),1) * -35.0),0.0,1.0),0.0), heightRelativeToClouds);
|
||||
#endif
|
||||
|
||||
// terrible fake rayleigh scattering
|
||||
vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5)*3;
|
||||
float atmosphere = exp(abs(approxdistance.y) * -5.0);
|
||||
@ -538,6 +543,11 @@ vec4 renderClouds(
|
||||
if(!below_Layer2) color = color * layer2.a + layer2.rgb;
|
||||
#endif
|
||||
|
||||
#ifndef SKY_GROUND
|
||||
color = color * distantfog2;
|
||||
total_extinction = mix(1.0, total_extinction, distantfog2);
|
||||
#endif
|
||||
|
||||
return vec4(color, total_extinction);
|
||||
// return mix(vec4(color, total_extinction),vec4(0.0,0.0,0.0,1.0),exp(abs(approxdistance.y) * -1) * (1-clamp(1.0-max(cameraPosition.y - LAYER2_HEIGHT,0.0) / 1000.0 ,0.0,1.0)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user