Microsoft PowerPoint - Lect17-FromGeoToPixels-1.pptx

Similar documents
(Microsoft PowerPoint - EDIDFDXLLBYN.ppt [\310\243\310\257 \270\360\265\345])

[ReadyToCameral]RUF¹öÆÛ(CSTA02-29).hwp

Output file

2005CG01.PDF

63-69±è´ë¿µ

À±½Â¿í Ãâ·Â

Microsoft PowerPoint - ch03ysk2012.ppt [호환 모드]

Microsoft PowerPoint - lecture20-ch7.ppt [읽기 전용]

融合先验信息到三维重建 组会报 告[2]

19_9_767.hwp

04-다시_고속철도61~80p

2 min 응용 말하기 01 I set my alarm for It goes off. 03 It doesn t go off. 04 I sleep in. 05 I make my bed. 06 I brush my teeth. 07 I take a shower.

Microsoft PowerPoint - gpgpu_proximity.ppt

0125_ 워크샵 발표자료_완성.key

Microsoft PowerPoint - lecture19-ch7.ppt

300 구보학보 12집. 1),,.,,, TV,,.,,,,,,..,...,....,... (recall). 2) 1) 양웅, 김충현, 김태원, 광고표현 수사법에 따른 이해와 선호 효과: 브랜드 인지도와 의미고정의 영향을 중심으로, 광고학연구 18권 2호, 2007 여름

<B3EDB9AEC1FD5F3235C1FD2E687770>

한국성인에서초기황반변성질환과 연관된위험요인연구

public key private key Encryption Algorithm Decryption Algorithm 1

High Resolution Disparity Map Generation Using TOF Depth Camera In this paper, we propose a high-resolution disparity map generation method using a lo

삼교-1-4.hwp

<32382DC3BBB0A2C0E5BED6C0DA2E687770>

Microsoft PowerPoint - lecture18-ch7.ppt [호환 모드]

Hi-MO 애프터케어 시스템 편 5. 오비맥주 카스 카스 후레쉬 테이블 맥주는 천연식품이다 편 처음 스타일 그대로, 부탁 케어~ Hi-MO 애프터케어 시스템 지속적인 모발 관리로 끝까지 스타일이 유지되도록 독보적이다! 근데 그거 아세요? 맥주도 인공첨가물이

#Ȳ¿ë¼®

<BFACBCBCC0C7BBE7C7D E687770>

강의10

Microsoft PowerPoint - lecture18-ch7 [호환 모드]

APOGEE Insight_KR_Base_3P11

- 2 -

Microsoft PowerPoint - 27.pptx

untitled

(JBE Vol. 21, No. 1, January 2016) (Regular Paper) 21 1, (JBE Vol. 21, No. 1, January 2016) ISSN 228

지능정보연구제 16 권제 1 호 2010 년 3 월 (pp.71~92),.,.,., Support Vector Machines,,., KOSPI200.,. * 지능정보연구제 16 권제 1 호 2010 년 3 월

본문01

Microsoft PowerPoint - 7-Work and Energy.ppt

04_오픈지엘API.key

45-51 ¹Ú¼ø¸¸

歯1.PDF

¹Ìµå¹Ì3Â÷Àμâ


LIDAR와 영상 Data Fusion에 의한 건물 자동추출

Vol.259 C O N T E N T S M O N T H L Y P U B L I C F I N A N C E F O R U M

Journal of Educational Innovation Research 2019, Vol. 29, No. 1, pp DOI: (LiD) - - * Way to

example code are examined in this stage The low pressure pressurizer reactor trip module of the Plant Protection System was programmed as subject for

장양수

歯kjmh2004v13n1.PDF

p 19; pp 32 37; 2013 p ㆍ 新 興 寺 大 光 殿 大 光 殿 壁 畵 考 察 ; : 2006

DBPIA-NURIMEDIA

09권오설_ok.hwp

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh

Stage 2 First Phonics

Can032.hwp



14È£À¯½Åȸº¸¸ñÂ÷.ps

09김정식.PDF

Journal of Educational Innovation Research 2017, Vol. 27, No. 2, pp DOI: : Researc


(Microsoft PowerPoint - CNVZNGWAIYSE.ppt [\310\243\310\257 \270\360\265\345])

