Normal Map shading problems

Solved, it was an geometry issue. Sorry for false alarm :slight_smile:

Ok, I didn’t have time to work further on this. So I just figured I’d push it in its curent state, even if it’s not perfect.
It’s available in latest master and PBRisComing branch.

Usage is :

MikkTSpaceTangentGenerator.generate(spatial);

Could you please try it on your models and report?

Thank you!!! I will try to test models as soon as it is possible for our project. We have to create model loader in our SSeditor and embed your MikkTSpaceTangentGenerator

Hm…crazy artefact crossing through whole model:

What with the old tangent generator?

Old generation does not have this “specular stroke” issue

But it is still old, broken generation :smile:

btw, why MikkTSpace dont have “split vertices with mirrored UV”, can it be a problem in this case?

Idk, I’d have to see your UV layout to tell if there are mirrored uvs :wink:

What you can do though is call first the old generator with the split mirrorred to true, then call the Mikktspace generator afterward.

http://i.imgur.com/i1gaXOn.png

ok so no mirrored Uvs. So splitting won’t help.
For the record, the mikktspace I implemented is the regular blender implementation. So I really have no clue why it’s not working with that generator…

I’ll think about it, I have to catch some sleep first…

Next try, PBR:
Standart tangent generator:
http://i.imgur.com/gSnNtRA.png
MIKKTSPACE
http://i.imgur.com/TkTTxz9.png

The problem was found via PBR exploring:

@nehon: I think i fixed the shading problem and made a pull request for the PBR branch.

https://github.com/jMonkeyEngine/jmonkeyengine/pull/457

also the ripples effect is caused by banding because of the 8 bit normal map, a 16 bit map would fix this, but the best trick to avoid banding is to bake the normal map with 16 bit channels and then convert it in Photoshop (or GIMP, Krita whatever) down to 8 bit which will introduce dithering, the dithered texture is a good compromise in quality to texture size.
Polycount has a discussion about it with nice pictures: http://polycount.com/discussion/148303/of-bit-depths-banding-and-normal-maps

5 Likes

I can’t give you enough like for this dude… thanks a lot.
I merged the PR

Thanks! I am always using 16 bits png as my output and than I convert it to 8 bit tga in photoshop.

But the problem of shading is still in place, alas :frowning:

Model still has this specular artefacts.

Maybe I am doing something wrong. If so, here is my model:

Maybe that’s the parallax fix… does it changes when you change the lightProbe radius?

Nothing changed at all.

final BoundingSphere bounds = (BoundingSphere) lightProbe.getBounds();
    bounds.setRadius(1);

final BoundingSphere bounds = (BoundingSphere) lightProbe.getBounds();
    bounds.setRadius(100);

Do you have a reference image so I can compare?

Reference image? Of what kind?

I mean the same render with substance painter or sketchfab. With the same env map and same conditions.

Tryed to create as same as possible shots
substance:

JME

Look closer at the white stripe on the enviroment map, in substance it make strong reflection over the back of mesh, and in JME it is rarelly visible

Also, I did turn on directional light

Look how it creates specular on red ring and how should create in flat beveled edge, I suppose it is normal map and tangent problems.

p.s. I tryed to correct exposition as in substence, but it is pretty hard :smile:

So I’ve made some tests
I merged Perjin’s fix with the classic lighting shader and I used a classic cube like in this post:

Here is the result : left is the old tangent generator, right is the mikktspace generator.

Not much better. There are still dark areas on the faces.
Note though… that there is no visible difference between the generators…

I looked on the interwebz on how substance painter computes its tangent space. They apparently use mikktSpace, but since few version there is a new option when you create a project:

“Compute tangent space per fragment”
I searched and it seems that if you want to export to Unity you need that unchecked, but if you export to UE4 you need that checked… so I tried as if we were UE4… :smiley:

I checked that box and re-baked the normal map from the high res mesh then used it in my scene

That is by far the best result I had so far…

This is standard lighting so there may be other issues with PBR and reflection, but I want to tackle this…
I’m going to try with your gun model an see if it’s better (with lighting first). Then we’ll see for PBR.

2 Likes