A little help for a directx newb
First off, can someone give me a good definition of what normalize means in terms of vectors/vertices/vertexes (and other 3d math stuff)? The dictionary term is too generic and it means different things in different contexts.
Second, I just installed the DX8 SDK and started an appwizard project with just a triangle (SDI/DirectInput/no DirectMusic) I was looking at the source and fiddling with different things trying to figure out what they do, etc (until i can buy a decent book) and came across the lighting area. The appwizard puts 2 triangles (a front and back) on the screen centered around 0,0,0; The viewport (My eyes) are set to 0,0,-7; The light is set at 0,0,1 with the direction 0,0,1. Wouldnt that mean the light is behind the triangle, so I should be seeing black? Well I dont, I see red, and when I set the light to be at pos 0,0,-1 and direction 0,0,-1 I see a black triangle. Can someone kindly give my head a shake, because it is confusing as hell.
Thanks,
Micah
OK, the first bit is relatively easy.
Every vector has a magnitude (which is it''s length). For example, a vector of say 0,3,0 would have a magnitude of 3, and 0,3,4 would have a magnitude of 5. Normalising a vector means changing its length to 1, but keeping its direction the same, so normalising 0,3,0 would give you 0,1,0 (which has a magnitude of 1, but the same direction/orientation as 0,3,0).
The second one is a tiny bit harder. What type of light is it? Since you have given a direction vector, it is probably a Direction light. This type of light is not affected by position, only by orientation, so it doesn''t matter which side of the triangle it is, only what direction the light is pointing in. If the light is pointing directly away from the camera (as 0,0,1 is), then it will light the rotating triangle from the front, and you will see the triangle. If it''s facing towards the camera (as 0,0,-1 is), then it will light the other side of the triangle, which you can''t see.
Hope that helps,
John B
Every vector has a magnitude (which is it''s length). For example, a vector of say 0,3,0 would have a magnitude of 3, and 0,3,4 would have a magnitude of 5. Normalising a vector means changing its length to 1, but keeping its direction the same, so normalising 0,3,0 would give you 0,1,0 (which has a magnitude of 1, but the same direction/orientation as 0,3,0).
The second one is a tiny bit harder. What type of light is it? Since you have given a direction vector, it is probably a Direction light. This type of light is not affected by position, only by orientation, so it doesn''t matter which side of the triangle it is, only what direction the light is pointing in. If the light is pointing directly away from the camera (as 0,0,1 is), then it will light the rotating triangle from the front, and you will see the triangle. If it''s facing towards the camera (as 0,0,-1 is), then it will light the other side of the triangle, which you can''t see.
Hope that helps,
John B
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
Okay, I think I understand normals a bit better now. It sounds like normals are used for the direction of a vector or other object (like a triangle''s face).
Yes it was Directional Light, so thank you very much.
Regards,
Micah
quote: Original post by JohnBSmall
Since you have given a direction vector, it is probably a Direction light. This type of light is not affected by position, only by orientation, so it doesn''t matter which side of the triangle it is, only what direction the light is pointing in.
Yes it was Directional Light, so thank you very much.
Regards,
Micah
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement