Quick Flow
text
local -> World -> world -> View -> view -> Projection -> clip
clip.xyz / clip.w -> NDC -> viewport -> screen/depthDirect3D의 기본 NDC depth는 0..1입니다. Clip position은 아직 pixel 좌표가 아니며 rasterizer가 clipping과 perspective divide를 처리합니다.
값의 공간
Position은 w=1이라 translation을 받고 direction은 w=0이라 받지 않습니다. Lighting을 world space에서 계산하면 normal, light direction, camera position도 모두 world space로 맞춥니다.
화면이 좌우·앞뒤로 뒤집히면 행렬 하나만 transpose하기 전에 handedness, forward axis, winding, projection function과 shader multiplication convention을 표로 적어 확인합니다.
자주 틀리는 점
- Clip
z를 linear camera distance로 사용하지 않습니다. - World-space bounds에 local center만 더하고 rotation·scale을 무시하지 않습니다.
- View matrix를 camera world transform과 같은 방향의 행렬로 보지 않습니다.
- OpenGL의 NDC depth 관례를 D3D projection과 섞지 않습니다.
참고 링크
2 sources