Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Calculating normals...
Author Message
Homer_simpson

Posted: Mon Jul 21, 2003 7:59 pm   Post subject: Calculating normals...

well since the site doesn't have a math section and this isn't a spam i'm gonna post it here...
now the question is how do i caculate the light normals for a triangle without using sine and cosine?!

Asok

Posted: Mon Jul 21, 2003 8:21 pm   Post subject: (No subject)

use a calculator perhaps?

Catalyst

Posted: Mon Jul 21, 2003 11:24 pm   Post subject: (No subject)

http://www.gamedev.net/reference/articles/article1682.asp

this should explain it all (well per-polygon lighting)

Posted: Tue Jul 22, 2003 2:52 am   Post subject: (No subject)

dunno if this will help, but the cross product will give you a vector that is perpendicular to the two vectors you're doing it with

to use the cross product do this...

get two direction vectors for your plane (take three points that land on it, then just subtract x, y and z values to give you two direction vectors)

then when you have your two direction vectors.. let's say (i1, j1, k1) and (i2, j2, k2)

do this (it's kinda funny... but works)

write out the vectors twice each like this...
i1 j1 k1 i1 j1 k1
i2 j2 k2 i2 j2 k2

then you multiply j1 by k2 and subtract k1 * j2 from it... this is the i for your normal vector
they go like this..
i = j1k2 - k1j2
j = k1i2 - i1k2
k = i1j2 - j1i2

if you didn't catch it, the reason you write out the vectors (when you're doing it by hand or whatever) is to use for a guide for what to multiply .. and just remember multipolications going \ are positive and multiplications going / are negative

or use the link Catalyst gave depends how much work you wanna do even though it looks like they are using exactly what I explained hehe
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: