Skip to main content
GameDev.net gamedev.net
🔒 Locked

Polygon vertex order

Started by ByteMe95 Jul 12, 2000 at 11:52 AM 0 replies 350+ views
Original Post
ByteMe95
ByteMe95
Hey, I''m a newbie in the 3d field and I seethat for lighting your polygon has to haveits vertices aligned in clockwise order. Does this mean the 2d projection points have to be in 2d order? And how exactly would I go about doing this, any well known methods? ------------------------------ fclose(fp) ------------------------------
ByteMe95::~ByteMe95()My S(h)ite
bishop_pass
bishop_pass
You have right hand systems and left hand systems. Normals are derived from crossing two vectors defining edges of a polygon.

I have written 4 cross functions:
crosscwrhs
crossccwrhs
crosscwlhs
crossccwlhs

Actually, I wrote only one cross function, and #defined 3 others which reverse the input order if necessary.

Each of these functions will return a vector normal to the plane defined by the two input vectors. The normal returned will be facing you if you are using the cross function that is consistent with the cooridnate system and the conssistent with the winding of the vectors. If you reverse the order of the input vectors, you have changed their winding from clockwise to counter-clockwise or the opposite.

If you are in 3d space and outside an object and want a normal facing you, then you have to calculate the cross correctly. This is dependent on the winding of the input vectors, and whether you are using a right hand or left hand cooridnate system.

Winding (cw or ccw) is only consistent for all edges of a polygon if it is convex. If it is concave, further processing is required.



_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.