Is local/relative/normalized uv space for sprite coming soon / possible?

There are still many kinds of effects which rely on the ability for the UV range to go over the entire size of a sprite in an atlas and not beyond it, but is impossible unless we use textures directly and apply them to unitquads, which is very wasteful tedious and doesn’t get perks of using atlases.

Tools like Unity does have features which enable this.

1 Like

I do not know if this would be difficult to add to out current setup. @sven and @jhonny.goransson, thoughts?

1 Like

Without having looked at the code, I guess there’s two basic approaches we could do:

  • expose the sub-texture dimension as uniform, which will break the batching per-object I guess.
  • add a separate uv channel, which increases the data size

Technically easy to do but there’s things to consider. What’s a good use case you’d say?

2 Likes

Probably extra uv channel? There also needs to be a checkbox in every atlas to disable rotation for fit.

https://forum.unity.com/threads/relative-texcoord-when-using-sprite-atlas.400450/

There are a variety of use cases such as applying gradient effects over the space of an individual sprite and not an entire atlas texture.

Old issue

Many of the effects I want to do also have a time param which I have to send so that breaks batching anyway.

I’m not that familiar with how the editor deals with the atlas so I can’t say how much work it would be to add options to skip rotation and whatnot, but we could expose a rotation angle as well to the uniform/vertex attribute so you could rotate the UV accordingly in the vertex shader. Either way I think it’s doable but I can’t say when :slight_smile:

1 Like

Great! I’ll contribute some useful shaders and effects that make use of it if it’s eventually implemented.

1 Like