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

fix vertex alpha export #205

Closed jgernandt closed 5 months ago

jgernandt commented 5 months ago

Hello BadDog,

Thank you for sharing this tool. I only recently stumbled on it, and it has been a great help in my workflow.

Now to business. I've added an sRGB->linear colour conversion on export of vertex alpha.

Background: Blender internally stores colour attributes as sRGB, which doesn't make sense when used to represent non-colour data like alpha. Your exporter never converts the VERTEX_ALPHA colour to actual alpha values, so the NIF ends up with nonsensical sRGB vertex alphas. Moreover, since your importer does convert to sRGB, vertex alpha changes if you import a model and export it right back again. The colour conversion fixes these issues.

BadDogSkyrim commented 5 months ago

Cool. (Woulda been cooler with a test.) I'll have a look.

jgernandt commented 5 months ago

Sorry for dropping this out of the blue, and without a test. For what it's worth, your current test will still pass (and still fail to catch this issue), as it only tests 0 and 1. I'll get back to you with an update.

jgernandt commented 5 months ago

That should do it, I hope.

BadDogSkyrim commented 5 months ago

Great, thanks. No way I can keep control of this without a good test suite.