problems with simple shadow plane rendering

Started by
4 comments, last by GalaxyQuest 19 years, 10 months ago
Im kind of a newbie when it comes to using z-buffers/stencils, so bear with me plz. :o Im using D3d and want to do REALLY simple shadow rendering of a character onto a plane. I am able to use D3DXMatrixShadow() to project my mesh down onto the plane and render it. But I cannot, for the life of me, get the rendering states & z-buffer to correctly render this shadow! Here's an image, with the areas of concern tagged with yellow dots near it. Overlapping tris 'add' to the shadow, even with what I believe to be z-buffering turned on. http://home.earthlink.net/~gqjohnm/images/zartifact.jpg Heres my effect file rendering this: technique t1 { pass p0 { // Transform: WorldTransform[0] = mtxWorld; // syntax removed for post // Render States: Lighting = FALSE; FogEnable = FALSE; CullMode = CCW; ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = LESS; // Alpha Blending AlphaBlendEnable = TRUE; SrcBlend = ZERO; DestBlend = INVDESTCOLOR; BlendOp = ADD; // Texture 0 States Texture[0] = NULL; ColorOp[0] = DISABLE; } } Need help! Ive tried a lot of settings. When I move the model, its as if the tris are z-fighting amongst each other! Ack!! >: - john [edited by - GalaxyQuest on May 27, 2004 11:38:57 PM]
Advertisement
How did you even do that? I can''t get the pixel shaders in the FX Composer to work with my files. I can''t get it so that it will take my ViewProjWorld matrix. In C++ there seems to be and Effect->SetMatrix. If you are using C#, please help me out
If your asking how to pass params into the effect file, I didnt post it above, but I have a matrix variable declared at the top of the file, like so:

Matrix mtxWorld;
bool bAlphaBlend = true;
... (techniques) ...

In c++, pass matrix into fx like so:
pEffect->SetMatrix("mtxWorld", &m_mtxWorldIdentity);


I help you, you help me. Why wont the zbuffer work in this instance. Its gotta be a rendering setting I hope.

Help!!!

Im confused. I was thinking that I may, if I wanted this ''simple'' transparent plane shadow to work, I would need the stencil buffer. But why? Aren''t I not only worried about z alpha triangles being rendered correctly, therefore only requiring the z testing and blending?

Currently, the only way to render this shadow (and from a vb example I found on the internet) is if its full black, which looks like crap.

Any ideas?
hmm, if you want transparent shadows you cannot simply use alphablending, this way you will draw 2 or more times on the same pixel and the shadow will not be the same color. I think you have to use the stencil buffer to "mark" the areas where you draw, and draw only where it''s not marked.
Anyway i never used the stencil buffer so I can''t help you more than this..
I figured as much, thanks for the reply.
- John

This topic is closed to new replies.

Advertisement