mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
FIX DOF and exposure. tweak fog phase. make cloud shadows not go crazy at low sun angles. adjust bloomy fog default value.
This commit is contained in:
parent
d26a29d1f2
commit
a4f448987f
@ -164,23 +164,6 @@ vec2 decodeVec2(float a){
|
|||||||
const float constant2 = 256. / 255.;
|
const float constant2 = 256. / 255.;
|
||||||
return fract( a * constant1 ) * constant2 ;
|
return fract( a * constant1 ) * constant2 ;
|
||||||
}
|
}
|
||||||
// float linZ(float depth) {
|
|
||||||
// return (2.0 * near) / (far + near - depth * (far - near));
|
|
||||||
// // l = (2*n)/(f+n-d(f-n))
|
|
||||||
// // f+n-d(f-n) = 2n/l
|
|
||||||
// // -d(f-n) = ((2n/l)-f-n)
|
|
||||||
// // d = -((2n/l)-f-n)/(f-n)
|
|
||||||
|
|
||||||
// }
|
|
||||||
// float invLinZ (float lindepth){
|
|
||||||
// return -((2.0*near/lindepth)-far-near)/(far-near);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// vec3 toClipSpace3(vec3 viewSpacePosition) {
|
|
||||||
// return projMAD(gbufferProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vec2 tapLocation(int sampleNumber,int nb, float nbRot,float jitter,float distort)
|
vec2 tapLocation(int sampleNumber,int nb, float nbRot,float jitter,float distort)
|
||||||
@ -342,7 +325,15 @@ float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves
|
|||||||
}
|
}
|
||||||
return caustic / weightSum;
|
return caustic / weightSum;
|
||||||
}
|
}
|
||||||
|
float fogPhase(float lightPoint){
|
||||||
|
float linear = 1.0 - clamp(lightPoint*0.5+0.5,0.0,1.0);
|
||||||
|
float linear2 = 1.0 - clamp(lightPoint,0.0,1.0);
|
||||||
|
|
||||||
|
float exponential = exp2(pow(linear,0.3) * -15.0 ) * 1.5;
|
||||||
|
exponential += sqrt(exp2(sqrt(linear) * -12.5));
|
||||||
|
|
||||||
|
return exponential;
|
||||||
|
}
|
||||||
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
||||||
inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value
|
inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value
|
||||||
int spCount = rayMarchSampleCount;
|
int spCount = rayMarchSampleCount;
|
||||||
@ -364,9 +355,8 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
|||||||
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
||||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||||
|
|
||||||
// float phase = (phaseg(VdotL,0.5) + phaseg(VdotL,0.8)) ;
|
// float phase = (phaseg(VdotL,0.6) + phaseg(VdotL,0.8)) * 0.5;
|
||||||
float phase = (phaseg(VdotL,0.6) + phaseg(VdotL,0.8)) * 0.5;
|
float phase = fogPhase(VdotL) ;
|
||||||
// float phase = phaseg(VdotL, 0.7);
|
|
||||||
|
|
||||||
vec3 absorbance = vec3(1.0);
|
vec3 absorbance = vec3(1.0);
|
||||||
vec3 vL = vec3(0.0);
|
vec3 vL = vec3(0.0);
|
||||||
@ -416,33 +406,6 @@ void Emission(
|
|||||||
if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve);
|
if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
// float rayTraceShadow(vec3 dir,vec3 position,float dither){
|
|
||||||
// const float quality = 16.;
|
|
||||||
// vec3 clipPosition = toClipSpace3(position);
|
|
||||||
// //prevents the ray from going behind the camera
|
|
||||||
// float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
|
|
||||||
// (-near -position.z) / dir.z : far*sqrt(3.) ;
|
|
||||||
// vec3 direction = toClipSpace3(position+dir*rayLength)-clipPosition; //convert to clip space
|
|
||||||
// direction.xyz = direction.xyz/max(abs(direction.x)/texelSize.x,abs(direction.y)/texelSize.y); //fixed step size
|
|
||||||
// vec3 stepv = direction * 3.0 * clamp(MC_RENDER_QUALITY,1.,2.0);
|
|
||||||
|
|
||||||
// vec3 spos = clipPosition;
|
|
||||||
// spos += stepv*dither ;
|
|
||||||
|
|
||||||
// for (int i = 0; i < int(quality); i++) {
|
|
||||||
// spos += stepv;
|
|
||||||
|
|
||||||
// float sp = texture2D(depthtex1,spos.xy).x;
|
|
||||||
|
|
||||||
// if( sp < spos.z) {
|
|
||||||
// float dist = abs(linZ(sp)-linZ(spos.z))/linZ(spos.z);
|
|
||||||
// if (dist < 0.015 ) return i / quality;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return 1.0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool inshadowmap, inout float Shadow, inout float SSS){
|
void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool inshadowmap, inout float Shadow, inout float SSS){
|
||||||
float steps = 16.0;
|
float steps = 16.0;
|
||||||
vec3 clipPosition = toClipSpace3(viewPos);
|
vec3 clipPosition = toClipSpace3(viewPos);
|
||||||
@ -484,45 +447,6 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// void SSRT_SkySSS(vec3 viewPos, vec3 lightDir, float noise, inout float SSS, bool isgrass){
|
|
||||||
// float steps = 16;
|
|
||||||
// vec3 clipPosition = toClipSpace3(viewPos);
|
|
||||||
|
|
||||||
// //prevents the ray from going behind the camera
|
|
||||||
// float rayLength = ((viewPos.z + lightDir.z * far*sqrt(3.)) > -near) ?
|
|
||||||
// (-near -viewPos.z) / lightDir.z : far*sqrt(3.);
|
|
||||||
|
|
||||||
// vec3 direction = toClipSpace3(viewPos + lightDir*rayLength) - clipPosition; //convert to clip space
|
|
||||||
// direction.xyz = direction.xyz / max(abs(direction.x)/texelSize.x, abs(direction.y)/texelSize.y); //fixed step size
|
|
||||||
|
|
||||||
// float dist = 1.0 + clamp(viewPos.z*viewPos.z/50.0,0,1); // shrink sample size as distance increases
|
|
||||||
// vec3 rayDir = direction / dist;
|
|
||||||
|
|
||||||
// vec3 screenPos = clipPosition + rayDir*noise;
|
|
||||||
|
|
||||||
// float dist3 = clamp(1-exp( viewPos.z*viewPos.z / -50),0,1);
|
|
||||||
|
|
||||||
|
|
||||||
// float depththing = isgrass ? 1 : 0.05;
|
|
||||||
|
|
||||||
// for (int i = 0; i < int(steps); i++) {
|
|
||||||
// screenPos += rayDir*3;
|
|
||||||
|
|
||||||
// float shadowgradient = clamp(i/steps,0.0,1.0);
|
|
||||||
|
|
||||||
// float samplePos = texture2D(depthtex1, screenPos.xy).x;
|
|
||||||
|
|
||||||
// if(samplePos <= screenPos.z) {
|
|
||||||
// vec2 linearZ = vec2(linZ(screenPos.z), linZ(samplePos));
|
|
||||||
// float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x;
|
|
||||||
|
|
||||||
// bool depthThreshold = calcthreshold < depththing;
|
|
||||||
|
|
||||||
|
|
||||||
// if(depthThreshold) SSS = shadowgradient;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
float GetShading( vec3 WorldPos, vec3 LightPos, vec3 Normal){
|
float GetShading( vec3 WorldPos, vec3 LightPos, vec3 Normal){
|
||||||
|
|
||||||
@ -579,30 +503,6 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
|||||||
|
|
||||||
return scatter ;
|
return scatter ;
|
||||||
}
|
}
|
||||||
// #ifdef IS_IRIS
|
|
||||||
// uniform vec4 lightningBoltPosition;
|
|
||||||
// float Iris_Lightningflash(vec3 feetPlayerPos, vec3 lightningBoltPos, vec3 WorldSpace_normal, inout float Phase){
|
|
||||||
|
|
||||||
// vec3 LightningPos = feetPlayerPos - vec3(lightningBoltPosition.x, clamp(feetPlayerPos.y, lightningBoltPosition.y+16, lightningBoltPosition.y+116.0),lightningBoltPosition.z);
|
|
||||||
|
|
||||||
// // point light, max distance is ~500 blocks (the maximim entity render distance)
|
|
||||||
// float lightDistance = 300.0 ;
|
|
||||||
// float lightningLight = max(1.0 - length(LightningPos) / lightDistance, 0.0);
|
|
||||||
|
|
||||||
// // the light above ^^^ is a linear curve. me no likey. here's an exponential one instead.
|
|
||||||
// lightningLight = exp((1.0 - lightningLight) * -10.0);
|
|
||||||
|
|
||||||
// // a phase for subsurface scattering.
|
|
||||||
// vec3 PhasePos = normalize(feetPlayerPos) + vec3(lightningBoltPosition.x, lightningBoltPosition.y + 60, lightningBoltPosition.z);
|
|
||||||
// float PhaseOrigin = 1.0 - clamp(dot(normalize(feetPlayerPos), normalize(PhasePos)),0.0,1.0);
|
|
||||||
// Phase = exp(sqrt(PhaseOrigin) * -2.0) * 5.0 * lightningLight;
|
|
||||||
|
|
||||||
// // good old NdotL. only normals facing towards the lightning bolt origin rise to 1.0
|
|
||||||
// float NdotL = clamp(dot(LightningPos, -WorldSpace_normal), 0.0, 1.0);
|
|
||||||
|
|
||||||
// return lightningLight * NdotL;
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "/lib/indirect_lighting_effects.glsl"
|
#include "/lib/indirect_lighting_effects.glsl"
|
||||||
|
@ -18,7 +18,7 @@ void main() {
|
|||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
texcoord = gl_MultiTexCoord0.xy;
|
texcoord = gl_MultiTexCoord0.xy;
|
||||||
|
|
||||||
exposure = vec4(texelFetch2D(colortex4,ivec2(10,37),0).r*vec3(FinalR,FinalG,FinalB),texelFetch2D(colortex4,ivec2(10,37),0).r);
|
exposure=vec4(texelFetch2D(colortex4,ivec2(10,37),0).r*vec3(FinalR,FinalG,FinalB),texelFetch2D(colortex4,ivec2(10,37),0).r);
|
||||||
rodExposureDepth = texelFetch2D(colortex4,ivec2(14,37),0).rg;
|
rodExposureDepth = texelFetch2D(colortex4,ivec2(14,37),0).rg;
|
||||||
rodExposureDepth.y = sqrt(rodExposureDepth.y/65000.0);
|
rodExposureDepth.y = sqrt(rodExposureDepth.y/65000.0);;
|
||||||
}
|
}
|
@ -152,6 +152,8 @@ float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves
|
|||||||
return caustic / weightSum;
|
return caustic / weightSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEyeDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEyeDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
||||||
int spCount = 8;
|
int spCount = 8;
|
||||||
|
|
||||||
@ -170,7 +172,8 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
|||||||
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
||||||
// vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
|
// vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
|
||||||
|
|
||||||
float phase = (phaseg(VdotL,0.6) + phaseg(VdotL,0.8)) * 0.5;
|
// float phase = (phaseg(VdotL,0.6) + phaseg(VdotL,0.8)) * 0.5;
|
||||||
|
float phase = fogPhase(VdotL) ;
|
||||||
|
|
||||||
vec3 absorbance = vec3(1.0);
|
vec3 absorbance = vec3(1.0);
|
||||||
vec3 vL = vec3(0.0);
|
vec3 vL = vec3(0.0);
|
||||||
|
@ -302,7 +302,7 @@ void main() {
|
|||||||
fogfade *= 1.0 - clamp( length(fragpos) / far,0.0,1.0);
|
fogfade *= 1.0 - clamp( length(fragpos) / far,0.0,1.0);
|
||||||
|
|
||||||
color.rgb *= fogfade ;
|
color.rgb *= fogfade ;
|
||||||
bloomyFogMult *= 0.4;
|
bloomyFogMult *= 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply VL fog to the scene
|
// apply VL fog to the scene
|
||||||
|
@ -13,10 +13,12 @@ flat varying vec3 moonColor;
|
|||||||
// flat varying vec3 WsunVec;
|
// flat varying vec3 WsunVec;
|
||||||
|
|
||||||
flat varying vec2 tempOffsets;
|
flat varying vec2 tempOffsets;
|
||||||
|
|
||||||
flat varying float exposure;
|
flat varying float exposure;
|
||||||
flat varying float rodExposure;
|
|
||||||
flat varying float avgBrightness;
|
flat varying float avgBrightness;
|
||||||
flat varying float exposureF;
|
flat varying float rodExposure;
|
||||||
|
flat varying float avgL2;
|
||||||
|
flat varying float centerDepth;
|
||||||
|
|
||||||
uniform sampler2D noisetex;
|
uniform sampler2D noisetex;
|
||||||
|
|
||||||
@ -279,8 +281,8 @@ gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.);
|
|||||||
|
|
||||||
//Exposure values
|
//Exposure values
|
||||||
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
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,exposureF,1.0);
|
gl_FragData[0] = vec4(exposure,avgBrightness,avgL2,1.0);
|
||||||
if (gl_FragCoord.x > 14. && gl_FragCoord.x < 15. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
if (gl_FragCoord.x > 14. && gl_FragCoord.x < 15. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||||
gl_FragData[0] = vec4(rodExposure,0.0,0.0,1.0);
|
gl_FragData[0] = vec4(rodExposure,centerDepth,0.0, 1.0);
|
||||||
|
|
||||||
}
|
}
|
@ -15,6 +15,7 @@ flat varying vec3 lightSourceColor;
|
|||||||
flat varying vec3 zenithColor;
|
flat varying vec3 zenithColor;
|
||||||
|
|
||||||
flat varying vec2 tempOffsets;
|
flat varying vec2 tempOffsets;
|
||||||
|
|
||||||
flat varying float exposure;
|
flat varying float exposure;
|
||||||
flat varying float avgBrightness;
|
flat varying float avgBrightness;
|
||||||
flat varying float rodExposure;
|
flat varying float rodExposure;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
float phaseRayleigh(float cosTheta) {
|
|
||||||
const vec2 mul_add = vec2(0.1, 0.28) /acos(-1.0);
|
|
||||||
return cosTheta * mul_add.x + mul_add.y; // optimized version from [Elek09], divided by 4 pi for energy conservation
|
|
||||||
}
|
|
||||||
|
|
||||||
uniform float noPuddleAreas;
|
uniform float noPuddleAreas;
|
||||||
float densityAtPosFog(in vec3 pos){
|
float densityAtPosFog(in vec3 pos){
|
||||||
@ -48,7 +45,22 @@ float cloudVol(in vec3 pos){
|
|||||||
return CloudyFog + UniformFog + RainFog;
|
return CloudyFog + UniformFog + RainFog;
|
||||||
}
|
}
|
||||||
|
|
||||||
uniform bool inSpecialBiome;
|
float phaseRayleigh(float cosTheta) {
|
||||||
|
const vec2 mul_add = vec2(0.1, 0.28) / acos(-1.0);
|
||||||
|
return cosTheta * mul_add.x + mul_add.y; // optimized version from [Elek09], divided by 4 pi for energy conservation
|
||||||
|
}
|
||||||
|
float fogPhase(float lightPoint){
|
||||||
|
float linear = 1.0 - clamp(lightPoint*0.5+0.5,0.0,1.0);
|
||||||
|
float linear2 = 1.0 - clamp(lightPoint,0.0,1.0);
|
||||||
|
|
||||||
|
float exponential = exp2(pow(linear,0.3) * -15.0 ) * 1.5;
|
||||||
|
exponential += sqrt(exp2(sqrt(linear) * -12.5));
|
||||||
|
|
||||||
|
return exponential;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// uniform bool inSpecialBiome;
|
||||||
vec4 GetVolumetricFog(
|
vec4 GetVolumetricFog(
|
||||||
vec3 viewPosition,
|
vec3 viewPosition,
|
||||||
float dither,
|
float dither,
|
||||||
@ -90,7 +102,8 @@ vec4 GetVolumetricFog(
|
|||||||
float dL = length(dVWorld);
|
float dL = length(dVWorld);
|
||||||
|
|
||||||
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
||||||
float mie = phaseg(SdotV,0.7)*5.0 + 0.1;
|
// float mie = phaseg(SdotV,0.7)*5.0 + 0.1;
|
||||||
|
float mie = fogPhase(SdotV) * 5.0;
|
||||||
float rayL = phaseRayleigh(SdotV);
|
float rayL = phaseRayleigh(SdotV);
|
||||||
|
|
||||||
vec3 rC = vec3(fog_coefficientRayleighR*1e-6, fog_coefficientRayleighG*1e-5, fog_coefficientRayleighB*1e-5);
|
vec3 rC = vec3(fog_coefficientRayleighR*1e-6, fog_coefficientRayleighG*1e-5, fog_coefficientRayleighB*1e-5);
|
||||||
@ -178,7 +191,8 @@ vec4 GetVolumetricFog(
|
|||||||
vec3 AtmosphericFog = skyCol0 * (rL*3.0 + m);// + (LightSourceColor * sh) * (rayL*rL*3.0 + m*mie);
|
vec3 AtmosphericFog = skyCol0 * (rL*3.0 + m);// + (LightSourceColor * sh) * (rayL*rL*3.0 + m*mie);
|
||||||
|
|
||||||
vec3 vL0 = (AtmosphericFog + AmbientLight + DirectLight + Lightning) * lightleakfix;
|
vec3 vL0 = (AtmosphericFog + AmbientLight + DirectLight + Lightning) * lightleakfix;
|
||||||
// vec3 vL0 = DirectLight;
|
|
||||||
|
// vL0 = DirectLight;
|
||||||
|
|
||||||
// #if defined Cave_fog && defined TEST
|
// #if defined Cave_fog && defined TEST
|
||||||
// vL0 += cavefogCol;
|
// vL0 += cavefogCol;
|
||||||
|
@ -164,7 +164,7 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
|
|||||||
|
|
||||||
#define RainFog_amount 3 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
|
#define RainFog_amount 3 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
|
||||||
|
|
||||||
#define BLOOMY_FOG 2.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
|
#define BLOOMY_FOG 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
|
||||||
#define BLOOM_STRENGTH 4.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0]
|
#define BLOOM_STRENGTH 4.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0]
|
||||||
|
|
||||||
#define Cave_fog
|
#define Cave_fog
|
||||||
|
@ -380,12 +380,13 @@ float GetCloudShadow(vec3 feetPlayerPos){
|
|||||||
|
|
||||||
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
||||||
#ifdef Cumulus
|
#ifdef Cumulus
|
||||||
vec3 lowShadowStart = playerPos + WsunVec/abs(WsunVec.y) * max((MaxCumulusHeight - 70) - playerPos.y,0.0) ;
|
|
||||||
|
vec3 lowShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max((MaxCumulusHeight - 70) - playerPos.y,0.0) ;
|
||||||
shadow += GetCumulusDensity(lowShadowStart, 1)*Cumulus_density;
|
shadow += GetCumulusDensity(lowShadowStart, 1)*Cumulus_density;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Altostratus
|
#ifdef Altostratus
|
||||||
vec3 highShadowStart = playerPos + WsunVec/abs(WsunVec.y) * max(AltostratusHeight - playerPos.y,0.0);
|
vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(AltostratusHeight - playerPos.y,0.0);
|
||||||
shadow += GetAltostratusDensity(highShadowStart) * 0.5;
|
shadow += GetAltostratusDensity(highShadowStart) * 0.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -403,15 +404,14 @@ float GetCloudShadow(vec3 feetPlayerPos){
|
|||||||
float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
|
float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
|
||||||
#ifdef CLOUDS_SHADOWS
|
#ifdef CLOUDS_SHADOWS
|
||||||
float shadow = 0.0;
|
float shadow = 0.0;
|
||||||
|
|
||||||
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
||||||
#ifdef Cumulus
|
#ifdef Cumulus
|
||||||
vec3 lowShadowStart = WorldPos + WorldSpace_sunVec/abs(WorldSpace_sunVec.y) * max((MaxCumulusHeight - 60) - WorldPos.y,0.0) ;
|
vec3 lowShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max((MaxCumulusHeight - 60) - WorldPos.y,0.0) ;
|
||||||
shadow += max(GetCumulusDensity(lowShadowStart, 0) , 0.0)*Cumulus_density;
|
shadow += max(GetCumulusDensity(lowShadowStart, 0), 0.0)*Cumulus_density;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Altostratus
|
#ifdef Altostratus
|
||||||
vec3 highShadowStart = WorldPos + WorldSpace_sunVec/abs(WorldSpace_sunVec.y) * max(AltostratusHeight - WorldPos.y,0.0);
|
vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(AltostratusHeight - WorldPos.y,0.0);
|
||||||
shadow += GetAltostratusDensity(highShadowStart)*0.5;
|
shadow += GetAltostratusDensity(highShadowStart)*0.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves
|
float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves
|
||||||
vec2 movement = vec2(frameTimeCounter*0.05);
|
vec2 movement = vec2(frameTimeCounter*0.05);
|
||||||
vec2 pos = posxz ;
|
vec2 pos = posxz ;
|
||||||
@ -27,6 +29,8 @@ float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { /
|
|||||||
}
|
}
|
||||||
return ((3.0-caustic) * weightSum / (30.0 * 3.0));
|
return ((3.0-caustic) * weightSum / (30.0 * 3.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves
|
// float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves
|
||||||
// vec2 movement = vec2(frameTimeCounter*0.025);
|
// vec2 movement = vec2(frameTimeCounter*0.025);
|
||||||
// vec2 pos = posxz ;
|
// vec2 pos = posxz ;
|
||||||
|
Loading…
Reference in New Issue
Block a user