74
Texturering & Modeling a Procedual Approach 김김김

20120713 ch13

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 20120713 ch13

Texturering & Modelinga Procedual Approach

김정근

Page 2: 20120713 ch13

Chapter 13

Real-time Procedural Solid

Texturing

Page 3: 20120713 ch13

3

AgendaA Real-time Procedural Solid Texturing Algo-

rithm

Creating an Atlas For Procedural Solid Textur-

ing

Avoiding Seam Artifacts

Implementing Real-Time Texturing Procedures

Applications

Acknowledgments

Page 4: 20120713 ch13

Introduction

4

Procedural Solid Texturing 는 production-quality image 로 통합할 때 아주 막강한 툴

유저로 하여금 반복되지 않는 산들과 해안지대들 , 구름들로 만들어진 세계를 탐험할 수 있게 함

불이나 폭발같은 동적으로 움직이는 Texture 들은 Procedural Texture 를 이용해 효율적으로 나타냄

나무나 돌처럼 medium 으로 Texture 된 것으로 부터 조각된 물체들은Solid texturing 을 이용해서 Texturing 할수 있음

Solid texturing 은 Surface 을 Parameter 로 나타낼 필요가 없기 때문에

Surface Texturing 보다 더 쉬움

Page 5: 20120713 ch13

5

Introduction하지만 Procedural Solid Texturing 는

“ 장점 대부분이 Production-Quality Scene 의오프라인 렌더링에만 제한되어 왔다 ”

Page 6: 20120713 ch13

6

Introduction현재의 Procedural Solid Texturing 는

“ 작고 조밀해서 필요할때마다 통합 가능”

“ 비디오게임과 가상환경에 추가 용량이 거의 없이 방대한 Texture Variations 을 제공할 수 있다 .”

“Programmable Shading Hardware 의 등장으로게임과 가상환경에서 리얼타임 그래픽 요소의 유용한 툴이 됨”

Page 7: 20120713 ch13

7

Introduction이 챕터에서는

“ 현재 그래픽 프로그래밍 라이브러리에서 이미 사용할만한 특징을 이용해서

리얼타임 시스템에 Procedural Solid Texturing 을 어떻게 통합할 것인지를 기술”

“ 기술을 이용해 실시간 피드백을 가지고 인터렉티브한 Procedural Solid Texturing

설계 시스템을 만드는데 사용하는 방법”

Page 8: 20120713 ch13

8

A Real-time Procedural Solid Texturing Al-gorithm

Renderman 기술을 기반Surface Shading 을 하는데 Texture Map 을 허용함

모델의 구성각각의 vertex 가 좌표 축 3 개로 구성되어 있다고 가정

Vertex 의 공간좌표 x, y, z 는 모델 ( 로컬 ) 스페이스에서의 vertex 위치를 의미

Vertex 의 u,v Parameter 는 2D Texture Map 에서의 vertex 위치를 의미

Vertex 의 Solid Texture Coordinate 인 s, t ,r   은 3D Procedural Texture Space 에서 Vertex 가 어디로부터 Vertex Color 와 그 외 Shading 정보를 얻어오는 지를 의미

Page 9: 20120713 ch13

9

A Real-time Procedural Solid Texturing Al-gorithm

공간좌표와 Solid Texture 좌표들이 주어지면 자동으로 Parameter 들을 구축

종종 Solid Texture 좌표들은 공간좌표와 그냥 동일한것으로 세팅하기도 하며 이 알고리즘은 공간좌표만 주어져도 물체에 Texture 를 입힐 수 있다이 알고리즘은 Rasterization, Procedural Eval-uation 그리고 Texture Mapping 중일 때 동작할 것이다

Page 10: 20120713 ch13

10

래스터라이즈 ? A Real-time Procedural Solid Textur-

ing Algorithm

물체의 Polygon 들을 Texture Map 에 기록하는 것Vertex 들 좌표를 가지고 u, v 로 Parameter 화하고

Vertex 들의 Color (R=s, G=t, B=r) 를 가지고 Solid Texture Coordinate 를 만든다

그래픽 하드웨어는 오랫동안 Polygon 면에서 Linear interpolation 을 지원 , 예를 들어 Gouraud shad-ing

Texture Map 에 레스터라이즈된 Polygon 면들에 걸쳐Solid Texture coordinate 들을 자동으로 계산

Page 11: 20120713 ch13

11

For each polygon pBegin polygonFor each vertex i

