Allow Paper2D sprite to have more than 1 texture (compression issues)

I think it would be useful, for texture compression issues, allow Paper2D sprites to have more than 1 texture (1 for RGB and another one for alpha channel). This way all textures could be compressed with ETC1 for android.

I was wondering if there is any plan to make sprites more texture-compression-friendly.

If not, I could try to implement this myself and then I would like to hear your advice (in order to do something that at least could be profitable to more people, not just me).

Yours
Dredok

Hi Dredok,

I’d like to add general support for multiple textures on sprites. It won’t be specifically for Android texture compression, but with a custom material that pulls RGB from the first slot and A from the second, it could certainly be used for that (as well as for normal-mapped sprites, complex materials that need a mask texture, etc…).

I haven’t decided exactly how I plan on implementing it yet, but conceptually it’s not too bad:

  • Adding either an array of textures or a fixed set of additional textures to UPaperSprite
  • Transferring more than one texture from game thread to render thread in the various sprite/flipbook proxies
  • Adding a texture index/texture slot parameter to UMaterialExpressionSpriteTextureSampler
  • Extending the named texture replacement stuff in FTextureOverrideRenderProxy to replace more than one

Note: You can work around this now if your source assets are already atlased, you could create one material instance per atlas page that references the separate alpha texture as a non-sprite texture sample. (You could even do it if they aren’t atlased, but you’d have a plethora of loose one-off materials that might be annoying to work with).

[edit] I also just want to take a moment to both rue and lament the state of texture compression on mobile devices and the patents on texture compression that put everyone in the present situation.

Cheers,
Michael Noland

goooood !
These improvements will be great!

Also thanks for the workaround, I really like it. Simple and easy to implement! I definetly can use it.

I have all textures atlased except the textures I use with UMG (which currently does not support atlasing and its a BIG pity). So yeah, It will work ! I guess at some point the implementation of sprite batching will push towards having less and bigger atlases right?

Anyways, thanks Michael!

This has been added in to the main branch and will be part of 4.8:

https://github.com/EpicGames/UnrealEngine/commit/03f9cdcb27c5805b671ef66ab259a7d65b8e21f2
https://github.com/EpicGames/UnrealEngine/commit/c1d276d1ddddefcf8e6a5e0c83f632900101405f

Paper2D: Add support for specifying additional textures for a sprite

  • This is useful for providing masks, normal maps, etc…
  • The position of the sprite in each additional texture must match the relative position in the Source sprite
  • Sprite texture sampler nodes can now be configured to point to one of the additional textures

Paper2D: Add name customizations for sprite texture slots, which are pulled from the default material (so you can tag a slot as ‘Normal Map’ or ‘Base Map’ and it will display that way in the Sprite Editor)

SpriteTextureSlot.png

Cheers,
Michael Noland

Thanks for this Michael Noland !

it will be really useful :slight_smile:

now we need a bit more of love in android development and I might finally release my game hehe

Appreciate that this is a very old post…
But is there any way to deal with image sequences in the additional slots? If I have an image sequence of 100 frames do I have to manually select each normal, roughness, emission etc. texture that I add to my sprite?