mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
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:
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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]
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
Reference in New Issue
Block a user