Color(p[i].str)Vertex(p[i].uv)

End polygonSave image as texture map tex

래스터라이즈 A Real-time Procedural Solid Texturing

Algorithm

Page 12: 20120713 ch13

12

Procedural Evalua-tion A Real-time Procedural Solid Texturing Algorithm

Texture Map 에서 모든 Pixel 에 걸쳐 진행하고 ,Pixel 의 RGB color 로 저장된 Solid Texture

Coordinate (s,t,r) 상에서 Procedural 으로 Texturing 을 평가

이 평가를 통해 Solid Texture space 상의 점 (s,t,r) 에서의 Texture 를 대표해주는새로운 RGB color 가 나올 것이며

이 새로운 RGB color 는 Solid Texture coordinate 에 대응하는 Procedural Texture color 로 덮어써서Texture Map 에서 현재 pixel 에 저장

Page 13: 20120713 ch13

13

Procedural Evalua-tion A Real-time Procedural Solid Texturing Algorithm

For each pixel (x, y) in the Texture Maptextex[x, y]=proc(tex[x, y])

Page 14: 20120713 ch13

Texture MappingA Real-time Procedural Solid Texturing Algorithm

14

물체의 u,v Parameter 를 이용한 표준 Texture Mapping 을

통해 물체위의 Texture 를 위치물체가 그려질때 , 물체의 Polygon vertex 들의 공간좌표는

그래픽스 파이프라인을 걸쳐 지나간다

Polygon 은 Polygon 의 u,v Parameter 와 interpolate 되어 Rasteri-zation

Texture Map 에 저장된 Procedural Solid Texture 로부터Pixel 과 Mapping 되는 지를 체크해서 Polygon 에 Texturing

Page 15: 20120713 ch13

15

Texture MappingA Real-time Procedural Solid Texturing Algorithm

Set Texture Map totexFor each polygon p

Begin polygonFor each vertexi

TexCoord(p[i].uv)Vertex(p[i].xyz)

End polygon

Page 16: 20120713 ch13

16

A Real-time Procedural Solid Texturing Algorithm

Page 17: 20120713 ch13

17

A Real-time Procedural Solid Texturing Algorithm

이 기술이 동작하기 위해 , 물체 표면상에 있는 Polygon 들은 overlap 하지 않고

Texture Map 에 놓여질 필요가 있다

이러한 Texture Mapping 이 atlas

Page 18: 20120713 ch13

A Real-time Procedural Solid Texturing Algorithm

18

atlas 구축단계는 이전 알고리즘에 선처리로 수행되고한 물체에 대해 한번만 계산될 필요가 있다

모델은 일반적으로 Texture Map 에 평평하게 놓이게 되는 순서에 따라 하나 이상의 삭감이 필요하다 .

이러한 삭감은 Texture 의 불연속으로 Seam 이 보이는 결과를 발생할 수 있다 .

일부 Texture 레이아웃 기법이 seam 의 수와 길이의 감소에 초점을 맞췄다 .

“Avoiding Seam Artifacts” 에서…

Page 19: 20120713 ch13

19

A Real-time Procedural Solid Texturing Algorithm

래스터화 및 Texture 매핑 단계 모두 하드웨어 가속이 되며 Procedural 평가 단계에서는 병목현상이 있음

Page 20: 20120713 ch13

20

Creating an Atlas For Procedural Solid Textur-ing

Perlinnoise 기능을 바탕으로 이들 특히 Procedural Texture 의 효율적인

구현을 위한 몇 가지 기법을 설명

Page 21: 20120713 ch13

21

Creating an Atlas For Procedural Solid Textur-ing 아틀라스 기법의 다양함Texture Atlas 를 만들기 위해 개발 , 이러한 기술의 일부는 자동으로 표면에 2 차원 Texture 를 추가하기 위해 Object 를 Parameter 화하기 위해 개발

왜곡을 최소화Texture Map 이미지의 비율은 합리적으로 Texture 표면에 재현

Texture Map 에서 Pixel 당 저장된 Solid Texture coordinate 로부터Texture 를 계산하기 때문에 Atlas 의 왜곡은 Procedural Solid Texture 의 비율에 영향을 주지 않음

distortion 의 Scaling 컴포넌트는 stretch (Sander et al. 2001) 또는 상대 크기 (Carr 과 Hart 2002) 처럼 다른 곳에서의 다양한 형태의 분량을 재는 것은 Object 표면에 걸쳐 Sample 의 분포에

