editor2-issues icon indicating copy to clipboard operation
editor2-issues copied to clipboard

Need relative texcoord0 for texture within texture atlas

Open subsoap opened this issue 8 years ago • 2 comments

Is this already possible?

There are certain shader effects which need relative information of texture size to work right. Problem is though that with Defold the only way to use textures is with Atlases and even if you put a single texture into an Atlas it will still expand to the size of the Atlas even if the size of the texture is only so large. So even with a single texture within an Atlas, unless the texture is the exact size of the Atals, the texcoord0 value is useless for these kinds of effects.

2017-05-08 19_05_14-defold editor 2 0 - deffx

So if I have a texture in an atlas above and I try to get the x middle of the texture it will think I want the image below 2017-05-08-19_05_14-defold-editor-22

instead of the middle x of the red bar.

So we need a secondary texcoord0 with consideration for x,y position on the main texture and size of texture to give its relative texcoord0? Is the needed information already exposed for us to be able to do this ourselves? I can't think of anywhere we can access exact texture position on an atlas of an animation.

Info with Unity of people having similar problem

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

subsoap avatar May 09 '17 02:05 subsoap

For this to be reasonably easy to work with I think there also needs to be a checkbox to disable rotation of sprites in the atlas.

Malmer avatar May 09 '17 09:05 Malmer

Is there any workaround for this?

makeartandgames avatar Nov 01 '20 20:11 makeartandgames