2019.2.0b1 Secondary Textures + SpriteAtlas

Will secondary textures support packing into an atlas in paralllel? For example, if I were to assign my sprites a normal as a secondary, would it be possible to generate another atlas automatically out of the secondary textures that exactly mirrors with packing of the primary textures?

Another feature that would really be nice is being able to generate at atlas outside the Editor, like when pulling from the web on load or supporting player-made mods. Opening the atlas up a little would make it much more viable for my needs.

Also, are 2D Lights not ready yet? I’m not seeing a specific package for it, nor a “2D Light” script as in this video, nor under any Light or 2D dropdown.

Not yet. However we will be addressing this soon. Will keep this thread updated. Thanks.

Is this applied on 2019.3.0?

Subscribing to the thread because I’ve been asking this question a couple of time already, so I want to be updated whenever it will happen

Im also using a shader graph that uses secondary textures and need the atlas packing to be exactly the same as the main textures atlas. I would like to know if this issue has been solved.

This issue is high priority on our list, we’ll probably start working on this in a few weeks.

That’s good news, thanks for the update.

Will it be possible to enable its use once already built for pulling from web or player-made mods?

our current workflow is a bunch of seperate sprites packed into a unity atlas, then we set the sprites in an animator. will it be possible to just add identical normal map sprites, generate an identical atlas from those, and add the normal map atlas as a sub atlas? i really dont want to be re-adding 3000 sprites to a bunch of animations. doing it the first time with albedo was enough.

Support for secondary textures in SpriteAtlas has been added and will be available in the upcoming 2020.2 alpha (likely to be 2020.2.0a5). Will post an update once its published. Thanks.

5 Likes

2020.2? so, december more or less?

@Venkify
If I might ask, how do secondary textures in SpriteAtlas work from a technical standpoint? Will the sprite mesh get a second set of UVs? I made a custom system for secondary textures in sprite atlases back in 2017, but it was a pretty ugly solution, so I’m wondering how the official one will work.

Packing SpriteAtlas will create a new atlas texture for each secondary texture associated with a sprite retaining the texture uv coordinates from the primary atlas texture.

No, only the primary uv(0) channel data is used as texture uv coordinates are retained for the secondary atlas textures.

1 Like

So this means that the secondary texture will be positioned in exact same position in secondary atlas as the primary texture in primary atlas? Won’t that significantly reduce the efficiency of sprite packing? Let’s say there are 10 sprites in the atlas, and 5 of those sprites have a secondary texture. If UVs are to stay the same, it sounds like the secondary atlas will have just those 5 sprites with secondary textures with huge empty holes between them.

Seems so, but if you’re to make a separate atlas for that - you have to add additional UVs to sprite’s meshes, and, main problem, you will need separate shaders that will use additional UV channels.
Best thing they can make is do a toggle somewhere to switch between “same layout” and “separate layout” secondary texture packing mode, 2nd one for those who will write their own shaders

If you are to use secondary textures - won’t you have to write your own shaders that utilize secondary textures anyway?

No, they are automatically applied to the material, if there is a property with same name as secondary texture. So you can use existing shaders normally

Except there are no official, say, normal-mapped shaders for sprites, as far as I know.

There are. Like, ones for 2D lights. Also, using standard shader for the sprites is fine as well. Default sprite shader do not write depth, so it don’t work with post-processing effects like DOF

2D lights are not part of the default render pipeline. And standard shader is absolutely not fine for sprites - sprites need special shaders to support instancing, flipping and pixel snapping. Sprites with alpha textures can’t really write meaningful depth in any case.