[gpu pro]《正当防卫2》渲染技术

humus写在gpu pro上面的,其中很多东西在他的网站上,以及后来的siggraph12上面提及了,文章链接

雷同的地方就不记录了,结合siggraph12上面的那个文章,可以说含金量颇高,有较多可以借鉴的亮点。


light index

多光源的处理方法不是deferred系列,而是使用light index的方式,把light信息放到一个texture里面。

细节就略过了。

shadow

使用了cascaded shadow map,有snapping避免抖动,在camera处于不同情况下会自动的调节shadow的range来最大化利用率。

这里一个细节很棒,在不同cascade之间过渡的时候,使用的是dither,而不是blend,这样就避免了sample两次的问题。


在pc还实现了一个类似pcss的效果,是使用类似ssao的方法,在shadowmap里面进行sample搜索,根据有没有occluder来决定shadow kernel的大小。

人物的shadow

justcause2的游戏情况是常常是人物就在镜头前,这个造成正常的shadow的效果精度不足,humus他们尝试了增加一个专门的渲染人物的shadow buffer,但是发现性价比过低。最后采用的是tatarchuk的light bleed mapping technique。

这个参考文章是这个:http://developer.amd.com/wordpress/media/2012/10/D3DTutorial05_Real-Time_Skin_Rendering.pdf

05年gdc一个文章,当年应该说颇具前沿的,现在看来也挺有理论深度的,不过基本上是不适用了,图形学变化真是快速。

light bleeding就是把shadow计算做一些扩展,根据receiver和occluder的距离,不再是简单的可见不可见,而是逐渐的亮度递减:

light bleeding的函数图:


正常shadow的函数图:


humus做了些变化,natalya是使用的exp衰减,而justcause2里面是使用的线性衰减。

最后character部分的阴影就更加的柔和(visual artifact更少),算是不求有功但求无过的做法了。

ao

有这么几种ao:

  • 物件上材质带的ao,material里面带一个ao的通道
  • ssao
  • ao volume:在character,车辆上面常常有
floating point precision
在另外一篇博客里面有了,就不重复了,这里稍微记录下floating point的精度大小怎么去计算,这个涉及到floating point的原理,这个原理用到的几率非常之低,所以忘记了应该说挺正常的。
我们一般的floating point是23位的mantissa,所以如果我们在8192这个级别做计算,那么精度就是8192/pow(2,23)=1/1024,大约是毫米级别,但是在矩阵做了各种旋转类的操作之后,误差积累是惊人的,做法就是先做translation,避免掉大数据,然后再做rotation。

一致的api

跨平台的常用做法就是自己engine里面有一个api,处理各种平台,这个在设计的时候humus表示如果能更早的借鉴dx10的state object设计上会更精简一些。

dx10之后就是把state做了分组,blend state等等,这样的设计就是更精炼。

gamma

justcause2里面使用linear space做lighting,但是有一些硬件在dx9的srgb上面的blending有一些问题这个带来一些困扰。

然后一个问题不是那么技术,但是导致的问题却非常多,就是早期程序员使用了2作为gamma转换的值,而不是2.2,这个对于程序员来说看不出什么区别,但是对于artist这个区别就大了去了,最后改正带来一些代价。

memory优化

首先justcause使用了一个不错的给artist&designer的反馈就是,在memory耗尽的时候,就不再分配新的贴图出来,而是使用一个错误贴图来警示,然后迫使designer来做资源缩减,这个就是项目中技术含量虽然不高,但是非常有效的一个手段。

shdow map使用16bit,1024分辨率,3张。

vertex compress

做了一个进一步的texture packing,在一些允许的情况下,把texture的颜色放到vertex上面,texture里面只保留luminance,然后3张压到1张dxt1里面。



  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Hardcover: 586 pages Publisher: A K Peters/CRC Press (September 3, 2015) Language: English ISBN-10: 1482264617 ISBN-13: 978-1482264616 The latest edition of this bestselling game development reference offers proven tips and techniques for the real-time rendering of special effects and visualization data that are useful for beginners and seasoned game and graphics programmers alike. Exploring recent developments in the rapidly evolving field of real-time rendering, GPU Pro6: Advanced Rendering Techniques assembles a high-quality collection of cutting-edge techniques for advanced graphics processing unit (GPU) programming. It incorporates contributions from more than 45 experts who cover the latest developments in graphics programming for games and movies. The book covers advanced rendering techniques that run on the DirectX or OpenGL runtimes, as well as on any other runtime with any language available. It details the specific challenges involved in creating games across the most common consumer software platforms such as PCs, video consoles, and mobile devices. The book includes coverage of geometry manipulation; rendering techniques, handheld devices programming, effects in image space, shadows, 3D engine design, graphics-related tools, and environmental effects. It also includes a dedicated section on general purpose GPU programming that covers CUDA, DirectCompute, and OpenCL examples. In color throughout, GPU Pro6 presents ready-to-use ideas and procedures that can help solve many of your daily graphics programming challenges. Example programs with downloadable source code are also provided on the book’s CRC Press web page.
Hardcover: 320 pages Publisher: A K Peters/CRC Press (March 18, 2016) Language: English ISBN-10: 149874253X ISBN-13: 978-1498742535 The latest edition of this bestselling game development reference offers proven tips and techniques for the real-time rendering of special effects and visualization data that are useful for beginners and seasoned game and graphics programmers alike. Exploring recent developments in the rapidly evolving field of real-time rendering, GPU Pro 7: Advanced Rendering Techniques assembles a high-quality collection of cutting-edge techniques for advanced graphics processing unit (GPU) programming. It incorporates contributions from more than 30 experts who cover the latest developments in graphics programming for games and movies. The book covers advanced rendering techniques that run on the DirectX or OpenGL runtimes, as well as on any other runtime with any language available. It details the specific challenges involved in creating games across the most common consumer software platforms such as PCs, video consoles, and mobile devices. The book includes coverage of geometry manipulation; rendering techniques, handheld devices programming, effects in image space, lighting, 3D engine design, graphics-related tools, and environmental effects. It also includes a dedicated section on general purpose GPU programming that covers CUDA and DirectCompute examples. In color throughout, GPU Pro 7 presents ready-to-use ideas and procedures that can help solve many of your daily graphics programming challenges. Example programs with downloadable source code are also provided on the book’s CRC Press web page.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值