Generating Tangents causing Dark Patches

I sculpted this model in blender, then I spent some time making and testing out different specular and normal maps. I generated the tangents about 3-4 times without any issues, and then on the next attempt I got these odd results and the SDK gave me a warning. I’ve ran into this error in the past, both in the SDK and JMB so I think it’s something I’m doing but I’ve never managed to figure out the reason :anguished:

The only guess I have right now is that the normal map I’m trying to use might be invalid in some way? I generated it with the GIMP normal map plugin, converted the colors to the JME standard, and this is the resulting normal map for one of the less intense normal maps I was testing:

And here’s what the problem appears like when placed in a lighted environment with this normal map

here’s the warning message I get while generating tangents

Angle between tangents exceeds tolerance for vertex 32.
Angle between tangents exceeds tolerance for vertex 33.
Angle between tangents exceeds tolerance for vertex 52.
Angle between tangents exceeds tolerance for vertex 53.
Angle between tangents exceeds tolerance for vertex 72.
Angle between tangents exceeds tolerance for vertex 73.
Angle between tangents exceeds tolerance for vertex 375.
Angle between tangents exceeds tolerance for vertex 378.
Angle between tangents exceeds tolerance for vertex 438.
Angle between tangents exceeds tolerance for vertex 498.
Angle between tangents exceeds tolerance for vertex 956.
Angle between tangents exceeds tolerance for vertex 959.
Angle between tangents exceeds tolerance for vertex 974.
Angle between tangents exceeds tolerance for vertex 1,113.
Angle between tangents exceeds tolerance for vertex 1,116.
Normal and tangent are parallel for vertex 1,116.
Angle between tangents exceeds tolerance for vertex 1,117.
Angle between tangents exceeds tolerance for vertex 1,271.
Angle between tangents exceeds tolerance for vertex 1,272.
Angle between tangents exceeds tolerance for vertex 1,291.
Angle between tangents exceeds tolerance for vertex 1,312.
Angle between tangents exceeds tolerance for vertex 32.
Angle between tangents exceeds tolerance for vertex 33.
Angle between tangents exceeds tolerance for vertex 52.
Angle between tangents exceeds tolerance for vertex 53.
Angle between tangents exceeds tolerance for vertex 72.
Angle between tangents exceeds tolerance for vertex 73.
Angle between tangents exceeds tolerance for vertex 375.
Angle between tangents exceeds tolerance for vertex 378.
Angle between tangents exceeds tolerance for vertex 438.
Angle between tangents exceeds tolerance for vertex 498.
Angle between tangents exceeds tolerance for vertex 956.
Angle between tangents exceeds tolerance for vertex 959.
Angle between tangents exceeds tolerance for vertex 974.
Angle between tangents exceeds tolerance for vertex 1,113.
Angle between tangents exceeds tolerance for vertex 1,116.
Normal and tangent are parallel for vertex 1,116.
Angle between tangents exceeds tolerance for vertex 1,117.
Angle between tangents exceeds tolerance for vertex 1,271.
Angle between tangents exceeds tolerance for vertex 1,272.
Angle between tangents exceeds tolerance for vertex 1,291.
Angle between tangents exceeds tolerance for vertex 1,312.

This doesn’t look like a normal map.

What do you mean by that?

I used the node editor in blender to change the clolor based on this part of the tutorials. https://jmonkeyengine.github.io/wiki/jme3/external/blender.html#fixing-the-normal-colors-in-blender

mhh never read this tutorial but there are a lot of mistakes in it.
You should only have to invert the green channel, the red channel should stay unchanged. So basically in the first part of the tutorial the curve for the red channel should go from bottom left to top right.

Then about the scale and the blur, it’s totally wrong, don’t do it. A normal map contains precise data and scaling or blurring it makes no sense and just screws the data.

1 Like

I had wondered if blurring my normal maps was a good idea or not on a few occassions, I appreciate the tip.

