Skip to main content
gamedev.net
🔒 Locked

Creating polygon from normal

Started by Xero_Tolerance May 3, 2004 at 6:27 PM 0 replies 550+ views
Original Post
Xero_Tolerance
Xero_Tolerance
Basically I''m trying to work on a lighting system. I have it all setup but with a few problems. Basically the problem is I have a normal from a polygon and the intersection point. How would I make a square of size X that lies on the same plane as the normal originated from and make sure the intersection point is the center of the square. Any help would be much appreciated, thanks.
"Real men don''t use parachutes" -Guy in Firearms
JohnBolton
JohnBolton
The first problem is that there are an infinite number of squares that meet your requirements. You need to somehow cut it down to one. If N is the normal, P is the intersection, L is the light direction, and P1,2,3,4 are the corners of the square, you can do it like this as long as L != N and L != -N:
U = N cross L
Normalize U
V = N cross U
P1 = P + ( -U + -V ) * X / 2
P2 = P + ( -U + V ) * X / 2
P3 = P + ( U + -V ) * X / 2
P4 = P + ( U + V ) * X / 2
Actually, you can replace L with any vector as long as it is not in the same or the opposite direction of N.





John Bolton
Page 44 Studios
Current project: NHL Faceoff 2005 PS2


[edited by - JohnBolton on May 4, 2004 3:59:00 AM]
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!

Topic Locked

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

Sign in to reply to this topic.