I'm currently learning D3D, and have a question about normals.
I have a slowly rotating quad defined with this vertices :
#define D3DFVF_UNLIT_TEX_VERTEX D3DFVF_XYZ | D3DFVF_NORMAL
typedef struct
{
float x, y, z;
float nx, ny, nz;
} UNLIT_TEX_VERTEX;
UNLIT_TEX_VERTEX m_QuadVertices[] =
{
{ 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, },
{ 1.0f,-1.0f, 0.0f, 1.0f,-1.0f, 0.0f, },
{ -1.0f,-1.0f, 0.0f, -1.0f,-1.0f, 0.0f, },
{ -1.0f,-1.0f, 0.0f, -1.0f,-1.0f, 0.0f, },
{ -1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f, },
{ 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, },
};
I have Backface ulling turned off. The normals seems to be ok, as long as the face isn't directly looking at the camera (the light is slightly behind, above and right of the camera). I understand why, but if I set the Z of the normals to anything than 0.0f only one face is lit, and the other stays black.
The only solution I can see is to build the quad ~2 sided~ out of 4 triangles instead of 2, and to have 2 triangles have their normals pointing along the positive Z axis, and the 2 others with negative Zs. (I hope you understand what I mean

Is that the only way? It's not really crucial for me to have this worked out, as I'm just fooling around with vertices currently, but I'm just wondering ...
Thanks,
Sammy
EDIT: had forgotten to write how the structure definition looked like.
Edited by - Sammy70 on March 29, 2002 2:43:10 PM