Hey there,
I recently implemented a deferred renderer using guidelines posted at www.catalinzima.com. It's working fine, but i want to be able to render alpha blended objects in my scene now.
The deferred renderer creates a depth texture while rendering the objects, as far as i know it should be possible to render this texture to the depth buffer using a fullscreen quad. Here's my HLSL code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
output.Position = float4(input.Position,1);
output.TextureCoordinate = input.TextureCoordinate;
return output;
}
void PixelShaderFunction(in VertexShaderOutput input,
out float4 color : COLOR0,
out float depth : DEPTH)
{
//black color
color = 0.0f;
depth = tex2D(depthSampler, input.TextureCoordinate);
}
technique Technique1
{
pass Pass1
{
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
} |
I'm hoping somebody has had a similar problem and can post some guidelines. Thanks!