I made the model like it says here: [Creating assets in Blender3D] and imported it with the SDK blender importer. I tried to do TangentBinormalGenerator.generate() on the mesh. But it didn’t help, instead I kinda lost all my UV-Coords and it looked even worse.
This is the normal map:
And (for reference) the diffuse map:
Another Question: Is there any reference how jMonkey maps the RGB-Values to normal coordinates? The link from above advises to invert R and G from the blender normal map. According to blenders normal mapping color standard this would mean jMonkeyEngine maps as follows:
Red maps to X, mapping (0 – 255) to (positive 1.0 – negative 1.0)
Green maps to Y, mapping (0 – 255) to (positive 1.0 – negative 1.0)
Blue maps to Z, mapping (0 – 255) to (0.0 – positive 1.0)
This does look a bit weird to me? Every OpenGL shader implemention I have seen yet just mapps RGB to XYZ mapping (0 – 255) to (negative 1.0 – positive 1.0)
(Aahrg why is there no possibility to edit the thread starting post? :facepalm: *kind of harD to explain)
What I forgot to say: The rotation/lightning issue also appears in the SDK model viewer. When I turn on camera light, the model is only lit from the front. The back is very dark although the camera light of course also is moving around the ball (I assume that). Of course there is no light source in the .blend, by the way.
You will need tangents or the normal map won’t work at all and you’ll get an effect similar to what you are seeing.
Normal maps and bump maps can’t work without tangents. So that’s the place you should be teasing out. The tangent generator shouldn’t be messing with your texture coordinates at all, though.
What I did:
[java]TangentBinormalGenerator.generate(((Geometry)((Node)ball_geo).getChild(“Icosphere1”)).getMesh());[/java]
or just
[java]TangentBinormalGenerator.generate(ball_geo);[/java]
what made exactly the same result.
Are you guys looking at the same normal map I am? Because it doesn’t look like a bump map to me unless we are thinking two different kinds of bump maps.
I do start to wonder about y-flipping, too.
Edit: OP, do you just load the model from blender or have you exported/tweaked the material in some way? If you have modified that material can you show us that code? Perhaps the diffuse map is properly y-flipped but the normal map isn’t.
This is why I asked the second question, I had a feeling that it is obsolete stuff which is written there… I just didn’t try the regular blender normal baking output with TangentBinormalGenerator.generate() :facepalm:
So many thanks to all of you!
One last thing: Does anyone know the answer to my second question from above so I can ensure my blender normal baking output fully corresponds to jMonkeys idea of normal maps?
Edit @pspeed: I’m running jMonkeyEngine SDK 3.0 I recently downloaded from the website.
There was a time when we were flipping the normalmap’s Y (green) value which was incorrect. It has since been removed from the lighting shader. Should we remove that section from the blender wiki then?
When I’m sure I got the point right, it would be a pleasure to me to update the docs
This is blenders normal (maps) mapping:
Red maps from (0-255) to X (-1.0 - 1.0)
Green maps from (0-255) to Y (-1.0 - 1.0)
Blue maps from (0-255) to Z (0.0 - 1.0)
I assume jMonkey uses this mapping(?):
Red maps from (0-255) to X (-1.0 - 1.0)
Green maps from (0-255) to Y (-1.0 - 1.0)
Blue maps from (0-255) to Z (-1.0 - 1.0)
Is that right? This would mean you have to scale down the blue channel of blenders normal map and position it in the upper half. Mathematically it would be
Blue_jMonkey = 128 + Blue_blender/2
I did this with nodes in blender and got the best result till now. When one of you developers could review and confirm my thoughts then I would update the docs with a blender nodes setup that works 8)