SX 3 2 15 Reduction of Lighting Calculations

  • Slides: 24
Download presentation
SX 3 -2. 15 Reduction of Lighting Calculations Using Spherical Harmonics 조욱래 mech 12@nate.

SX 3 -2. 15 Reduction of Lighting Calculations Using Spherical Harmonics 조욱래 mech 12@nate. com www. cafe. naver. com/shader

Spherical Harmonics Based Lighting

Spherical Harmonics Based Lighting

Irradiance ± ± . Amount of light incident onto a point Computed by intergrating

Irradiance ± ± . Amount of light incident onto a point Computed by intergrating the incoming light ® E : Irradiance , Function of surface normal ® n : surface normal ® w : incoming light direction ® L(w) : whole environment map light

Coefficients Ylm ± Polynomial form ® X, y, z : cartesian coord of the

Coefficients Ylm ± Polynomial form ® X, y, z : cartesian coord of the incident vector

± E : expressed function of L ® Theta , pi : spherical coord

± E : expressed function of L ® Theta , pi : spherical coord ® A : term of dependent on n and w ® Alpha : error term ® p, q : number of term ® [Ramamoorthi 01]의하면 coeffi값은 9개정도만 해 도 높은 정밀도의 결과를 얻을수 있다.

Coefficents ± ± l = 0, 1, 2 m= 0 ® -1, 0, 1

Coefficents ± ± l = 0, 1, 2 m= 0 ® -1, 0, 1 ® -2, -1, 0, 1, 2 ®

게임상의 구현 ± 1 st : encode the lighting ENV in SH term. ®

게임상의 구현 ± 1 st : encode the lighting ENV in SH term. ® Static Light ENV Calculated offline ® distant sun, etc… ® Static is not mean cannot be rotated. ® ® SH Property is rotationally invriant. ® Dnynamic light source Need to encoding real time ® This mean calculating the Llm terms ®

게임상의 구현(2) ± 2 nd : calculating the actual irradiance, E ® E depends

게임상의 구현(2) ± 2 nd : calculating the actual irradiance, E ® E depends on theta , pi (Spherical coord) , and surface normal. ® 그래서 물체가 렌더링 되는 시점에서 계산되 야함.

The Two Methods

The Two Methods

Analytical Lights ± Spot, point light, etc ® 빛이 무한대에 위치한다고 가정. ® Lighting

Analytical Lights ± Spot, point light, etc ® 빛이 무한대에 위치한다고 가정. ® Lighting ENV map의 일부로 가정. ® 각각의 빛은 해당 SH coeffi를 spatail domain 이나 frequency domain에서 쉽게 더함으로 해서 적용될 수 있다. ® Run time

Surface Lights ± Sky , pre-rendered ENV map, HDR, non-HDR map, bulb , neon

Surface Lights ± Sky , pre-rendered ENV map, HDR, non-HDR map, bulb , neon light ® 전역광에 의한 더 정확한 사실 묘사에 유용. ± Ylm : Nine coefficents ® L=(0, 1, 2) and m=(-2, -1, 0, 1, 2) ± Llm ® ± Light weight of ENV map L ® 한지점에서의 빛세기.

Determining the Lights’ Contribution to the Scene

Determining the Lights’ Contribution to the Scene

Putting It All Together-Code Explanation SH를 이용한 빛 계산은 크게 CPU tiime과 GPU time으로

Putting It All Together-Code Explanation SH를 이용한 빛 계산은 크게 CPU tiime과 GPU time으로 분리된다. (GPU의 성능에 크게 영향을 받음. )

Surface Lights ± Compute SH’s coefficients

Surface Lights ± Compute SH’s coefficients

Analytical Lights ± To turn analytical light into SH

Analytical Lights ± To turn analytical light into SH

ENV map & Cube map (? ? ? ) Foreach ( 9 coeffi) //l,

ENV map & Cube map (? ? ? ) Foreach ( 9 coeffi) //l, m For(every pixel in ENV map) Foreach ( 9 coeffi) //l, m For(pixels in 6 faces of ENV map) Get 2 D coeffi 극좌표->2 D 좌표& face ‘n’ -> 3 D좌표 극좌표->3 D좌표 Ylm계산 Integra += samplevalue(xp, yp) * Ylm CPU GPU Color계산 using normal & coeffi. Blend this with other incomming colour & vertex color

장단점 ± Vertex Program Work ® Fast ® Poor quality in low tessellated geometry

장단점 ± Vertex Program Work ® Fast ® Poor quality in low tessellated geometry ± Fragments Program Work ® Looks good ( diffuse light per pixel ) ® Slow

최종분석 ± Shader. X 3 -2. 15. vsd

최종분석 ± Shader. X 3 -2. 15. vsd

Q&A

Q&A