영향을 줄 수 있다 .

Page 22: 20120713 ch13

22

Creating an Atlas For Procedural Solid Textur-ing

레스터화는 ..Solid Texture Coordinate 로 Texture Map 의 Pixel 을 채우고 있기 때문에 , Texture Map 에서 서로 상대적인 Triangle 의 위치가 부적절하게 만들 수 있음

Object 의 인접한 Triangle 은 Texture Map 의 근처가 필요치 않음 .

크게 Texture Atlas 에서 Triangle 을 평면 배치하는 과정을 단순화

가능한 한 사용 가능한 Texture Pixel 만큼을 사용하려면 , 전체 Texture Map 에 걸쳐 Mesh 에 Triangle 을 배치

Page 23: 20120713 ch13

23

Creating an Atlas For Procedural Solid Textur-ing

“ 매우 똑바른 방법으로 Pack 된 이등변의 축 정렬된 직각 Triangle 행으로

구성”

Page 24: 20120713 ch13

Creating an Atlas For Procedural Solid Textur-ing

24

“ 매우 똑바른 방법으로 Pack 된 이등변의 축 정렬된 직각 Triangle 행으로

구성”

균일한 크기의 Texture Map Triangle 으로 모든 Object Triangle 을 평면배치 하는 것은 Texture Sample 을 잘 분배하지 않는다 .

대형 Object Triangle 은 작은 Triangle Object 보다 더 많이 Proce-dural Solid Texture Sample 이 있어야 하지만 , 균일한 Mesh Atlas

는 Triangle 에게 Sample 의 같은 번호를 할당

이것은 작은 Triangle 에게 너무 많은 Texture Sample 을 제공함으로써 큰 Triangle 에게 고르지 않는 Texture 아티펙트와 일반적으로 Tex-

ture 공간의 낭비가 발생할수 있음

Page 25: 20120713 ch13

25

Creating an Atlas For Procedural Solid Textur-ing

“Strip 당 Triangle 의 크기를 변화하여 물체의 표면에 걸쳐 고르게 사용 가능한 Texture Sample 을 분배하여 균일한 Mesh Atlas 을

조정”

Page 26: 20120713 ch13

Creating an Atlas For Procedural Solid Textur-ing

26

“Strip 당 Triangle 의 크기를 변화하여 물체의 표면에 걸쳐 고르게 사용 가능한 Texture Sample 을 분배하여 균일한 Mesh Atlas 을

조정”

증가하지 않는 영역의 알맞은 Texture Map 안에 Triangle 을 가늘게 Pack

Texture 영역에 대한 표면적의 비율로 균일 규모 계수를 추정하고 각 수평 Strip 으로 Triangle 의 크기를 설정하기 위해 이 Scale factor 를

사용 .

각 수평 Strip 의 Texture Map 삼각 관계의 모든 Texture Sample 을 낭비하지 않도록 동일한 크기로 설정

Page 27: 20120713 ch13

Creating an Atlas For Procedural Solid Textur-ing

27

“Strip 당 Triangle 의 크기를 변화하여 물체의 표면에 걸쳐 고르게 사용 가능한 Texture Sample 을 분배하여 균일한 Mesh Atlas 을

조정”

Area-Weighted Mesh Atlas 를 사용하여 Procedural Solid Texture와 음형 형태의 Sample 을 보여줌

Triangle 의 Strip 당 사이즈 는 표면 전체 Texture Sample 을 2 에 n승에 가깝게 정량화된 또 다른 면적 가중 레이아웃보다 더 균등하게 준비

면적 가중 Mesh 가 낭비되는 Texture Sample 의 고르지 않는 Edge 를 가지고 있는 반면 이 테크닉은 더 쉽게 Texture Map 을 작성하는 경향이

있다 .

Page 28: 20120713 ch13

28

또 다른 기술 Creating an Atlas For Procedural Solid Texturing

Maruya (1995)블록과 같은 균일한 Mesh Atlas 의 Triangle 을 취급하고 2 에 n승에 가깝게 정량화된 크기의 다양한 Triangle 으로 이러한 블록을 Pack

Rioux, Soucy, and Godin (1996)사각형 블록 (2 에 n승에 가깝게 정량화된 ) 에 유사한 크기의 Triangle 이점과 이러한 블록을 Pack

Battke, Stalling, and Aege (1996)Texture Map 에 견고하게 Strip 을 Pack

