摘要: Depth Buffer 1、Learning to Love your Z-bufferIntroductionOne of the more common OpenGL programming problems that I see concerns the poor precision of the Z buffer.Many of the early 3D adaptors for the PC have a 16 bit Z buffer, some others have 24 bits - and the very best have 32 bits. If y... 阅读全文
posted @ 2012-09-08 23:35 ActionFG 阅读(645) 评论(0) 推荐(0)
摘要: 例子见Nvidia DX10 sdk 《Stencil Routed KBuffer》主要实现:第一遍正常渲染,获得Z最小的一层深度值,第二层将第一层深度值作为ShaderResourceView传入,若场景的Z小于等于第一层深度,则discard,这样获得第二层深度值;后面以此类推。// tDepthBuffer为上一层深度, IN.HPosition为屏幕坐标 DepthColorOutput DepthPeelPS ( Geometry_VSOut IN ) { DepthColorOutput output = (DepthColorO... 阅读全文
posted @ 2012-09-08 23:31 ActionFG 阅读(275) 评论(0) 推荐(0)
摘要: 当前效果是Quad始终处于相机正前方, 而不只是方向垂直。去掉m_vOffset就是一般意义上的billboard了。 Vert程序: uniform mat4 g_WorldViewProjectionMatrix;uniform mat4 g_WorldMatrix;uniform mat4 g_ProjectionMatrix;uniform mat4 g_ViewMatrix;uniform vec3 m_vOffset;uniform vec3 m_CamPos;attribute vec3 inPosition;attribute vec2 i... 阅读全文
posted @ 2012-09-08 23:11 ActionFG 阅读(406) 评论(0) 推荐(0)