Archived

This topic is now archived and is closed to further replies.

problems with simple shadow plane rendering

This topic is 4949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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!!!

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites