즉, GL_POSITION, ...) 의 ... 에는 동차좌표가 (x,y,z,w)의 배열 형태로 넘어 가는데, 이것의 의미에 대한 질문에 답한 글을 긁어왔다.(질문내용은 생략)
---------------------------------------------------
참조 위치: http://www.gamedev.net/community/forums/topic.asp?topic_id=518088
Look up homogenous coordinates. Basically, a coordinate (x, y, z, w) in 4D homogenous space is equal to (x/w, y/w, z/w) in 3D space. When w=1, you have the 3D subspace of 4D homogenous space which corresponds to 3D space. That is, the point is located at (x/1, y/1, z/1).
Now see what happens as w approaches 0. For w=0.1, the point is (10*x, 10*y, 10*z). For w=0.001, the point is (1000*x, 1000*y, 1000*z). As w approaches 0, the point (x/w, y/w, z/w) approaches a point at infinity in the direction from the origin towards (x, y, z).
Therefore, a light positioned at (0, 0, 1, 0) is located an infinite distance from the origin in the direction (0, 0, 1), which means the light is shining in the direction (0, 0, -1) from infinity towards the origin.
In short, when specifying directional lights, the vector is not the direction of the light. It is the direction towards the light source from the origin.
--------
자세하고 직관적인 설명이다. 되새겨 봐야겠다.
덧붙여
그리고 빛의 위치는 GL_POSITION으로 주면 될 것이다..
이에 관련된 내용도 다음의 답변글에 있다. (질문내용은 생략)
--------
spotlights have a position and a direction. Position is the same as the other lights. The direction of the spotlight is a direction vector pointing in the direction the spotlight is aimed.
---------------------------------------------------
참조 위치: http://www.gamedev.net/community/forums/topic.asp?topic_id=518088
Look up homogenous coordinates. Basically, a coordinate (x, y, z, w) in 4D homogenous space is equal to (x/w, y/w, z/w) in 3D space. When w=1, you have the 3D subspace of 4D homogenous space which corresponds to 3D space. That is, the point is located at (x/1, y/1, z/1).
Now see what happens as w approaches 0. For w=0.1, the point is (10*x, 10*y, 10*z). For w=0.001, the point is (1000*x, 1000*y, 1000*z). As w approaches 0, the point (x/w, y/w, z/w) approaches a point at infinity in the direction from the origin towards (x, y, z).
Therefore, a light positioned at (0, 0, 1, 0) is located an infinite distance from the origin in the direction (0, 0, 1), which means the light is shining in the direction (0, 0, -1) from infinity towards the origin.
In short, when specifying directional lights, the vector is not the direction of the light. It is the direction towards the light source from the origin.
--------
자세하고 직관적인 설명이다. 되새겨 봐야겠다.
덧붙여
GL_SPOT_DIRECTION
, ... ) 의 ...부분은 빛이 향하는 점을 3개의 좌표로 적으면 된다.GL_POSITON과는 반대라는 의미.그리고 빛의 위치는 GL_POSITION으로 주면 될 것이다..
이에 관련된 내용도 다음의 답변글에 있다. (질문내용은 생략)
--------
spotlights have a position and a direction. Position is the same as the other lights. The direction of the spotlight is a direction vector pointing in the direction the spotlight is aimed.
'그래픽스 관련' 카테고리의 다른 글
[Maya] C++ API 중 MMatrix, xform -matrix의 옵션 (0) | 2011.06.22 |
---|---|
[Maya] Setting up Visual Studio 2010 for Maya Plugin Development (0) | 2011.06.17 |
(OpenGL) Get Matrix (0) | 2009.12.06 |
기초상식. 1080p (0) | 2009.10.30 |
기초상식. NTSC와 PAL. (네이버지식IN) (0) | 2009.10.30 |