diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index 61dd366..d44caf6 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -272,12 +272,11 @@ vec2 SSAO( vec2 offsets = CleanSample(i, samples - 1, noise) / distanceScale; - ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE); + ivec2 offsetUV = ivec2(clamp((gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE)*texelSize,screenEdges,1.0-screenEdges)/texelSize); - // if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) { + if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) { - // float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand); - float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(clamp(offsetUV*texelSize,screenEdges,1.0-screenEdges)/texelSize), 0).x, hand); + float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand); #ifdef DISTANT_HORIZONS float sampleDHDepth = texelFetch2D(dhDepthTex1, offsetUV, 0).x; @@ -305,9 +304,9 @@ vec2 SSAO( #endif } - // } + } } - float finaalAO = max(1.0 - occlusion*AO_Strength/n, 0.0); + float finaalAO = max(1.0 - occlusion*AO_Strength/max(n,1e-5), 0.0); float finalSSS = sss/float(samples); return vec2(finaalAO, finalSSS); diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index eb1a75b..be3ef49 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -642,7 +642,7 @@ vec4 raymarchCloud( } #endif - vec3 mainLightVec = mix(moonVector, sunVector, smoothstep(-0.06, 0.1, sunElevation)); + vec3 mainLightVec = mix(moonVector, sunVector, smoothstep(-0.06, 0.06, sunElevation)); float tallness = maxHeight - minHeight;