Flickering spot light shadows in GLSL Two years ago I made a labyrinth game for a class, and it worked perfectly. Now I need to use this game for other reasons, but the lightning is bugged.

I'm using GLSL because that's how I managed to make everything work back then. I'm using a spot light to generate shadows, in lieu of the sun, because a Sun wasn't generating shadows as I wanted. But I'm using a sphere of 20 Suns to simulate global illumination, because other means to do that weren't working back then.

I have a camera overlooking the labyrinth, and the shadows are correct there. I also have a first person camera, and that's where the problem is. I'm failing to put this problem into words, so I made a video:

https://youtu.be/iwVJ0AlqWtU

I've Googled and messed around a bit, but I found no solution. I found out that I could replace my spot light by a Sun, and the shadows even look better, but the bug remains exactly the same.

The necessary files are here:

https://github.com/GuiRitter/labyrinth-game-exercise

Is there a solution to this?

Thanks in advance.

Update:


I tested a bit further. I don't know if it can be seen in the video (terrible job at using OBS Studio), but the ground texture is also bugged, (not) moving like the shadows are. I've deleted all light sources and the problem remains (tested in two scenarios: #1 added Emit in Properties > Material > Shading to the ground texture; #2 added ambient lightning in Properties > World > Environment Lightning (didn't knew of this before or it didn't existed when I had to make that fake ambient lightning))..
I've made a minimal version from scratch (nothing copied from the first one) and the bug remains.
Also didn't work: deleting all cameras, creating a new camera, not scaling it, setting it's physics to No Collision, vertex parenting it to the player character (although that makes the camera not change orientation with the parent), positioning it such that it would not be inside another object. I positioned it above the labyrinth walls and deleted the sky to ensure the last one.
You need set up only one sun lamp.


(Asuming all objects are deselect)RigthMouseButton to select the sun lamp and while pressing Shit + RigthMouseButton select your player:

While both selected press Ctrl + P and select Vertex:





select, deselect all pressing A.
Select the sun lamp RigthMouseButton.
in property > data, active the shadow and show shadow check box.





In Quality you can edit the shadow size (higher value more impact)
In Quality you can edit the 'Bias' value, set to 0.1 and then go up to see what happens :P.
In Clipping the clip end value define the distance, beyond which objects will no generate shadows





In Clipping the frustum size value define the box size


Note HIGHER VALUES MAY HAVE PERFORMACE IMPACT

EDIT

You will notice bad light:



Then add a Hemi lamp and point it oposite to the sun lamp




ANSWER ANSWER!

The problem is with the camera.

I have reproduced the problem in 2 ways.


Positioning the camera closer or inside of an object with camera physics static
Positioning the camera inside of an object with camera physics no collision


Also found that your camera was tiny and the cylinder(character) too.
take a look to the blender manual> render>camera

To solve it:

1.Delete the camera and add a new camera (and dont scale it)

2.Move the camera To Position (dont put it inside of an object.) Make sure that the camera physics are no collision.


Yo can change the size of the camera:




And then you can parent the camera to object, and the sun to the  vertex object (better with vertex make parent in edition mode).