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
167 stars 15 forks source link

Blue Channel of Normal Map Inverted in Shader Instead of Green #207

Open Sync-67 opened 4 months ago

Sync-67 commented 4 months ago

I noticed a shading issue on imported NIFs being caused by the conversion of the normal map from DirectX to the OpenGL format. The shader set up has the blue channel of the normal map being inverted and used as the green channel when recombining. I think the nodes just got mislinked when it was intended for the green channel to be inverted.

Nodes

BadDogSkyrim commented 4 months ago

Fixed in latest.

Sync-67 commented 4 months ago

Model space normals for character meshes import correctly, but this is an issue on standard normal maps, like the ones used for architecture meshes. The nodes are still being generated incorrectly with PyNifly V14.5.2 and Blender 4.1.

https://github.com/BadDogSkyrim/PyNifly/blob/c181744691103754d9e03a1d1924a2a9ae6cc1bb/PyNifly/shader_io.py#L359

The index number of the output being inverted still points to the blue channel. Changing the index to 1, so it points to the green channel fixes the issue for me.

BadDogSkyrim commented 4 months ago

Crud, ok I'll check.