민속지_이건욱T 최종

274 한국문화 73

歯3이화진

저작자표시 - 비영리 - 변경금지 2.0 대한민국 이용자는아래의조건을따르는경우에한하여자유롭게 이저작물을복제, 배포, 전송, 전시, 공연및방송할수있습니다. 다음과같은조건을따라야합니다 : 저작자표시. 귀하는원저작자를표시하여야합니다. 비영리. 귀하는이저작물을영리목적으로이용할

Microsoft Word - cg12-midterm-answer

°í¼®ÁÖ Ãâ·Â

untitled

Structure and Interpretation of Computer Programs: Assignment 3 Seung-Hoon Na October 4, George (아래 3개의 문제에 대한 구현이 모두 포함된 george.rkt파일을 제출하시오.

Microsoft PowerPoint cg01.ppt

<B3EDB9AEC1FD5F3235C1FD2E687770>

untitled

Page 2 of 5 아니다 means to not be, and is therefore the opposite of 이다. While English simply turns words like to be or to exist negative by adding not,

PowerPoint 프레젠테이션

WRIEHFIDWQWF.hwp

ecorp-프로젝트제안서작성실무(양식3)

<32B1B3BDC32E687770>

6자료집최종(6.8))

<31342D3034C0E5C7FDBFB52E687770>

UPMLOPEKAUWE.hwp


Crt114( ).hwp

03신경숙내지작업

<BFA9BAD02DB0A1BBF3B1A4B0ED28C0CCBCF6B9FC2920B3BBC1F62E706466>

< FC7D1BEE7B4EB2DB9FDC7D0B3EDC3D132382D332E687770>


김기남_ATDC2016_160620_[키노트].key

<3130C0E5>


Slide 1

BSC Discussion 1

04 형사판례연구 hwp

Chap 6: Graphs

Microsoft PowerPoint - 알고리즘_5주차_1차시.pptx


우리들이 일반적으로 기호

<30322D28C6AF29C0CCB1E2B4EB35362D312E687770>

I&IRC5 TG_08권

Microsoft PowerPoint - Freebairn, John_ppt

Gray level 변환 및 Arithmetic 연산을 사용한 영상 개선

6. Separate HDD by pulling in the arrow direction. * Cautions Avoid lifting HDD excessively, because Connector can be damaged ODD Remove

Transcription:

Lect17. From Geometry to Pixels-1 DoHoon Lee Ph.D Visual & Biomedical Computing(VisBiC) Lab. School of Computer Science & Engineering Pusan National University http://visbic.pusan.ac.kr/ This slide is modified by DHLee based on Angel s lecture 이강의자료는다른강의자료를참고하여작성된것으로무단배포나공개는원저작자의저작권을침해할수있음을유의하기바랍니다.

Rendering Overview Introduce basic implementation strategies Clipping Rendering lines polygons Give a sample algorithm for each 2

Overview At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives that are outside the view frustum Algorithms based on representing primitives by lists of vertices Must find which pixels can be affected by each primitive Fragment generation Rasterization or scan conversion 3

Required Tasks Clipping Rasterization or scan conversion Transformations Some tasks deferred until fragment processing Hidden surface removal Antialiasing 4

Rasterization Meta Algorithms Any rendering method process every object and must assign a color to every pixel Think of rendering algorithms as two loops over objects over pixels The order of these loops defines two strategies image oriented object oriented 5

Object Space Approach For every object, determine which pixels it covers and shade these pixels Pipeline approach Must keep track of depths for HSR(Hidden Surface Removal) Cannot handle most global lighting calculations Need entire framebuffer available at all times 6

Image Space Approach For every pixel, determine which object that projects on the pixel is closest to the viewer and compute the shade of this pixel Ray tracing paradigm Need all objects available Patch Renderers Divide framebuffer into small patches Determine which objects affect each patch Used in limited power devices such as cell phones 7

Clipping Clipping lines First of implementation algorithms Clipping polygons (next) Focus on pipeline plus a few classic algorithms 8

Clipping 2D against clipping window 3D against clipping volume Easy for line segments polygons Hard for curves and text Convert to lines and polygons first 9

Clipping 2D Line Segments Brute force approach: compute intersections with all sides of clipping window Inefficient: one division per intersection 10

