mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-20 16:07:22 +08:00
quick fix for GI strength
This commit is contained in:
parent
bc431c7e0c
commit
c13fdfa29d
@ -553,6 +553,7 @@ vec3 cosineHemisphereSample(vec2 Xi, float roughness){
|
|||||||
|
|
||||||
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
|
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
|
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
|
||||||
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
||||||
vec3 T = normalize(cross(UpVector, N));
|
vec3 T = normalize(cross(UpVector, N));
|
||||||
@ -561,11 +562,6 @@ vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
|
|||||||
return vec3((T * H.x) + (B * H.y) + (N * H.z));
|
return vec3((T * H.x) + (B * H.y) + (N * H.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 applyContrast(vec3 color, float contrast){
|
|
||||||
return (color - 0.5) * contrast + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 lightmaps, vec3 skylightcolor, vec3 torchcolor){
|
void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 lightmaps, vec3 skylightcolor, vec3 torchcolor){
|
||||||
int nrays = RAY_COUNT;
|
int nrays = RAY_COUNT;
|
||||||
|
|
||||||
@ -592,7 +588,7 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li
|
|||||||
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
||||||
skycontribution = (skyCloudsFromTex(rayDir, colortex4).rgb / 15.0) * skyLM + torchlight;
|
skycontribution = (skyCloudsFromTex(rayDir, colortex4).rgb / 15.0) * skyLM + torchlight;
|
||||||
#else
|
#else
|
||||||
skycontribution = (skylightcolor * skyLM) * max(rayDir.y,1 - AO_Strength) + torchlight;
|
skycontribution = (skylightcolor * skyLM) * max(rayDir.y,1.0 - AO_Strength) + torchlight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rayHit.z < 1.){
|
if (rayHit.z < 1.){
|
||||||
@ -602,7 +598,7 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li
|
|||||||
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
||||||
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
||||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){
|
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){
|
||||||
radiance += applyContrast(texture2D(colortex5,previousPosition.xy).rgb, GI_Strength) + skycontribution;
|
radiance += (texture2D(colortex5,previousPosition.xy).rgb + skycontribution) * GI_Strength;
|
||||||
} else {
|
} else {
|
||||||
radiance += skycontribution;
|
radiance += skycontribution;
|
||||||
}
|
}
|
||||||
@ -610,13 +606,13 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li
|
|||||||
radiance += skycontribution;
|
radiance += skycontribution;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
occlusion += skycontribution;
|
occlusion += skycontribution * GI_Strength;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
radiance += skycontribution;
|
radiance += skycontribution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lighting = (radiance - occlusion)/nrays;
|
lighting = max(radiance - occlusion,0.0)/nrays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
#define indirect_effect 1 // [0 1 2 3 4]
|
#define indirect_effect 1 // [0 1 2 3 4]
|
||||||
|
|
||||||
#define AO_in_sunlight
|
#define AO_in_sunlight
|
||||||
#define AO_Strength 0.9 // [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 AO_Strength 0.9 // [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 SKY_CONTRIBUTION_IN_SSRT
|
// #define SKY_CONTRIBUTION_IN_SSRT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user