write to depth buffer while using multiple render targets
Posted
by
DocSeuss
on Game Development
See other posts from Game Development
or by DocSeuss
Published on 2013-10-31T19:52:55Z
Indexed on
2013/10/31
22:19 UTC
Read the original article
Hit count: 270
Presently my engine is set up to use deferred shading. My pixel shader output struct is as follows:
struct GBuffer
{
float4 Depth : DEPTH0; //depth render target
float4 Normal : COLOR0; //normal render target
float4 Diffuse : COLOR1; //diffuse render target
float4 Specular : COLOR2; //specular render target
};
This works fine for flat surfaces, but I'm trying to implement relief mapping which requires me to manually write to the depth buffer to get correct silhouettes. MSDN suggests doing what I'm already doing to output to my depth render target - however, this has no impact on z culling. I think it might be because XNA uses a different depth buffer for every RenderTarget2D. How can I address these depth buffers from the pixel shader?
© Game Development or respective owner