Theoretically, at least, fix everything (except hte sky issue which is resolved in another branch)

pull/1547/head
AnyOldName3 7 years ago
parent d0587a3ad5
commit 3f63ebce77

@ -210,7 +210,7 @@ namespace MWRender
settings->setReceivesShadowTraversalMask(~0u);
//settings->setShadowMapProjectionHint(osgShadow::ShadowSettings::PERSPECTIVE_SHADOW_MAP);
settings->setBaseShadowTextureUnit(1);
settings->setBaseShadowTextureUnit(7);
//settings->setMinimumShadowMapNearFarRatio(0);
//settings->setNumShadowMapsPerLight(1);
//settings->setShadowMapProjectionHint(osgShadow::ShadowSettings::ORTHOGRAPHIC_SHADOW_MAP);

@ -46,6 +46,7 @@ varying vec4 passColor;
varying vec3 passViewPos;
varying vec3 passNormal;
uniform int shadowTextureUnit0;
varying vec4 shadowSpaceCoords;
#include "lighting.glsl"
@ -104,6 +105,6 @@ void main(void)
passNormal = gl_Normal.xyz;
// This matrix has the opposite handedness to the others used here, so multiplication must have the vector to the left. Alternatively it could be transposed after construction, but that's extra work for the GPU just to make the code look a tiny bit cleaner.
mat4 eyePlaneMat = mat4(gl_EyePlaneS[1], gl_EyePlaneT[1], gl_EyePlaneR[1], gl_EyePlaneQ[1]);
mat4 eyePlaneMat = mat4(gl_EyePlaneS[shadowTextureUnit0], gl_EyePlaneT[shadowTextureUnit0], gl_EyePlaneR[shadowTextureUnit0], gl_EyePlaneQ[shadowTextureUnit0]);
shadowSpaceCoords = viewPos * eyePlaneMat;
}

@ -14,6 +14,7 @@ varying vec4 passColor;
varying vec3 passViewPos;
varying vec3 passNormal;
uniform int shadowTextureUnit0;
varying vec4 shadowSpaceCoords;
#include "lighting.glsl"
@ -38,6 +39,6 @@ void main(void)
uv = gl_MultiTexCoord0.xy;
// This matrix has the opposite handedness to the others used here, so multiplication must have the vector to the left. Alternatively it could be transposed after construction, but that's extra work for the GPU just to make the code look a tiny bit cleaner.
mat4 eyePlaneMat = mat4(gl_EyePlaneS[1], gl_EyePlaneT[1], gl_EyePlaneR[1], gl_EyePlaneQ[1]);
mat4 eyePlaneMat = mat4(gl_EyePlaneS[shadowTextureUnit0], gl_EyePlaneT[shadowTextureUnit0], gl_EyePlaneR[shadowTextureUnit0], gl_EyePlaneQ[shadowTextureUnit0]);
shadowSpaceCoords = viewPos * eyePlaneMat;
}

@ -4,6 +4,7 @@ varying vec3 screenCoordsPassthrough;
varying vec4 position;
varying float depthPassthrough;
uniform int shadowTextureUnit0;
varying vec4 shadowSpaceCoords;
void main(void)
@ -23,6 +24,6 @@ void main(void)
depthPassthrough = gl_Position.z;
// This matrix has the opposite handedness to the others used here, so multiplication must have the vector to the left. Alternatively it could be transposed after construction, but that's extra work for the GPU just to make the code look a tiny bit cleaner.
mat4 eyePlaneMat = mat4(gl_EyePlaneS[1], gl_EyePlaneT[1], gl_EyePlaneR[1], gl_EyePlaneQ[1]);
mat4 eyePlaneMat = mat4(gl_EyePlaneS[shadowTextureUnit0], gl_EyePlaneT[shadowTextureUnit0], gl_EyePlaneR[shadowTextureUnit0], gl_EyePlaneQ[shadowTextureUnit0]);
shadowSpaceCoords = (gl_ModelViewMatrix * gl_Vertex) * eyePlaneMat;
}

Loading…
Cancel
Save