[1106 조진현] if you( batch rendering )

39
조 진현

Upload: -

Post on 05-Jul-2015

1.409 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: [1106 조진현] if you( batch rendering )

조 진현

Page 2: [1106 조진현] if you( batch rendering )

정적인 오브젝트에만 국한된 얘기들이다.

Page 3: [1106 조진현] if you( batch rendering )
Page 4: [1106 조진현] if you( batch rendering )
Page 5: [1106 조진현] if you( batch rendering )

3D RENDERING OPTIMIZING #4- 박 민 근 (민군)DEVROOKIE(CAFÉ.NAVER.COM/DEVROOKIE)

5DevRookie박민근(민군)

Page 6: [1106 조진현] if you( batch rendering )

별도의 작업없이그냥 렌더링만 하게

해주세요~~~

Page 7: [1106 조진현] if you( batch rendering )

Future GPUs will make it better!? Really?

Page 8: [1106 조진현] if you( batch rendering )
Page 9: [1106 조진현] if you( batch rendering )

과거에는 CPU 사이클을 줄이는 것.

현재는 병목 현상을 제거하는 것.

Page 10: [1106 조진현] if you( batch rendering )

대역폭

Vertex

Format

(Byte)

Half

16bit순차적접근

GPU 활용Lock

Cache

Memory

POOL

텍스쳐옵션압축

Page 11: [1106 조진현] if you( batch rendering )
Page 12: [1106 조진현] if you( batch rendering )
Page 13: [1106 조진현] if you( batch rendering )

폴리곤을 그리지 않는 것!

폴리곤을 효과적으로 렌더링 하는 것!

Page 14: [1106 조진현] if you( batch rendering )
Page 15: [1106 조진현] if you( batch rendering )

DrawXXXPrimitiveUp

DrawPrimitive

Page 16: [1106 조진현] if you( batch rendering )

파이프라인은 필연적으로 통과한다.

즉, 할만큼 다 제거했다… 그 이후의 작업~

Page 17: [1106 조진현] if you( batch rendering )

Object : 11개

Texture : 4장

Material : 5개

Shader : 2종

Page 18: [1106 조진현] if you( batch rendering )

For( 오브젝트 개수 만큼 )

{

스테이트 셋팅()

행렬 셋팅()

텍스쳐 바인딩()

버퍼 바인딩()

그리기 명령()

}

Page 19: [1106 조진현] if you( batch rendering )

오브젝트 정렬 후…

For( 오브젝트 개수 만큼 )

{

스테이트 셋팅()

행렬 셋팅()

텍스쳐 바인딩()

버퍼 바인딩()

그리기 명령()

}

Page 20: [1106 조진현] if you( batch rendering )

Material 별로 정리 후 정렬.

( 같은 Material 별로 그룹화 )

For( Material 그룹화 개수 만큼 )

Material 바인딩.

for( 그룹내 오브젝트 개수 만큼 )

행렬세팅()

버퍼 바인딩()

그리기 명령()

Page 21: [1106 조진현] if you( batch rendering )

투명한 오브젝트와 불투명한 오브젝트로 분류. ( 투명 그룹, 불투명 그룹 )

For ( 각 투명 그룹에 대하여 )

알파 관련 셋팅

각각에 대해서 Material 별로 정리

Material 별로 정리 후 정렬.

( 같은 Material 별로 그룹화 )

For( Material 그룹화 개수 만큼 )

Material 바인딩.

for( 그룹내 오브젝트 개수 만큼 )

행렬세팅()

버퍼 바인딩()

그리기 명령()

Page 22: [1106 조진현] if you( batch rendering )

되도록 많은 것을 하나의 버퍼로 묶어라.

복수의 Stream 에 연결하라~

반드시 Strip 화 시켜라.

Page 23: [1106 조진현] if you( batch rendering )
Page 24: [1106 조진현] if you( batch rendering )

H/W

Designers

Driver

Architects

API / Runtime

Architects

Application

Developers

Page 25: [1106 조진현] if you( batch rendering )

Application

Driver

Core API / HLSL / Runtime

Hardware

Page 26: [1106 조진현] if you( batch rendering )

시스템에서 목적으로 하는 효과를 얻기 위해

본질적인 것은 아니지만 요구되는 작동,

또는 그 때문에 필요한 자원.

필연적인 것!!!

Page 27: [1106 조진현] if you( batch rendering )
Page 28: [1106 조진현] if you( batch rendering )

DrawIndexedPrimitive()

GPU 에게 n개의 폴리곤을 렌더링을 명령하는 작업.

같은 State들을 가지는 삼각형들의 묶음

Batch를 렌더링 하기 위해서는

반드시 State 들이 먼저 설정되어야 한다.

State가 변경되면, 최소 2개의 Batch가 필요.

Page 29: [1106 조진현] if you( batch rendering )

어떤 State 변화가일어나는가?

얼마나 많은 State 변화가

일어나는가?

잠재적 State 변화의 요인들은

무엇인가?

Page 30: [1106 조진현] if you( batch rendering )

State의 변화는 소모적인 명령.

GPU의 잦은 Tri-SetUp 비용.

OS 커널의 명령어 전송 증가.

Page 31: [1106 조진현] if you( batch rendering )

CPU에 의존적인 최적화.

( CPU 성능에 좌우 )

얼마나 많은 폴리곤이 Batch에 들어있는지는

중요하지 않음. ( 이것은 GPU의 몫 )

Page 32: [1106 조진현] if you( batch rendering )

되도록 많은 폴리곤을 하나의 Batch에 넣어라.

CPU는 계속 성능이 증가!!! But…

많으면 그냥 좋음!!!

Page 33: [1106 조진현] if you( batch rendering )

Texture 교체.

Transform 변화.

스키닝.

Material 교체.

Page 34: [1106 조진현] if you( batch rendering )

선행 처리가 필요.( Strip 기반의 버퍼 최적화 )

버퍼를 셋팅.

투명한 오브젝트와 불투명한 오브젝트로 분류. ( 투명 그룹, 불투명 그룹 )

For ( 각 투명 그룹에 대하여 )

알파 관련 셋팅

각각에 대해서 Material 별로 정리 및 정렬

( 같은 Material 별로 그룹화 )

For( Material 그룹화 개수 만큼 )

Material 바인딩.

for( 그룹내 오브젝트 개수 만큼 )

행렬세팅()

그리기 명령()

Page 35: [1106 조진현] if you( batch rendering )

Texture Atlas.

Page 36: [1106 조진현] if you( batch rendering )

병렬 프로그래밍과의 결합.

Strip 기반으로 엔진을 구성할 것.

Page 37: [1106 조진현] if you( batch rendering )
Page 38: [1106 조진현] if you( batch rendering )
Page 39: [1106 조진현] if you( batch rendering )

질문 주세요~~~