mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
Clean specular.glsl and make it easier to use for myself across dimension. make grass brighter in ambient light.
This commit is contained in:
@ -87,7 +87,7 @@ vec3 sky_opticalDepth(vec3 position, vec3 direction, const float steps) {
|
||||
}
|
||||
|
||||
vec3 sky_transmittance(vec3 position, vec3 direction, const float steps) {
|
||||
return exp2(-sky_opticalDepth(position, direction, steps) * rLOG2);
|
||||
return exp(-sky_opticalDepth(position, direction, steps) * rLOG2);
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ 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;
|
||||
|
||||
|
||||
vec3 sunvec2 = sunVector;
|
||||
|
||||
vec3 viewPosition = (sky_planetRadius + eyeAltitude) * upVector;
|
||||
|
||||
@ -111,7 +111,9 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
||||
vec3 increment = viewVector * stepSize;
|
||||
vec3 position = viewVector * sd.x + viewPosition;
|
||||
position += increment * (0.34*noise);
|
||||
vec2 phaseSun = sky_phase(dot(viewVector, sunVector ), sky_mieg) ;
|
||||
vec2 phaseSun = (pow(sky_phase(dot(viewVector, sunVector ), 0.6)*3, vec2(2)) + sky_phase(dot(viewVector, sunVector ), 0.8))/2;
|
||||
|
||||
// phaseSun = sky_phase(dot(viewVector, sunVector ), 0.8);
|
||||
vec2 phaseMoon = sky_phase(dot(viewVector, moonVector), sky_mieg);
|
||||
|
||||
vec3 scatteringSun = vec3(0.0);
|
||||
@ -123,8 +125,8 @@ 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.0) ;
|
||||
float high_sun = clamp(pow(sunvec2.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(sunvec2.y))*3.) - high_sun,1.0,2.0) ;
|
||||
|
||||
for (int i = 0; i < iSteps; ++i, position += increment) {
|
||||
vec3 density = sky_density(length(position));
|
||||
@ -139,12 +141,12 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
||||
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun ) * stepScatteringVisible * sky_transmittance(position, sunVector*0.5+0.1, jSteps) ;
|
||||
scatteringMoon += sky_coefficientsScattering * (stepAirmass.xy * phaseMoon) * stepScatteringVisible * sky_transmittance(position, moonVector, jSteps);
|
||||
// Nice way to fake multiple scattering.
|
||||
scatteringAmbient += sky_coefficientsScattering * stepAirmass.xy * (stepScatteringVisible * low_sun);
|
||||
scatteringAmbient += sky_coefficientsScattering * stepAirmass.xy * stepScatteringVisible * low_sun;
|
||||
|
||||
transmittance *= stepTransmittance ;
|
||||
}
|
||||
|
||||
vec3 scattering = scatteringSun * sunColorBase + (scatteringAmbient) * background + scatteringMoon*moonColorBase ;
|
||||
vec3 scattering = scatteringSun * sunColorBase + scatteringAmbient * background + scatteringMoon*moonColorBase ;
|
||||
// scattering = vec3(0,high_sun*255.,0);
|
||||
return scattering;
|
||||
}
|
||||
|
Reference in New Issue
Block a user