Jump to content
  • Advertisement
Sign in to follow this  

Shadow Volume Creation

This topic is 4137 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

Hi. I have been reading up on how to create shadows using shadow volumes and a stencil buffer, but alas, i have tripped up on the first hurdle. I have been lead to believe (from http://downloads.gamedev.net/pdf/VolumeShadowsTutorial-2036.pdf) that you must create the shadow volume by finding the contour edges of the occular object. You do this by cycling through every polygon of the object and finding the dot product of the normal of the polygon and the direction of the light at that polygon, and check if it is facing the light or not. So i have a D3D mesh, (a teapot actually), but I am confused as to how to access each polygon individually. =/ Any help would appreciated greatly. Thanks for your time. Trandafira

Share this post

Link to post
Share on other sites
Since it is derived from an ID3DXBaseMesh (I'm guessing!), then you should be able to access it's vertex buffer, lock it, and get all the info you want to construct your data.


IDirect3DVertexBuffer9 * VertBuff;


Vertex * v;
VertBuff->Lock(0,0,(void**)&v, NULL);
for (unsigned int i = 0; i < pMesh->GetNumVertices(); i++)
// every third vert completes a triangle
// add together the normals and divide by 3 to find average normal
// which will be the face/triangle normal


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!