Public Group

# Help with Direct3D Normals

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

## Recommended Posts

Hi, I know that this is like one of the simplest, most basic concepts, but I just can't get it to work with Direct3D. I haven't been in touch with 3D math/programming for more than 6 months now, so do correct me wherever I'm wrong. From my understanding: DirectX uses the LH coordinate system, right? Which means, Vertices facing the front(viewer) should be specified in CW-order (As Z increases, it moves away from the viewer) So I'm trying to create a simple triangle facing the viewer:
    // Format {posX, posY, posZ, normVector, color}
// Using -1 for Z normal, because I want it to face the viewer, the negative
// direction of Z.
NormalVertex vertices[] = {
{0, 5, 0, D3DXVECTOR3(0,0,-1), 0xffff0000},
{5, -5, 0, D3DXVECTOR3(0,0,-1), 0xff00ff00},
{-5, -5, 0, D3DXVECTOR3(0,0,-1), 0xff0000ff}
};


But by doing this, it is drawn as nothing more than a dark triangle. I had to change the Z-component from -1 to 1 for the triangle to show up. Also, please note that: 1. I'm using LH for projection and view 2. Camera and light is set at {0,0,-30} Thanks.

##### Share on other sites
the winding order of the vertices and the normal direction are independent to directx. you can have clockwise or counter clockwise or no culling and face the normal in whatever dir you want. it's probably what dir you have the light facing that is mattering here.

D3DRS_CULLMODE render state determine culling (clock wise, counter, none)

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 11
• 15
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633004
• Total Posts
3009837
• ### Who's Online (See full list)

There are no registered users currently online

×