Click here to load reader

Deferred Shading ( 지연 세이딩 )

  • Upload
    torin

  • View
    140

  • Download
    0

Embed Size (px)

DESCRIPTION

Deferred Shading ( 지연 세이딩 ). 박민근 ( 알콜코더 ) 네이버 초중급 게임 개발자 스터디 [ 데브루키 ] 2011.03.26. Real-Time Rendering. 최근 게임들은 수 많은 라이트와 수많은 오브젝트 들이 등장한다 . -> 라이팅 계산양의 증가. 리얼 타임 라이팅을 위한 세가지 주요 기법. 포워드 렌더링 (Forward Rendering) Single-pass, Multi-light Multi-pass, Multi-light 디퍼드 렌더링 - PowerPoint PPT Presentation

Citation preview

DIP Bridge pattern Layer architecture

Deferred Shading ( )() []2011.03.261

Real-Time Rendering .-> 2 (Forward Rendering)Single-pass, Multi-lightMulti-pass, Multi-light

Deferred Shading3 4Single-pass, multi-lightfor each object dofor each light doframebuffer= light_model(object,light);5

6Single-pass, multi-light . . 7Single-pass, multi-light1 , 50 [ ]1 * 508Multi-pass, multi-lightfor each light dofor each object affected by light doframebuffer+= light_model(object,light);9

10Multi-pass, multi-light . 1/object/light .Vertex Transform & setupAnisotropic filtering11Multi-pass, multi-light1 , 50 [ ]50 * 12 13Deferred Shadingfor each object doG-buffer = lighting properties of object;for each light doframebuffer+= light_model(G-buffer,light);14

15Deferred Shading , O(1) . 16Deferred Shading1 , 50 [ ] * 17Deferred Shading 2D .3D -> 2D . . .18Deferred Shading , (Deferred) .19Deferred Shading 1988 . Deferred .

!!20 MRT(Multi Render Target) 4 DirectX 9 6800 ShaderModel 3.0 !! 21 22

23

24

25

CryEngine 3

26 Unity Deferred Rendering

27 UDK() - Samaritan

28 29

30General Architecture

31G-Buffer?Geometry Buffer

Per-pixel NormalPositionDeffuse / Specular Albedo, Other Attributes32

33

34

35

36

37

38

39

40

41

42 (G )43 3D () G-Buffer !MRT(Multi Render Target) , 4 .DepthNormalDiffuse / Specular

44

45

462. ( )47 .Point Light = SphereSpot Light = coneSun = full Screen Quad

48 . Render Shadow Map FrameBuffer .

49 (accumlation) .Diffuse , Specular .

For each light:diffuse += diffuse(G-buff.N, L))specular += G-buff.spec * specular(G-buff.N, G-buff.P, L)50 Diffuse .framebuffer = diffuse * G-buff.diffuse + specular51Per-Pixel Lightingfloat4 PointLightingPS(VS_OUTPUT1 In) : COLOR{ half4 diffuseTex = tex2D(MRT0Sampler, In.TexCoord); half4 normalTex = tex2D(MRT1Sampler, In.TexCoord); half z = tex2D(MRT2Sampler, In.TexCoord);

//unpack half3 albedo = diffuseTex.xyz;//reconstruct original view-space position//normalize//diffuse lighting half NdotL = dot(normal, lightVec); half selfShadow = (NdotL > 0) ? 1 : 0; half3 diffuse = albedo * NdotL * selfShadow * LightColor;52Per-Pixel Lightingfloat4 PointLightingPS(VS_OUTPUT1 In) : COLOR{ () //compute half angle half3 halfAngle = normalize(lightVec + eyeVec);

half3 specular = max(pow(dot(halfAngle, normal), SpecularExponent), 0) * selfShadow; ()}53

54

55

56

57 58 O(1) , .

.59 , . G-Buffer . ( )60 . ( , , SSAO )

61 62MRT(Multi Render Target) . ? 63

MSAA(Anti Aliasing)2D (Aliasing) . , 64Transparency . 2D ( ) .65 66SSAO (Screen Space Amibent Occlusion)Motion BlurBloomHDR67

GI ( )

68 69Light Indexed Deferred Lightinglight volumescene light index , MSAA 2 pass ,

7071 , (ex. 2)72 , , , 73 (Bloom, HDR) , . (G-Buffer )

74 MMORPG , 75, MSAA, Transparency . ( )76 MMORPG FPS 77 Deferred Shading (Shader Study) Deferred Shading Codevania() Deferred Shading Tutorial - CodevaniaDeferred Shading NVIDIA ()HDR Deferred Shading NVIDIA ( ) 3D KILLZONE 2 Light Indexed Deferred Lighting Codevania78