Moreover, TexturePacker is especially slow when changing the anchor point fo several sprites at the same time, I think you can do betterīy the way, I just briefly tested the latest release (windows 64bits), and the polygon algorithm seems to not work with multipacking. Do you see what I mean ?Īnother very important feature for me is the ability to set the anchor point position (manually or automatically for center, borders and corners), including for several sprites at the same time. For instance, if I have a single project with many smart folders so that then can not fit on one single spritesheet, TexturePacker will dispatch sprites of the same animation on several different spritesheets while for performance reasons they should be preferably kept together on the same spritesheet, even if it means losing some space. One thing that always bugged me in TexturePacker is that there is no way to group sprites in the same project so that when it is multipacking, it preferably put these sprites together. Use Sprite Sheet Only to create a sprite sheet without using a game engine. TexturePacker supports 30+ engines and can be extended to support your own. creating several spritesheet in one project if one spritesheet is not enough for all imported images). Select the game engine (optional) Click the Data Format button and select whichever you game engine you want to use. I have a feature suggestion: I saw that you already started to support multipacking as TexturePack does (i.e. And yes I know a vector of vectors is not the most efficient way of doing this, but we’re doing experiments here, no need to go too hard just yet.It is so nice to see that open source tools are developped for cocos2d which is an open source engine.ĭo you intend to keep it open source forever? Node = c -> active_head prev = & c -> active_head while ( node -> x + width width ) Īt its core, this algorithm needs to maintain a huge grid which is effectively a black and white image. Not knowing anything, I started this adventure by attempting to understand a rectangle packing library called stb_rect_pack, it’s public domain, easy to use and I figured would be a great place for me to start learning. Note I’m only going to explore a few packing algorithms I found in my research, but there truly are endless amounts of these. With polygon packing we could make spritesheets a lot smaller, like this simplified example (every different color is a different sprite): You can see here the large round shape now allow the small shapes to fill the transparent hole that normally is just large missing space. Thus you have to pick what suits your needs, which is what we’ll attempt to do here. As a result, there are countless different algorithms that “solve” the problem to some degree, but all have tradeoffs and issues. I don’t understand computational complexity enough to define that in detail, but suffice to say it’s extremely difficult and does not have a “perfect” solution. The tricky thing is, this is what’s called an NP-hard (non-deterministic polynomial) problem. In game development, we’re used to 2D packing problems, and more specifically the rectangle packing problem, where you have some set of rectangles of different dimensions and you need to fit them into a containing rectangle. More generally, “packing” problems are a set of problems related to fitting shapes into some kind of container. What is a rectangle packing algorithm?īefore we get stuck into the details lets just take a moment to get everyone on the same page as to what a rectangle packing algorithm is. What I came away with though was an appreciation for how sometimes the simplest option is a much better option that you might care to admit. So here I am several weeks later, still not quite finished texture packing my fonts after having explored several algorithms and learned a great deal about something probably not that important. Turns out though, this is not such a trivial problem, and there’s a huge wealth of literature on the topic. I figured it would be easy, I’d just search around for an algorithm to do this, implement it and move on. Recently, while working on my engine, I decided I should pack all my rasterized font bitmaps into one big texture rather than uploading all these individual characters bitmaps to the GPU. Based on the polygon outline a triangle mesh can be exported, your framework can use it to significantly reduce the number of. With this trim mode the polygon packer (see Algorithm selector) can pack the sprites even tighter than any rectangle-based packing algorithm. Exploring rectangle packing algorithms Posted | Share: Polygon: Polygon: Approximates the outline of the sprite using a polygon path.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |