Strange normal mapping

For some unknown reason, this barrel I am working does not want to correctly render the lighting if the normal map is applied, except in the blender internal renderer. It doesn’t even appear correctly rendered realtime in the viewport, as shown in this screenshot.

I have tried everything, even completely remade the meshes and normal maps but for some reason the lighting doesn’t match up with the position of the light source. Unless I render in the blender internal renderer. It seems to have a problem with open gl and d3d, because the same thing happens if exported and put into the ogre graphics engine.

Someone please tell me what is going on and how to fix this.

Did you use Blender or another application to bake the normal map? Blender tends to swap around the XYZ from what other applications use as “standard”. I saw a nodal fix for this somewhere but have since lost the link.

Other than that, what settings are you using? (It might be as fast to include the blend file for a proper look)

Yup all blender, baked and all. I have attached the blend file for you.


Barrel 004.blend (451 KB)

Thanks. I’m going to have to go for the weekend, so I won’t be able to reply for a couple of days.
I looked briefly at your file. You have a full coloured UVmap, which indicates that you did not set the “bake” to tangent.
I did set your bake to tangent and got nothing much happening at all (no map).
I noticed also that your original hi-res model also reacts oddly to the light.

If no one is onto this by the time I get back I’ll look at it more closely.

Yes well I was using tangent space for a while however I ran into other problems regarding exporting and using in ogre graphics engine so I decided to use object space instead. I have not noticed the original high-res behaving strangely to light but perhaps I will have a better look at it later, got a busy weekend myself.

Alright thanks.

Did some trouble shooting. So we know the low poly is fine, light reacts normal. So I made a copy of the low poly and make a normal map from it and applied it to the original low poly object. The lighting is STILL wrong.

I’m just back but have to dash off again.

I had a play with the file just now and think I got it working… (see attached) Took a fair bit of playing around.

When I get back from my meeting I’ll post up some of the things I tried to try to pinpoint more what’s gone wrong in the original. In the meantime, if seeing this gives it away to you, let me know.



barrel_fix.blend (199 KB)

Back again. Time for a small explanation of the things put into getting your barrel normal map to work (see file attachment last post)

What had gone wrong was puzzling at first, though at the end of the day there are three main points which I think will help you…

  • You should be using a tangent map. They are a blue colour, whereas yours is green. The reason you want to use tangent is because other types (world / object centric) are designed for objects that will not be moved around or deformed, like the bricks of an underground labyrinth. In this early method of normal mapping, lighting changes would be detected, but the positioning of the object itself would not. If your barrel was likewise getting its UV coordinates from “world”, then it won’t detect lighting changes when it’s moved about, so the lighting will be stuck as if on one side of the barrel, even as the barrel turns around. This is the kind of thing which will cause oddities in lighting angle as you have experienced. By using tangent space maps, you can reposition your barrel anywhere in your scene, including rotation, and the lighting will self-correct.
  • Your outliner has another mode called “Oops schematic”. Once switched on, a little rearranging of the diagram shows that your low-poly and high poly barrels are leading on to share the same material. In fact, through your attempts at getting this to work, your materials are a bit of a mess. I recommend you delete links to materials for the high resolution mesh altogether, and also delete the extra unused materials of the low poly mesh as these can get in the way of your normal map working.
  • I was stumped for quite some time as to why every time I rendered a normal map from your high resolution barrel, nothing appeared but flat colour when there should have been wooden planks. The answer was very simple. You had disabled “rendering” of the high resolution mesh in the outliner view. In this state, the mesh will likewise fail to “render” itself to a normal map. Simple, but a the sort of thing which can be (was) real nasty to find. A Normal Mapping tutorial I wrote earlier recommends using layers to toggle objects on & off.

Hope this is enough to have resolved the issues for you.

Thanks for spending the time to help. My original interest was to have object space mapping to be “fixed” but that now seems impossible from what you say.

  1. Yeah I am aware the problem is not present with tangent space mapping, so it seems I am forced to use it.

  2. Noted.

  3. Yeah that was not an accident actually :D. I tend to hide one while working on the other. Just gotta get in the habit of remembering to turn it back on when wanting to see it. :slight_smile:

Thanks again.

If the object is to be “fixed” then you aren’t limited to tangent mapping and world space would be fine. Just that you might have to map it “in place” to the scene.