# My point light shadows only really work if my point light is at the world origin (0,0,0)

When I move the light, the shadows will fall apart as if their occluders aren't occluding them in certain areas.

For example, in the following scene, I move a pointlight 400 units down the Z axis, I get a scene like this, where somehow occluded fragments are passing the shadow test:

The shadowmap texture appears fine to me. Since I'm working with a pointlight, I need a cubemap, so here are the relevant portions of its texture:

I'm fairly certain my issue has to be somewhere in one of my shaders.

My point light's shadowing logic subtracts the lights' position from the fragment's world position, takes the length of that vec3 and outputs that as the FragColor.

#version 330

in vec3 WorldPos; // aka ViewMatrix*ModelMatrix*Vertex

layout (location = 0) out float FragColor;

uniform vec3 LightPos;

void main()
{
vec3 LightToVertex = WorldPos - LightPos;
float LightToPixelDistance = length(LightToVertex);

FragColor = LightToPixelDistance;
}


And then within the actual lighting logic, I do this to calculate a shadow factor (where 1.0 == full illumination, and 0.0 == full darkness)

uniform samplerCubeShadow ShadowMap;
in vec3 WorldPos;

{
vec3 LightDirection = WorldPos - pointLight.position;
float Distance = length(LightDirection);
vec3 Direction = normalize(LightDirection);

float Factor = 0.2;
vec4 UVC = vec4(Direction, (Distance + EPSILON));