Jamez0r

My project uses Unity's 2D lights system with the new Spine shaders (namely the URP/2D/Spine/Sprite shader). When I pack my regular spine images, I use Premultiplied Alpha. When packing my normal-map images into their own atlas, I also was using Premultiplied Alpha - I'm wondering if this is correct to do or not?
User avatar
Jamez0r
  • Posts: 126

Harald

You have to be very carefol when packing normal maps in any texture packer. You have to be sure to prevent image rotation while packing, otherwise your normal orientation will be off by 90 degrees in these parts.

Regarding your question above:
Premultiply alpha is only used on the color output channel, for use with additive blend mode.
Premultiply alpha makes no real sense with normalmaps, as it effectively bends the normal to face in negative X and Y direction. When fetching normal info, there is no such thing as transparency. So in short, you should disable it when packing your normalmaps (unless you want some strange lighting effect in semi-transparent regions).
User avatar
Harald

Harri
  • Posts: 1500

Jamez0r

Harald wrote:You have to be very carefol when packing normal maps in any texture packer. You have to be sure to prevent image rotation while packing, otherwise your normal orientation will be off by 90 degrees in these parts.

Regarding your question above:
Premultiply alpha is only used on the color output channel, for use with additive blend mode.
Premultiply alpha makes no real sense with normalmaps, as it effectively bends the normal to face in negative X and Y direction. When fetching normal info, there is no such thing as transparency. So in short, you should disable it when packing your normalmaps (unless you want some strange lighting effect in semi-transparent regions).
Thanks Harald!

Yeah, that makes total sense - and I did indeed have a bit of weird lighting at the edges, which is now fixed 8)

Also, thanks for the other tips - I've had to disable both rotation and alias'ing (since we have some images that are slight color alterations, but their normal maps end up exactly the same). Its tricky/aggravating when you're packing hundreds of images across multiple folders, and your source images atlas doesn't end up looking like your normalmap atlas :bigeye: I still plan on doing a Start-To-Finish guide on Spine + Unity's lights, including making and packing the normalmaps. Hopefully will have some time next month :)
User avatar
Jamez0r
  • Posts: 126

Harald

Glad it helped! Sorry to hear that the whole normalmap packing procedure is somewhat tedious. And thanks in advance for sharing any best-practice info!
User avatar
Harald

Harri
  • Posts: 1500


Return to Unity