Archived

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

zilch_

D3DFVF_NORMAL, d3d

Recommended Posts

Why do I need D3DFVF_NORMAL when I use lightning? I understand that it is used to know which direction the light is reflected. But in which way is this normal different from the one d3d uses to know which side of the surface to draw (when using culling). Or better, how do you calculate the values by yourself? Or am I compeltely wrong about this? Thanks plenty! zilch_ (newbie)

Share this post


Link to post
Share on other sites
AFAIK, this is the normal per vertex, not per triangle as D3D uses to deside what triangles to draw.

One vertex can be used by multiple triangles, and the vertexnormal for this point is the average normal for the planes that uses this vertex.

Please correct me if I''m wrong
*still a beginner*

Share this post


Link to post
Share on other sites
AFAIK D3D doesn''t use normals for backface culling. The graphics card does it in 2D by looking at the winding order (thus the clockwise vs counterclockwise dependence - if the culling were done with a stored normal that wouldn''t be necessary).

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thanks,
but how do I calculate it?

All I have is the x, y, z and the color. How do I calculate the normal on each vertex then?

thanks

Share this post


Link to post
Share on other sites
Ok,
I can see how I can manually insert the normals there. I have looked at some examples. But if I have a complex model? There must be a way to calculate it... isn''t there? :-)

zilch_

Share this post


Link to post
Share on other sites
If you are using D3DX Meshes there is a function I believe is called D3DXComputeNormals(). Otherwise it''s a slow old hog at load time but worth it for the lighting.....

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites