GSoC project: Sprite engine overhaul - Weekly A&O report #6/7
Tue, 2012-06-26 13:21 — WolfgangSt
Hi everyone!
Time for some updates. Implementing the actual atlas took quite a little longer than a week, which however, was to be expected. After all it was a rather complex change. During the last two weeks the atlas code has gone through quite some changes. As you may recall in an earlier A&O I described, how I seperated texture internals to sprites and textures.![](/files/wosteff/atlas_013.png)
Atlas after adding 14 sprites
![](/files/wosteff/atlas_006.png)
Atlas after adding 7 sprites
The next logical step was to pack several sprites into a shared texture like you can see in the following images:
The whole process works adaptive, meaning one sprite can be added after another. The packer will try to insert the requested sprite as good as it can into the free region(s).
However at some point new sprites wont fit in anymore. As you can see the atlas is already quite full after having added 13 sprites to it.
What happens now is that the packer trys to repack all existing sprites plus the new to be added sprite tighter to the atlas. You can see this process in the following image:![](/files/wosteff/repack.png)
What happens now is that the packer trys to repack all existing sprites plus the new to be added sprite tighter to the atlas. You can see this process in the following image:
![](/files/wosteff/atlas_016.png)
The following video shows the process during level load time:
For next week lots of clean up needs to be done. Currently the atlas routines run side by side with the old routines. I've as well to fix some minor bugs left and work around some design limited issues as the water rendering.- WolfgangSt's blog
- Login or register to post comments
unC0Rr
I think I see 7 sprites on the first illustration, and 14 on the second one
Star and Moon
So those sprites being packed together will be shown while the game is loading?
nemo
Naw, this is all internal. He's animating it so people can see how his code works.
WolfgangSt
unC0Rr: yes you are right, just got it off by one as i named the files with 0 indexing.
Star and Moon: as nemo pointed out it's just a visualization of the new internal code. In the old version each sprite was one texture object on the graphics card, while in the new version as much as possible in a shared texture.
You do such a thing because "changing between textures" on the graphic card is a quite costly operation.
Furthermore all draw commands using the same texture could be batched rather than send as many individual draw commands.
Dark Spyro
I don't get it. Is that code you say?![Hiding Hiding](/images/smileys/hide.png)