Lighting - strange behaviour

Hi there,
It’s late at night here, but I’m still coding. And I’ve encountered a strange thing. Look at the image:

http://s1.postimg.org/xow04wufz/3ddu9.png

There are two scenes. But first a small explanation.
Left corridor’s walls are made of tiles (2.0x2.0 just a models taken from blender), the right wall is a manually generated Geometry (new Box(4f, 0.1f, 2f); etc.). Both have the same material:

[java]
Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap : Flip Repeat Models/Obiekty_srodowiska/Lochy/wallDIF.png
SpecularMap : Flip Repeat Models/Obiekty_srodowiska/Lochy/wallSPEC.png
Minnaert : false
Specular : 1.0 1.0 1.0 1.0
Diffuse : 1.0 1.0 1.0 1.0
UseMaterialColors : true
ParallaxHeight : 0.05
NormalMap : Flip Repeat Models/Obiekty_srodowiska/Lochy/wallBUMP2.png
Ambient : 1.0 1.0 1.0 1.0
Shininess : 20.0
WardIso : false
HardwareShadows : true
VertexLighting : true
}
AdditionalRenderState {
FaceCull Back
Wireframe Off
DepthWrite On
PolyOffset 0.0 0.0
AlphaTestFalloff 0.0
Blend Off
PointSprite Off
ColorWrite On
DepthTest On
}
}
[/java]

Ok, look at the left picture.
(1) We stands at the end of right wall. It’s illuminated the same way as the right wall. All looks good.
Now the right scene: (2) We are in the middle of the right wall (it ends two ‘steps’ forward), the light follows the camera, notice that the right wall is dark.

Ok, next image: http://s11.postimg.org/x7wjz0cwz/3ddu10.png
I’ve left my light at the begining of the corridor (1), moved forward, a bit further than (2) and turned back. Notice that the wall made of tiles is illuminated only at its begining, but the extended, box wall is illuminated much longer.

How to understand that? and the more important question: What to do to have both walls illuminated the same way?

Did you generate tangents?

Hmm, I tried it now (TangentBinormalGenerator.generate(box);), it did not solved the problem.
In addition, strange artifacts starts to appear on other walls. If it’s important I’ll upload an image tomorrow, now I’m just to tired.

@FrozenShade said: Hmm, I tried it now (TangentBinormalGenerator.generate(box);), it did not solved the problem. In addition, strange artifacts starts to appear on other walls. If it's important I'll upload an image tomorrow, now I'm just to tired.

On both the loaded model and the regular boxes?

If you use normalmaps then you definitely need tangents and JME Boxes don’t include them by default.

No, yesterday i tested tangents only on manually generated wall. But before I made many other tests, one by removing normal map from material. Nothing was changed.

Point lights are sensitive to how big the surfaces are. For a really large quad you will have interpolation issues as you are seeing. No way around it, really, except to use more triangles.

Thank you for your reply. The Box surface is not what I really need, it was only a test for my own, custom mesh, which behave the same way. I’ll work on it.

As a test that what I’m talking about is true, you could add the Lemur GUI library to your project to use its MBox mesh (and/or just cut and paste the MBox.java class)… it’s like a JME Box except that you can give it a number of splits. 0 = same as a JME box, just 6 quads. 1 splits every edge (so 24 faces), 2 splits them into 3x3 quads and so on.

Otherwise it should mostly be a drop-in replacement for JME’s box so should make a quick test.

No, it was that. Now I made my own custom mesh, calculated normals, used TangentBinormalGenerator and everything is ok. I don’t need large boxes - they were only for test purpose. Its just ‘too much knowledge to take in too short time’. I know that everything was written in wiki, but sometimes I miss something. And it causes such questions.

But here comes next thing I need to do. Tell me, do you have any experience in writing .frag files? I do something there, it works almost good, but there is a thing I can’t find a solution. It is something with texture2D(m_SomeCustomMap, texCoord)… If you can help me with that I’ll extend the topic.