I have a simple scene with only one empty box. Within that box I have the camera attached to a scene node, which the user can move (translate/rotate). Additionally a spotlight is attached to the camera's scene node, facing into the same direction as the camera. So when the camera is moved, then the light moves as well.

m_pCamera = m_pSceneMgr->createCamera("Camera");

Light* spotLight = m_pSceneMgr->createLight("spotLight");
spotLight->setDiffuseColour(1, 1, 1);
spotLight->setSpecularColour(1, 1, 1);
spotLight->setSpotlightRange(Degree(50), Degree(100));

So, this basically works fine. There is one problem though: As soon as the user moves the camera very close to a side of the box, then suddenly all is black, I can't see anyting. I am sure the camera is NOT moving through the box's side, it is still within the box.

So the problem seems to be that the light does not "work" when it is too close to an object, as if the object (the box side in my case) is not reflecting the light any more.

Any ideas?

  • \$\begingroup\$ crosspost: ogre3d.org/forums/viewtopic.php?f=2&t=77461 \$\endgroup\$ May 1, 2013 at 16:33
  • \$\begingroup\$ @PhilipAllgaier: Correct. I am sorry, but is it considered as bad practice to post a question here and another forum as well? \$\endgroup\$
    – Matthias
    May 1, 2013 at 17:04
  • \$\begingroup\$ usually it is considered slightly impolite (especially without bi-directional links) since people might invest time to solve your question here, without knowing that others already solved or at least partially solved in in another forum. so at least put links in to make sure everyone is on the same page. \$\endgroup\$ May 1, 2013 at 17:11

2 Answers 2


It's probably the near clip distance of the camera. So your camera is outside of the box but the near clipping plane sees through it.

Usually you fix this by making sure the collision on whatever is moving with the camera is larger than the near clipping plane so that you can't physically get close enough to the world to see through it.

  • \$\begingroup\$ Thanks for your answer, but it seems that does not cause the problem. I have set the near clip distance of the camera to 0.01 (and updated my original posting accordingly). Or have I misunderstood your reply? \$\endgroup\$
    – Matthias
    May 1, 2013 at 16:03
  • \$\begingroup\$ Yes you understood what I was getting at. You say it's .01, but what is the distance it starts to fail at? \$\endgroup\$
    – Tetrad
    May 1, 2013 at 16:06
  • \$\begingroup\$ When I calculate the difference between the current camera position and the plane or box side I move the camera towards, then my described problem occurs at a distance of around 60. When I move the camera back again, then I can see the plane or box side fine again. \$\endgroup\$
    – Matthias
    May 1, 2013 at 17:01

It seems the problem is with per-vertex lighting vs. per-pixel lighting.
More details in this thread: Ogre: Light not reflecting correctly


You must log in to answer this question.

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