Cohen-Sutherland Algorithm Danny Cohen and Ivan Sutherland(1967, for flight simulator work) Idea: eliminate as many cases as possible without computing intersections Start with four lines that determine the sides of the clipping window y = y max x = x min x = x max y = y min 11

The Cases Case 1: both endpoints of line segment inside all four lines Draw (accept) line segment as is y = y max x = x min x = x max y = y min Case 2: both endpoints outside all lines and on same side of a line Discard (reject) the line segment 12

The Cases Case 3: One endpoint inside, one outside Must do at least one intersection Case 4: Both outside May have part inside Must do at least one intersection y = y max x = x min x = x max 13

Defining Outcodes For each endpoint, define an outcode b 0 b 1 b 2 b 3 b 0 = 1 if y > y max, 0 otherwise b 1 = 1 if y < y min, 0 otherwise b 2 = 1 if x > x max, 0 otherwise b 3 = 1 if x < x min, 0 otherwise Outcodes divide space into 9 regions Computation of outcode requires at most 4 subtractions 14

Using Outcodes Consider the 5 cases below AB: outcode(a) = outcode(b) = 0 Accept line segment 15

Using Outcodes CD: outcode (C) = 0, outcode(d) 0 Compute intersection Location of 1 in outcode(d) determines which edge to intersect with Note if there were a segment from A to a point in a region with 2 ones in outcode, we might have to do two interesections 16

Using Outcodes EF: outcode(e) logically ANDed with outcode(f) (bitwise) 0 Both outcodes have a 1 bit in the same place Line segment is outside of corresponding side of clipping window reject 17

Using Outcodes GH and IJ: same outcodes, neither zero but logical AND yields zero Shorten line segment by intersecting with one of sides of window Compute outcode of intersection (new endpoint of shortened line segment) Reexecute algorithm 18

Efficiency In many applications, the clipping window is small relative to the size of the entire data base Most line segments are outside one or more side of the window and can be eliminated based on their outcodes Inefficiency when code has to be reexecuted for line segments that must be shortened in more than one step 19

Cohen Sutherland in 3D Use 6-bit outcodes When needed, clip line segment against planes 20

Plane-Line Intersections 1 0 21

Liang-Barsky Algorithm 교차점의상대적인위치에의한절단알고리즘 : 어느위치가클리핑될지한번에판단 절단사각형의모든변을대상으로교차점계산. 다음과같이교차점번호부여 아래 x 축 = 1, 왼쪽 y 축 = 2, 윗쪽 x 축 = 3, 오른쪽 y 축 = 4 교차점에서의파라미터값의순서를기준으로여러가지경우를판단 4 3 3 2 1 4 1 2

Polygon Rendering Introduce clipping algorithms for polygons Survey hidden-surface algorithms 23

Polygon Clipping Not as simple as line segment clipping Clipping a line segment yields at most one line segment Clipping a polygon can yield multiple polygons However, clipping a convex polygon can yield at most one other polygon 24

Tessellation and Convexity One strategy is to replace nonconvex (concave) polygons with a set of triangular polygons (a tessellation) Also makes fill easier Tessellation through tesselllation shaders 25

Sutherland-Hodgeman Algorithm 절단다각형을기준으로순서대로절단 순서 : 위 -> 우변 -> 밑 -> 좌변기준으로절단 [ 그림 ] 서더런드 - 핫지만알고리즘의처리순서 절단규칙 내부-> 추가 / 내부-> 외부 : 교차점추가 / 외부점 : 무시 / 외부-> 내부 : 교차점, 내부점추가 추가된정점만연결 : 클리핑된다각형 [ 그림 ] 서더런드 - 핫지먼알고리즘의절단규칙

선분을연장한직선을기준으로절단 Ex. 좌변기준의절단 Sutherland-Hodgeman Algorithm [ 그림 ] 삼각형의절단 3 차원절단 상, 하, 좌, 우, 전, 후의 6 개의면을기준으로절단 면을기준으로내외부판정 in Hardware 구현에적합 Silicon Graphics 의 Geometry Engine 에사용 [ 그림 8-26] 3 차원서더런드 - 핫지먼알고리즘

