Convert a vector to another vector's space?
Blitz3D Forums/Blitz3D Programming/Convert a vector to another vector's space?
| ||
My brain is not working today. If I have a vector and want to find what it is relative to another vector, what is the operation? |
| ||
Relative in which way? Projection of vec2 on vec1? |
| ||
Do you mean the math, or do you just want TFormVector? |
| ||
The math, of course. This tangent to RGB to world to tangent to RGB stuff is giving me a headache. |
| ||
Be sure to help him out guys. If the past has taught us anything, he'll be really appreciative and grateful. |
| ||
It's not really possible, I asked the same question here before when I was doing dot3 stuff in blitz. The closest I came was to allign a pivot to the target vector, then tform the tangent vector by that. PointEntity lpiv1,spiv PointEntity spiv,lpiv1 AlignToVector spiv,nox,noy,noz,0 AlignToVector spiv,nox,noy,noz,2 TFormVector2(vx,vy,vz,nox,noy,noz) ar=128.0+(128.0*TFormedX()) ag=128.0+(128.0*TFormedY()) ab=128.0+(128.0*TFormedZ()) vx,vy,vz=vertex position, nox,noy etc=normal.lpiv being a pivot at the vertex position and spiv, being a pivot projected in the direction of the target vector. |
| ||
EpicBoy you should help him, you must know this stuff ;) |
| ||
Of course, a vector does not have roll, so it might not even be possible. This is all for tangent normal mapping. It looks pretty cool, but no one seems to have a clue how to get the vert colors right. |
| ||
EpicBoy you should help him, you must know this stuff ;) Yes, the company I work for does normal mapping so I must have first hand knowledge of all the math. :) |
| ||
>Yes, the company I work for does normal mapping so I must have first hand knowledge of all the math. :) That was my idea :-) |
| ||
Isn't it strange how someone so desperate to comment on everyone else's ego around here has overtime seemed to developed an even bigger alter-ego himself. |
| ||
Put your handbags away.... |
| ||
Deep. Very deep. |
| ||
If I have a vector and want to find what it is relative to another vector, what is the operation? 1. You need to get your vector maths straight, what one vector is relative to another is a very vague statement. Dot product, cross product, normal reflection, would all be a lot more helpfull descriptions :P This is all for tangent normal mapping. It looks pretty cool, but no one seems to have a clue how to get the vert colors right. 2. It's a piece of cake, I've had tangent normal mapping in blitz for half a year now, just because someone kepth asking me to actualy write propper code for it, but if I post the code to do it the best thing I could possibly expect from you is to grab it and run, while the most likely response would be that of you using it in the wrong way (because you wouldn't understand what it did anyways) and then coming back here and telling me my code sucks... So, I'll think twice before doing something that stupid. ;) You have, more then once proven to be ignorant of the inner workings of these maths, this does not make you a bad person at all, but the fact that you will act like you do understand them and then stamp over other peoples code (such as that of sswift I believe) simply because you don't "get it", that's what makes you look bad in my eyes. |
| ||
Just a little addition: For all programming in 3D which didn't have the needed math already in college, I can really advice the book "3D Math Primer for Graphics and Game Developement" by Dunn & Parberry. It covers most of all common math you need for 3D dev @halo: You still have not really answered the question at the top but that is normal as you ignore me. On the other hand you should already know the answer as you wrote a map exporter for CS and texture coords in map format are familiar with what you are asking for here. |
| ||
This stuff is still hurting my head too. this is messy, it's a mash of Fredborgs original DOT3 code, a snippet of yours Halo, and some of my own. It produces ok results, but I'm not sure when stuff is rotated. b.t.w this is slightly different from one I posted a few weeks back, the shading wasn't correct, but it is using Halos tangent>rgb math. The problem for rotating meshes seems to be hierarchial tranformations. http://www.tomspeed.com/test/normal-mapping-2.zip Tom |
| ||
That's a pretty nice normal map. See my other thread for a demo with tangent mapping. It's just a little off at some angles, I am sure we can figure it out. |