Vector help...
Blitz3D Forums/Blitz3D Programming/Vector help...
| ||
Im trying to understand tangent space and therefore apply it in Blitz... I'm not very good with vectors though, can someone explain some of this..? I don't understand how to normalize a vecotr (alothugh i heard its meant to result in the length being 1?) and what does it mean 'X is the cross product.' The cross product of what? Just the vertex? :) If anyone can go through that code, i'd really appriate it xD |
| ||
normalize: dc = 1/sqr(x*x+y*y+z*z) ; compute correction factor x=x*dc y=y*dc z=z*dc cross product: http://mathworld.wolfram.com/CrossProduct.html A cross product is the vector normal to the plane defined by 2 other vectors Beyond that, I'm as confused, if not more so, than you are :) |
| ||
Thanks for those snips Zombie :) Now that i've got some of these formula's "in the bag" (i love that phrase ^_^) I may will be able to get some nice Dot3 Lighting down. |
| ||
Some more questions: In the following, it seems that a vector also has 'U' and 'V' parts? I don't think that these are talking about texture co-ordinates either. The tangent space is made of three vectors: the tangent, the binormal and the normal. The tangent is the vector along which the U coordinates of the vertices are increased. The binormal is the vector along which the V coordinates of the vertices are increased. The normal is... the normal! Most of the time the three vectors are orthogonal. In some cases they are not, but lighting will still work. And here we see another mention of a vector having 'u' and 'v' components... (p2->x-p1->x,p2->u-p1->u,p2->v-p1->v) Any ideas? |
| ||
thats where you start losing me -- on those math sites, u/v are polar vectors, not texture coords :) that is if I'm reading any part of it right :) I dropped the idea of a math major and went with a puter major instead :) I'm definitly a lazy git :) |
| ||
dc = 1/sqr(x*x+y*y+z*z) Watch out for divide by zero here. |
| ||
Im using Noel Cowers vector maths lib, and i think that it checks |
| ||
Ya think this stuff is tough, take a look a matrix manipulations(in fact, do it anyway, they're very useful.) |