Normal Map shading problems

Isn’t something with the comment found in lighting.frag?

  //Note the -2.0 and -1.0. **We invert the green channel of the normal map,** 
  //as it's complient with normal maps generated with blender.
  //for more explanation.

Thanks guys but it’s not that issue. I tried both and It looks similar but it’s not that.

I made some progress… but I’m a bit confused. I created a C code that use the mikktspace.c as is, and I managed to generate the tangents in C.
The first thing I noticed is that the tangents values are VERY close to the ones generated by JME’s TangentBinormalGenerator.
Here are some screenshot :
Standard generator

MikkTSpace tangents:

As you can see the result is slightly better… but still obviously wrong…
There might be another issue…

EDIT : The standard Generator warns about the angle between some tangents that exceed seom threshold (defulat is 45 degres). Maybe I should duplicate those vertices.


Made some progress, The MikkTspace generator now works in its java version. But still generates not completely accurate tangents…

I tried to split the rotated tangents whit the current generator and it worst…

There must be something else…

Any chance to use your fix in 3.0?

I’m using TangentBinormalGenerator (a fixed one) but sometimes I have similar issues.

I’ll commit my change to master, there are 3 stand alone files, so you 'll be able to pick then and use them in a 3.0 project.
Though note that it won’t solve all issues as it is now. I’m still looking into it.

What do you mean by “a fixed one”? If you made some fixes on the generator I’d be glad to see them.

You made recently some changes into 3.1 TangentBinormalGenerator, I don’t remember when it was. I took the whole class and I use it in 3.0.

EDIT: I have a good memory: Fixed a big bug in TangentBinormalGenerator - #3 by nehon

oh alright. Yeah this bug was introduced by the previous change actually.
ok, so that will be pretty much the same process with the MikkTSpaceGenerator

1 Like

By the way.
I’ve checked in blender, and Blender MikkTSpace seems to work exactly like your implementation :sunglasses:

So this artefacts are “lesser of two evils”, and I believe this black strokes appear because hirez triangulation, look closer, I pointed with arrows.

Also, I recommend to use normal maps from Blender Internal, they seem to be more correct and clean. From far there is no real visual difference between BI and Hirez

If you need, here is BI normal maps:

  1. Blender internal old map
  2. Blender Internal new map (I did some spliting in hirez model, and issue with black strokes in front faces gone)

Cool thanks.
I want to try something else though… for now we approximate the bitangent (aka binormal) with a cross product of the normal and the computed tangent. But sometimes the real bitangent is not perpendicular to the tangent (though always perpendicular to the normal. usually this approx is ok, but I want to try tu use the bitangent computed by the mikktspace.
I’ll have to modify the shader though.

Some parts of the normal map have high frequency noise / ridges. Are those actually mapped in the mesh? If so, it could cause the artifacts you’re seeing.

1 Like

I would look for extremely thin triangles too. Subdivide along the longest edge two times. Then regenerate everything.

The thing is… even if you are right, substance and blender can display those models with those normal maps flawlessly… we should be able to do it too.

What about that image he posted? :chimpanzee_nogood: Seems to look similar in the other software:

Yep but there are subtle inconsistancies in the lighting in JME compared to other softwares that are hard to see on still pictures.

See this cube for example :

See the darker area in the center of each face? Neihter blender nor substance display them.

it’s easier to see the issue with a full reflective material and PBR.

See the distorsion at the center of the face. (don’t mind the pixelated reflection which is yet another issue…).
Substance displays a clean mirror like reflection with the same model and same normal map.
That’s wrong tangents.

Seems like exactly the effect I’d expect from interpolating normals/tangents/whatever linearly.

Ah yes. I’ve seen those small “ripples” with the jME WaterFilter when looking from underwater into sky (even though ripples were turned off). Might be related to that.

Is the normal map shader evaluated to not be the source of the problem?

Could texture min/mag filters be a problem? Or anisotropic off and then every normal looses its tiny little mind?

Although in this case, I’d expect interpolation to be constant since the normals and tangents should be uniform over the surface. Maybe a view space versus light space issue?

No the ripples in the water filter are intended… :stuck_out_tongue:

I really think it’s a case of non hortogonal tangent and bitangent…
Idk I’ll continue to look into it anyway.
The thing is… with a classic model with textures and all… you will never notice those issues… It’s just for the sake of having correct tangents.

1 Like

Yeah, but don’t do that to you: :chimpanzee_lobotized: