Advertisement

Normals and D3D DrawPrimitive

Started by April 22, 2000 03:37 PM
5 comments, last by Cyxor 24 years, 7 months ago
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.
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).
Jonathan Makqueasy gamesgate 88[email=jon.mak@utoronto.ca]email[/email]
Advertisement
duh. Flipped them around and they work great. Thanks for your time!

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"
"Your thoughts are the reality, the phisical side is the illusion"
hey Queasy,Normals are also used for BackFace Culling.
Esap, I doubt it. The normals don''t make a difference in the side that is displayed. The order that the polygons are displayed (i.e. clockwise or ccw) makes a difference.

altair
altair734@yahoo.com
biggins.mit.edu/altair734
altairaltair734@yahoo.comwww.geocities.com/altair734
Advertisement
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement