BinomialLLC / basis_universal

Basis Universal GPU Texture Codec
Apache License 2.0
2.71k stars 266 forks source link

Ability to normalise 2 channel normal maps (and use custom packaged textures) #212

Open ProPuke opened 3 years ago

ProPuke commented 3 years ago

It would be super nice to be able to generate mipmaps for normal maps consisting of only 2 channels, and still have correct normalisation. This would likely also require the ability to specify which channels the 2 normal map channels are stored in, and mipmap the others as normal, which would allow normals to also be packed alongside existing data

I would envision adding channel parameters to -normalmap, so something like -mipmap -normalmap 1,3 (mipmap, treating channels 1 and 2 as the [2 channel] normalmap)

It would assume the source normals were initially normalised, and maybe calculate what the extra channel would be, then normalise the 2 remainder and the third in memory when generating each reduced mipmap, so that lengths were correctly maintained (or maybe some other method if there's a more sound mathematical convention).

Being able to specify channels for parameters like -normalmap would also provide knowledge about channel packing and may allow other abilities later on, when packing data together.

richgel999 commented 3 years ago

Got it - this is a good idea. It's on the TODO list.