Jump to content
  • Advertisement

Archived

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

Cyxor

Normals and D3D DrawPrimitive

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

Does the normal determine which "side" of a polygon is visible? And if so, should the following polygon be visible on screen? 0,0 to 1,0 squared with z = 0 normal 0,0,-1 with the camera pointing towards 0,0,0 from 0,0,-50 I can draw the polygons, and I can see them, but only from one direction. But if I switch the normal to 0,0,1, the poly''s don''t spin around. They stay the same.

Share this post


Link to post
Share on other sites
Advertisement
normals for lighting (and the like).

to have the poly face the other side you have to define the poly in a different order.

Look at the triangle tutorial included in the sdk [under samples\multimedia\d3dim\tutorials\traignle] or something like that. They define a triangle that is visible on both sides (which is two triangles really).

Share this post


Link to post
Share on other sites
another way to do it is by turning backface culling off (somewhere in those renderstate flags)

"Your thoughts are the reality, the phisical side is the illusion"

Share this post


Link to post
Share on other sites
You are both right.

The normals defined in the vertices are only used for light calculations, environment mapping etc. But not backface culling.

However, when Direct3D or OpenGL does the backface culling they compute the triangle normal as the crossproduct of two of the triangles edges. This normal is then used when testing if the camera is in front of the triangle or behind it. Since the direction of the crossproduct depends on the order of its arguments the order of the triangles vertices desides which side of the triangle is front or back.

WitchLord

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!