`

Cocos2d (v.3.0) rendering pipeline roadmap

 
阅读更多

Why (the vision)

 


The way currently Cocos2d does rendering is good but it is beginning to feel somehow antiquate and moreover it doesn’t actually leverage modern multi core CPUs so popular nowadays on most modern tablets and mobile phones.

So we want to re design Cocos renderer, for making it more performing, elegant, scalable, flexible but still simple to use and to understand. Also we want to maintain that same familiar API that current Cocos2d users will feel immediately comfortable with, without having to bother about what’s changed or new under the hood.

We will do this maintaining the same key cornerstone concepts Cocos2d users get to know and like as Scenes, Nodes, Layers, Sprites.  




What (the goals)

 

Here is a high level view of the new features and improvements we would like to achieve in Cocos2d v.3.0:

 

Decouple the scene graph from the renderer

Visiting nodes issues graphics commands and put them on a queue, but doesn’t actually invoke any OpenGL rendering code  

 

Viewing frustum Geometry culling

Sprites (and geometries more in general) not visible from the camera’s point of view be automatically removed from the current frame and not rendered

 

Rendering on a thread

The execution of all the rendering commands (i.e. OpenGL calls) will be moved to different thread than the main one (this will allow for better parallelism and usage of more than one CPUs cores where possible)

 

Automatic batching

Efficiently reduces the number of draw calls (automatically) batching them together when possible (i.e. sprites using the same material)

 

(Node based) Customizable rendering

As in the current version of Cocos, users will still be able (if needed) to customize rendering on a per node basis, calling OpenGL commands directly, disregarding the official renderer (but possibly incurring on worst performances)




How (the plan)


Central to the new design is the notion CommandQueue. While visiting a node, rendering will not call OpenGL commands directly anymore (as currently is the case); it will instead push CocosGraphicsCommands to a queue. Commands In the queue will subsequently be read by the rendering backend, processed as needed and pushed to the actual rendering API (i.e. OpenGL) (see picture)



 
The rendering backend (running on his own thread) will in turn pop graphics commands from the queue, process them and actually execute them. Any locking or CPU expensive OpenGL commands will be then executed from the back-end thread, letting Cocos’ main thread free continue working on parsing the scene graph or doing other non rendering related tasks. This will help parallelism and will allow for using multi core CPU’s (see picture)



 
With Cocos2d-x 3.00 we also want to introduce the concept of automatic batching.  In fact we believe reducing the number of draw calls and render device state changes will improve drastically rendering speed.

In order to achieve very good batching, we would like to introduce also a new concept of “attributes” for Layers (formally CCLayer). There are going to (at least) 3 new Layer attributes:

 

  • Unordered

  • Static

  • Batch



Unordered Layer (formally CCLayer)



We want now focus on Unordered Layers, which are going to help achieving auto batching for improving rendering performance.

Rendering order in Cocos2d is dictated by the “order” nodes are arranged in the scene graph (see picture)



 
This is still going to be true still in V.3.0 unless the Layer is tagged as Unordered.

The Unordered attribute will instruct the Layer to disregard rendering order for all of his children (see picture)



 
The graphics commands will then be put in the CommandQueue and a special “unordered tag” will be place in the command queue as well for instructing the rendered to disregard the order and re arrange graphics commands so to render all the primitives using the same material in one draw call. Rendering all primitives (that use the same “material”) in one go will make rendering much faster, especially on mobile devices.



Static Layer

 

Layers tagged as static, will be treated as if all children will not going to be translated/rotated/zoomed (transformed) during the entire lifespan of the layer. This will allow Cocos performing expensive operations as matrices concatenation or computing culling information (i.e. quad-tree) only once (typically before the first rendering pass) improving drastically performance. Note that sprites in a static Layer can still be “animated” as far as they’re not transformed or scaled.



Batch Layer

 

A batch layers will behave very similarly to how a Batch Node (CCBatchNode) currently works in Cocos2d. All the children of a batch layer will HAVE to use the same “material” thus allowing the front end to combine all the draw calls for that layer in one single one. (Erroneously) Adding children that use a different material to a Batch Layer will trigger an Assert ().



Automatic Culling

 

To do



Rendering context (RenderBucket, RenderTarget, Camera, viewport)

 

To do



Rendering and materials system

 

To do



Customize rendering for nodes

To do

 

转载:https://docs.google.com/document/d/1nDX131S-k_XwKHkh7CjP4yC4pmywLk8Do3kMtyrRYwI/edit?pli=1

  • 大小: 64.1 KB
  • 大小: 32.8 KB
  • 大小: 53.8 KB
  • 大小: 65.7 KB
分享到:
评论

相关推荐

    cocos2d-x 3.0

    《cocos2d-x 3.0:游戏开发中的角色移动技术详解》 在游戏开发领域,cocos2d-x是一款广泛使用的开源2D游戏引擎,尤其在移动平台上的应用非常广泛。cocos2d-x 3.0版本带来了许多性能优化和新特性,使得开发者能够更...

    Cocos2d-x3.0正式版 练练看 源码

    在本文中,我们将深入探讨Cocos2d-x3.0版本的关键特性和源码分析,以及如何利用它进行游戏开发。 Cocos2d-x3.0是一个重要的里程碑,因为它引入了多项优化和新功能,旨在提升开发者的效率和游戏性能。以下是一些关键...

    Cocos2d-x 3.0的俄罗斯方块代码

    《Cocos2d-x 3.0的俄罗斯方块代码》是一个基于Cocos2d-x游戏引擎3.0及以上版本实现的经典游戏项目。Cocos2d-x是一个广泛使用的开源跨平台2D游戏开发框架,它允许开发者用C++、Lua或JavaScript编写游戏,并在iOS、...

    .Learning.iPhone.Game.Development.with.Cocos2D.3.0

    Harness the power of Cocos2D to create your own stunning and engaging games for iOS Overview Find practical solutions to many real-world game development problems Create games from start to finish by...

    cocos2d-x-3.0 类图

    这是我重新弄的cocos2d-x-3.0的类图.之前别人兄台弄的,有些不全面,有些地方错误.我这个可以说是最新的了.每个类添加了中文的详细注解,同时也添加了中文的类名称翻译.这样对cocos2d-x-3.0的框架比较好上手. 有兴趣的...

    cocos2d-x 3.0 骨骼动画 demo

    《cocos2d-x 3.0 骨骼动画技术详解及应用实践》 cocos2d-x 是一个广泛使用的开源游戏开发框架,而3.0版本在原有的基础上引入了骨骼动画功能,大大增强了2D游戏的角色表现力和动态效果。本篇文章将围绕“cocos2d-x ...

    cocos2d-x 3.0-alpha0 Lib文件

    《cocos2d-x 3.0-alpha0 Lib文件详解》 cocos2d-x是一款开源的游戏开发框架,尤其在2D游戏开发领域备受开发者喜爱。3.0-alpha0是cocos2d-x的一个重要版本,它引入了诸多新特性与优化,旨在提升开发效率和游戏性能。...

    Cocos2d-x3.0游戏实例《别救我》源码

    Cocos2d-x3.0是一款广泛应用于游戏开发的开源框架,主要支持2D游戏的构建,基于C++,同时也提供了Lua和JavaScript的绑定。它以其高效、跨平台的特性,使得开发者能够轻松地在iOS、Android、Windows等多个平台上发布...

    cocos2d-x3.0rc0 中文API

    《cocos2d-x 3.0中文API详解》 cocos2d-x是一个开源的、跨平台的游戏开发框架,广泛应用于2D游戏、实验性的3D游戏以及各种交互式应用的开发。3.0版本的发布带来了许多新特性和改进,其中中文API文档的推出更是为...

    animatepacker +cocos2d-x3.0接口封装

    《animatepacker与cocos2d-x3.0接口封装详解》 在游戏开发领域,cocos2d-x是一款广泛使用的2D游戏引擎,而animatepacker则是一款强大的动画处理工具。本文将深入探讨如何将animatepacker的功能与cocos2d-x3.0进行...

    使用cocos2d-x3.0来给Sprite添加遮罩

    在Cocos2d-x 3.0中,为Sprite添加遮罩是一项常见的图形处理任务,它可以帮助我们实现各种视觉效果,比如隐藏某些区域、创建剪贴蒙版或者实现动态模糊等。下面我们将深入探讨如何使用Cocos2d-x 3.0来实现这一功能。 ...

    cocos2d-x 3.0 类关系图

    这是cocos2d-x 3.0 类关系图, 这个制作者是:gamecocos2dx 他做的Xmind,我导出的PNG格式,我推荐还是看Xmind,里面还有一些注释 gamecocos2dx Xmind下载地址:...

    Cocos2d-x 3.0 过渡学习

    在Cocos2d-x 3.0的过渡学习中,首先需要了解到的是类命名的变化。在3.0版本中,以"CC"为前缀的类名被移除,例如CCSprite类被简化为Sprite,CCNode类被简化为Node,CCDirector类被简化为Director。这意味着,在升级到...

    cocos2d-android.zip_android_android Cocos2d.jar_cocos2d android.

    《Cocos2d-android.jar:Android游戏开发的关键组件》 在Android游戏开发领域,Cocos2d-x是一个广泛使用的开源游戏引擎,它基于C++,并提供了多种语言接口,包括Java,使得开发者能够轻松地创建跨平台的游戏。本文...

    cocos2d-x 3.0创建项目

    在cocos2d-x 3.0中创建项目是一个重要的步骤,这标志着你的游戏或应用开发的起点。Cocos2d-x 是一个跨平台的2D游戏开发框架,支持多种编程语言,包括C++和Lua。以下是使用Cocos2d-x 3.0创建项目的详细步骤: 1. **...

    cocos2d-x 3.0 +cocostudio 1.4 奇怪的大冒险

    《cocos2d-x 3.0与cocostudio 1.4:打造奇怪的大冒险》 在游戏开发领域,cocos2d-x 和 cocostudio 是两款强大的工具,尤其适用于初学者。cocos2d-x 是一个开源的2D游戏引擎,广泛应用于iOS、Android以及Windows等多...

    Cocos2d-x3.0final自学教程贪食蛇项目源码

    《Cocos2d-x3.0final自学教程贪食蛇项目源码》是针对游戏开发初学者的一个宝贵资源,它提供了使用Cocos2d-x3.0final版本开发经典游戏"贪食蛇"的完整代码。Cocos2d-x是一个跨平台的2D游戏开发框架,广泛应用于iOS、...

    cocos2d-x3.0导出自定义类到lua的测试源文件

    《cocos2d-x3.0中自定义类与Lua交互的深度解析》 在cocos2d-x 3.0版本中,开发者们经常需要将C++自定义的类暴露给Lua脚本使用,以便在游戏中实现更复杂的逻辑和交互。这篇文档将详细解释如何将C++自定义类导出到Lua...

    在cocos2d-x3.0里面如何使用拖拽精灵

    官网中文docs文档的例子下载 创建工程的时候一定要创建一样的文件名 http://www.cocos2d-x.org/docs/tutorial/framework/native/how-to-drag-and-drop-sprites/zh

    SneakyJoystick-Cocos2d-x 3.0rc0

    《SneakyJoystick-Cocos2d-x 3.0rc0:打造高效游戏控制体验》 Cocos2d-x是一款流行的开源游戏开发框架,它使用C++编写,支持多种平台,包括iOS、Android以及Windows等。在游戏开发中,交互性是至关重要的,而...

Global site tag (gtag.js) - Google Analytics