DEPTHSTENCIL as Render Target ?

Boke

New member
I want to add hardware shadow map support to my D3D engine...
Just wondering if render to depth stencil is not supported because of a hardware limitation, or has it not been enabled in the drivers yet? Is it supported in OGL?
I've got my 3D engine up and running with full skinned mesh and keyframe animation support. I'm loading and displaying .x files with my own code, all math is also done with my own code ( I like to fully understand whats going on before I make it fast. ), so it would not take long to switch to OpenGL.
 
Re: DEPTHSTENCIL as Render Target ?

Boke said:
I want to add hardware shadow map support to my D3D engine...
Just wondering if render to depth stencil is not supported because of a hardware limitation, or has it not been enabled in the drivers yet? Is it supported in OGL?
I've got my 3D engine up and running with full skinned mesh and keyframe animation support. I'm loading and displaying .x files with my own code, all math is also done with my own code ( I like to fully understand whats going on before I make it fast. ), so it would not take long to switch to OpenGL.

The 8500 doesn't support Depth read, so you can't do depth shadows (or shadow maps).

There are ways you can get around that in OpenGL, but it's VERY slow (using glReadPixels).

That was probably the only thing I was disappointed at with the 8500.
 
I'm not an expert on shadow mapping, but I may have a solution to the problem.

You need the Z value from when you render from the light's point of view, right? I know you can't do depth reads, but can't you use the vertex shader to copy the Z value into a vertex color, and then use that vertex color to write into a texture? That effectively gives you a Z value that you can project and use for comparison when rendering from the eye.

Hope this works. I'm planning on trying it out myself.

Aside:
Since you mentioned shadow volumes, is there any way to render to the depth and stencil buffers without touching the colour buffer? In the DX8 SDK the example just makes alpha zero, but I have a feeling this is still consuming color bandwidth (i.e. reading and writing the same pixel back). The performance is really low considering you're just rendering to the Z and the stencil buffer.
 
Hi Mintmaster

Yep... your right. I did exactly as you described yesterday. I now have a nice rendering of the depth buffer. I have not had time to see if it will work for the depth compare yet.

"is there any way to render to the depth and stencil buffers without touching the colour buffer?"
Yes, I'm not sure that it will speed things up though.
ID3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE , 0 );

"The performance is really low considering you're just rendering to the Z and the stencil buffer."
I just program as a hobby right now but... some of the code in the SDK is pretty bad. Look at the skinned mesh sample... Ugh!!
 
RAGE LT MAN said:
nitroGL, is the inability to do depth reads caused by z-culling, or would they happen before that?

Not sure... I suppose Hierarchal-Z could prevent it, but I think it's just a hardware limit (you'd have to ask ATI about it though).
 
Back
Top