Weiler-Atherton Algorithm : convex/concave Sutherland-Hodgeman 볼록다각형에만적용 하나의다각형으로취급 오목다각형처리결과 : 오류 (b) [ 그림 ] 오목다각형처리결과 해법 1: 다각형분할 (Tessellation) 오목 -> 볼록 [ 그림 ] 다각형분할 해법 2: 웨일러 - 애서톤 (Weiler-Atherton) 알고리즘

Weiler-Atherton Algorithm Sutherland-Hodgeman 알고리즘일반화 내부에서외부로가는교차점이추가되면즉시그교차점으로부터절단사각형을따라서반시계방향으로간다. 즉, 가장최근에외부에서내부로들어온교차점을만날때까지간다. 1-C-D-2 로구성되는하나의다각형이완성 분리된여러개의다각형을생성함 [ 그림 ] 웨일러 - 애서톤알고리즘

Inside and Outside of vertex Clipping algorithm 어떤점이주어진절단선또는절단면의내부 / 외부판정하는것에서출발 [ 그림 ] 정점의내외부판정 예각 : 코사인값양. 내적 : 양둔각 : 코사인값 음. 내적 : 음 90; : 0

Inside and Outside using Homogenous 점 (P) 과평면 (H) 간의거리 (d) P = (x, y, z, 1) H : Ax + By + Cz + D = 0 법선벡터방향이면의외부로정의됨 [ 그림 ] 점과평면의거리

Intersection [ 그림 ] 교차점계산 선분과면의교차점계산에필요한식. 이를전개 선분양끝점 : S, R, 법선벡터 : N, 절단면상의임의점 : Q=> 교차점 t 를구할수있음. 위식에대입하면 x, y, z

Example of Intersection 선분 RS 와육면체가만나는점 (1,.5, -5) 절단면상의점 Q(1, 0, 0) 에서 (Q-R).N = (1-.5, 0-.5, 0-(-5)).(1,0,0) = 0.5 (S-R).N=(2-.5,.5-.5, (-.5)-(-.5)).(1,0,0)=1.5 t = (Q-R).N / (S-R).N = 0.5/1.5 = 1/3 z y Q(1, 0,0) R(.5,.5, -.5) S(2,.5, -.5) 1 x t 값을 x(t),y(t),z(t) 값에적용하면 (1,.5, -.5) 다른방식으로 t 값을구하는방법 평면의식Ax+By+Cz+D=0 에 x,y,z대신 x(t),y(t),z(t) 값을대입 => t에대한식으로전환 예. 우측면의식 x=1, 1x+0y+0z-1=0 인평면. x,y,z대신위식을대입. 다음등식으로 t를구함. R과 S점값을대입 1x+0y+0z-1= 1((1-t)(.5)+t(2)) + 0.((1-t)(.5)+t(.5)) + 0.((1-t)(-.5) + t(-.5))-1 = 0 에서 t=1/3 구함.

Clipping as a Black Box Can consider line segment clipping as a process that takes in two vertices and produces either no vertices or the vertices of a clipped line segment 34

Pipeline Clipping of Line Segments Clipping against each side of window is independent of other sides Can use four independent clippers in a pipeline 35

Pipeline Clipping of Polygons Three dimensions: add front and back clippers Strategy used in SGI Geometry Engine Small increase in latency 36

Bounding Boxes Rather than doing clipping on a complex polygon, we can use an axis-aligned bounding box or extent Smallest rectangle aligned with axes that encloses the polygon Simple to compute: max and min of x and y 37

Bounding boxes Can usually determine accept/reject based only on bounding box reject accept requires detailed clipping 38

Clipping and Visibility Clipping has much in common with hiddensurface removal In both cases, we are trying to remove objects that are not visible to the camera Often we can use visibility or occlusion testing early in the process to eliminate as many polygons as possible before going through the entire pipeline 39

Hidden Surface Removal Approaches Object space method 공간상객체의앞뒤위치관계를이용하여은면결정 객체수가많지않거나서로분산되어있을때효율적방법. 면의수가많아지면처리시간문제. O( n 2 ) n : 면의수 은선제거알고리즘 깊이정렬알고리즘 (Depth sorting / painter s algorithm) 부동소수점계산 Image space method 투영된픽셀평면에서객체가보이는지여부를검사 처음 Hit( 관통 ) 하는면. O(m.n) m : # of pixel, n: # of objects Z-buffer algorithm Ray Casting method 화소 - 정수표현 : 정수계산

Hidden Surface Removal Object-space approach: use pairwise testing between polygons (objects) partially obscuring can draw independently Worst case complexity O(n 2 ) for n polygons 41

Painter s Algorithm Render polygons a back to front order so that polygons behind others are simply painted over B behind A as seen by viewer Fill B then A 42

Depth Sort Requires ordering of polygons first O(n log n) calculation for ordering Not every polygon is either in front or behind all other polygons Order polygons and deal with easy cases first, harder later Polygons sorted by distance from COP 43

Easy Cases A lies behind all other polygons Can render Polygons overlap in z but not in either x or y Can render independently 44

Hard Cases Overlap in all directions but can one is fully on one side of the other cyclic overlap penetration 45

Back-Face Removal (Culling) face is visible iff 90-90 equivalently cos 0 or v n 0 plane of face has form ax + by +cz +d =0 but after normalization n = ( 0 0 1 0) T need only test the sign of c In OpenGL we can simply enable culling but may not work correctly if we have nonconvex objects 46

Image Space Approach Look at each projector (nm for an nxm frame buffer) and find closest of k polygons Complexity O(nmk) Ray tracing z-buffer 47

z-buffer Algorithm Use a buffer called the z or depth buffer to store the depth of the closest object at each pixel found so far As we render each polygon, compare the depth of each pixel to depth in z buffer If less, place shade of pixel in color buffer and update z buffer 48

Efficiency If we work scan line by scan line as we move across a scan line, the depth changes satisfy a x+b y+c z=0 Along scan line In screen space x = 1 49

Scan-Line Algorithm Can combine shading and hsr through scan line algorithm scan line i: no need for depth information, can only be in no or one polygon scan line j: need depth information only when in more than one polygon 50

Implementation Need a data structure to store Flag for each polygon (inside/outside) Incremental structure for scan lines that stores which edges are encountered Parameters for planes 51

Visibility Testing In many realtime applications, such as games, we want to eliminate as many objects as possible within the application Reduce burden on pipeline Reduce traffic on bus Partition space with Binary Spatial Partition (BSP) Tree 52

Simple Example consider 6 parallel polygons top view The plane of A separates B and C from D, E and F 53

BSP Tree Can continue recursively Plane of C separates B from A Plane of D separates E and F Can put this information in a BSP tree Use for visibility and occlusion testing 54

Z-buffer Algorithm 화소공간접근방법 (image space algorithm) 결국화소공간으로사상 Depth Buffer( 깊이버퍼 ) 알고리즘이라고도함 화소공간해상도로은면을판단하면됨 Z 값이가장작은평면의값을그림. Z 값을저장하는깊이버 (z-buffer) 와색상을저장하는프레임버퍼필요 Z-buffer 의시선 [ 그림 8-57] z-buffer 퍼알고리즘의시선

Z-buffer algorithm 특징 일반곡면에대해서도적용가능 구현이간단. 다각형면에대한정렬이필요없음 추가버퍼가요구되므로이를위한저장공간필요 지-버퍼 (Z-Buffer) 또는깊이버퍼 (Depth Buffer) 지-버퍼알고리즘 Initialize Frame Buffer with Background Color; // Frame(x,y) = 배경색으로설정 Initialize Z Buffer with Infinite Distance; // 모든픽셀 (x,y) 에대해depth(x,y)= - for Each Polygon { for Each Pixel { Calculate z of Intersection if (Calculated z < Current z of Z-Buffer[depth(x,y)]) { Update Z-Buffer with Calculate z; //depth(x,y) = z Update Frame Buffer with the Color of Current Polygon; //Frame(x,y)=intensity(pixel) } } }

Z-buffer algorithm [ 그림 8-59] 지 - 버퍼의초기화 [ 그림 8-60] 갈색삼각형처리결과

Z-buffer algorithm [ 그림 8-58] 지 - 버퍼알고리즘 [ 그림 8-60] 갈색삼각형처리결과 [ 그림 8-61] 녹색삼각형처리결과