Spotlight glitch/annoyance

[video]http://www.youtube.com/watch?v=WZWXMhL4gTs[/video]

Hopefully you can see what is going on here, the player is illuminated only by a spotlight, and when he moves closer to a wall it turns dark, which looks unnatural. It isn’t necessarily a glitch, but it is kind of annoying. Anyone know a fix?

Can’t edit the OP for some reason but:

  • The video looks much darker than it does on my screen, so the problem actually looks quite a bit worse than it is
  • All the walls are in a single mesh in my j3o scene

because your walls are simple parallelepiped.
The light direction is computed to each vertex so the closer you get to the wall the more the light direction is parallel to it so the lighting is wrong. That’s a known limitation of our lighting shader.
I guess we could make an optional per pixel lighting calculation, but an easy way to alleviate the issue is to subdivide the mesh

Thanks @nehon
I tried just subdividing my entire walls mesh, but I see no difference? So there is now 4 quads making up each surface of a wall, but the surface is just as flat as before. Do I need to reposition them slightly to see a difference?

you need more subdivision i guess.
I’m gonna make some tests and see if I have the issue

Thanks, but I’d rather have the black black walls than adding that many more polygons to my scene :smiley: ah Well

@javagame said: Thanks, but I'd rather have the black black walls than adding that many more polygons to my scene :D ah Well

Subdivisions should have provided some improvement… especially if looking at the center of the wall.

If it didn’t then I suspect something else was/is wrong… like maybe the walls weren’t really subdivided or something. You could switch your material to wire frame (in the render state) to see for sure.

It seems like using a better normal map has made a HUGE improvement, but I had to add some ambient light as well as a spotlight, and that makes the edges of the spotlight much sharper and less natural looking than before, I will run a few test & maybe make a new thread about it

Thank you for your contributions

If you are using normal map you have to generate the tangents in order for it to work properly. Could be the source of your issue.
see TangentBinormalGenerator.generate(spatial).