0
$\begingroup$

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.

$\endgroup$
6
  • $\begingroup$ Seeing the same result you have here. You have too many lamps, if different mixed types, with too many needlessly independent object data, with too wide radius, too far from the scene, too big shadowmap sizes, and too far apart clipping ranges. Your scene needs some serious cleanup and optimization. You also seem to have lamps illuminating your scene from under the floor, which seems quite pontless. $\endgroup$ Commented May 12, 2017 at 16:15
  • $\begingroup$ @DuarteFarrajotaRamos see the update in the first post. $\endgroup$
    – GuiRitter
    Commented May 15, 2017 at 11:42
  • $\begingroup$ @GuiRitter i have tested your file and try to fix it but seems corrupted somehow, so i suggest that try with a new blend. $\endgroup$ Commented May 16, 2017 at 17:51
  • $\begingroup$ @Strapicarus I've made a minimal version from scratch (nothing copied from the first one) and the bug remains. I've uploaded it to the link I provided, inside the "minimum" folder. $\endgroup$
    – GuiRitter
    Commented May 17, 2017 at 12:35
  • $\begingroup$ @GuiRitter I found the problem, please read the answer. $\endgroup$ Commented May 18, 2017 at 2:19

2 Answers 2

2
$\begingroup$

You need set up only one sun lamp.

  1. (Asuming all objects are deselect)RigthMouseButton to select the sun lamp and while pressing Shit + RigthMouseButton select your player: enter image description here

  2. While both selected press Ctrl + P and select Vertex:

enter image description here

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

enter image description here

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

enter image description here

  1. In Clipping the frustum size value define the box sizeenter image description here

Note HIGHER VALUES MAY HAVE PERFORMACE IMPACT

EDIT

You will notice bad light:

enter image description here

Then add a Hemi lamp and point it oposite to the sun lamp enter image description here

enter image description here

ANSWER ANSWER!

The problem is with the camera.

I have reproduced the problem in 2 ways.

  1. Positioning the camera closer or inside of an object with camera physics static
  2. 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.

  1. Yo can change the size of the camera:

enter image description here

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

$\endgroup$
2
  • $\begingroup$ See the update in the first post $\endgroup$
    – GuiRitter
    Commented May 15, 2017 at 11:43
  • $\begingroup$ Your updated answer didn't work :'( (I updated the first post again) $\endgroup$
    – GuiRitter
    Commented May 22, 2017 at 12:54
1
$\begingroup$

Tilt the camera by 0.1 degrees up or down to fix the problem.

This is a bug since Blender 2.77, source: https://developer.blender.org/T48256

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .