关于Depth Bounds Test (DBT)和在CE3的运用
- DBT的逻辑是在 scissor test 后面, alpha testing前面
- min/max值被clamp在[0, 1]之间,非法值会被转为0
- DBT会被打开,当下面条件都为真时
- min < max
- min > 1 并且 max<1
- depth值在Shader里被使用
void CD3D9Renderer::SetDepthBoundTest(float fMin,float fMax,bool bEnable)
{
if(bEnable)
{
m_pd3dDevice->SetRenderState(D3DRS_ADAPTIVETESS_X,MAKEFOURCC('N','V','D','B'));
m_pd3dDevice->SetRenderState(D3DRS_ADAPTIVETESS_Z,*(DWORD*)&fMin);
m_pd3dDevice->SetRenderState(D3DRS_ADAPTIVETESS_W,*(DWORD*)&fMax);
}
else// disable depth bound test
{
m_pd3dDevice->SetRenderState(D3DRS_ADAPTIVETESS_X,);
}
}
DBT的主要用处有两个,一个例子是在OpenGL extension文档里的例子 可以用来优化stenciled shadow volume 的渲染

SetDepthBoundTest(.f,0.9999f,true);
下雨效果
CD3D9Renderer::FX_DeferredRainLayer()
constVec4 vDepthBounds =CDeferredShading::Instance().GetLightDepthBounds(rainVolParams.m_vWorldPos, rainVolParams.m_fRadius);
SetDepthBoundTest(max(vDepthBounds.x, fMinZ), min(vDepthBounds.z, fMaxZ),true);
下雪效果
CD3D9Renderer::FX_DeferredSnowLayer()
constVec4 vDepthBounds =CDeferredShading::Instance().GetLightDepthBounds(snowVolParams.m_vWorldPos, snowVolParams.m_fRadius);
SetDepthBoundTest(max(vDepthBounds.x, fMinZ), min(vDepthBounds.z, fMaxZ),true);
延迟光照着色
CDeferredShading::LightPass
Vec4 pDepthBounds =GetLightDepthBounds( pDL );
rd->SetDepthBoundTest( pDepthBounds.x, pDepthBounds.z,true);IBL的延迟着色
CDeferredShading::DeferredCubemapPass
Vec4 pDepthBounds =GetLightDepthBounds( pDL );
rd->SetDepthBoundTest( pDepthBounds.x, pDepthBounds.z,true);屏幕空间反射
CDeferredShading::ScreenSpaceReflectionPass
rd->SetDepthBoundTest(0.0f,0.9999f,true);
CDeferredShading::DirectionalOcclusionPass()
CDeferredShading::DirectionalOcclusionPass()
阴影处理
CDeferredShading::ShadowLightPasses()
Vec4 pDepthBounds =GetLightDepthBounds(&light );
rd->SetDepthBoundTest( pDepthBounds.x, pDepthBounds.z,true);为了在绘制里可以忽略天空部分
void CDeferredShading::Render()
if(CRenderer::CV_r_DeferredShadingDepthBoundsTest )
{
constVec4 pDepthBounds =CDeferredShading::Instance().GetLightDepthBounds( rRendSettings.m_pos, m_fDistance );
rd->SetDepthBoundTest(pDepthBounds.x, pDepthBounds.z,true);// skip sky only for GI
}
修改方法也比较简单,关闭CV_r_DeferredShadingDepthBoundsTest,或在shader里添加clip来discard掉像素,或用alpha test替代,但这两种方法在移动平台上忌讳的,所以需要进一步测试才有结果了
关于Depth Bounds Test (DBT)和在CE3的运用的更多相关文章
- (转)Shadow Map & Shadow Volume
转自:http://blog.csdn.net/hippig/article/details/7858574 shadow volume 这个术语几乎是随着 DOOM3 的发布而成为FPS 玩家和图形 ...
- D3D9 GPU Hacks (转载)
D3D9 GPU Hacks I’ve been trying to catch up what hacks GPU vendors have exposed in Direct3D9, and tu ...
- 引擎设计跟踪(九.14.3.2) Deferred shading的后续实现和优化
最近完成了deferred shading和spot light的支持, 并作了一部分优化. 之前forward shading也只支持方向光, 现在也支持了点光源和探照光. 对于forward sh ...
- 阴影锥(shadow volume)原理与展望
转记:找了不少关于shadow volume原理的资料,还是这个帖子讲解的一目了然,转帖在这里,方便查阅.引用链接:http://blog.donews.com/yyh/archive/2005/05 ...
- [LeetCode] Minimum Depth of Binary Tree 二叉树的最小深度
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...
- [LeetCode] Maximum Depth of Binary Tree 二叉树的最大深度
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...
- leetcode 111 minimum depth of binary tree
problem description: Given a binary tree, find its minimum depth. The minimum depth is the number of ...
- frame和bounds
- frame 是一个以**父视图**为坐标系的位置- bounds 是一个以**自身**为坐标系的位置- 如果改变了bounds 那么会影响子控件的显示位置
- 【leetcode】Minimum Depth of Binary Tree
题目简述: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along th ...
随机推荐
- Android打Path的方法
转自:http://blog.csdn.net/xiangzi10/article/details/42710099 作为程序员,了解diff&patch命 令是非常必要的.比如说我们发现某个 ...
- 无需u盘和光盘安装linux
今天折腾linux引导的时候发现一个不用任何移动介质的linux安装方法,即直接在硬盘中启动安装系统. 1.首先下载一个easyBCD.进入“添加新条目”选项选择“NeoGrub”条目,然后选择“添加 ...
- c++ 复习内容
. ]) { sizeof(str)=? } :// 函数行参仅是一个指针 . Typedef struct s* tPs; tPs p3,p4;//相等 struct s*p3,struct s*p ...
- String.split使用竖线做为分隔符
String.split使用竖线做为分隔符时会发现得到的数组不对,每个字符都被拆分成数组里的一个值: 解决办法:竖线需要转义才可以作为split的参数,String.split("\\|&q ...
- x264码率控制方法介绍
转自:http://www.bubuko.com/infodetail-471698.html 1. X264显式支持的一趟码率控制方法有:ABR, CQP, CRF. 缺省方法是CRF.这三种方式 ...
- VMware 虚拟机网络 组网问题
1.VMware虚拟机组网概述 整个结构: 需要确定的内容: 1) 虚拟机连接到哪个VMnet(交换机)? 2) VMnet(交换机)的组网模式? 首先,讲一下VMware的界面内容 安装好VMwar ...
- Hark的数据结构与算法练习之臭皮匠排序
算法说明 个人感觉是没有意义的算法,只是用来作为学术研究.或者说开拓一下思维. 从wikipedia copy来的一句解释的话:Stooge排序是一种低效的递归排序算法,甚至慢于冒泡排序.在<算 ...
- elk是指logstash,elasticsearch,kibana三件套,这三件套可以组成日志分析和监控工具
Logstash是一个完全开源的工具,他可以对你的日志进行收集.分析,并将其存储供以后使用(如,搜索),您可以使用它.说到搜索,logstash带有一个web界面,搜索和展示所有日志.kibana 也 ...
- ZOJ1232 Adventure of Super Mario(DP+SPFA)
dp[u][t]表示从起点出发,到达i点且用了t次magic boot时的最短时间, 方程如下: dp[v][t]=min(dp[v][t],dp[u][t]+dis[u][v]); dp[v][t] ...
- ! cocos2d sprintf的问题
char dong[100]; sprintf(dong,"%s","dongshen"); CCLOG(dong); 以上正确 char dong[100]; ...