Depth Bias(Direct3D 9)
2009-02-14 00:51
197 查看
Depth Bias (Direct3D 9)
Polygons that are coplanar inyour 3D space can be made to appear as if they are not coplanar by
adding a z-bias to each one. This is a technique commonly used to
ensure that shadows in a scene are displayed properly. For instance, a
shadow on a wall will likely have the same depth value as the wall
does. If you render the wall first and then the shadow, the shadow
might not be visible, or depth artifacts might be visible. You can
reverse the order in which you render the coplanar objects in hopes of
reversing the effect, but depth artifacts are still likely.
An
application can help ensure that coplanar polygons are rendered
properly by adding a bias to the z-values that the system uses when
rendering the sets of coplanar polygons. To add a z-bias to a set of
polygons, call the IDirect3DDevice9::SetRenderState method just before rendering them, setting the State
parameter to D3DRS_DEPTHBIAS, and the Value parameter to a value
between 0-16 inclusive. A higher z-bias value increases the likelihood
that the polygons you render will be visible when displayed with other
coplanar polygons.
Offset = m * D3DRS_SLOPESCALEDEPTHBIAS + D3DRS_DEPTHBIAS
where m is the maximum depth slope of the triangle being rendered.
m = max(abs(delta z / delta x), abs(delta z / delta y))
The units for the D3DRS_DEPTHBIAS and
D3DRS_SLOPESCALEDEPTHBIAS render states depend on whether z-buffering
or w-buffering is enabled. The application must provide suitable values.
The
bias is not applied to any line and point primitive. However, this bias
needs to be applied to triangles drawn in wireframe mode.
// RenderStates D3DRS_SLOPESCALEDEPTHBIAS, // Defaults to zero D3DRS_DEPTHBIAS, // Defaults to zero
// Caps D3DPRASTERCAPS_DEPTHBIAS D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
相关文章推荐
- Depth Bias 以及 Ogre材质中的depth_bias
- ogre中的 z-filghting看到的z-bias及其getIterationDepthBias
- Z - Fighting 和 Depth-bias
- Depth Bias AMD Sample
- Depth Bias(Direct3D 9) Alternatives to Using Z-Bias to Fix Z-Fighting Issues
- Depth Bias 以及 Ogre材质中的depth_bias
- Z - Fighting 和 Depth-bias
- opengl 和direct3d坐标系的区别
- PHP 性能分析第二篇: Xhgui In-Depth
- LeetCode|Minimum Depth of Binary Tree-java
- Stereo Matching文献笔记之(七):《Spatial-Depth Super Resolution for Range Images》读后感~
- leetcode 104--Maximum Depth of Binary Tree
- OpenCV中对Mat里面depth,dims,channels,step,data,elemSize和数据地址计算的理解
- [LeetCode]Maximum Depth of Binary Tree
- leetcode 104 Maximum Depth of Binary Tree
- LeetCode 104: Maximum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Maximum Depth of Binary Tree
- leetcode-Minimum Depth of Binary Tree
- Direct3D 光照和材质