Deferred shading rendering path翻译
Overview 概述
When using deferred shading, there is no limit on the number of lights that can affect a GameObject. All lights are evaluated per-pixel, which means that they all interact correctly with normal maps, etc. Additionally, all lights can have cookies and shadows.
使用延迟着色时,对游戏对象有影响的光源数量没有限制。所有光都被逐像素估算,这意味着他们都正确地与法线贴图等交互。另外所有光都有cookies(不知道怎么准确翻译,是类似剪影的贴图的东西)和阴影。
Deferred shading has the advantage that the processing overhead of lighting is proportional to the number of pixels the light shines on. This is determined by the size of the light volume in the Scene regardless of how many GameObjects it illuminates. Therefore, performance can be improved by keeping lights small. Deferred shading also has highly consistent and predictable behaviour. The effect of each light is computed per-pixel, so there are no lighting computations that break down on large triangles.
延迟着色的优点在于光照开销与光照亮的像素数量成正比。这取决于光的体积在场景中的大小而不是它照亮了多少游戏对象。因此保持小(体积)的光能够提升性能。延迟着色也拥有高度一致和可预测的行为。每个光的效果是逐像素计算的,因此光照计算在大的三角形时不会出现崩溃。
On the downside, deferred shading has no real support for anti-aliasing and can’t handle semi-transparent GameObjects (these are rendered using forward rendering). There is also no support for the Mesh
Renderer’s Receive Shadows flag and culling masks are only supported in a limited way. You can only use up to four culling masks. That is, your culling layer mask must at least contain all layers minus four arbitrary layers, so 28 of
the 32 layers must be set. Otherwise you get graphical artifacts.
从缺点来看,延迟着色没有真正支持抗锯齿,并且无法处理半透明的游戏对象(他们是用前向渲染的)。也不支持网格渲染器的接受阴影标记(启用后可以显示投射在网格上的阴影)并且对culling mask的支持也是受限的。你最多使用4个剔除遮罩(是light的Culling Mask),即32个层最少勾选28个。 在unity上测试,当light.cullingMask不渲染的层超过4个时,就会出现不正确的图。
Requirements 要求
It requires a graphics card with Multiple Render Targets (MRT), Shader Model 3.0 (or later) and support for Depth render textures. Most PC graphics cards made after 2006 support deferred shading, starting with GeForce 8xxx, Radeon X2400, Intel G45.
pc上使用延迟着色需要一张有MRT(一帧里可以同时渲染多个渲染目标)功能和shader model3.0功能并且支持深度渲染纹理的显卡。从GeForce 8xxx, Radeon X2400, Intel G45开始,大部分06年以后的显卡支持延迟着色。
On mobile, deferred shading is supported on all devices running at least OpenGL ES 3.0.
在移动平台上,只有那些有OpenGL3.0的设备支持延迟着色。
Note: Deferred rendering is not supported when using Orthographic projection. If the Camera’s projection mode is set to Orthographic, the Camera falls back to Forward rendering.
注意:使用正交投影时延迟着色是不支持的。如果摄像机的投影模式是正交投影,摄像机会回退到前向渲染。
Performance considerations 性能注意事项
The rendering overhead of realtime lights in deferred shading is
proportional to the number of pixels illuminated by the light and not
dependent on Scene complexity. So small point or spot lights are very
cheap to render and if they are fully or partially occluded by Scene
GameObjects then they are even cheaper.
延迟着色的实时光渲染开销跟光照亮的像素成正比,并不取决于场景复杂度。所以渲染小的点光源或者聚光灯的开销非常小,如果他们被场景里的物体完全或者部分遮挡那么消耗将更小。
Of course, lights with shadows are much more expensive than lights
without shadows. In deferred shading, shadow-casting GameObjects still
need to be rendered once or more for each shadow-casting light.
Furthermore, the lighting shader that applies shadows has a higher
rendering overhead than the one used when shadows are disabled.
带阴影的光开销显然大于不带阴影的光。延迟着色中,依然需要为每个投影光渲染一次或更多次的投影物体。此外,应用阴影的光照着色器比不用的有更高的开销。
Implementation details 实现细节
Objects with Shaders that do not support deferred shading are rendered after deferred shading is complete, using the forward rendering path.
不支持延迟着色的带有着色器的物体将在延迟渲染完成后通过前向渲染路径进行渲染。
The default layout of the render targets (RT0 - RT4) in the geometry
buffer (g-buffer) is listed below. Data types are placed in the various
channels of each render target. The channels used are shown in
parentheses.
在几何缓存中,渲染目标的默认布局如下所列。数据类型被存放在每个渲染目标的各个通道中。所用通道显示在在括号里。
- RT0, ARGB32 format: Diffuse color (RGB), occlusion (A). RT0 ARGB32(每个通道分别是8bit)格式:漫反射颜色 (RGB),遮挡(A)
- RT1, ARGB32 format: Specular color(RGB), roughness (A). RT1, ARGB32 格式:高光颜色(RGB),粗糙度(A)。
- RT2, ARGB2101010 format: World space normal (RGB), unused (A). RT2,ARGB2101010 (alpha通道为两位,其余通道均为10位)格式:世界坐标法线(RGB),未使用(A)。
- RT3, ARGB2101010 (non-HDR) or ARGBHalf (HDR) format: Emission + lighting + lightmaps + reflection probes buffer. RT3,ARGB2101010 (non-HDR非高动态范围) 或者ARGBHalf(每个通道分别是16位的浮点数)(HDR高动态范围):自发光+光照+光照贴图+反射探针缓冲。
- Depth+Stencil buffer. 深度+模板缓冲。
So the default g-buffer layout is 160 bits/pixel (non-HDR) or 192 bits/pixel (HDR).
所以默认的几何缓冲布局是每像素160位 (non-HDR) 或者192位 (HDR) 。
If using the Shadowmask or Distance Shadowmask modes for Mixed lighting, a fifth target is used:
- RT4, ARGB32 format: Light occlusion values (RGBA).
如果为混合光照使用Shadowmask或者Distance Shadowmask模式,第五个对象将会被使用:
RT4,ARGB32格式:光遮挡值(RGBA)
And thus the g-buffer layout is 192 bits/pixel (non-HDR) or 224 bits/pixel (HDR).
因此几何缓冲布局是每像素192位(non-HDR)或者224位(HDR)。
If the hardware does not support five concurrent rendertargets then
objects using shadowmasks will fallback to the forward rendering path.
Emission+lighting buffer (RT3) is logarithmically encoded to provide
greater dynamic range than is usually possible with an ARGB32 texture,
when the Camera is not using HDR.
如果硬件不支持五个并行的渲染目标,那么物体使用阴影蒙版时会回退到前向渲染路径。当相机没有使用HDR时,自发光+光照缓冲(RT3)是对数编码的以提供比通常ARGB32纹理更好的动态范围。
Note that when the Camera is using HDR rendering, there’s no separate
rendertarget being created for Emission+lighting buffer (RT3); instead
the rendertarget that the Camera renders into (that is, the one that is
passed to the image effects) is used as RT3.
注意,当相机使用HDR渲染时,没有为自发光+光照缓冲生成单独的渲染目标;相反摄像机渲染的目标(传递给图像效果的那个)被用作RT3。
G-Buffer pass几何缓冲通道
The g-buffer pass renders each GameObject once. Diffuse and specular
colors, surface smoothness, world space normal, and
emission+ambient+reflections+lightmaps are rendered into g-buffer
textures. The g-buffer textures are setup as global shader properties
for later access by shaders (CameraGBufferTexture0 .. CameraGBufferTexture3 names).
几何缓冲通道渲染每个游戏对象一次。漫反射和镜面高光颜色,表面平滑度,世界空间法向量,和自发光+环境+反射光+光照贴图都被渲染进几何缓冲纹理。几何缓冲纹理被设置成全局着色器属性,为了着色器之后访问(命名为CameraGBufferTexture0 .. CameraGBufferTexture3)。
Lighting pass光照通道
The lighting pass computes lighting based on g-buffer and depth.
Lighting is computed in screen space, so the time it takes to process is
independent of Scene complexity. Lighting is added to the emission
buffer.
光照通道基于几何缓冲和深度计算光照。光照是在屏幕空间被计算的,所以计算的时间与场景复杂度无关。光照被添加到自发光缓冲。
Point and spot lights that do not cross the Camera’s near plane are
rendered as 3D shapes, with the Z buffer’s test against the Scene
enabled. This makes partially or fully occluded point and spot lights
very cheap to render. Directional lights and point/spot lights that
cross the near plane are rendered as fullscreen quads.
没有与摄像机的近裁剪面交叉的点光源和聚光灯被当做3D图形渲染,并且针对场景的深度值测试是启用的。与近裁剪面相交的平行光和点光源/聚光灯被渲染成全屏四边形。
If a light has shadows enabled then they are also rendered and
applied in this pass. Note that shadows do not come for “free”; shadow
casters need to be rendered and a more complex light shader must be
applied.
如果光的阴影是启用的,那么他们将会在这个通道里渲染和应用。注意阴影并不是“免费”的;阴影投射器需要被渲染并且需要应用一个更加复杂的光照着色器。
The only lighting model available is Standard. If a different model
is wanted you can modify the lighting pass shader, by placing the
modified version of the Internal-DeferredShading.shader file from the Built-in shaders into a folder named “Resources” in your “Assets” folder. Then open the Graphics settings (menu: Edit > Project Settings,
then click the Graphics category). Change the “Deferred” dropdown to
“Custom Shader”. Then change the Shader option which appears to the
shader you are using.
唯一可用的光照模型是Standard。如果需要不同模型,你可以通过放置内置延迟着色的修改版本,用于修改光照通道着色器。着色器文件从内置着色器进入到Assets/Resources文件夹下。然后打开Graphics设置(菜单:Edit > Project Settings,然后点击Graphics类别)。修改“Deferred”下拉框为“Custom Shader”。然后将着色器选项改成你所使用的着色器。
Deferred shading rendering path翻译的更多相关文章
- Unity5 的新旧延迟渲染Deferred Lighting Rendering Path
unity5 的render path ,比4的区别就是使用的新的deferred rendering,之前的4的deferred rendering(其实是light prepass)也被保留了下来 ...
- 渲染路径-Unity5 的新旧推迟渲染Deferred Lighting Rendering Path
Unity5 的新旧延迟渲染Deferred Lighting Rendering Path unity5 的render path ,比4的区别就是使用的新的deferred rendering,之 ...
- Unity的Deferred Shading
什么是Deferred Shading Unity自身除了支持前向渲染之外,还支持延迟渲染.Unity的rendering path可以通过Edit/Project Settings中的Graphic ...
- Thinking in Unity3D:渲染管线中的Rendering Path
关于<Thinking in Unity3D> 笔者在研究和使用Unity3D的过程中,获得了一些Unity3D方面的信息,同时也感叹Unity3D设计之精妙.不得不说,笔者最近几年的 ...
- Deferred Shading 延迟着色(翻译)
原文地址:https://en.wikipedia.org/wiki/Deferred_shading 在3D计算机图形学领域,deferred shading 是一种屏幕空间着色技术.它被称为Def ...
- 【原】实时渲染中常用的几种Rendering Path
[原]实时渲染中常用的几种Rendering Path 本文转载请注明出处 —— polobymulberry-博客园 本文为我的图形学大作业的论文部分,介绍了一些Rendering Path,比较简 ...
- Unity Lighting - Choosing a Rendering Path 选择渲染路径(三)
Choosing a Rendering Path 选择渲染路径 Unity supports a number of rendering techniques, or ‘paths’. An i ...
- 渲染路径-实时渲染中常用的几种Rendering Path
http://www.cnblogs.com/polobymulberry/p/5126892.html?utm_source=tuicool&utm_medium=referral 回到顶部 ...
- shader 3 rendering path
渲染通道, rendering path. vertexlit, forward 和 Deferred lighting 旧有的非统一架构下: 分为顶点着色引擎和像素渲染通道 渲染通道是GPU负责给图 ...
随机推荐
- 下推栈实现(c++编程思想 p136)
1 头文件Stack.h #ifndef STACK_H #define STACK_H struct Stack { struct Link { void* data; Link* next; vo ...
- java项目和npm项目命令窗口部署方便调试
1.maven窗口选择root项目 在点击lifstyle--> package 点击播放箭头 build完毕以后会出现在TARGET目录下todo.jar 在执行 java -jar todo ...
- linux 编译模块
第一步, 我们需要看一下模块如何必须被建立. 模块的建立过程与用户空间的应用程序的 建立过程有显著不同; 内核是一个大的, 独立的程序, 对于它的各个部分如何组合在一起 有详细的明确的要求. 建立过程 ...
- H3C 配置静态及动态域名解析
- CSS---文本相关属性
text-transform 检索或设置对象中的文本的大小写. 属性值 none:无转换 capitalize:将每个单词的第一个字母转换成大写 uppercase:将每个单词转换成大写 lowerc ...
- dotnet 新项目格式与对应框架预定义的宏
在 sdk style 的项目格式支持使用多框架开发,此时需要在代码里面通过宏判断,在编译的时候执行不同的代码.本文告诉大家在框架里面对应的预定义的条件编译符有哪些 在让一个 csproj 项目指定多 ...
- 洛谷——P1540机器翻译(队列操作)
#include<bits/stdc++.h> using namespace std; int main(){ queue<int> num;//存放的内存 ]; int m ...
- python scrapy爬取前程无忧招聘信息
使用scrapy框架之前,使用以下命令下载库: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple 1.创建项目文件夹 scr ...
- 对QT中QBitArray类进行简单剖析
我们知道Qt中的QBitArray类支持在位(bit)的层次上进行数据操作.本文剖析该类在二进制文件读写时的一些要点.另外,在Qt中,QDataStream类对于二进制文件的读写提供了诸多便利,需要注 ...
- __str__、__repr__和__format__
obj.__ str __ ()是面向用户的,该方法将实例转换为一个字符 obj.__ repr __ ()面向程序员,该方法返回一个实例的代码表示形式,通常用来重新构造这个实例,repr()函数返回 ...