Tuesday, March 20, 2007
CryEngine2特性剖析 — Volumetric, Layer and View Distance Fogging
CryEngine2的官方Features Document中的描述为:Create clouds or fog banks which can hug the ground and realistically reduce both visibility and contrast, and properly interact with both dynamic lights and shadows, add depth and dimension to a landscape by reducing scene contrast and clarity for distant landmarks.
本来想查找一些相关资料,没有想到却找到了CryTek关于此技术的一篇文档,惊喜!请看Advanced Real-Time Rendering in 3D Graphics and Games中的第六章(Chapter 6):Real-Time Atmospheric Effects in Games.
CryEngine2中Volumetric fog依赖于Scene depth based rendering,也就是Providing access to the depth of each pixel in the scene to be able to recover its original position in world space. 该技术使得post processing各种特效成为无限可能。缺点是难以处理无序透明物体,小左注意到2006年有一篇文章叫作Hardware Oriented Algorithms for Rendering Order-Independent Transparency,不知道能否解决这个问题。
关于从post perspective space到world space的换算,文中提出的算法很有意思:However there's often a simpler way, especially when implementing effects via full screen quads. Knowing the camera's four corner points at the far clipping plane in world space, a full screen quad is set up using the distance of each of these points from the camera position as input texture coordinates. During rasterization, this texture coordinate contains the current direction vector from the camera to the far clipping plane. Scaling this vector by the linear, normalized pixel depth and adding the camera position yields the pixel's position in world space. 看,即使你不想实现volumetric fog,这个方法也可以使你的其它post processing受益。
关于Volumetric Fog,文中详细列出了公式推导和HLSL代码,真棒。甚至如何处理透明物体,也有详细的说明,基本上就是在vertex上应用volumetric fog,然后blend into已经雾化处理过的frame buffer。
至于文中提到的Sky light渲染和Clouds渲染,都有比较详细的参考文章列举。这些特效,在xbox360,ps3和新一代pc上,都很容易实现。
Subscribe to:
Posts (Atom)