Cignoni et al. (1998)유사한 Strip 을 Pack 했지만 적당히 같은 Triangle 은 제거

Page 29: 20120713 ch13

29

Skinny trianglesCreating an Atlas For Procedural Solid Texturing

“Skinny Triangle 의 상당수가 있는 Mesh 는 가중면적 At-las 를 사용하는 일부 Texture 를 blockiness 하게 보여질수 있음”

Length-Weighted atlas Texture Map 에 그 이미지의 크기를 set 하는 Triangle 의 서피스

영역을 사용하는 대신에 Triangle 의 가장 긴 가장자리의 길이를 사용

Mesh 의 긴 가장자리가 최대의 Sample 을 얻을 것을 보장하지만 Skinny Triangle 을 oversample 하는 경향이 있어 다른 영역이

사용가능한 Sample 의 수를 줄여줌

Page 30: 20120713 ch13

30

MIP MappingCreating an Atlas For Procedural Solid Texturing

Sander et al. (2001) Triangle 의 영역을 한 무리로 모으고 Atlas 안에 이 Cluster 를 pack

Cluster 사이의 영역은 MIP Mapping 될수 있으며 “합리적인” 색상으로 채워짐

Carr and Hart (2002)반드시 인근 아니라 , 지역 , 인접한의 계층 구조로 Triangle 을 pack 하기 위한 MIP 매핑의 일부 속성을 사용

Page 31: 20120713 ch13

31

MIP MappingCreating an Atlas For Procedural Solid Texturing

주어진 MIP Map 레벨에서 같은 사분면에 Mesh Triangle 의 인접한

클러스터를 매핑한 인접한 MIP Map 의 예

Page 32: 20120713 ch13

32

Avoiding Seam Arti-facts

Texture Filtering 을 하다 보면 , Texture Map내의 잘못된 Polygon 이미지로부터

그려진 Polygon 경계 근처를 Sampling 할 수도 있다

Triangle 주변에서 Sampling했다면 심각하지는 않지만 Polygon 주변을 무시하고 있기 때문에 이런 상황에 기댈 수 없

다 .

Page 33: 20120713 ch13

33

Avoiding Seam Arti-facts

(a) Texture 들은 하나의 pixel 배열로 저장된다

(b) nearest-neighbor filter ( 제일 가까운 근방 필터 ) 를 사용하면 Sampling

한 위치에서 가장 가까운 pixel color 를 준다 .

(c) 그 결과 seam artifact 가 발생한다 . 밝은 Triangle color 가 어두운 Tri-

angle 의 Sampling 영역에 새어 들어 간 것을 볼 수 있다 .

Page 34: 20120713 ch13

34

Avoiding Seam Arti-facts

Texture Map내에서 Triangle 들을 Sampling 이 정확하게

될 수 있도록 위치시킬 필요가 있다

이 문제의 해결책은 Triangle 의 빗변을 공유하는 부분에 수평으로 한 개 의 pixel 로 offset 을 주는 것

(Rioux, Soucy, and Godin 1996)

Page 35: 20120713 ch13

35

Avoiding Seam Arti-facts

(a) 세 vertex 들 (−0.5,−0.5), (5.5,−0.5),(−0.5, 5.5) 들로 이루어진 더 확장된 어두운 Triangle 과 (0.5, 4.5), (5.5,−0.5), (5.5, 4.5) 로 이동된 밝은 Triangle 을 레스터라이즈(b) 각각의 Triangle 에 주어진 pixel 수만큼 새로운 Triangle 들을 Rasterization한것을 Shading(c) 어두운 Triangle 의 Texture 좌표 u, v 는 안 바뀐 상태이므로 , 오버스캔된 Ras-terization 로부터 더 작은 Triangle 을 적당하게 Sampling

(d) 밝은 Triangle 은 이동된 위치로부터 동일하게 Sampling

Page 36: 20120713 ch13

36

Avoiding Seam Arti-facts

(d) 의 Sampling 영역을 이용해서 Bilinear filtering (Carr and Hart 2002) 도 적용 가능

atlas 에서 빗변을 공유하는 Triangle 들은 mesh 에서 edge 를 공유해야만 함

Sampling 영역의 vertex 들은 bilinear Filtering 을 지원하기

위해 필요한 버퍼를 제공하는 차원에서 반 pixel 을 추가해 왔음

Page 37: 20120713 ch13

37

Implementing Real-Time Texturing Proce-dures

리얼타임 Procedural Solid Texturing 알고리즘은 레스터라이즈 단계에서 Solid Texture  coordinate 들로 Texture Atlas 를 채운 후에 , Procedural 를

수행

Procedural 평가 단계를 통해 , RGB 값으로 저장된 Solid Texture coordinate 를 Texture color 로 교체

Texture color 는 Texture Mapping 단계에서 Object 에 적용

Page 38: 20120713 ch13

38

Implementing Real-Time Texturing Proce-dures

“ 현대 그래픽 가속기들은 각각 다른 콤포넌트들을 사용하고 있어 다양한

구현방식들이 존재한다”

Page 39: 20120713 ch13

39

Implementing Real-Time Texturing Proce-dures

선형적으로 재구축한 필터 (Mine and Neyret 1999) 에 의한 랜덤값으로 이루어진 3D Tex-

ture 를 이용해서 Noise 함수를 구현 가능

Solid Texture  coordinate 들이 존재하는 한 장의 Texture Atlas 를 OpenGL pixel Texture 확장버전이나 관련 Texturing 을

사용해서이러한 Noise Sample 들로 교체 가능

Page 40: 20120713 ch13

40

Implementing Real-Time Texturing Proce-dures

Vertex Shader 로 (NVIDIA 2001)Perlin Noise 함수를 구현하는 방법들도

있지만 Vertex 한개당 Procedural Texture는 Vertex color 들이나 Face끼리 보간된

Gouraud 속성의 결과를 만듬 ( 단 그 결과는 좀 다름 )

그 결과 Noise 의 frequency 는 테셀레이션의 frequency 에 의해 정해진다

Page 41: 20120713 ch13

41

Implementing Real-Time Texturing Proce-dures

Multi-Pass 를 걸친 Pixel Shader 를 이용해서 (Hart 2001) Perlin Noise 함수를

구현

Page 42: 20120713 ch13

42

Implementing Real-Time Texturing Proce-dures

0~1 사이의 랜덤값이 균등하게 분포된 3D 정수개의 격자를 Perlin Noise 함수의

공식으로 만든다는 컨셉을 바탕

랜덤값의 정수 격자 ( 라벨 #0, #1,..,#7) 를 바탕으로 한 Noise.

Page 43: 20120713 ch13

43

Implementing Real-Time Texturing Proce-dures

이 불연속적인 lattice 값들은 보간을 통해 연속적인 함수로 재구성

Page 44: 20120713 ch13

44

Implementing Real-Time Texturing Proce-dures

Perlin Noise 함수를 여러개의 Pass 로 구성된 Pixel Shader 로 구현하는 것은 Rayshade 구현을 바탕으로 한다

(Skinner and Kolb 1991).

Page 45: 20120713 ch13

45

Implementing Real-Time Texturing Proce-dures

Noise 함수 구현은 진폭을 가진 각각의 정수 격자점들에게 격자점 랜덤값으로 세팅해주는 3D 재구축 필터 kernel 을 사용

Page 46: 20120713 ch13

46

Implementing Real-Time Texturing Proce-dures

s, t, r 점들을 포함하는 정육면체의 8군데 모서리 전부를 반복적으로 돌아가면서

랜덤값들을 요약

각각의 모서리들마다 Hash3d(x, y, z) 함수는 정수 좌표값들 x,y,z 상에서 임의로 정한 비트 연산을 수행함으로써 , 정수 격자점

(x,y,z) 즉 , 랜덤값 t 를 구축

Page 47: 20120713 ch13

47

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

1. 알고리즘은 래스터화 단계 (Figure13.8(a)) 로부터 보간된

s, t, r  coordinate 가 가지는 Atlas Color, 즉 일명 인풋 RGB Texture 를 가지고 시작

Page 48: 20120713 ch13

48

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

2. 검정색으로 출력 luminance Texture Noise 를 초기화

Page 49: 20120713 ch13

49

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

3.Pixel 은 Atlas 의 해당 Pixel 의 정수 부분만 허용하는 RGB Texture 가 되게 만든다 .

atlas_int 의 각 Pixel 은 Atlas(Figure 13.8(b)) 의 해당 Pixel 의 좌표가 들어있는 Noise 격자 셀의 왼쪽 아래 앞 모서리의 좌표들을 포함한다

Page 50: 20120713 ch13

50

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

4.Texture atlas_int++ 를 얻기위해 Texture atlas_int Pixel 의 RGB   각각에 1 을 더한다 .

atlas_int++ 의 각 Pixel 은 현재 Atlas 의 Pixel 의 좌표가 들어 있는 Noise 격자의 오른쪽 위 뒤 코너의 좌표를 포함한다 .

이제 Noise 격자 셀의 여덟 코너는 atlas_int 및 atlas_int++ 의 구성 요소의 조합으로 만들 수 있다 .

Page 51: 20120713 ch13

51

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

5.Atlas내에 소숫점 영역과 대응되는 Pixel 들을 하나의 Texture 로 만들어보자 (결과 :13.8(c) )

Page 52: 20120713 ch13

52

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6. k= 0 부터 7 까지 반복적으로 loop 돌리면서 a ~ f 과정을 각각 수행한다

Page 53: 20120713 ch13

53

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-a. Color Mask(k&1, k&2, k&4) 를 사용해서 Texture atlas_int++ 를 Texture atlas_int 에 덮어쓰기 해서 RGB Texture 를 atlas_int 와 같게 만들어서 코너에 위치시켜라

(k&1, k&2, k&4).=> (k & 0x001,  k&0x010,  k&0x100 )

Texture 코너는 이제 셀 모서리에 # K 의 정수 좌표를 포함

Page 54: 20120713 ch13

54

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-b. 코너의 해당 Pixel 에 의한 랜덤 값 인덱스를 무작위로 배포하는 Luminance Texture 를 만들어라

랜덤 Texture 는 이제 코너 #K (Figure 13.9 (a)) 에서 Noise 값을 보유

Page 55: 20120713 ch13

55

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-c. 만약 (k & 1) 이면 ,Þ (k & 0x001 ) => BGR & 001 => 00R R 채널과 랜덤이 곱해진다 ( 나머지는 비트연산에 의해 마스크 )

만약 (k & 1) 이 아니면(k & 0x001 ) 이 아니면 => (k & 110 ) => BG0 1 - R 과 랜덤이 곱해진다

Page 56: 20120713 ch13

56

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-d. 만약 (k & 2) 이면 ,Þ (k & 0x010 ) => BGR & 010 => 0G0Þ G 채널과 랜덤이 곱해진다

만약 (k & 2) 이 아니면Þ (k & 0x010 ) 이 아니면 => (k & 101 ) => B0RÞ 1 - G 과 랜덤이 곱해진다

Page 57: 20120713 ch13

57

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-d만약 (k & 2) 이면 ,Þ (k & 0x010 ) => BGR & 010 => 0G0Þ G 채널과 랜덤이 곱해진다

만약 (k & 2) 이 아니면Þ (k & 0x010 ) 이 아니면 => (k & 101 ) => B0RÞ 1 - G 과 랜덤이 곱해진다

Page 58: 20120713 ch13

58

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-e, b 채널도 마찬가지

이 세가지 연산들은 이제 trilinear 보간에서 해당 코너가 가지는 값을 계산

Page 59: 20120713 ch13

59

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

6-f, 계산된 랜덤을 Noise 에 추가한다 .

Page 60: 20120713 ch13

60

Noise Multipass Pixel Shader 구현의 기본적인 개요Implementing Real-Time Texturing Procedures

7. 이 시점에서 luminance Texture Noise 의 Pixel 은 셀 코너 8 개의 주변의 좌표에 의해 인덱스된 랜덤값을 리니어 보간한 값을 가진다

(a) atlas_int 로 계산한 랜덤값

(b) 1-R 가중치로 곱한 랜덤값

(c) 1-G 가중치로 곱한 랜덤값

(d) 그리고 1-B 가중치로 곱한 랜덤값으로 정수격자점 코너 #0 위치를 만듬

Page 61: 20120713 ch13

61

Implementing Real-Time Texturing Proce-dures

여기서는 정수격자점 코너 #0 부터 #3까지 총 합친 것이 Noise,

( 정수격자점 코너 #4 부터 #7까지 는 검정색 , 왜냐하면 Solid Texture co-

ordinate (s,t,r) 중 r 이 정수이므로 테스트를 통해 0 이 되버리기 때문 )

Page 62: 20120713 ch13

62

Implementing Real-Time Texturing Proce-dures

(a) (0,0,0)~ (1,1,1) 사이 범위의 Solid Texture coordinate (s,t,r) 을 Texture Map 으로

나타낸 것 ,

(b) 는 (a) 에서 정수 부분들 atlas_int 만 분리한 것

(c)   는 (a) 에서 소숫점 영역들을 분리한 것

Page 63: 20120713 ch13

63

Implementing Real-Time Texturing Proce-dures

이 알고리즘의 첫번째 구현은 8 비트정밀도만 허용했던 (Hart 2001)Pixel Shader 에서 구현

이 구현은 정수 4 비트 fixed-point number 와 소숫점 4 점비트를 사용

그리고 특별한 Pixel Shader 루틴은 정수 부분과 소숫점 부분을 획득하기 위해 ,

값들을 왼쪽으로 이동시키거나 오른쪽으로 이동시키는 용도로 개발

Page 64: 20120713 ch13

64

Implementing Real-Time Texturing Proce-dures

근대의 그래픽 하드웨어가 이제

관련된 Texturing 을 지원

원본 구현은 PixelShader 에서 랜덤 넘버 제너레이터 기능도 구현

Index 된 Texture 코너의 RGB콤포넌트들을 이용해서

랜덤값의 미리 계산된 Texture 로 랜덤 Texture 를 제너레이션시켜주는것

Page 65: 20120713 ch13

65

Applications

“ 실시간 Procedural Solid Texturing 메서드는 독자적이라고 볼 수 있으며 Ob-

ject 의 Atlas 에 계산될 때 실시간으로 볼 수 있음”

Page 66: 20120713 ch13

66

Applications

“ 실시간 Procedural Solid Texturing 과정의

가장 비싼 작업은 Atlas 의 생성”

“ 다행히 Atlas 는 오직 Object 당

한번 생성되는 것을 필요로 함”

“Object 의 모양이 변화할때

Atlas 는 재생성이 필요”

Page 67: 20120713 ch13

67

Applications

Object 가 오직 Vertex 위치를 변경하여 변형하는 경우에는 Atlas 는 여전히 바뀌지 않음

Object 표면에 Triangle 의 상대적인 크기는 Texture Sample 의 좋지않은 분포의 결과가 발생하여 변경될 수

있음

Atlas 는 Object 의 Procedural Texturing 을 보호Texture 된 Atlas 는 간단한 2D Texture Map 처럼 Object 모델에

결속되며 이미 아주 많은 Object 파일포맷이 지원

Page 68: 20120713 ch13

68

Applications

Object 가 변형되지만 동일한 Mesh 구조를 유지한다면 Procedural Solid Texture 가 Object 에

충실함

Page 69: 20120713 ch13

69

Applications

“ 실시간 Procedural Solid Texturing 과정의

두번째로 비싼 작업은 Procedural Texture 평가 단계”

“ 레스터화 단계는 그래픽 하드웨어에서 수행하지만

그래픽 하드웨어에 제약을 주어 CPU 에서 이 단계를 수행”첫 번째 이유는 CPU 가 래스터라이즈된 Pixel 의 비싼 readback 을

수행하지 않고 Procedural Texture 를 적용하는 것을 허용

두 번째 이유는 때때로 하드웨어 구현간에 다를 수 있지만 레스터화의 규칙에 완전한 제어권을 주는 것

Page 70: 20120713 ch13

70

Applications

“Readback 속도 개선 및 그래픽 하드웨어가 더 많이 Programmable 해짐에 따라 , GPU 의 모든 세 단계의 구현은 확실히 더 실용적인 선택될 것”

Page 71: 20120713 ch13

71

Applications

“Interactive Procedural Solid texturing de-sign system 을 구축하기 위해 이러한 기술을 사

용”이 시스템은 Procedural Solid Texturing 이 Parameter 슬라이더를

통해 조작할 수 있음슬라이더를 이동으로 인한 Procedural Solid 질감이 Object 에 다시 적용

Page 72: 20120713 ch13

72

Applications

“Object 의 모양이 변화되지 않는다면 , Atlas 는 재계산할 필요가 없지만 ,

Procedural Texture 는 Atlas 를 재계산할 필요가 있음 .”래스터화과 Texture 평가를 위한 호스트 프로세서를 사용하여

해상도 2562 의 Atlas 와 10 Hz 의 속도를 지원

이 속도는 그래픽 하드웨어 성능이 빨라지고 있어 향상될 것 !

Page 73: 20120713 ch13

Q & A

Page 74: 20120713 ch13

감사합니다