360 likes | 824 Views
니들이 알고리즘을 맛을 알아 ?. 2003. 6. 11. 박찬종. 차례. 멀티미디어 컨텐트 알고리즘과 S/W 소프트웨어 도구 CG 안네서의 알고리즘 가시화 점 , 선 , 면 , 물체의 표현 점과 선의 표현 Bresenham ’ s Algorithm, 기하학적 이해 물체의 표현 Swept Volume, 물체 분할 ,, Octree 기타사항. Multimedia Contents. CG 로 만든 만화 , 영화 , 방송 영상물 컨텐트 제작 과정 기획 , 시나리오 , 콘티 등
E N D
니들이 알고리즘을 맛을 알아? 2003. 6. 11. 박찬종
차례 • 멀티미디어 컨텐트 • 알고리즘과 S/W • 소프트웨어 도구 • CG안네서의 알고리즘 • 가시화 • 점, 선, 면, 물체의 표현 • 점과 선의 표현 • Bresenham’s Algorithm, 기하학적 이해 • 물체의 표현 • Swept Volume, 물체 분할,, Octree • 기타사항
Multimedia Contents • CG로 만든 만화, 영화, 방송 영상물 • 컨텐트 제작 과정 • 기획, 시나리오, 콘티 등 • 모델링 (캐스팅, 세트, 헌팅) • 렌더링 (연출, 카메라 감독) • 배포, 디스플레이 (배급, 상영)
알고리즘과 S/W • WFM, 엘리베이터 운행, 기차시간표 • CDN, 게임서버 구축, AI 캐릭터 행동양식 등 • CGI (computer Generated Image)용 S/W • Modeling • Rendering (Recording) • 도구 (컴퓨터 S/W) • 도구를 쓰는 사람 : 디자이너 • 도구를 만드는 사람 : 프로그래머
S/W Tools (도구) • 불, 석기, 청동기, 활, 총, … , 컴퓨터 • 소프트웨어 제작자 • 제작자와 사용자의 차이 (예: 그림판) • 사용자는 알고리즘을 굳이 알 필요가 없다 • 제작자는 알고리즘을 꼭 알아야 한다 * 사용자가 원하는 대로 쉽고 편하게 쓰게끔 효율적으로 프로그램하기 위해서 * 0.1초=60억초(5회*300일*4000만명)
CG 안에서의 알고리즘 • 기본 요소 • 점, 선 (곡선, 원), 면 • 시각적 요소 • 시점/시각, 빛/그림자, 색깔, 질감 등 • 시간적 요소 • 정지화상, 동영상 • frame rate 조절: 압축/복원, 상세도조절
가시화 • 물체를 본다(인식한다)는 것 • 현실세계 (RW) vs. 가상세계(CGW) • 현실세계 : 그 속에 내가 참여 된 상태 (눈) • 가상세계 : 디스플레이 장치(창)를 통해서 봄 • 가상현실 : 현실세계에 있는 듯한 착각이 들 정도로 사용자의 오감에 감동을 주는 가상세계를 제공하는 기술
점, 선, 면, 물체의 표현 • 창에 그려진 각 점(픽셀)의 색깔을 인식 • 창에 그리는 기본 요소 • 점, 선, 면 …: 알고리즘이 중요 • 곡선의 표현 (예: 베지어 커브) • 일반적인 물체의 표현 • 선: 점의 집합으로 표현 (선분, 원, 곡선 등) • 매쉬: 삼각형(3개의 점을 연결하는 선분으로 구성) • 물체: 매쉬의 집합으로 구성 “왜 삼각형인가?” “왜 물체를 점의 집합으로 표현하지 않는가?”
점, 선, 면의 표현 king - continuity (8-connectivity) rook - continuity (4-connectivity)
Bresenham’s Line Algorithm • Basic idea • Find the closest integer coordinates to the actual line path using only integer arithmetic • Candidate for the next pixel position Specified Line Path Specified Line Path
Bresenham’s Line Algorithm procedure bres_line (x1, y1, x2, y2 : integer); var x, y, x,y,p,incrE,incrNE : integer; begin x := x2 – x1; y := y2 – y1; p := 2*y - x; incrE := 2*y; incrNE := 2*(y - x); x := x1; y := y1; display(x,y); while x < x2 do begin if p<0 then begin p := p + incrE; x := x + 1; end; { then begin } else begin p := p + incrNE; y := y + 1; x := x + 1; end; { else begin } display (x, y); end { while x < x2 } end; { bres_line}
Geometric Interpretation (1) Any slope Bresenhams’s Algorithm
Geometric Interpretation (2) y x 그림판
Surface t s Accurate representation of surface Cannot represent a true solid object (inside/outside)
물체의 표현 • Primitives: points and lines P4 P3 P2 P1 P7 P8 P5 P6 Simple and efficient Ambiguous
Swept Volume Z Z sweep sweep X Y Y X
은선/은면 제거 Why HL/HS removal? Which one ?
Objects Images 은선/은면 제거 (Cont’) “ f ” is called a “viewing pipeline.”
은선/은면 제거 (Cont’) MC WC NDC CC EC WdC viewport transformation perspective division viewing transformation projection transformation modeling transformation rasterization visibility determination texturing fog color composition …. lighting clipping
은선/은면 제거 (Cont’) • Perspective Projection • Parallel Projection
Single View Multi View General Orthographic Cabinet Cavalier General Oblique 1 point 2 point 3 point Geometric Projections 요약 • Parallel Projection • Perspective Projection
Taxonomy of Algorithms HL / HS Algorithms Image Space Hybrid Object Space Hidden Surface Hidden Line
Basic Tools • Sorting • Coherence
back-face normal pointing inside Back-Face Culling
Depth-Buffer Algorithms (z-buffer algorithms) y Frame buffer intensity x z Depth buffer depth
y z x Depth-Buffer Algorithms (Cont’)
Depth Sorting Algorithm (List Priority Algorithms) y x sorting A B A C painting B x (A,B,C) C z z Painter’s Algorithm !!!
Depth Sorting x x x P P P Q Q Q z z (…,P,Q,…) z In general, we have (……..P,Q,…….) , then O.K If Otherwise, do further processing
Swapping x x Q P Q P z z (P,Q)(Q,P) (P,Q)(Q,P)
P Q Cycle testing and splitting If not successful in box testing and swapping, then “Split P” !!! P Q Q P
scan line i Scan-Line Algorithm • Wilie et al. (1967) W. Bouknight (1970), CACM, 13, 527-536 G. Watkins (1970) • Image space • Easy to anti-aliasing • Low memory requirement • Need sorting y x
y x y x z x z
기타 사항 • Transformation • Light, Shading, Color • Texture Mapping • Animation