# 5 - Vertex Processing 1

# Outline

  • Rasterization Pipeline & Vertex Processing
  • Modeling Transformation
  • Viewing Transformation

# Recall: Rasterization Pipeline

(3D ์žฅ๋ฉด์˜ ๊ธฐํ•˜ ์ •๋ณด๋ฅผ ํ”ฝ์…€ ๋‹จ์œ„์˜ 2D ์ด๋ฏธ์ง€๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์ผ๋ จ์˜ ์ฒ˜๋ฆฌ ๊ณผ์ •)

  • Vertex Processing
    • vertex๋ฅผ screen space๋กœ ๋ณ€ํ™˜
  • Primitive Processing
    • vertex๋“ค์„ polygon์œผ๋กœ ๊ตฌ์„ฑ
  • Scan Conversion
    • polygon์„ fragment ์ง‘ํ•ฉ์œผ๋กœ ๋ณ€ํ™˜
  • Fragment Processing
    • ๊ฐ fragment์˜ ์ƒ‰์ƒ ๊ฒฐ์ • (ํ…์Šค์ฒ˜, ์กฐ๋ช… ๋ชจ๋ธ ๋“ฑ ๊ณ ๋ ค)
  • Per-sample Operations
    • depth test, alpha blending ๋“ฑ ์ˆ˜ํ–‰
  • Vertex Processing:
    • ์ •์ ๋“ค์„ ํ™”๋ฉด ์ขŒํ‘œ๊ณ„๋กœ ๋ณ€ํ™˜
    • ์ผ๋ จ์˜ ์ •์  ๋ณ€ํ™˜ ์‹œํ€€์Šค๋ฅผ ์ ์šฉ
  • ์šฐ๋ฆฌ๊ฐ€ ์ง€๊ธˆ๊นŒ์ง€ ํ•™์Šตํ•œ ๋ฒ”์œ„๋Š”:
    • Primitive Processing ~ Per-sample Operations
  • ์˜ค๋Š˜๊ณผ ๋‹ค์Œ ์‹œ๊ฐ„์— ๋ณผ ๋‚ด์šฉ:
    • Vertex Processing

# Vertex Processing

  • ๊ฐ ๊ฐ์ฒด์˜ body frame์—์„œ์˜ ์ •์  ์œ„์น˜:

    $$ \mathbf{p}_1,\quad \mathbf{p}_2,\quad \mathbf{p}_3 $$

  • World frame์œผ๋กœ์˜ ๋ณ€ํ™˜:

    $$ \mathbf{M} \mathbf{p}_1,\quad \mathbf{M} \mathbf{p}_2,\quad \mathbf{M} \mathbf{p}_3 $$

  • โ†’ ํ•˜์ง€๋งŒ ์•„์ง ํ™”๋ฉด์— ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•ด์„  ์ถ”๊ฐ€ ๊ฐœ๋…์ด ํ•„์š”ํ•จ

    โ€œ์นด๋ฉ”๋ผโ€๊ฐ€ ์žฅ๋ฉด์„ ๋ฐ”๋ผ๋ณธ๋‹ค๋Š” ๊ฐœ๋… ๋„์ž… ํ•„์š”

  • ์ด์–ด์ง€๋Š” ๋‹จ๊ณ„:

    1. โ€œ์นด๋ฉ”๋ผโ€ ๋ฐฐ์น˜
    2. โ€œ๋ Œ์ฆˆโ€ ์„ ํƒ
    3. โ€œ์Šคํฌ๋ฆฐโ€์— ํˆฌ์‚ฌ

# In Terms of CG Transformation,

  1. ๊ฐ์ฒด ๋ฐฐ์น˜
    โ†’ Modeling Transformation
  2. ์นด๋ฉ”๋ผ ๋ฐฐ์น˜
    โ†’ Viewing Transformation
  3. ๋ Œ์ฆˆ ์„ ํƒ
    โ†’ Projection Transformation
  4. ํ™”๋ฉด์— ์ถœ๋ ฅ
    โ†’ Viewport Transformation
  • ์œ„ ๋ชจ๋“  ๋ณ€ํ™˜๋“ค์€ ํ–‰๋ ฌ ๊ณฑ์…ˆ์œผ๋กœ ๊ตฌ์„ฑ๋จ

