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

高屋建瓴 cocos2d-x-3.0架构设计 Cocos2d (v.3.0) rendering pipeline roadmap(原文)的更多相关文章

  1. 支持 gRPC 长链接,深度解读 Nacos 2.0 架构设计及新模型

    支持 gRPC 长链接,深度解读 Nacos 2.0 架构设计及新模型 原创 杨翊(席翁) 阿里巴巴云原生 2020-12-28    

  2. Go语言学习之14 商品秒杀架构设计与开发

    本节主要内容 1. 秒杀抢购背景2. 秒杀抢购架构设计&模块划分3. 秒杀抢购接入层实现 1. 秒杀抢购背景 (1)架构分析 电商网站架构 秒杀抢购1.0 (2)上述网站架构问题 和已有电商逻 ...

  3. ThinkPHP5.0框架开发--第2章 TP5.0架构

    ThinkPHP5.0框架开发--第2章 TP5.0架构 第2章 TP5.0架构 ================================================== 上次复习 1.如 ...

  4. 建筑材料系统 ASP.NET MVC4.0 + WebAPI + EasyUI + Knockout 的架构设计开发

    框架介绍: 1.基于 ASP.NET MVC4.0 + WebAPI + EasyUI + Knockout 的架构设计开发 2.采用MVC的框架模式,具有耦合性低.重用性高.生命周期成本低.可维护性 ...

  5. petshop4.0 具体解释之中的一个(系统架构设计)

    前言:PetShop是一个范例,微软用它来展示.Net企业系统开发的能力.业界有很多.Net与J2EE之争,很多数据是从微软的PetShop和Sun的PetStore而来.这样的争论不可避免带有浓厚的 ...

  6. 高并发架构系列:如何从0到1设计一个类Dubbo的RPC框架

    在过去持续分享的几十期阿里Java面试题中,几乎每次都会问到Dubbo相关问题,比如:“如何从0到1设计一个Dubbo的RPC框架”,这个问题主要考察以下几个方面: 你对RPC框架的底层原理掌握程度. ...

  7. 万字详解TDengine 2.0整体架构设计思路

    ​导读:涛思数据8月3日将TDengine 的集群功能开源,TDengine具有超强的性能和功能,为什么能做到?它到底有哪些技术创新?今将TDengine的整体设计文档分享出来. 1: 数据模型 物联 ...

  8. .NET Core实战项目之CMS 第九章 设计篇-白话架构设计

    前面两篇文章给大家介绍了我们实战的CMS系统的数据库设计,源码也已经上传到服务器上了.今天我们就好聊聊架构设计,在开始之前先给大家分享一下这几天我一直在听的<从零开始学架构>里面关于架构设 ...

  9. cocos2D(一)----第一个cocos2D程序

    简单介绍 我们这个专题要学习的是一款iOS平台的2D游戏引擎cocos2d.严格来说叫做cocos2d-iphone,由于cocos2d有非常多个版本号.我们学习的是iphone版本号的.既然是个游戏 ...

随机推荐

  1. HTML系列(一):创建HTML文档

    从本学期开始我打算把我以前学的知识点系统地总结一下,先从HTML开始.(本系列内容总结自博文视点出版社•代码逆袭系列书籍,包括代码片段.) 一.HTML文档类型 HTML版本众多,浏览器如何得知使用的 ...

  2. 【转】Linq实现DataTable行列转换

    出处:http://www.cnblogs.com/li-peng/ 转换前的table: 转换后的table: 代码里有详细的说明, 还有一些参数我都截图了下面有 using System;usin ...

  3. codeforces 620F. Xors on Segments

    题目链接 定义一种操作f(u, v) = u^u+1^.......^v. (u<=v), 给n个数, q个询问, 每个询问给出一个区间[l, r], 求这个区间里的f(a[i], a[j]) ...

  4. codeforces 374D. Inna and Sequence 线段树

    题目链接 给m个数, n个操作, 一个数列, 初始为空.一共有3种操作, 在数列末尾加0, 加1, 或删除位置为a[i]的数, a[i]为初始给的m个数, 如果a[i]大于数列长度, 那么什么也不发生 ...

  5. HTML+CSS笔记 CSS入门

    简介: </span>年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间,决心开发一个新的<span>脚本解释程序</span>,作为ABC语言的一种继承. & ...

  6. 基于FPGA的信号消抖

    上一篇写了一个按键消抖,按键消抖需要一个计数器.可是有些信号是不需要这么负责的,仅仅是抖动而已.于是我在上一篇博文的基础上做了一点修改,于是有了这个信号消抖的程序 module sig_nojitte ...

  7. js函数调用模式总结

    在javascript中一共有四种调用模式:方法调用模式.函数调用模式.构造器调用模式和apply调用模式.这些模式在如何初始化关键参数this上存在差异 方法调用模式 当一个函数被保存为对象的一个属 ...

  8. 用于COB工艺的PCB设计指导

    绑定角度尽量在45°之内,多于这个角度,绑定时候,银线不好打入焊盘.而且打入焊盘的尾部可能短路到相邻的焊盘,绑定焊盘之间的间距一般在4MIL为极限,半场的工艺一般就这样了.而且焊盘离被绑定的IC引脚最 ...

  9. MVC设计模式JavaWeb实现

    JSP开发模式 jsp开发模式的发展 1.模式1:(适合小型项目的技术的开发)     a.第一版本号.纯jsp(封装数据.处理数据,显示数据)     b.第二版本号,Jsp+JavaBean.   ...

  10. bulk insert data into database with table type .net

    1. Create Table type in Sqlserver2008. CREATE TYPE dbo.WordTable as table ( [WordText] [nchar]() NUL ...