mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-22 17:47:34 +08:00
make the nether playable. fix error with enabling DH shadowmap with translucent shadows on.
This commit is contained in:
parent
46405f95f1
commit
f071204fc9
@ -200,7 +200,8 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef NETHER_SHADER
|
||||
vec3 AmbientLightColor = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb / 15;
|
||||
// vec3 AmbientLightColor = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb / 15;
|
||||
vec3 AmbientLightColor = vec3(0.1);
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
|
@ -526,14 +526,17 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
#endif
|
||||
|
||||
#ifdef NETHER_SHADER
|
||||
vec3 AmbientLightColor = skyCloudsFromTexLOD2(WS_normal, colortex4, 6).rgb ;
|
||||
// vec3 AmbientLightColor = skyCloudsFromTexLOD2(WS_normal, colortex4, 6).rgb ;
|
||||
|
||||
vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb;
|
||||
vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb;
|
||||
// vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb;
|
||||
// vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb;
|
||||
|
||||
up *= pow( max( WS_normal.y, 0), 2);
|
||||
down *= pow( max(-WS_normal.y, 0), 2);
|
||||
AmbientLightColor += up + down;
|
||||
// up *= pow( max( WS_normal.y, 0), 2);
|
||||
// down *= pow( max(-WS_normal.y, 0), 2);
|
||||
// AmbientLightColor += up + down;
|
||||
|
||||
vec3 AmbientLightColor = vec3(0.1);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
|
@ -208,10 +208,16 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
void convertHandDepth(inout float depth) {
|
||||
float ndcDepth = depth * 2.0 - 1.0;
|
||||
ndcDepth /= MC_HAND_DEPTH;
|
||||
depth = ndcDepth * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
vec2 SSAO(
|
||||
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
||||
){
|
||||
if(hand) return vec2(1.0,0.0);
|
||||
// if(hand) return vec2(1.0,0.0);
|
||||
int samples = 7;
|
||||
float occlusion = 0.0;
|
||||
float sss = 0.0;
|
||||
@ -286,7 +292,6 @@ float encodeVec2(vec2 a){
|
||||
float encodeVec2(float x,float y){
|
||||
return encodeVec2(vec2(x,y));
|
||||
}
|
||||
|
||||
// #include "/lib/indirect_lighting_effects.glsl"
|
||||
|
||||
#ifdef DENOISE_SSS_AND_SSAO
|
||||
@ -304,7 +309,6 @@ void main() {
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
float DH_depth1 = texture2D(dhDepthTex1,texcoord).x;
|
||||
|
||||
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5, z, DH_depth1);
|
||||
|
||||
|
||||
|
||||
@ -325,8 +329,13 @@ void main() {
|
||||
bool hand = abs(dataUnpacked1.w-0.75) < 0.01;
|
||||
// bool blocklights = abs(dataUnpacked1.w-0.8) <0.01;
|
||||
|
||||
|
||||
if(hand) convertHandDepth(z);
|
||||
|
||||
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5, z, DH_depth1);
|
||||
|
||||
gl_FragData[1] = vec4(0.0,0.0,0.0,texture2D(colortex14,texcoord).a);
|
||||
|
||||
#if defined DENOISE_SSS_AND_SSAO && indirect_effect == 1
|
||||
float depth = z;
|
||||
|
||||
@ -374,10 +383,10 @@ void main() {
|
||||
}
|
||||
|
||||
#ifndef Variable_Penumbra_Shadows
|
||||
if (LabSSS > 0.0 && !hand && NdotL < 0.001) minshadowfilt += 50;
|
||||
if (LabSSS > 0.0 && NdotL < 0.001) minshadowfilt += 50;
|
||||
#endif
|
||||
|
||||
if (z < 1.0 && !hand){
|
||||
if (z < 1.0){
|
||||
|
||||
gl_FragData[0] = vec4(minshadowfilt, 0.1, 0.0, 0.0);
|
||||
gl_FragData[0].a = 0;
|
||||
|
@ -127,6 +127,12 @@ flat varying vec3 WsunVec;
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
void convertHandDepth(inout float depth) {
|
||||
float ndcDepth = depth * 2.0 - 1.0;
|
||||
ndcDepth /= MC_HAND_DEPTH;
|
||||
depth = ndcDepth * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
vec3 toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
@ -773,12 +779,7 @@ void main() {
|
||||
float DH_depth1 = 0.0;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z, DH_depth1);
|
||||
#else
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
|
||||
@ -837,10 +838,17 @@ void main() {
|
||||
// bool blocklights = abs(dataUnpacked1.w-0.8) <0.01;
|
||||
|
||||
|
||||
if(hand) viewPos *= 5.0;
|
||||
|
||||
if(hand) convertHandDepth(z);
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z, DH_depth1);
|
||||
#else
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
|
||||
#endif
|
||||
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
|
||||
vec3 feetPlayerPos_normalized = normVec(feetPlayerPos);
|
||||
|
||||
////// --------------- COLORS --------------- //////
|
||||
|
||||
float dirtAmount = Dirt_Amount + 0.01;
|
||||
@ -859,7 +867,7 @@ void main() {
|
||||
#endif
|
||||
vec3 Absorbtion = vec3(1.0);
|
||||
vec3 AmbientLightColor = vec3(0.0);
|
||||
vec3 MinimumLightColor = vec3(1.0);
|
||||
vec3 MinimumLightColor = vec3(1.0);
|
||||
vec3 Indirect_lighting = vec3(0.0);
|
||||
vec3 Indirect_SSS = vec3(0.0);
|
||||
|
||||
@ -988,7 +996,8 @@ void main() {
|
||||
|
||||
vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
if(!entities || !hand) GriAndEminShadowFix(shadowPlayerPos, viewToWorld(FlatNormals), vanilla_AO, lightmap.y);
|
||||
// if(!entities) if(!hand)
|
||||
GriAndEminShadowFix(shadowPlayerPos, viewToWorld(FlatNormals), vanilla_AO, lightmap.y);
|
||||
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * shadowPlayerPos + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
@ -1118,7 +1127,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if defined DISTANT_HORIZONS_SHADOWMAP && defined Variable_Penumbra_Shadows
|
||||
ShadowBlockerDepth = mix(pow(1.0 - Shadows,2.0), ShadowBlockerDepth, shadowMapFalloff);
|
||||
ShadowBlockerDepth = mix(pow(1.0 - Shadows.x,2.0), ShadowBlockerDepth, shadowMapFalloff);
|
||||
#endif
|
||||
|
||||
#if !defined Variable_Penumbra_Shadows
|
||||
@ -1198,14 +1207,16 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef NETHER_SHADER
|
||||
Indirect_lighting = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb;
|
||||
// Indirect_lighting = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb;
|
||||
|
||||
vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb;
|
||||
vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb;
|
||||
// vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb;
|
||||
// vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb;
|
||||
|
||||
up *= pow( max( slopednormal.y, 0), 2);
|
||||
down *= pow( max(-slopednormal.y, 0), 2);
|
||||
Indirect_lighting += up + down;
|
||||
// up *= pow( max( slopednormal.y, 0), 2);
|
||||
// down *= pow( max(-slopednormal.y, 0), 2);
|
||||
// Indirect_lighting += up + down;
|
||||
|
||||
Indirect_lighting = vec3(0.1);
|
||||
|
||||
Indirect_lighting *= Absorbtion;
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ void main() {
|
||||
#ifdef NETHER_SHADER
|
||||
lightCol.rgb = vec3(0.0);
|
||||
averageSkyCol = vec3(0.0);
|
||||
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 30.0;
|
||||
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 10.0;
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
|
@ -53,7 +53,7 @@ void main() {
|
||||
#ifdef NETHER_SHADER
|
||||
lightCol.rgb = vec3(0.0);
|
||||
averageSkyCol = vec3(0.0);
|
||||
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 30.0;
|
||||
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 10.0;
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
|
Loading…
Reference in New Issue
Block a user