BadDogSkyrim / PyNifly

Export/Import tools between Blender and the Nif format, using Bodyslide/Outfit Studio's Nifly layer. Supports Skyrim LE, Skyrim SE, Fallout 4, Fallout New Vegas, Fallout 76, and Fallout 3.
GNU General Public License v3.0
173 stars 16 forks source link

Handle directx normal maps on import #61

Closed kamicane closed 3 years ago

kamicane commented 3 years ago

Directx tangent space normal maps have an inverted green channel compared to opengl normal maps (the format blender uses).

I have been fixing it by inverting the green channel in the shader like so:

InvertGreen

Would be cool if pynifly could do this automatically on import, like it separates red and on the specular maps.

Results:

Directx (inverted green)

directx-normals

OpenGL (non-inverted green)

opengl-normals

BadDogSkyrim commented 3 years ago

Is there any way to recognize a directx normal when you see it? Is there a particular nif version or game?

kamicane commented 3 years ago

Every fallout 4 normal map is in directx format. Never really did any Skyrim modding so not sure what format it uses, or if it even uses tangent space normals?

Is there any way to recognize a directx normal when you see it?

No way, they are technically valid but bumps magically become holes.

Fun fact: there are a megaton of mods on the nexus that have the wrong normals.

BadDogSkyrim commented 3 years ago

F*ck, srsly? Like probably all of mine. Likely that explains some of the weird behavior I've seen. Plus calls into question every tool I use to handle normals. My whole life is a lie.

BadDogSkyrim commented 3 years ago

Fixed in latest rev.