开发者

Depth buffer only show blue color

I'm trying to implement Light Prepass rendering in RenderMonkey. So far, in Normal+Depth pass, it seems like Normal buffer is getting corre开发者_如何学Pythonct result, but Depth buffer only show one color. How can I check if my Depth buffer is correct or not? Workspace download link: http://www.mediafire.com/?jq3jmantyxw


The light blue is actually RGB values 0.0, 1.0, 1.0. Since depth is (usually) a single channel representing Z, when sampled from texture it's returned in the first channel, red. Missing channels green, blue and alpha will have 1.0 substituted by the hardware.

Your download link is non-functional, since it's been 2 years I suspect.

You should ensure your pixel shader is returning both COLOR0 and COLOR1 semantics (note that depth is a float4 despite the output being a single channel texture):

struct PS_OUT { float4 color : COLOR0; float4 depth : COLOR1; };

PS_OUT ps_main( PS_INPUT Input )
{
    PS_OUT Output;
    // your color shader here
    Output.color = myFinalColor;
    Output.depth = myFinalDepth;  // e.g. Input.posz / Input.posw from your vertex shader
    return Output;
}

Depending on your camera settings, you could get something like:

Depth buffer only show blue color

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