boruok
February 18, 2026, 6:26am
1
How get image x and y coordinate from atlas? coordinates system seem unintuitive. Trying to get correct uv coordinate and apply it to mesh/quad.
u = minimal u-coordinate / atlas_width
v = (minimal v-coorinate - height of image) / atlas_height
and then you have to invert y coordinate? by:
v = 1 - (v + h)
1 Like
Pawel
February 18, 2026, 10:11am
2
Atlas UVs use a top-left origin, so (0,0) is in top-left corner, (1,1) is in bottom-right corner, just get the data from the resource.get_atlas() (API reference (Resource) )
For meshes, the texcoord0 values you put in the buffer are typically normalized [0..1], and orientation is same: (0,0) top-left, (1,1) bottom-right.
So if you’re computing UVs from an atlas rect (x, y, w, h), where x,y are pixels from the top-left of the atlas, no inversion should be needed.
If you need a single image from an atlas, check out its metatadata using resource.get_atlas(), like explained e.g. here: Get animation frames of sprite at runtime , but bear in mind those coordinates will be in pixels (not normalized).
There is one pitfall with rotated images - here you can find a very good explanation on how to set properly images from atlas as textures for the meshes:
Linked topic:
I am trying to make a soft object similar to : Puffy Cat - game with soft-body physics
I have points linked by elastic connections. This works well. However, I don’t know how to apply a bitmap to this object. I don’t seem to fully understand how to use the mesh component.
Do any of you have a simple example showing how to overlay a physical object 2D like this, with a texture ?
2 Likes
Pawel:
For meshes, the texcoord0 values you put in the buffer are typically normalized [0..1], and orientation is same: (0,0) top-left, (1,1) bottom-right.
It’s been a while since I’ve checked but if I remember correctly 0,0 position is bottom left and 1,1 is top right.
3 Likes
boruok
February 18, 2026, 1:47pm
4
thanks everyone. Can’t test it right now, atlas geometry order seem shuffled, which means you can’t expect image order like in editor outline:
opened 01:25PM - 18 Feb 26 UTC
closed 03:49PM - 18 Feb 26 UTC
bug
**Describe the bug (REQUIRED)**
Trying to found exact uv coordinates of image wi… thin table, but found out that geometries table doesn't follow editor outline order.
There atlas with images enumerated from 1 to 43, and only one of them have 16x32px dimensions **at the end of editor outline**, but if you try print atlas geometry table image table appears **somehere in the middle of table**.
<img width="861" height="467" alt="Image" src="https://github.com/user-attachments/assets/41855d1c-7d3f-4c48-8dc0-bcbdd82b691f" />
script used
```lua
go.property("atlas", resource.atlas())
function init(self)
local info = resource.get_atlas(self.atlas)
for k, v in ipairs(info.geometries) do
pprint(v)
end
end
```
**To Reproduce (REQUIRED)**
1. run mrp
2. watch output
**Expected behavior (REQUIRED)**
Atlas geometry order matches outline order.
**Defold version (REQUIRED):**
- Version 1.12.1
**Platforms (REQUIRED):**
- Platforms: Linux
- OS: Ubuntu 24.04.4 LTS
**Minimal repro case project (OPTIONAL):**
[Empty Project.zip](https://github.com/user-attachments/files/25391363/Empty.Project.zip)
Correct. Lua key-value tables aren’t ordered, so there is no guarantuee about the iteration order.
Pawel
February 18, 2026, 2:56pm
6
Ok, I have to check it too!
1 Like
boruok
February 18, 2026, 3:53pm
7
now actually solved, gulev made handy function that search atlas image uv by name(id)
please check github issue:
opened 01:25PM - 18 Feb 26 UTC
closed 03:49PM - 18 Feb 26 UTC
bug
**Describe the bug (REQUIRED)**
Trying to found exact uv coordinates of image wi… thin table, but found out that geometries table doesn't follow editor outline order.
There atlas with images enumerated from 1 to 43, and only one of them have 16x32px dimensions **at the end of editor outline**, but if you try print atlas geometry table image table appears **somehere in the middle of table**.
<img width="861" height="467" alt="Image" src="https://github.com/user-attachments/assets/41855d1c-7d3f-4c48-8dc0-bcbdd82b691f" />
script used
```lua
go.property("atlas", resource.atlas())
function init(self)
local info = resource.get_atlas(self.atlas)
for k, v in ipairs(info.geometries) do
pprint(v)
end
end
```
**To Reproduce (REQUIRED)**
1. run mrp
2. watch output
**Expected behavior (REQUIRED)**
Atlas geometry order matches outline order.
**Defold version (REQUIRED):**
- Version 1.12.1
**Platforms (REQUIRED):**
- Platforms: Linux
- OS: Ubuntu 24.04.4 LTS
**Minimal repro case project (OPTIONAL):**
[Empty Project.zip](https://github.com/user-attachments/files/25391363/Empty.Project.zip)
1 Like
Mathias
February 18, 2026, 6:08pm
8
This find_uvrect function could definitly be in the defold API this could help a lot of people.
Like a sprite.find_uvrect()