cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.23k stars 7.05k forks source link

Feature Request - Static Batching #19389

Open kkafaseb opened 5 years ago

kkafaseb commented 5 years ago

Static Batching: This is a feature that is supported in Unity. If i understand correctly, you can mark certain objects as static and although not sharing same properties they are grouped together as one texture internally therefore minimizing gl calls. Any way to support this feature?

minggo commented 5 years ago

I think you can use SpriteBatchNode for it.

kkafaseb commented 5 years ago

@minggo oh really? I thought SpriteBatchNode needed same textures to work and was also deprecated. So even with different textures, it will still batch?

minggo commented 5 years ago

Different textures can not be batched.

kkafaseb commented 5 years ago

exactly. so i think unity static batch can combine internally different textures into 1 bigger. got it?

sebas86 commented 5 years ago

No, Unity was never merge textures for static batches. It just merge meshes as many as it can to create one vertex buffer, any single material has own batch. If you wan't bigger batches in unity you should merge textures by hand. BTW texture automerging is inefficient and error prone... this approach can exceed optimum texture size also there are other problems.

kkafaseb commented 5 years ago

Thanks for calirification sebas86

imtrobin commented 5 years ago

Actually, Unity does auto pack, it's just not enabled by default in Editor

https://docs.unity3d.com/Manual/SpritePacker.html

kkafaseb commented 5 years ago

Also Unity static batching here: https://docs.unity3d.com/Manual/DrawCallBatching.html

Basically takes dynamic batching which is already supported in cocos, a step further:

screenshot 2019-02-18 at 2 35 39 pm

Nordsoft91 commented 3 years ago

Also need this feature.