前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Nebula3的渲染流程

Nebula3的渲染流程

作者头像
逍遥剑客
发布2019-02-20 12:53:28
4630
发布2019-02-20 12:53:28
举报

在说流程之前, 有必要先看一下N3的Frame子系统:

每帧的渲染过程都写进了配置文件, 默认使用的是"frame/win32/dx9default.xml", 阴影还有另外一套.

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<Nebula3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../schemas/frame.xsd">

<!-- 
    Test frame shader for the Win32 platform.
    Renders a dedicated depth pass first, then renders the solid and alpha geometry to a (possibly
    multisampled) color buffer, and finally resolves the result through a post-effect into the backbuffer.
--> 
<FrameShader name="DX9Default">
    
    <!-- declare render targets -->
    <DeclareRenderTarget name="ColorBuffer" format="A8R8G8B8" depth="true" relWidth="1.0" relHeight="1.0" msaa="true"/>
    
    <!-- render the world to the BackBuffer render target -->
    <Pass name="Color" renderTarget="ColorBuffer" shader="p_color" clearColor="0.2,0.2,0.2,1.0" clearDepth="1.0" clearStencil="0">
        <Batch shader="b_depth" type="Depth" shdFeatures="Depth" nodeFilter="Solid" sorting="FrontToBack" lighting="None"/>
        <Batch shader="b_solid" type="Solid" shdFeatures="Solid" nodeFilter="Solid" sorting="None" lighting="SinglePass"/>
        <Batch shader="b_alpha" type="Alpha" shdFeatures="Alpha" nodeFilter="Alpha" sorting="None" lighting="None"/>
    </Pass>

    <!-- apply a post effect with color correction, renders directly to the presentation buffer -->
    <PostEffect name="Compose" shader="pe_compose">
        <ApplyShaderVariable sem="ColorBuffer" value="ColorBuffer"/>
        
        <!-- render debug stuff on top of complete frame -->
        <Batch shader="b_shape" type="Shapes"/>
        <Batch shader="b_empty" type="Text"/>
    </PostEffect>
    
</FrameShader>
</Nebula3>

在FrameShader的配置文件里, 声明了一些RenderTarget, 还有FramePass和FramePostEffect.

FramePass包装了所有要渲染到RenderTarget的所有3D渲染相关的东西, 由FrameBatch组成.

FrameBatch代表一个批次的ModelNodeInstance, 比如深度批次, 非透明批次和透明批次等等(相当于OGRE中的RenderGroup), 而ModelNodeInstance就做为最小的渲染单位了.

FramePostEffect就是后处理, 各种效果如HDR, Bloom, Depth of Field, Motion Blur等等都是在这里完成. Shadow Mapping有降采样也可以放到这里, 因为那也是图像空间的操作.

具体的流程就由流程图来说明吧:

InternalGraphicsServer代表就是图形世界, 在图形库外部对应前面提过的Stage/View.

一个Graphics View的作用就是把一个Stage通过CameraEntity渲染到RenderTarget上. 一个Stage可以有多个View, 而一个View也可以依赖另一个.

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2009年02月02日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
批量计算
批量计算(BatchCompute,Batch)是为有大数据计算业务的企业、科研单位等提供高性价比且易用的计算服务。批量计算 Batch 可以根据用户提供的批处理规模,智能地管理作业和调动其所需的最佳资源。有了 Batch 的帮助,您可以将精力集中在如何分析和处理数据结果上。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档