mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2026-10-12 02:08:16 +08:00
very small tweak to zoom type lightleak fix
This commit is contained in:
1 parent
bb25f840cb
commit
764e62cf3d
3 files changed
+19
-11
No files matched your search
@@ -44,6 +44,7 @@ uniform vec2 texelSize;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float rainStrength;
|
||||
uniform int frameCounter;
|
||||
uniform ivec2 eyeBrightnessSmooth;
|
||||
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
@@ -69,6 +70,8 @@ uniform float near;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
#include "/lib/Shadows.glsl"
|
||||
|
||||
#define ffstep(x,y) clamp((y - x) * 1e35,0.0,1.0)
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
@@ -251,7 +254,7 @@ float convertHandDepth_2(in float depth, bool hand) {
|
||||
}
|
||||
|
||||
vec2 SSAO(
|
||||
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, bool leaves, float noise
|
||||
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, float noise
|
||||
){
|
||||
int samples = 7;
|
||||
float occlusion = 0.0;
|
||||
@@ -353,6 +356,8 @@ void main() {
|
||||
vec2 lightmap = dataUnpacked1.yz;
|
||||
|
||||
|
||||
float lightLeakFix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0);
|
||||
|
||||
gl_FragData[1] = vec4(0.0,0.0,0.0, texelFetch2D(colortex14,ivec2((floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize)/texelSize),0).a);
|
||||
|
||||
|
||||
@@ -404,7 +409,7 @@ void main() {
|
||||
vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0);
|
||||
if(z >= 1.0) FlatNormals = normal;
|
||||
|
||||
vec2 SSAO_SSS = SSAO(viewPos, worldToView(normal), worldToView(FlatNormals), hand, isLeaf, noise);
|
||||
vec2 SSAO_SSS = SSAO(viewPos, worldToView(normal), worldToView(FlatNormals), hand, noise);
|
||||
|
||||
#ifndef OLD_INDIRECT_SSS
|
||||
SSAO_SSS.y = clamp(SSAO_SSS.y + 0.5 * lightmap.y*lightmap.y,0.0,1.0);
|
||||
@@ -441,8 +446,6 @@ void main() {
|
||||
float minshadowfilt = Min_Shadow_Filter_Radius;
|
||||
float maxshadowfilt = Max_Shadow_Filter_Radius;
|
||||
|
||||
if(lightmap.y < 0.1) maxshadowfilt = min(maxshadowfilt, minshadowfilt);
|
||||
|
||||
#ifdef BASIC_SHADOW_FILTER
|
||||
if (LabSSS > 0.0 && NdotL < 0.001){
|
||||
minshadowfilt = 50;
|
||||
@@ -458,6 +461,11 @@ void main() {
|
||||
// if (LabSSS > -1) {
|
||||
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
#if LIGHTLEAKFIX_MODE == 1
|
||||
if(!hand) GriAndEminShadowFix(feetPlayerPos, FlatNormals, lightLeakFix);
|
||||
#endif
|
||||
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
|
||||
@@ -490,10 +498,9 @@ void main() {
|
||||
|
||||
for(int i = 0; i < VPS_Search_Samples; i++){
|
||||
|
||||
// vec2 offsetS = SpiralSample(i, 7, 8, noise) * 0.5;
|
||||
vec2 offsetS = CleanSample(i, VPS_Search_Samples - 1, noise) * 0.5;
|
||||
|
||||
float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
|
||||
float weight = 3.0 + (i+noise) * rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
|
||||
|
||||
float d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;
|
||||
float b = smoothstep(weight*diffthresh/2.0, weight*diffthresh, projectedShadowPosition.z - d);
|
||||
|
||||
@@ -1050,7 +1050,7 @@ void main() {
|
||||
vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
#if LIGHTLEAKFIX_MODE == 1
|
||||
if(!hand) GriAndEminShadowFix(shadowPlayerPos, FlatNormals, vanilla_AO, lightmap.y, lightLeakFix);
|
||||
if(!hand) GriAndEminShadowFix(shadowPlayerPos, FlatNormals, lightLeakFix);
|
||||
#endif
|
||||
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * shadowPlayerPos + shadowModelView[3].xyz;
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
void GriAndEminShadowFix(
|
||||
inout vec3 WorldPos,
|
||||
vec3 FlatNormal,
|
||||
float VanillaAO,
|
||||
float SkyLightmap,
|
||||
float transition
|
||||
){
|
||||
float zoomLevel = 1.0-(transition*transition*transition*transition*0.5+0.5);
|
||||
if(SkyLightmap < 0.1 && isEyeInWater != 1) WorldPos = WorldPos - ( fract(WorldPos+cameraPosition - WorldPos*0.0001)*zoomLevel - zoomLevel*0.5);
|
||||
transition = 1.0-transition;
|
||||
transition *= transition*transition*transition*transition*transition*transition;
|
||||
float zoomLevel = mix(0.0, 0.5, transition);
|
||||
|
||||
if(zoomLevel > 0.001 && isEyeInWater != 1) WorldPos = WorldPos - ( fract(WorldPos+cameraPosition - WorldPos*0.0001)*zoomLevel - zoomLevel*0.5);
|
||||
}
|
||||
|
||||
void applyShadowBias(inout vec3 projectedShadowPosition, in vec3 playerPos, in vec3 geoNormals){
|
||||
|
||||
Reference in new issue
Block a user