Texture size for Atlas properties

Is it possible to save texture size inside atlas properties?
The problem is: Sometimes when working with shaders it is necessary to know the exact size of the atlas texture for calculations. For example, to draw outline of the same thickness for sprites located in different atlases. As long as one atlas is used, there are no problems, but if there are several atlases, and they are of different sizes (for example, 2048 * 2048 and 1024 * 1024), the algorithms will draw outline of different thicknesses.
Ideally, it would be great to have a function like getAtlasSize(), but since this case is not frequent, it will be enough to store the texture sizes inside the atlas properties, and parse them from there, if necessary, from the code.

5 Likes

What do you mean by atlas properties? I think that maybe we’d like to have a way of querying this from the resource namespace, so something like resource.get_texture(…) similar to resource.get_atlas(…) that returns the meta data about the texture. It’s on my radar, but we need to discuss it a bit internally to figure out the API. But yes, it would be a good feature :+1:

2 Likes

Oh sorry, I forgot to attach an example.
This is how the *.atlas file looks like
изображение

If we could add height and width properties right there, that would have been enough.
For example, like this:
изображение

But having a function returning metadata about the texture would be just awesome, of course )))

1 Like

Yeah I think we will go with an engine function in this case :slight_smile: would you mind opening up a ticket at Issues · defold/defold · GitHub? thanks!

1 Like
5 Likes