# Vertex Processing (Transformation Pipeline)

  • Object space (body frame):
    • ๊ฐ์ฒด ๊ธฐ์ค€ ์ขŒํ‘œ๊ณ„
  • World space (world frame):
    • ์ „์ฒด ์žฅ๋ฉด ๊ธฐ์ค€ ์ขŒํ‘œ๊ณ„
  • ์ˆ˜ํ–‰ํ•  ์ž‘์—…:
    • ์ด๋™(translate), ํšŒ์ „(rotate), ํฌ๊ธฐ ์กฐ์ ˆ(scale) ๋“ฑ
    • ์ด์ „ ๊ฐ•์˜์—์„œ ๋‹ค๋ฃฌ ๋ชจ๋“  affine ๋ณ€ํ™˜ ํฌํ•จ

# Modeling transformation

  • ๊ฐ์ฒด ์ขŒํ‘œ๊ณ„ (object space) โ†’ world ์ขŒํ‘œ๊ณ„๋กœ ๋ณ€ํ™˜
  • ์ด์ „ ๊ฐ•์˜์—์„œ ๋ฐฐ์šด affine transformation์„ ์ ์šฉํ•จ

# Placing a โ€œcameraโ€

  • world ์ขŒํ‘œ๊ณ„ ์ƒ์—์„œ ์นด๋ฉ”๋ผ๋ฅผ ๋ฐฐ์น˜ํ•จ
  • view space (๋˜๋Š” camera space) ์ •์˜๋จ

# Viewing transformation

  • world space โ†’ camera space๋กœ ๋ณ€ํ™˜
  • ์ฆ‰, world ๊ธฐ์ค€ ์žฅ๋ฉด์„ ์นด๋ฉ”๋ผ ๊ธฐ์ค€์œผ๋กœ ์žฌ๋ฐฐ์—ด

# Selecting its โ€œlensโ€

  • ํˆฌ์˜ ๋ฐฉ์‹์„ ์ •์˜ํ•จ (์˜ˆ: perspective, orthographic ๋“ฑ)
  • view space โ†’ Clip space / NDC (normalized device coordinate) space

# Projection transformation

  • ์‹œ์•ผ๊ฐ(FOV), ์ข…ํšก๋น„, near/far plane ๋“ฑ์„ ๊ณ ๋ คํ•˜์—ฌ
    3D ๊ณต๊ฐ„์„ ์ •๊ทœํ™”๋œ ์žฅ์น˜ ์ขŒํ‘œ๊ณ„(NDC) ๋กœ ๋ณ€ํ™˜
  • ์ขŒํ‘œ ๋ฒ”์œ„: $(-1,~-1,~-1)$ ~ $(1,~1,~1)$

# Displaying on a โ€œcinema screenโ€

  • NDC ๊ณต๊ฐ„์„ ์ด๋ฏธ์ง€ ๊ณต๊ฐ„์œผ๋กœ ๋ณ€ํ™˜
  • ์ฆ‰, ํ”ฝ์…€ ์ขŒํ‘œ๊ณ„ ์ƒ์— ํ™”๋ฉด ์ถœ๋ ฅ

# Viewport transformation

  • NDC ์ขŒํ‘œ๋ฅผ ์‹ค์ œ ํ™”๋ฉด ํ•ด์ƒ๋„์— ๋งž๊ฒŒ ์Šค์ผ€์ผ ์กฐ์ •
  • ์ขŒํ‘œ๊ณ„๋ฅผ ์ •๊ทœํ™” ๊ณต๊ฐ„ โ†’ ์Šคํฌ๋ฆฐ ๊ณต๊ฐ„์œผ๋กœ ๋ณ€ํ™˜

# Transformation Pipeline ์ „์ฒด ์š”์•ฝ

Object space โ†’ View space โ†’ Clip space โ†’ Screen space

  1. Modeling transformation
  2. Viewing transformation
  3. Projection transformation
  4. Viewport transformation

โ†’ ๋ชจ๋“  ๊ณผ์ •์€ ํ–‰๋ ฌ๊ณฑ(Matrix Multiplication) ์œผ๋กœ ๊ตฌ์„ฑ๋จ

  • Modeling, Viewing, Projection, Viewport ๋ณ€ํ™˜์€
    4x4 ํ–‰๋ ฌ ๊ณฑ์…ˆ์œผ๋กœ ์ฒ˜๋ฆฌ๋จ

MVP Matrix ์ ์šฉ

  • ํ•˜๋‚˜์˜ ์  $\mathbf{p}_o$๊ฐ€
    • ๋ชจ๋ธ๋ง ๋ณ€ํ™˜: $\mathbf{M}$
    • ๋ทฐ์ž‰ ๋ณ€ํ™˜: $\mathbf{V}$
    • ํˆฌ์˜ ๋ณ€ํ™˜: $\mathbf{P}$
    • ๋ทฐํฌํŠธ ๋ณ€ํ™˜: $\mathbf{T}_{\mathbf{vp}}$
      ์„ ๊ฑฐ์ณ์„œ
    • ์ตœ์ข… ์œ„์น˜ $\mathbf{p}_s$๋กœ ๋ณ€ํ™˜๋จ

$$ \mathbf{p}_s=\mathbf{{T}_{vp} PVMp_o} $$

# Modeling Transformation

  • object space์—์„œ world space๋กœ์˜ ๋ณ€ํ™˜
    $$ \mathbf{p}_w = \mathbf{M} \mathbf{p}_o $$
  • ์ด๋•Œ $\mathbf{M}$์€ affine transformation๋“ค์˜ ์กฐํ•ฉ
  • ์˜ˆ: ์ด๋™, ํšŒ์ „, ์Šค์ผ€์ผ ๋“ฑ

# Recall: Directions of the "arrow"

  • $$ \mathbf{p}_w = \mathbf{M} \mathbf{p}^{\{1\}} $$
  • 1๋ฒˆ์งธ ์˜๋ฏธ: geometry ๋ณ€ํ™˜ ๋ฐฉํ–ฅ
  • 3๋ฒˆ์งธ ์˜๋ฏธ: frame์ด ๋ฐ”๋€Œ๋Š” ๊ด€์ ์—์„œ โ†’ ๋ฐฉํ–ฅ ๋ฐ˜๋Œ€๊ฐ€ ๋˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์ผ ์ˆ˜ ์žˆ์Œ

# Modeling Transformation

  • ๊ฐ์ฒด๋Š” object์˜ ๊ณ ์œ  ์ขŒํ‘œ๊ณ„ (body frame) ์— ์ •์˜๋จ
  • object โ†’ world ๋ณ€ํ™˜์„ modeling transformation์ด๋ผ ํ•˜๋ฉฐ
    ํ–‰๋ ฌ $\mathbf{M}$์œผ๋กœ ํ‘œํ˜„๋จ
  • ์ด ํ–‰๋ ฌ $\mathbf{M}$์€ ์ง€๊ธˆ๊นŒ์ง€ ๋ฐฐ์šด affine ๋ณ€ํ™˜ (์ด๋™, ํšŒ์ „, ์Šค์ผ€์ผ ๋“ฑ)์˜ ์กฐํ•ฉ

์˜ˆ์‹œ: ๋‹ค์ค‘ ๋ถ€ํ’ˆ์˜ modeling

  • ๋ฐ”ํ€ด, ์บ๋นˆ, ์ปจํ…Œ์ด๋„ˆ ๊ฐ๊ฐ์˜ object frame์—์„œ
    • modeling matrix $\mathbf{M}_{\text{wheel}},\ \mathbf{M}_{\text{cab}},\ \mathbf{M}_{\text{container}}$๋ฅผ ์ ์šฉ
    • ์ตœ์ข…์ ์œผ๋กœ world frame ์ƒ์˜ ์ „์ฒด ํŠธ๋Ÿญ ์œ„์น˜๊ฐ€ ๊ตฌ์„ฑ๋จ

# Quiz 1

# Viewing Transformation

  • Viewing transformation์€ world space์—์„œ camera space(view space)๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์—ฐ์‚ฐ์ด๋‹ค.
  • ๋ณ€ํ™˜๋œ ๊ฒฐ๊ณผ๋Š” ๊ฒฐ๊ตญ ํ™”๋ฉด์ƒ์˜ 2D ์ด๋ฏธ์ง€(screen space)์— ๋‚˜ํƒ€๋‚œ๋‹ค.
  • ์ด ๊ณผ์ •์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ˆ˜์‹์„ ๋”ฐ๋ฅธ๋‹ค:
    $$ \mathbf{p}_\mathbf{v} = \mathbf{V} \mathbf{p}_\mathbf{w} $$

# Recall that...

    1. ๊ฐ์ฒด ๋ฐฐ์น˜
      โ†’ Modeling transformation
    1. "์นด๋ฉ”๋ผ" ๋ฐฐ์น˜
      โ†’ Viewing transformation
    1. "๋ Œ์ฆˆ" ์„ ํƒ
      โ†’ Projection transformation
    1. "์Šคํฌ๋ฆฐ"์— ํ‘œ์‹œ
      โ†’ Viewport transformation

# Viewing Transformation

  • Viewing transformation์€ rigid transformation์œผ๋กœ์„œ, ํšŒ์ „๊ณผ ์ด๋™์„ ํฌํ•จํ•œ๋‹ค.
  • world space์—์„œ view space๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋ฉฐ, ๋ณ€ํ™˜ ํ–‰๋ ฌ์€ viewing matrix V์ด๋‹ค.
  • ๋ชฉ์ : camera frame ์ƒ์—์„œ ๋ชจ๋“  ๊ฐ์ฒด์˜ vertex๋“ค์„ ํ‘œํ˜„ํ•˜๋Š” ๊ฒƒ
  • ์ด๋ฅผ ์œ„ํ•ด camera frame์„ ์ •์˜ํ•ด์•ผ ํ•จ (world frame ๊ธฐ์ค€)
  • camera frame์„ ์ •์˜ํ•œ๋‹ค๋Š” ๊ฒƒ์€ ๊ณง ์นด๋ฉ”๋ผ์˜ ์œ„์น˜์™€ ๋ฐฉํ–ฅ์„ ๊ฒฐ์ •ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™๋‹ค.

# Defining Camera Frame 1 - "LookAt"

  • ์นด๋ฉ”๋ผ์˜ ์œ„์น˜์™€ ๋ฐฉํ–ฅ์„ ์ •์˜ํ•˜๋Š” ์—ฌ๋Ÿฌ ๋ฐฉ์‹์ด ์žˆ๋‹ค.
  • ๊ทธ ์ค‘ ์ง๊ด€์ ์ธ ๋ฐฉ์‹์œผ๋กœ lookat ํ•จ์ˆ˜๋ฅผ ์†Œ๊ฐœ:
    • Eye point: ์นด๋ฉ”๋ผ ์œ„์น˜
    • Look-at point: ์นด๋ฉ”๋ผ๊ฐ€ ๋ฐ”๋ผ๋ณด๋Š” ์ง€์ 
    • Up vector: ์–ด๋А ๋ฐฉํ–ฅ์ด ์œ„๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š”์ง€ ์„ค๋ช…

# [Demo] LookAt Function

# Defining Camera Frame 1 - "LookAt"

  • eye point, look-at point, up vector๊ฐ€ ์ฃผ์–ด์ง€๋ฉด, camera frame์„ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์นด๋ฉ”๋ผ ์ขŒํ‘œ์ถ•์œผ๋กœ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ $\mathbf{u},\ \mathbf{v},\ \mathbf{w}$ ๋ฒกํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ์ด๋Š” ๊ฐ๊ฐ ๋‹ค์Œ์„ ๋‚˜ํƒ€๋ƒ„:
    • $\mathbf{u}$: ์˜ค๋ฅธ์ชฝ ๋ฐฉํ–ฅ
    • $\mathbf{v}$: ์œ„์ชฝ ๋ฐฉํ–ฅ
    • $\mathbf{w}$: ๋’ค์ชฝ ๋ฐฉํ–ฅ
  • camera frame์„ ์ •์˜ํ•˜๋ ค๋ฉด $\mathbf{u},\ \mathbf{v},\ \mathbf{w}$ ๋ฒกํ„ฐ์™€ ์›์ ์„ ๊ตฌํ•ด์•ผ ํ•จ

# Given Eye point, Look-at point, Up vector

  • Eye point, Look-at point, Up vector๋ฅผ ์ด์šฉํ•˜์—ฌ ์นด๋ฉ”๋ผ ์ขŒํ‘œ๊ณ„๋ฅผ ์ •์˜ํ•œ๋‹ค.

# Getting origin point

  • Eye point ์ž์ฒด๊ฐ€ ์นด๋ฉ”๋ผ ์ขŒํ‘œ๊ณ„์˜ ์›์ ์ด ๋œ๋‹ค.

    $$ \text{origin of camera frame} = \mathbf{P}_{\text{eye}} $$

# Getting "w" axis vector

  • Look-at point๋ฅผ ๋ฐ”๋ผ๋ณด๋Š” ๋ฐฉํ–ฅ์„ $\mathbf{w}$์ถ•์œผ๋กœ ์ •์˜ํ•œ๋‹ค.

    $$ \mathbf{w} = \frac{\mathbf{P}_{\text{eye}} - \mathbf{P}_{\text{ref}}}{|| \mathbf{P}_{\text{eye}} - \mathbf{P}_{\text{ref}} ||} $$

# Getting "u" axis vector

  • up ๋ฐฉํ–ฅ ๋ฒกํ„ฐ์™€ $\mathbf{w}$ ๋ฒกํ„ฐ์˜ ์™ธ์ ์„ ํ†ตํ•ด $\mathbf{u}$ ์ถ•์„ ๊ณ„์‚ฐํ•œ๋‹ค.

    $$ \mathbf{u} = \frac{\mathbf{V}_{\text{up}} \times \mathbf{w}}{|| \mathbf{V}_{\text{up}} \times \mathbf{w} ||} $$

# Getting "v" axis vector

  • ์ง๊ต์ขŒํ‘œ๊ณ„๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ •์˜ํ•œ๋‹ค.

    $$ \mathbf{v} = \mathbf{w} \times \mathbf{u} $$

# Recall: 2) Affine Transformation Matrix defines an Affine Frame w.r.t. World Frame

  • Affine ๋ณ€ํ™˜ ํ–‰๋ ฌ M์€ ์ขŒํ‘œ๊ณ„(ํ”„๋ ˆ์ž„)๋ฅผ ๋ณ€ํ™˜ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋œ๋‹ค.

  • ํ”„๋ ˆ์ž„ $\{1\}$์€ ํ”„๋ ˆ์ž„ $\{0\}$ ๊ธฐ์ค€์œผ๋กœ ์ •์˜๋œ๋‹ค.

  • ์ขŒํ‘œ๊ณ„ ์ถ• $(x,~y,~z)$๊ณผ ์›์  ์ขŒํ‘œ๊ฐ€ ํ–‰๋ ฌ์˜ ์—ด(column)๋กœ ๊ตฌ์„ฑ๋œ๋‹ค:

    $$ \text{Frame } \{1\} \text{ in } \{0\} = \begin{bmatrix} \mathbf{x}_1 & \mathbf{y}_1 & \mathbf{z}_1 & \mathbf{p}_1 \end{bmatrix} $$

    ๋˜๋Š” 4ร—4 homogeneous form์œผ๋กœ ํ‘œํ˜„ํ•˜๋ฉด:

    $$ \begin{bmatrix} x_{1x} & y_{1x} & z_{1x} & p_{1x} \\ x_{1y} & y_{1y} & z_{1y} & p_{1y} \\ x_{1z} & y_{1z} & z_{1z} & p_{1z} \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

# Thus, the Camera Frame is defined by

$$ \mathbf{v=wxu}$$

$$ \begin{bmatrix} u_x & v_x & w_x & P_{\text{eye},x} \\ u_y & v_y & w_y & P_{\text{eye},y} \\ u_z & v_z & w_z & P_{\text{eye},z} \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

# How can we get viewing matrix $\mathbf{V}$ from the camera frame?

  • ๋ชจ๋ธ๋ง ๋ณ€ํ™˜์˜ ๋ฐฉ์‹๊ณผ ์œ ์‚ฌํ•˜๊ฒŒ viewing matrix $\mathbf{V}$๋ฅผ ๊ตฌํ•  ์ˆ˜ ์žˆ๋‹ค.

  • ๊ธฐ๋ณธ์ ์œผ๋กœ, ๊ฐ์ฒด์˜ body frame์—์„œ์˜ ์ขŒํ‘œ๋ฅผ world frame์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” affine matrix์˜ ์—ญํ–‰๋ ฌ์ด ๋ฐ”๋กœ viewing matrix๊ฐ€ ๋œ๋‹ค.

  • ๊ฐ์ฒด ๊ณต๊ฐ„(Object space)์„ ์นด๋ฉ”๋ผ ๊ณต๊ฐ„(Camera space)์œผ๋กœ ๋ฐ”๊พธ๋ฉด, ์–ด๋–ค ๋ณ€ํ™˜ ํ–‰๋ ฌ์ด ํ•„์š”ํ• ๊นŒ?

  • ๋ทฐ ๊ณต๊ฐ„(View space) โ†’ ์›”๋“œ ๊ณต๊ฐ„(World space) ๋ฐฉํ–ฅ์œผ๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค๋ฉด?

  • ์นด๋ฉ”๋ผ ํ”„๋ ˆ์ž„์—์„œ์˜ ์ถ• ๋ฒกํ„ฐ $\mathbf{u},\ \mathbf{v},\ \mathbf{w}$์™€ ์›์  $\mathbf{P}_{\text{eye}}$๋ฅผ ์‚ฌ์šฉํ•ด ๋ณ€ํ™˜ ํ–‰๋ ฌ์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.

  • ์ด ํ–‰๋ ฌ์ด ๋ฐ”๋กœ Rigid transformation matrix์ด๋‹ค.

    $$ \begin{bmatrix} u_x & v_x & w_x & P_{\text{eye},x} \\ u_y & v_y & w_y & P_{\text{eye},y} \\ u_z & v_z & w_z & P_{\text{eye},z} \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

# Viewing Transformation is the Opposite Direction

  • Viewing matrix $\mathbf{V}$๋Š” ์œ„์˜ ํ–‰๋ ฌ์˜ ์—ญํ–‰๋ ฌ๋กœ ์ •์˜๋œ๋‹ค.

  • ์ฆ‰, ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ์œผ๋กœ์˜ ๋ณ€ํ™˜์ด๋‹ค.

    $$ \mathbf{V} = \begin{bmatrix} \mathbf{R} & \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix}^{-1} = \begin{bmatrix} \mathbf{R}^\top & -\mathbf{R}^\top \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix} $$

# Inverting Rigid Transformation Matrix

  • 3ร—3 ํšŒ์ „ ํ–‰๋ ฌ $\mathbf{R}$๊ณผ 3ร—1 ์ด๋™ ๋ฒกํ„ฐ $\mathbf{t}$๋ฅผ ํฌํ•จํ•œ rigid ๋ณ€ํ™˜ ํ–‰๋ ฌ $\mathbf{T}$์˜ ์—ญํ–‰๋ ฌ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค:

    $$ \mathbf{T} = \begin{bmatrix} \mathbf{R} & \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix} \quad \Rightarrow \quad \mathbf{T}^{-1} = \begin{bmatrix} \mathbf{R}^\top & -\mathbf{R}^\top \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix} $$

  • ์นด๋ฉ”๋ผ ํ”„๋ ˆ์ž„ ํ–‰๋ ฌ์˜ ๊ฒฝ์šฐ, $\mathbf{R}$์€ $\mathbf{u},\ \mathbf{v},\ \mathbf{w}$ ๋ฐฉํ–ฅ ๋ฒกํ„ฐ๋กœ ์ด๋ฃจ์–ด์ง„๋‹ค.

# Viewing Transformation is the Opposite Direction

  • $\mathbf{V}$๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ช…์‹œ์ ์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค:

    $$ \mathbf{V} = \begin{bmatrix} u_x & v_x & w_x & -\mathbf{u} \cdot \mathbf{P}_{\text{eye}} \\ u_y & v_y & w_y & -\mathbf{v} \cdot \mathbf{P}_{\text{eye}} \\ u_z & v_z & w_z & -\mathbf{w} \cdot \mathbf{P}_{\text{eye}} \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

# Defining Camera Frame 2 - Translate & Rotate

  • LookAt ํ•จ์ˆ˜ ์™ธ์—๋„, ์นด๋ฉ”๋ผ์˜ ์œ„์น˜์™€ ๋ฐฉํ–ฅ์„ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค.
  • ๋‹จ์ˆœํžˆ translateํ•˜๊ณ  rotateํ•˜๋ฉด rigid transformation ํ–‰๋ ฌ๋กœ ์ •์˜ ๊ฐ€๋Šฅํ•˜๋‹ค.

# [Demo] Translate & Rotate Camera

# Moving Camera vs Moving World

  • ์‚ฌ์‹ค, ์ด ๋‘˜์€ ๋™๋“ฑํ•œ ์—ฐ์‚ฐ์ด๋‹ค.
  • ์นด๋ฉ”๋ผ๋ฅผ $(1,~0,~2)$๋งŒํผ ์ด๋™์‹œํ‚ค๋Š” ๊ฒƒ์€
    == ์›”๋“œ๋ฅผ $(-1,~0,~-2)$๋งŒํผ ์ด๋™์‹œํ‚ค๋Š” ๊ฒƒ๊ณผ ๊ฐ™๋‹ค.
  • ์นด๋ฉ”๋ผ๋ฅผ $y$์ถ• ๊ธฐ์ค€์œผ๋กœ $60\degree$ ํšŒ์ „์‹œํ‚ค๋Š” ๊ฒƒ์€
    == ์›”๋“œ๋ฅผ $y$์ถ• ๊ธฐ์ค€์œผ๋กœ $-60\degree$ ํšŒ์ „์‹œํ‚ค๋Š” ๊ฒƒ๊ณผ ๊ฐ™๋‹ค.

# [Demo] Moving Camera vs. Moving World