Quote:Original post by Hurp
I have also been having a problem with this and I can not seem to figure out why. I noticed in most examples that the depth only pass and just rendering that texture shows red (since it is just writing to the red component), however, I get blue and not figure out why. It also seems to depend on the camera position for some reason. Does anyone happen to know why?
Shader Code:
*** Source Snippet Removed ***
Render Code (general algorithm)
*** Source Snippet Removed ***
pD3Dev->CreateTexture(nWidth, nHeight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R32F, D3DPOOL_DEFAULT, &m_pRenderTarget, NULL);
Is how I make my render target also.
How are you viewing your depth texture? In PIX, or are you rendering to the screen? When you render to an R32F surface, the green, blue, and alpha components are interpreted as having a value of 1.0. Therefore you'll want to only view the red channel if viewing in PIX, or set the green and blue components to the value of the red component if rendering to the screen.