Here’s a normal map I generated in Gimp and just tried converting with the red channel setup as you said. The results look way better than before, although I’m still getting the same warning message when I generate the tangents, and the lighting appears to be cut off along a few edges

I’m wondering if the normal map I’m generating in gimp is maybe too rough?

@EsKophan can you help with this topic? :slight_smile:

1 Like

Yeah, I was working at fixing this page when I first started and stopped at the NormalMap Baking heading. I updated the procedures mentioned for using nodes but not the content since I wasn’t sure if it was correct.

2 Likes

heheh somehow I knew you would answer this :wink:
Anyway, there are 2 “standards” for normal maps: direct x standard and opengl standard. the difference between them is that the green channel is inverted
I guess one would expect that we support the opengl way, but actually we support the directx way because it’s what blender supports and we thought it’d be easier in blender to JME workflow.

Note that the PBR material on master as a NormalType parameter that allows one to handle this in the shader instead of having to edit the normal map.

Maybe I should report this change on the lighting material.

2 Likes

There is an image editor in the jME SDK that can invert color channels, almost as if this has been needed before :stuck_out_tongue:

1 Like

sure.
Easy)

This map looks like 16-bit normal map with a wrong colour profile.
It is better to make sure that when you are baking maps in blender, you DONT check 32 bit. If you generate maps, make sure your settings correct and you don’t run into “normalize only” mode. Also, you’d better use free awesome bump for generating normal maps.
What software see is just lack of information in channels. regular maps have big % of midgray in channels
This is red channel of your map

1 Like

Alas, your current NM is useless. But actually, you can give it second life by recreation of channels

1 Like

Thanks for the replies.

I spent some time generating new normal maps for a few textures using AwesomeBump instead of gimp, and the results are much better.

The only thing that has me confused now is that I’m getting different results from inverting the color channel in the SDK as opposed to in blender. I tested the outcome of all 3 of these and the top left shows the best results using the standard JME lighting shader

The fountain from the original normal map turned out much better using AwesomeBump and it isn’t giving me the same warning that the normal maps from gimp were causing. I had never heard of AwesomeBump until now so I appreciate the recommendation and plan to use that as my go-to tool for normal mapping from now on :slight_smile:

1 Like

Blender works with float images, that is why you see significant shift in gamma.
Dont use blender for such things.
Probably the only way to achieve close to reality inversion is by recreation of invert node with slight changes:

Or a bit cleaner result:

1 Like

I rewrote or fixed everything up to Light Map baking. Including creating new images and adding specifics about the process.

If anyone sees a problem with this let me know.

https://jmonkeyengine.github.io/wiki/jme3/external/blender.html#normal-map-baking

@nehon can you look at this section and tell me if you approve or it needs changes?

https://jmonkeyengine.github.io/wiki/jme3/external/blender.html#fixing-the-normal-colors-in-blender

3 Likes

There is no need in render. If you plug-in viewrer node, you can output image from UV/image editor

Also we descussed some posts above that you can not invert image in blender for DX. Blender (like krita or, I believe, gimp) simply dont save 50% gray in image.after inversion 50%gray becomes 80%…yea, I understand, this is stupd in terms of logical thinking, but this way free software works. Photoshop dont do that. I dont know how to deal with this problem. Method of inverting real tangent space normals can not been presented unless you 100 shure that it is correct. Because tangent space really sensetive to pixel information

Actualy, I just figured out a different approach.

Try this,
https://jmonkeyengine.github.io/wiki/jme3/external/blender.html#fixing-the-normal-colors-in-blender

To do this after baking, in the “UV Editing” layout, from the “UV Image Editor” header select Image ▸ Invert ▸ Invert Green Channel. Don’t forget to save the Normal map image (monkey_bump_invert for example) after inverting.

Before,
https://imgur.com/a/ROAO2

After,
https://imgur.com/a/UwlgZ

Problem solved.

1 Like

Nice!
Strange to have invert option in this area, but this actually will help many people.