[BUG] Symmetrical Blender Model with TangentGenerator and NormalMap

Just a guess, could it be the model uses triangles where adjecant triangles have disjunkt data? Two triangles side by side should have identical normals, which are the average of the two triangle normals. So perhaps the problem is at the normals of the object, where each triangle has an own normal, which is just the face normal on all three vertices instead of an averaged.

Wrong normals could be caused by the modelling exporter or the jme importer.

@Kaelthas , can you fix it or add this feature? This is a vital thing.

The applied normals depend on the ‘smooth’ setting.

Each vertex has its own normal vector but if smooth is applied to the mesh these normals have the same (average) value.

If the smooth is not applied then the normals will be different for each face.



If the model does not have ‘smooth’ applied then this is a feature then not a bug :smiley:

@Momoko_Fan , @nehon , after fixing the TangentGenerator (or possibly something else) I have problems with normal maps and stitches. Image below:

http://dl.dropbox.com/u/26887202/123/jme_blender/normalmap_bug/stitches.jpg



This was old bug which was fixed by @nehon here: http://hub.jmonkeyengine.org/groups/graphics/forum/topic/baked-normal-map-seams-problems/



jME3_2011-09-20.zip - works ok. But nightly JME works in different way with stitches. Could it be because of TangentGenerator changes?



Guys, can you fix it again? This is very important.

Guys, did you read my message above? Another problem appeared with tangents/binormals.

Yes i read it, but i thought it was a bug in the matrix since there was the exact same issue 6 months ago.

I think there is a problem with the binormal parity. This is eventually gonna be fixed, please be patient.

Thanks a lot for answering. I will wait.

Hi @nehon ! I just want to ask you about the issue with tangent/binarmals again. Is there any chance to fix it?



I mean about this image below:

http://dl.dropbox.com/u/26887202/123/jme_blender/normalmap_bug/stitches.jpg

Kirill changed some things lately, do you still have the issue?

I have updated today but these things (stitches) are still here.

I’m sorry to ask but could you upload the model again? I can’t find it anymore on my computer and the link you provided on the other thread are dead since then

No problem!



Here is the model with textures (I use obj): http://code.google.com/p/jme-glsl-shaders/source/browse/#hg%2Fassets%2FModels%2FLightBlow



Here is code I use: http://code.google.com/p/jme-glsl-shaders/source/browse/src/LightBlow/LightBlow_Lighting_System.java



You can grab entire project: http://code.google.com/p/jme-glsl-shaders/downloads/detail?name=JME_ShaderBlow_04.zip&can=2&q=

I spoke with Lex, the person who wrote the TangentBinormalGenerator. He took a look at your model and said that your textures were designed to work with a broken tangent generator (the one before it was fixed), so you need to undo whatever changes you did.



Essentially just get it render correctly in Blender and then export the normal map that worked there.

Now I understand… I did this model about 1 year ago… So, many changes were made to normal map baking and tangentGenerating.



Guys, sorry for bothering. I did not expect such a thing.

@mifth: There’s a big rewrite of the tangent binormal generator, so it should now work with that model you got from blender. The issue is I think is because the blender importer doesn’t share the vertices between all the triangles so the verts cannot be smoothed, with the update to the tangent generator, it now takes positions of the vertices into account so proper tangents are generated. Big thanks to Lex for fixing his generator :slight_smile:

@Momoko_Fan ,

YAHOOOOOOOOOOOOOO!!! It works perfectly!

Very cool!! Now I can use *.blend models instead of *.obj.



The only problem with *.blend models is animation. It does not work correctly. But I thing this issue is related to Kaelthas.

For example this animations works with ogre2.6 exporter perfectly, but it does not work with blenderLoader: http://dl.dropbox.com/u/26887202/123/jme_blender/characterOgre26.zip



Aniway, THANKS A LOT to Lex and Momoko_Fan!!!

@Momoko_Fan now we have such a bug when Tangent Generator is switched off.



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

If you’re using normal mapping without generating tangents then the result is undefined

ok, i get you.

@Momoko_Fan , @nehon , the normal map is broken.



I baked an asteroid with blender 2.61. And I have stitches. TangentBinormalGenerator was switched on. This is because of big rewrite of the tangent binormal generator…





OLD BUG:

http://i.imgur.com/4XqJw.jpg





Blender 2.6 baked model:

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





Here is my model with normalmap texture:

http://dl.dropbox.com/u/26887202/123/jme_blender/normalmap_bug/ast2.zip



Please, test it. This is a vital bug.