Friday, December 9, 2022
HomeGame DevelopmentOne Massive sprite sheet or smaller particular person sheets? - cocos2d-x

One Massive sprite sheet or smaller particular person sheets? – cocos2d-x


Hello there,
Fast query. Is there any good thing about placing all sprites in a single sheet. For example the idle, the stroll, the run, the soar, the demise, and so on… In a single large picture and it’s corresponding one knowledge .xml/json file?
Or have a smaller particular person ones: walkSheet.png and walkSheet.json, run sheet.png and runSheet.json and so on…
Any profit from a efficiency perspective or it simply s matter of choice?

Thanks


Put as a lot as you may on a single sprite sheet. If all the things can match on a single sprite sheet, then that will imply a single draw name from CPU to the GPU; principally, no want for the CPU to waste time transferring knowledge throughout to the GPU. The extra draw calls you might have, the extra time you waste, and the decrease your body price, though chances are you’ll not discover this until you’re switching out giant textures or quite a lot of them.

Within the instance you gave, with idle, stroll, run and so on., you’d need to swap out and in of the completely different animations in a short time, so to keep away from must consistently ship completely different knowledge to the GPU every time (which means extra draw calls), simply match all of them on a sprite sheet.

If I keep in mind appropriately, all present GPUs assist a sprite sheet dimension of 2048×2048, and a few may even deal with 4096×4096 or bigger, however you would want to detect this someway and use the right set of sprite sheets if you’re going to attempt to use something bigger than 2048×2048.

Should you do an internet seek for the explanations to make use of sprite sheets, then I’m sure you’d have all the data you require about this matter. For example, the useful information right here.



1 Like

Cool, thanks for the reply and the hyperlink.
I did a analysis earlier than asking right here, and I discovered combined opinions and a few had been in favor of many sprite sheets claiming that it’s extra related the workflow you apply.

The factor is that, say you might have 2 sprite sheets: the stroll and the run. Every accommodates what ever variety of photographs. Then you definitely parse every sheet solely as soon as to create the Animate object. So that you retailer in reminiscence the walkAnimate object and the runAnimate object. Having finished that, that’s it proper? You’ll be able to neglect in regards to the sheet photographs since you already extracted the animate objects you want within the sport. So you aren’t going backwards and forwards studying sprites sheets. It’s finished as soon as.

In abstract, when you solely learn the sheets as soon as to retailer in reminiscence Animate objects, is there a distinction?

Thx

That’s not the way it works. The animation frames are sprites, and each sprite accommodates a reference to the feel that it requires (or a slice of the larger sprite sheet texture).

Irrespective of whether or not you’re utilizing a sprite sheet or particular person picture information, as soon as they’re loaded into reminiscence, they should stay there whereas something is referencing them.

I see. Thanks for the reason. I’ll give {that a} thought for certain.

cheers
R

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments