다 해상도 지연 셰이딩
Multi-Resolution Deferred Shading
                 Game Programming Gems 8




                         http://cafe.naver.com/shader
|개요
• 기존의 deferred shading에 적응적 부분 표
 준화(adaptive sub-sampling)를 적용
 – Adaptive Sub-sampling :
  넓은 영역은 큰 붓, 좁은 영역은 작은 붓



• 눈에 띄는 손해 없이 PS 의 cost 절감
|발전과정


            Light Pre-
 Deferred                Inferred
               pass
 Shading                 Lighting
            rendering
Deferred      Light Pre-pass    Inferred
  Shading          rendering      Lighting



• 렌더링에 필요한 정보를 G-Buffer에 저장
 – Depth, normal, 반사율(reflecxibility) 등

 – Memory와 Cost의 trade-off

• 최종 렌더링을 Per-pixel 처리로 대체
 – Lighting Cost와 scene complexity 가 무관
Deferred    Light Pre-pass   Inferred
    Shading        rendering     Lighting



• Material정보를 G-Buf에 저장하지 않음

• 최종 합성 전 light-pass를 두고 L-buffer 에
 lighting 처리 정보만을 따로 저장

• Obj를 다시 그리면서(2nd pass) 고유 material
 정보와 L-buffer 정보를 합성

• H/W anti-aliasing 지원
Deferred   Light Pre-pass   Inferred
   Shading       rendering     Lighting



• G-buf, L-buf 를 저해상도로 생성(대역폭 향
 상)
• Up-sampling 시 Discontinuity를 해결하기
 위해 depth, Obj ID를 이용해서 경계선을
 필터링(DSF필터링)
• 투명한 오브젝트 처리 가능
|Multi-resolution Deferred Shading

• 모든 픽셀에 대해 lighting을 계산하는
 deferred shading을 개선

• 비슷한 영역은 저해상도에서 처리 후 보간
 하여 고해상도 버퍼에 적용
|Process

• Geometry pass

• Multi-resolution rendering pass

• Composite pass
|Geometry pass
• Deferred shading 과 같이 G-buf 를 채움
  – 어떤 G-buf 구성도 호환
|Multi-resolution rendering pass

• Resolution selection

• Shading

• Interpolation
|Multi-resolution rendering pass

• 3개의 R-buffer 사용
  – 전체 해상도, 1/4 해상도, 1/16 해상도

• Early-Z culling 사용
  – 픽셀단위 culling, 2-pass 기법(depth 먼저)
|Multi-resolution rendering pass
1.    저해상도 R-buf에 depth를 1로 채움(z-test : LessEqual)

2.    버퍼를 렌더링할 직사각형 메시의 Z좌표를
     Zi = 0.1 – i * 0.1 (i : 현재 버퍼의 index) 로 지정

3.    공간 근접도(spatial proximity) 비교하여 depth를 저장

* spatial proximity

 : 주변 픽셀과의 material ID, depth,

     normal 등을 비교(threshold 사용)하여 측정
|Multi-resolution rendering pass

3. 공간 근접도가 일정 threshold를 넘으면 depth
  를 기록하지 않고 기존의 depth를 남겨 상위 해
  상도에서 기록하도록 유도

4. z-test를 equal로 변경 후 lighting 값을 R-buf 에
  적용
|Multi-resolution rendering pass

5. R-buf를 위 단계 해상도 버퍼로 복사
 - Bilinear / Bi-cubic 필터링 적용

6. 위의 1 – 5 과정을 해상도를 올려가며 반복

-> 화면의 각 픽셀이 적합한 해상도의 R-buf 로
shading 됨
|Multi-resolution rendering pass

BUT!

• Lighting, shadow에 artifact 가능성 존재

• Lighting시 빛을 받는 픽셀은 1, 그 외에는 0
 을 알파채널에 저장
  – 알파 값이 다른 부분은 상위 해상도에서 처리
|Multi-resolution rendering pass

• Shadow 중 penumbra 영역에 대해서도 알
 파 값을 0으로 지정해 상위 해상도에서 계
 산
|Multi-resolution rendering pass




                           출처:GPG 8
|Composite pass

• 전체 해상도 R-Buf의 값과 G-buf에 미리 저
 장한 값들을 이용하여 최종 shading 수행

• MSAA를 위해 geometry를 다시 그릴 수도
 있음 (lighting pre-pass처럼)
|마무리

• Low frequency에서의 렌더링 cost 절약

• Diffuse interreflection, subsurface light
  diffusion을 위한 GPU기반 빛 클러스터링
  기법(light pyramid)들에 적용 가능
  – 테스트 결과, 1.5 – 2.0배 까지 성능 향상
| 감사합니다.

다해상도 지연 렌더링

  • 1.
    다 해상도 지연셰이딩 Multi-Resolution Deferred Shading Game Programming Gems 8 http://cafe.naver.com/shader
  • 2.
    |개요 • 기존의 deferredshading에 적응적 부분 표 준화(adaptive sub-sampling)를 적용 – Adaptive Sub-sampling : 넓은 영역은 큰 붓, 좁은 영역은 작은 붓 • 눈에 띄는 손해 없이 PS 의 cost 절감
  • 3.
    |발전과정 Light Pre- Deferred Inferred pass Shading Lighting rendering
  • 4.
    Deferred Light Pre-pass Inferred Shading rendering Lighting • 렌더링에 필요한 정보를 G-Buffer에 저장 – Depth, normal, 반사율(reflecxibility) 등 – Memory와 Cost의 trade-off • 최종 렌더링을 Per-pixel 처리로 대체 – Lighting Cost와 scene complexity 가 무관
  • 5.
    Deferred Light Pre-pass Inferred Shading rendering Lighting • Material정보를 G-Buf에 저장하지 않음 • 최종 합성 전 light-pass를 두고 L-buffer 에 lighting 처리 정보만을 따로 저장 • Obj를 다시 그리면서(2nd pass) 고유 material 정보와 L-buffer 정보를 합성 • H/W anti-aliasing 지원
  • 6.
    Deferred Light Pre-pass Inferred Shading rendering Lighting • G-buf, L-buf 를 저해상도로 생성(대역폭 향 상) • Up-sampling 시 Discontinuity를 해결하기 위해 depth, Obj ID를 이용해서 경계선을 필터링(DSF필터링) • 투명한 오브젝트 처리 가능
  • 7.
    |Multi-resolution Deferred Shading •모든 픽셀에 대해 lighting을 계산하는 deferred shading을 개선 • 비슷한 영역은 저해상도에서 처리 후 보간 하여 고해상도 버퍼에 적용
  • 8.
    |Process • Geometry pass •Multi-resolution rendering pass • Composite pass
  • 9.
    |Geometry pass • Deferredshading 과 같이 G-buf 를 채움 – 어떤 G-buf 구성도 호환
  • 10.
    |Multi-resolution rendering pass •Resolution selection • Shading • Interpolation
  • 11.
    |Multi-resolution rendering pass •3개의 R-buffer 사용 – 전체 해상도, 1/4 해상도, 1/16 해상도 • Early-Z culling 사용 – 픽셀단위 culling, 2-pass 기법(depth 먼저)
  • 12.
    |Multi-resolution rendering pass 1. 저해상도 R-buf에 depth를 1로 채움(z-test : LessEqual) 2. 버퍼를 렌더링할 직사각형 메시의 Z좌표를 Zi = 0.1 – i * 0.1 (i : 현재 버퍼의 index) 로 지정 3. 공간 근접도(spatial proximity) 비교하여 depth를 저장 * spatial proximity : 주변 픽셀과의 material ID, depth, normal 등을 비교(threshold 사용)하여 측정
  • 13.
    |Multi-resolution rendering pass 3.공간 근접도가 일정 threshold를 넘으면 depth 를 기록하지 않고 기존의 depth를 남겨 상위 해 상도에서 기록하도록 유도 4. z-test를 equal로 변경 후 lighting 값을 R-buf 에 적용
  • 14.
    |Multi-resolution rendering pass 5.R-buf를 위 단계 해상도 버퍼로 복사 - Bilinear / Bi-cubic 필터링 적용 6. 위의 1 – 5 과정을 해상도를 올려가며 반복 -> 화면의 각 픽셀이 적합한 해상도의 R-buf 로 shading 됨
  • 15.
    |Multi-resolution rendering pass BUT! •Lighting, shadow에 artifact 가능성 존재 • Lighting시 빛을 받는 픽셀은 1, 그 외에는 0 을 알파채널에 저장 – 알파 값이 다른 부분은 상위 해상도에서 처리
  • 16.
    |Multi-resolution rendering pass •Shadow 중 penumbra 영역에 대해서도 알 파 값을 0으로 지정해 상위 해상도에서 계 산
  • 17.
  • 18.
    |Composite pass • 전체해상도 R-Buf의 값과 G-buf에 미리 저 장한 값들을 이용하여 최종 shading 수행 • MSAA를 위해 geometry를 다시 그릴 수도 있음 (lighting pre-pass처럼)
  • 19.
    |마무리 • Low frequency에서의렌더링 cost 절약 • Diffuse interreflection, subsurface light diffusion을 위한 GPU기반 빛 클러스터링 기법(light pyramid)들에 적용 가능 – 테스트 결과, 1.5 – 2.0배 까지 성능 향상
  • 20.