Author Topic: How to flip normal map DX <-> OpenGL  (Read 24651 times)

hello,

I bake my normal maps in blender or xnormal (because I am getting mostly full black, useless or "inverted" maps with the SD4 baker).

The normal maps imported from blender seem to be inverted, when projecting them on the default 3d cube in SD, areas that should look "pushed inwards" look like pushed outwards and vice versa...

When searching for "flip" or "normal" in SD Lib, I do not find, what I am looking for...

Kind regards

hello,

I bake my normal maps in blender or xnormal (because I am getting mostly full black, useless or "inverted" maps with the SD4 baker).

The normal maps imported from blender seem to be inverted, when projecting them on the default 3d cube in SD, areas that should look "pushed inwards" look like pushed outwards and vice versa...

When searching for "flip" or "normal" in SD Lib, I do not find, what I am looking for...

Kind regards

To switch from OGL to DX, you can add a levels node after the normal and go to the green channel and reverse the output black and white. This will invert the normal map correctly.

With the bakers, you shouldn't be having any issues. Can you let me know what is going on with the bakes?

Cheers,

Wes
Head of Substance Demo Art Team
the3dninja@adobe.com
Twitter: The3DNinja

Yes, here we go - first is baked from blender, 2nd is SD4 (obvious) ;)
(The same high- and lowpoly meshes were used)

Cheers!

Hi Elowan,

In the SD baker, it's set to Direct X. Are you using the normal map in blender and it's reversed? Does Blender use Open GL?

Cheers,

Wes
Head of Substance Demo Art Team
the3dninja@adobe.com
Twitter: The3DNinja

I´ve google-ed "Blender normal map orientation" and such - but I could not find a clear statement, if Blender uses DX or OGL... I guess, it uses OGL...

But this is not the main problem...

I did another bake in blender, also in SD4 - again, same meshes were used. The main thing is, the result from SD4 is kind of blurry (see images, comparsion of both normal maps, projected on a cube). 

Why is that?

It seems to me that it is just the min/max distance for the ray tracing which you set too low in Designer. The rays are probably only hitting part of the high-poly geometry, and the results are blurry because the diffusion process fills the gaps.

You can "eyeball" how much to set looking at your mesh (if the "relative to bounding box" option is checked, 1.0 corresponds to the length of the diagonal of the low poly bounding box, otherwise the baker uses whatever units your mesh file is using).

With the settings from image it is getting a bit better, but still waaaay too blurry...
(Both meshes got the same "locations" 0,0,0 Lowpoly is just a plane)

In blender the value for distance can be set to 0.1 units


Another example from a different mesh...

In SD4 the bake is "smeared", which should be sharp (blender)

Can you bake the world space normal map instead of the tangent space and post the results ? It could be that either the tangent frames are exported/imported incorrectly or recomputed differently.
Another possibility is that the normals of your high poly mesh are exported/imported incorrectly. What file format are you using ? Can you check how the high poly looks in Designer's 3D view when you look at it with the "mesh_info->normal" shader ?
Or better, post here your low and high poly mesh (the second, simpler one preferably).

Ok, I tried to export .fbx and .obj - results are the same.

Here is, what I get from baking out Worldspace normals in both programs:

Can you check how the high poly looks in Designer's 3D view when you look at it with the "mesh_info->normal" shader ?
Or better, post here your low and high poly mesh (the second, simpler one preferably).

Do you mean "Materials->Default->Shader->relief ?
Last Edit: June 10, 2014, 03:31:33 pm

No. I meant "Materials->Default->Shader->mesh_info->normal"

Ahhh, there it is, heheheh - sorry!


Seems like the normals of your high poly mesh are different in Designer. What file format are you using ?
Either you are exporting them incorrectly (or not at all) or Designer and Blender disagree on how to read/write that particular file format.

My guess is that for some reason your high poly mesh normals are not saved in the file (or Designer can not read them), and therefore Designer recomputes normals and smoothing groups/hard edges are lost in the process.

The image result above was with fbx export. When exporting obj, the end-result (baked tangent normal map) is the same - but not tested obj - worldspace combination yet...

When making normals visible in blender, vertex and faces got ok facing vectors - I will try baking with xnormal and see what result this gives. But not until tomorrow evening, unfortunately...


Kind regards

Edit: When opening the fbx in autodesk fbx viewer, it looks like in SD4. So it may be a problem within Blender...
Last Edit: June 10, 2014, 06:19:08 pm