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

## 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 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.

Brandon

[source="cpp"]IDirect3DVertexBuffer9		* VertBuff;	pMesh->GetVertexBuffer(&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       	}	VertBuff->Unlock();

##### Share on other sites
Thanks, question though: So would things derived from ID3DXBaseMesh be stored in Triangle lists?

##### Share on other sites
From my experiences, yes. I think an optimized mesh does a triangle strip though.

Brandon

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 10
• 23
• 9
• 47
• ### Forum Statistics

• Total Topics
632636
• Total Posts
3007574
• ### Who's Online (See full list)

There are no registered users currently online

×