High Performance Post-Processing

本文深入探讨了使用DirectX进行视觉效果制作的技术细节,重点介绍了Compute Shader在深度模糊(DOF)等特性中的应用。文章分析了Compute Shader的硬件结构,并讨论了其如何通过共享内存提高效率,以及在减少分支发散(Divergence)方面的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

link:

http://www.gdcvault.com/play/1014304/Advanced-Visual-Effects-with-DirectX

 

主要介绍computer shader硬件结构特性,以及在DOF系列feature上的引用。

这是一个比较hardcore的ppt,nice。

dx11和compute shader牛逼太多了,希望业界能够快速进入这个时代。


 

ThreadGroup

显卡里的多核架构和cpu端多核架构很多地方是重复的,重复部分跳过,看下特别的:thread group。

thread group是一组thread,他们有一个shared memory,这个是其强力的核心,其中的thread可以彼此共享资源,比如说做一个blur,传统pixel shader就是每一个fragment读取13个点来做blur,这样12个fragment就是12*13的读取量。

如果变成thread group的方式就是大家彼此之间有共享,大量的重复读取可以省略了。

 

 


 

Divergence

 

理论上thread是独立运行的,实际上在硬件里是一组组的(这个一组和thread group不是一个东西),叫做wavefront,在nv里目前是32个一组,amd里面是64.

于是有一个现象就是针对branch,如果一个wavefront里的thread在branch中走同一个分支,那么另一个分支会被跳过,否则就会都被都执行。

下图可以看见,性能差距还是比较大的。

 

 

实际应用中,是一个具体情况具体分析,在走同一个branch的情况下是很赚的,否则就亏,那么对于pixel shader可以看出两种情况下的选择优劣:

 

 


 

compute shader

dx11以及direct compute在显卡日益强劲的今天,即便只是针对于graphics,相对于dx9可以说革命性的。

计算模型从原先的vs,ps,texture unit, rasterizer进一步的解放出来,tessellation只是小试牛刀,更大的自由度给hardcore programmer更大的发挥空间。

在这片算法蓝海里,在相当长时间里,可以创造出更多的利用这些硬件的pipeline和solution。

硬件能力的提升是一步步走的,而且相对于所有人是一样的。

算法的提升则可以获得更快的速度,正是这些让同一个时代的工作室创造出不同时代的游戏。

就像ps3上的spu带来的东西一样,强力并且长期积累的工作室在一段时间之后会取得压倒性优势。

 

compute shader可以让程序员更好的控制计算资源的分配。

 

 


 

其他

shader model 5.0里面的unordered access view很不错,pixel shader可以输出到任意地方,而不是像sm4里面只能是固定的一个地方。这个对象近景depth of field都是非常有好处的。

 

说到这里之后其他的就顺理成章,比如加法就要用多线程思维来做prefix sum的算法,同理DOF也方便多了。

在做Bokeh效果,就是第一个图里面背景亮的点是一个“亮片”的效果,使用unorded access view,一个brightpass输出亮的点到一个buffer,再用这个buffer当新的顶点用,生成一个个亮片,效果现在很流行。

 

 

 

 

### HEC-RAS One-Dimensional River Cross-Section Modeling and Analysis Tools HEC-RAS (Hydrologic Engineering Center's River Analysis System) is a comprehensive software package used for hydraulic modeling, including the creation of one-dimensional river cross-section models. The toolset within HEC-RAS allows users to analyze water flow through rivers by dividing them into discrete sections or reaches where each section can be modeled as a series of cross-sectional profiles. #### Defining Cross Sections To define a cross section in HEC-RAS, detailed topographic data must be inputted that describes the shape and dimensions of the channel at various points along its length. This includes specifying bank stations, thalweg lines, and elevations across the width of the streambed. These inputs are crucial because they determine how accurately the model will simulate floodplain inundation during high flows[^1]. ```python # Example Python code snippet showing how elevation data might be processed before being imported into HEC-RAS. import numpy as np def process_elevation_data(elevations): """ Process raw elevation measurements from surveying equipment. Args: elevations (list): List containing float values representing measured heights above datum. Returns: list: Cleaned up set of elevation readings ready for import into HEC-RAS. """ cleaned_elevations = [] for e in elevations: if not np.isnan(e): cleaned_elevations.append(round(float(e), 2)) return cleaned_elevations ``` #### Setting Up Computational Parameters Once all necessary geometric information has been entered, computational parameters such as roughness coefficients need setting according to local conditions like vegetation type or substrate material present on site. Manning’s n value represents this coefficient which influences velocity distribution throughout the reach under consideration. #### Running Simulations After configuring both geometry and physics settings appropriately, simulations may commence using steady-state methods suitable for long-term planning studies concerning infrastructure development around riparian zones affected by seasonal variations in discharge rates. During these runs, adjustments made via control structures—such as weirs or spillways—can help mitigate potential risks associated with extreme weather events leading either excessive flooding downstream areas or insufficient supply upstream reservoirs. #### Post-Processing Results Following completion of simulation cycles, post-processing steps involve interpreting output files generated by HEC-RAS. Users often visualize results graphically alongside tabular summaries highlighting key performance indicators relevant to project objectives outlined earlier stages when initiating study scope discussions among stakeholders involved parties interested outcomes derived therefrom.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值