if(m_bRenderToZBufOnly)
pd3dDevice->SetRenderState(D3DRS_COLORWRITEENABLE,0x00000000);
RenderObj(pd3dDevice);
if(m_bRenderToZBufOnly)
pd3dDevice->SetRenderState(D3DRS_COLORWRITEENABLE,0x0000000f);
This used to seem to work, but now it doesn't (yes my hardware supports COLORWRITEENABLE). Is there any other state that could be set that would effect how this works. I do notice that some objects do seem to be occluded by the z-buf only objects, but most arent. Is there some sort of drawing order problem with this technique? Is there some sort of early z-buffer rejection optimization that would effect this?
Drawing only the the z-buffer
What I am trying to do is for certain objects draw only to the z-buffer. This way that object can occlude others without actually being visible. What i used to do is this:
You need to draw those occluding objects first, before drawing what is behind them. If objects behind them are drawn first, then they will not be covered later since color writes are disabled, and their image in the color buffer will still be present even though the z-buffer is overwritten by a closer object.
You don't need to sort objects per-se, just to separate your color pass in two separate passes (1st render all z-only models, then render all models) like you would do for a depth pre-pass. Within each pass, objects noeed no particular sorting
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement