Jump to content
Posted 18 January 2011 - 04:45 AM
Posted 18 January 2011 - 01:26 PM
Posted 18 January 2011 - 03:59 PM
Posted 18 January 2011 - 10:57 PM
Posted 18 January 2011 - 11:50 PM
D3DFMT_D24X8 is for use as a depth-stencil target, not as an MRT target. As mentioned above, you should use a floating-point, or ARGB8 texture here instead of a D24 one.
Hi, I am about to pull the trigger with my first attempt to render to multiple targets, because I want to do SSAO,
the implementation with normals, that's why I am using MRT, the first one is for depth (D3DFMT_D24X8) the
second one is for normals (D3DFMT_A8R8G8B8).
If the exact same geo is drawn with the exact same matrices, there won't be z-fighting.
I thought that is possible to perform a depth test using the depth texture (thinking in shadow map), and discard pixels beyond the depth, but there will be z-fighting for sure.
You can read from the depth buffer in DX9 if the end-user has a DX10-level graphics card.
In dx9 you cannot read from the depth buffer in the pixel shader. In dx10, you can create a depth buffer with the ability to sample it in the pixel shader.
const static D3DFORMAT D3DFMT_INTZ = (D3DFORMAT) MAKEFOURCC('I','N','T','Z'); bool supportsIntZ = d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, displayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_INTZ);
Posted 19 January 2011 - 06:42 AM
float2 Texcoords = 0.5 * In.Other.xy / In.Other.w + float2( 0.5, 0.5 ); Texcoords.y = 1.0f - Texcoords.y; float dist = In.Other.z/ In.Other.w; if(dist == tex2D( nolerpsampler, Texcoords ).r) return float4(1.0f,0.0f,0.0f,1.0f);
... float dist = (In.Other.z + 0.001f) / In.Other.w; if(dist > tex2D( nolerpsampler, Texcoords ).r) return float4(1.0f,0.0f,0.0f,1.0f);