fix error when POM is enabled

This commit is contained in:
Xonk 2025-02-25 22:23:50 -05:00
parent 8a1bdcb9ca
commit 232e5304a8
3 changed files with 30 additions and 49 deletions

View File

@ -197,9 +197,9 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis
#endif
#if defined DAMAGE_BLOCK_EFFECT && defined POM
#extension GL_ARB_shader_texture_lod : enable
#extension GL_ARB_shader_texture_lod : enable
mat3 inverseMatrix(mat3 m) {
mat3 inverseMatrix(mat3 m) {
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
@ -213,28 +213,20 @@ mat3 inverseMatrix(mat3 m) {
return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),
b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),
b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;
}
const float MAX_OCCLUSION_DISTANCE = MAX_DIST;
const float MIX_OCCLUSION_DISTANCE = MAX_DIST*0.9;
const int MAX_OCCLUSION_POINTS = MAX_ITERATIONS;
}
const float MAX_OCCLUSION_DISTANCE = MAX_DIST;
const float MIX_OCCLUSION_DISTANCE = MAX_DIST*0.9;
const int MAX_OCCLUSION_POINTS = MAX_ITERATIONS;
varying vec4 vtexcoordam; // .st for add, .pq for mul
varying vec4 vtexcoord;
varying vec4 vtexcoordam; // .st for add, .pq for mul
varying vec4 vtexcoord;
vec2 dcdx = dFdx(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias);
vec2 dcdy = dFdy(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias);
vec2 dcdx = dFdx(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias);
vec2 dcdy = dFdy(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias);
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
uniform mat4 gbufferProjection;
vec3 toClipSpace3(vec3 viewSpacePosition) {
return projMAD(gbufferProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
}
flat varying vec3 WsunVec2;
const float mincoord = 1.0/4096.0;
const float maxcoord = 1.0-mincoord;
@ -301,8 +293,6 @@ void main() {
float dist = length(fragpos);
float maxdist = MAX_OCCLUSION_DISTANCE;
// float depth = gl_FragCoord.z;
if (dist < maxdist) {
float depthmap = readNormal(vtexcoord.st).a;
@ -334,10 +324,6 @@ void main() {
}
adjustedTexCoord = mix(fract(coord.st)*vtexcoordam.pq+vtexcoordam.st, adjustedTexCoord, max(dist-MIX_OCCLUSION_DISTANCE,0.0)/(MAX_OCCLUSION_DISTANCE-MIX_OCCLUSION_DISTANCE));
// vec3 truePos = fragpos + sumVec*inverseMatrix(tbnMatrix)*interval;
// depth = toClipSpace3(truePos).z;
}
}

View File

@ -66,7 +66,6 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
varying vec4 tangent;
attribute vec4 at_tangent;
varying vec4 normalMat;
flat varying vec3 WsunVec2;
#endif
//////////////////////////////VOID MAIN//////////////////////////////
@ -77,9 +76,6 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
void main() {
#ifdef DAMAGE_BLOCK_EFFECT
WsunVec2 = (float(sunElevation > 1e-5)*2.0 - 1.0)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
lmtexcoord.xy = (gl_MultiTexCoord0).xy;
vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0;
lmtexcoord.zw = lmcoord;

View File

@ -324,7 +324,6 @@ vec3 specularReflections(
vec3 reflectedVector_L = reflect(playerPos, normal);
#endif
float shlickFresnel = shlickFresnelRoughness(dot(-normalize(viewDir), vec3(0.0,0.0,1.0)), roughness);
#if defined FORWARD_SPECULAR && defined SNELLS_WINDOW