Lighting Techniques

I’m starting to develop a testcase which will come in handy in my next project. Basically, I will be using Bump Maps (Normal Maps) to reduce the poly count in my scenes. I’m currently working on a dungeon scene.



I was going to add a directional light, however, I noticed that even if I add a point light, the shadows on the objects (caused by the bump map) do not change.



When I removed the directional light, the shadows caused by the bump map started to shift in accordance to the point light’s position. I would like to take some advice regarding this. Should I just scrap directional light in indoor scenes, and use point light?

Well, Are you using bump maps or normal maps? In Bump maps, the light direction doesn’t change.

I think it’s Normal Maps. When the point light moves, so do the shadow.



http://i42.tinypic.com/1z3qn4m.png



^The image shows four runs of the game - each with a different direction set to the Direction Light.



http://i39.tinypic.com/8ql4.jpg

^This image shows the map I’m using in the material editor as the Normal map.



When I use a Point Light, and rotate the spatial (or move the light), the shadow rotates too.



And as code, I’m using the following:

[java]TangentBinormalGenerator.generate(spatial);[/java]



Am I going the right way?

http://www.youtube.com/watch?v=kY9VNau0XOs&feature=youtu.be



I uploaded that video to show what I achieved so far. I am using a red point light. The light is a little bit below and closer to the camera than the model. Am I doing the right thing?

Directional light works fine with normal maps when everything is setup right. I assume that your mesh has normals and tangents… otherwise normal maps and bumps will be unpredictable or fail outright.

I’m using:



[java]TangentBinormalGenerator.generate(spatial);[/java]



Is that enough? See the third post for more information about what I’m doing. Also, I’m using a Point Light. Is everything working as it should in the above video?

Did your mesh have normals to start with? If not then tangent binormal generator won’t do anything.



Video looks alright I guess, though. DirectionalLight should work, too. I use it all the time and I’ve never used a point light.

I can’t understand what you mean by

Did your mesh have normals to start with?




Basically, this is what I did:


  1. I created the box model in 3DS Max.
  2. Unwrapped the UVW and got the UVW.
  3. From that UVW, I added a normal Bump Map (grayscale).
  4. I loaded the model into jME.
  5. I added the texture to jME.
  6. Using the Edit Texture, I created a Normal Map.
  7. I created a .j3m material and added the new Normal Map as the Normal Map.
  8. Then, I added: [java]TangentBinormalGenerator.generate(spatial);[/java]



    I’m trying to get something like the left ball: http://upload.wikimedia.org/wikipedia/commons/0/0a/Bump_map_vs_isosurface3ver2.png

    I am trying to give the box a bump effect. I’m not 100% sure if it’s working well. Would also appreciate feedback from someone who has worked with this and point light.

For normal maps and lighting to work, the mesh must have per-vertex normals. Maybe it already does.



If a JME Box works and your model doesn’t then maybe it doesn’t have vertex normals.



I don’t know.

That’s my model I’m using lol It’s not that an exception is coming up. It’s just that I don’t know whether I’m doing what I should be doing to get a bumped model as indicated in the tutorial: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:how_to_use_materials

If you use a JME box + tangent generation and it works and you use your model + tangent generation and it doesn’t… then there is something wrong with the model.



That’s why I mentioned a JME box.

Haha I’m not expressing myself well. Everything is working well - there is no exception and the program runs well. However, I’m not sure whether what I implemented is actually what I want - a bumped model.

@memonick said:
When I removed the directional light, the shadows caused by the bump map started to shift in accordance to the point light's position. I would like to take some advice regarding this. Should I just scrap directional light in indoor scenes, and use point light?


Hmmm... you made it sound like directional light was not making your shadows change. If you change the direction of the light then the shadows will change on your normal mapped surfaces.

I was not moving the DL, but when I did, it changed. Is this the effect of a Normal Map?

http://www.youtube.com/watch?v=0y8EwGoKp2k&feature=youtu.be



This is how it looks when I move the directional light in-game.

I can’t see nothing wrong with that.

Thats. I was worrying too much ':frowning: