Lighting Effect

Light Source Type

Point light

post_thumbnail

  • ๊ด‘์› ์ง€์ ์—์„œ ์ „ ๋ฐฉํ–ฅ์œผ๋กœ ๋น›์„ ๋ฐœ์‚ฌ
  • ๊ด‘์›์œผ๋กœ๋ถ€ํ„ฐ ๋ฉ€์–ด์งˆ์ˆ˜๋ก attenuation ๊ณต์‹์— ๋”ฐ๋ผ ๋ฐ๊ธฐ ์กฐ์ •
    • lighting position์— ์˜์กด์ 
  • constant, linear, quadratic, distance์— ๋”ฐ๋ผ ์—ฐ์‚ฐ
  • ex) ์ „๊ตฌ

Directional light

post_thumbnail

  • ๋น›์˜ ๋ฐฉํ–ฅ์„ฑ๊ณผ ์ƒ‰๋งŒ์„ ๊ฐ€์ง€๊ณ  ์—ฐ์‚ฐ
    • ๊ด‘์›๊ณผ์˜ ๊ฑฐ๋ฆฌ๊ฐ€ ๋ฌดํ•œ์ •์œผ๋กœ ๋ฉ€๋‹ค๋Š” ๊ฐ€์ •
    • ๋ฌผ์ฒด ํ‘œ๋ฉด์— ๋„๋‹ฌํ•˜๋Š” ๋น›์˜ ๋ฐฉํ–ฅ์€ ๋ชจ๋‘ ํ‰ํ–‰
    • attenuation์€ ๊ณ ๋ คํ•˜์ง€ ์•Š์Œ
  • ex) ํƒœ์–‘๊ด‘

Spotlight

post_thumbnail

  • ๊ด‘์›์ง€์ ์—์„œ ํŠน์ • ๋ฐฉํ–ฅ์œผ๋กœ๋งŒ ๋น›์„ ๋ฐœ์‚ฌ
    • cut off angle
    • ๋น›์˜ ์ง„ํ–‰ ๋ชจํ˜•์€ cone๊ณผ ์œ ์‚ฌ
  • point light์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ attenuation ๊ณต์‹์— ๋”ฐ๋ผ ๋ฐ๊ธฐ ์กฐ์ •
  • ํŠน์ • ๋ฐฉํ–ฅ/๊ฐ๋„์—์„œ์˜ ๋ผ์ดํŒ… ์ดํŽ™ํŠธ๊ฐ€ ๊ฐ•์กฐ๋˜๋„๋ก spotlightEffect ์—ฐ์‚ฐ
  • innerAngle
    • ๊ฐ•์กฐ๋˜๋Š” ๋‚ด๋ถ€ ์›๋ฟ” ์˜์—ญ
    • ๋น›์˜ intensity๊ฐ€ ์ผ์ •
  • outerAngle
    • ์ ์  ํ๋ ค์ง€๋Š” ์™ธ๋ถ€ ์›๋ฟ” ์˜์—ญ
    • outerAngle์˜ ์™ธ๋ถ€ ๋น›์˜ intensity = 0
  • ๋น› ๊ฐ•๋„๋ฅผ 0 - 1์‚ฌ์ด๋กœ clamp

Lighting and Material

  • ๊ฐ lighting map์„ ๋ชจ๋‘ ํ•ฉ์‚ฐํ•œ ๊ฒฐ๊ณผ ๊ฐ’์œผ๋กœ ๋น› ํšจ๊ณผ ์—ฐ์‚ฐ

Ambient

post_thumbnail

  • ์ฃผ๋ณ€๊ด‘, ๊ด‘์›์ด ๋ถˆ๋ถ„๋ช…ํ•œ ๋น›
    • Lighting Direction์„ ์ •์˜ํ•  ์ˆ˜ ์—†์Œ
  • ์ผ์ •ํ•œ ๋ฐ๊ธฐ์™€ ์ƒ‰์œผ๋กœ ํ‘œํ˜„ ๊ฐ€๋Šฅ
  • I_ambient = I_a * K_a
    • I_a: ambient lighting์˜ ์„ธ๊ธฐ
    • K_a: ambient lighting์ด ์ตœ์ข… ํ‘œ๋ฉด์— ๋„์ฐฉํ•˜๊ธฐ ๊นŒ์ง€ ๋ช‡ ๋ฒˆ์˜ ๋ฐ˜์‚ฌ๋ฅผ ๊ฑฐ์ณค๋Š”์ง€์˜ coefficient

Diffuse

post_thumbnail

  • ๋น›์œผ๋กœ๋ถ€ํ„ฐ ๊ณง์žฅ ๋“ค์–ด์™€ ๋ฌผ์ฒด ํ‘œ๋ฉด์— ๋ฟŒ๋ ค์ง
  • ๊ฐ๋„์— ๋”ฐ๋ผ ๋ฐ๊ธฐ๊ฐ€ ๋‹ค๋ฆ„
  • I_diffuse = I_d * K_d * cosฮธ = I_d * K_d * (N*L)
    • I_d: diffuse lighting์˜ ์„ธ๊ธฐ
    • K_d: ๋ฌผ์ฒด ํ‘œ๋ฉด ๋ฐ˜์‚ฌ์— ๋Œ€ํ•œ coefficient
    • N: face normal unit vector
    • L: ๋ฌผ์ฒด ํ‘œ๋ฉด์—์„œ ๊ด‘์› ๋ฐฉํ–ฅ์œผ๋กœ์˜ unit vector
    • ฮธ: face normal๊ณผ L์˜ ์‚ฌ์ด๊ฐ
  • N๊ณผ L์˜ ์‚ฌ์ด๊ฐ์ด 90๋ณด๋‹ค ์ปค์ง€๋ฉด diffuse ์˜ ๊ฐ’์€ 0
    • I_diffuse = I_d * K_d * max(N*L, 0) ๊ณผ ๊ฐ™์ด ์กฐ์ •
  • diffuse ๊ฐ’์˜ ์—ฐ์‚ฐ์€ viewer๋ฅผ ๊ณ ๋ คํ•˜์ง€ ์•Š๊ณ  ์—ฐ์‚ฐํ•˜๊ธฐ ๋•Œ๋ฌธ์— viewer์˜ ์œ„์น˜ ๋ฐ ๊ฐ๋„๋กœ๋ถ€ํ„ฐ ๋…๋ฆฝ

Specular

post_thumbnail

  • diffuse์™€ ๋™์ผํ•˜๊ฒŒ ๊ด‘์›์—์„œ ์ง์ ‘ ๋“ค์–ด์˜ค๋Š” ๋น›
    • ๊ทธ๋Ÿฌ๋‚˜ ํŠน์ •ํ•œ ๋ฐฉํ–ฅ์œผ๋กœ ์™„์ „ํžˆ ๋ฐ˜์‚ฌ๋˜๋Š” ๋น›
    • viewer์˜ ์œ„์น˜์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง
  • ํฐ์ƒ‰์˜ ๊ด‘์œผ๋กœ ํ‘œํ˜„
  • R๊ณผ V์˜ ์‚ฌ์ด๊ฐ์ด 90๋ณด๋‹ค ์ปค์ง€๋ฉด specular ์˜ ๊ฐ’์€ 0
    • diffuse๊ฐ€ 0์ด๋˜๋ฉด specular ์—ญ์‹œ 0

post_thumbnail

  • I_specular = I_s * K_s * (R*V)^ns
    • I_s: specular lighting์˜ ์„ธ๊ธฐ
    • K_s: ๋ฌผ์ฒด ํ‘œ๋ฉด ๋ฐ˜์‚ฌ์— ๋Œ€ํ•œ coefficient
    • R: reflection unit vector
    • V: ๋ฌผ์ฒด ํ‘œ๋ฉด์—์„œ viweer ๋ฐฉํ–ฅ์œผ๋กœ์˜ unit vector
    • ns: ํ‘œ๋ฉด ์งˆ๊ฐ์— ๋”ฐ๋ผ ๋ฐ˜์‚ฌ๋˜๋Š” ๊ด‘๋Ÿ‰์ด๋‚˜ ๋ฒ”์œ„๋ฅผ ์กฐ์ ˆํ•˜๋Š” index
  • R = 2N - L = 2(N*L) * abs(N) - L

Emissive

post_thumbnail

  • ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์Šค์Šค๋กœ ๋ฐœ์‚ฐํ•˜๋Š” ๋น›
    • ๋‹ค๋ฅธ ๋น›์— ์˜ํ•ด ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š์Œ
    • Material์˜ ์†์„ฑ์ผ ๋ฟ, ๊ด‘์›์ด ๋ฐœ์‚ฐํ•˜๋Š” ๋น›์ด ์•„๋‹˜

Shading

Phong lighting

  • ๋ผ์ดํŒ… ์ดํŽ™ํŠธ๋ฅผ ํ”ฝ์…€์ด ์•„๋‹Œ ๋ฒ„ํ…์Šค ๋‹จ์œ„๋กœ ์—ฐ์‚ฐ

Phong shading

  • ๋ผ์ดํŒ… ์ดํŽ™ํŠธ๋ฅผ ํ”ฝ์…€ ๋‹จ์œ„๋กœ ์—ฐ์‚ฐ
  • ๋ฆฌํ”Œ๋ ‰์…˜ ๋ฒกํ„ฐ๋ฅผ ์ด์šฉ
    • R = 2{(NL)*Norm(N)} - N

Blinn shading

post_thumbnail post_thumbnail

  • ํ ์‰์ด๋”ฉ์—์„œ ๋ฆฌํ”Œ๋ ‰์…˜ ๋ฒกํ„ฐ๋ฅผ ์ด์šฉํ•˜๋Š” ๋Œ€์‹  ํ•˜ํ”„ ๋ฒกํ„ฐ๋ฅผ ์ด์šฉ
    • Half Vector = Lighting Vector + Viewer Vector
  • ๋” ๊ด‘๋ฒ”์œ„ํ•˜๊ณ  ํ‰ํ‰ํ•œ ํ‘œ๋ฉด์— ๋Œ€ํ•ด ์—ฐ์‚ฐ์ด ํšจ์œจ์ 
    • Reflection Vector(R)๋ฅผ ์ผ์ผ์ด ์—ฐ์‚ฐํ•  ํ•„์š” ์—†์Œ
    • ๊ด‘์›๊ณผ viewer๊ฐ€ ๋ฌผ์ฒด๋กœ๋ถ€ํ„ฐ ์–ด๋Š ์ •๋„ ๋ฉ€๋”๋ผ๋„, V์™€ L์€ ์ƒ์ˆ˜
    • specular ๊ฐ’์˜ ์™œ๊ณก์„ ๋ฐฉ์ง€
  • Lighting Direction = -(Lighting Vector)
    • ๊ด‘์›์—์„œ fragments๋กœ ํ–ฅํ•˜๋Š” ๋ฒกํ„ฐ

์ถœ์ฒ˜