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

Similar documents
Microsoft PowerPoint - lecture16-ch6

Microsoft PowerPoint - lecture15-ch6.ppt

Łø·ŸÕ=¤ ¬ ÇX±xÒ¸ 06 - Èpº– 1

PowerPoint 프레젠테이션

(Microsoft PowerPoint - \301\24608\260\255 - \261\244\277\370\260\372 \300\347\301\372)

2005CG01.PDF


04_오픈지엘API.key

Backlight Unit의 광학적 특성 해석 및 Prism Sheet의 최적화 설계

Microsoft Word - cg07-final.doc

À±½Â¿í Ãâ·Â

Microsoft Word - cg09-midterm.doc

untitled

19_9_767.hwp

서피스셰이더프로그램 셰이더개발을쉽게! Thursday, April 12, 12

2002년 2학기 자료구조

Microsoft PowerPoint - 7-Work and Energy.ppt

슬라이드 1

Introduction Capillarity( ) (flow ceased) Capillary effect ( ) surface and colloid science, coalescence process,

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

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

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

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

歯스왑노트1

PowerPoint 프레젠테이션

Microsoft PowerPoint - AC3.pptx

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

63-69±è´ë¿µ

¼½¼Ç-3.00~3.4

Microsoft PowerPoint D View Class.pptx

1

THE JOURNAL OF KOREAN INSTITUTE OF ELECTROMAGNETIC ENGINEERING AND SCIENCE. vol. 29, no. 10, Oct ,,. 0.5 %.., cm mm FR4 (ε r =4.4)

untitled

Open GL

45-51 ¹Ú¼ø¸¸

public key private key Encryption Algorithm Decryption Algorithm 1

untitled

Microsoft Word - cg07-midterm.doc

chap8.PDF

룩업테이블기반비선형렌즈플레어실시간렌더링방법 (Real-Time Nonlinear Lens-Flare Rendering Method Based on Look-Up Table) 조성훈 정유나 이성길 (Sunghun Jo) (Yuna Jeong) (Sungkil Lee) 요

Microsoft Word - cg09-final-answer.doc

- 2 -

Microsoft Word - 1st-revise_Elements-and-structure-of-the-smart-lighting-design-in-the-office_1_

PowerPoint 프레젠테이션

(Exposure) Exposure (Exposure Assesment) EMF Unknown to mechanism Health Effect (Effect) Unknown to mechanism Behavior pattern (Micro- Environment) Re

untitled

Your title goes here

Physics 101: Lecture 1 Notes

산선생의 집입니다. 환영해요

Microsoft PowerPoint - 06-Body Data Class.pptx

2009년 국제법평론회 동계학술대회 일정

PowerPoint 프레젠테이션

슬라이드 제목 없음

OR MS와 응용-03장

untitled

Chapter4.hwp

09È«¼®¿µ 5~152s

Orcad Capture 9.x

2

Buy one get one with discount promotional strategy

歯Lecture2.PDF

DBPIA-NURIMEDIA

서강대학교 기초과학연구소대학중점연구소 심포지엄기초과학연구소

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

< C6AFC1FD28B0F1C7C1292E687770>

untitled

4.1 힘의모멘트 스칼라공식 4.1 힘의모멘트 스칼라공식 모멘트크기 (resultant moment) 2

THE JOURNAL OF KOREAN INSTITUTE OF ELECTROMAGNETIC ENGINEERING AND SCIENCE Jun.; 27(6),

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

2011년 10월 초판 c 2011 Sony Corporation. All rights reserved. 서면 허가 없이 전체 또는 일부를 복제하는 것을 금합니다. 기능 및 규격은 통보 없이 변경될 수 있습니다. Sony와 Sony 로고는 Sony의 상표입니다. G L

<4D F736F F F696E74202D20C1A63037B0AD202D20B1A4BFF8B0FA20B1D7B8B2C0DA>

Slide 1

e hwp

에너지경제연구 Korean Energy Economic Review Volume 11, Number 2, September 2012 : pp. 1~26 실물옵션을이용한해상풍력실증단지 사업의경제성평가 1

DBPIA-NURIMEDIA

i-movix 특징 l 안정성 l 뛰어난화질 l 차별화된편의성

PowerPoint 프레젠테이션

유한차분법을 이용한 다중 기초자산 주가연계증권 가격결정

01이국세_ok.hwp


1 n dn dt = f v = 4 π m 2kT 3/ 2 v 2 mv exp 2kT 2 f v dfv = 0 v = 0, v = /// fv = max = 0 dv 2kT v p = m 1/ 2 vfvdv 0 2 2kT = = vav = v f dv π m

2

67~81.HWP

untitled

- 2 -

<28C3D6C1BE29312DC0CCBDC2BEC62E687770>

<31335FB1C7B0E6C7CABFDC2E687770>

RVC Robot Vaccum Cleaner

KAERIAR hwp

자바 프로그래밍

좋은 사진 찍는 방법

Ⅰ. Introduction 우리들을 둘러싸고 잇는 생활 환경속에는 무수히 많은 색들이 있습니다. 색은 구매의욕이나 기호, 식욕 등의 감각을 좌우하는 것은 물론 나뭇잎의 변색에서 초목의 건강상태를 알며 물질의 판단에 이르기까지 광범위하고도 큰 역할을 하고 있습니다. 하

Microsoft PowerPoint cg01.ppt

초판 1쇄 발행 2013년 10월 25일 지은이 박승제 펴낸이 장성두 펴낸곳 제이펍 출판신고 2009년 11월 10일 제 호 주소 경기도 파주시 문발동 파주출판도시 뮤즈빌딩 403호 전화 / 팩스

PDF

슬라이드 1

예제 1.1 ( 관계연산자 ) >> A=1:9, B=9-A A = B = >> tf = A>4 % 4 보다큰 A 의원소들을찾을경우 tf = >> tf = (A==B) % A

PowerPoint 프레젠테이션

분석결과 Special Edition 녹색건물의 가치산정 및 탄소배출 평가 이슈 서 민간분야의 적극적인 참여 방안의 마련이 필요하다. 또한 우리나라는 녹색건축의 경제성에 대한 검증에 대 한 연구가 미흡한 실정이다. 반면, 미국, 영국, 호주 등은 민간 주도로 녹색건축물

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

Transcription:

Shading

Shading realistic computer graphics 의첫걸음 gradation of colors 색상이부드럽게변해가야 what is needed? light : 광원 matter ( material) : 물체표면의특성 optics ( 광학 ) or physics 1

6.1 Light and Matter

Light and Matter Light representation in computer graphics based on three color theory : Red, Green, Blue Matter material properties determine which wavelengths are absorbed or reflected to some extent in real world in computer graphics

Rendering Equation J. T. Kajiya, The Rendering Equation, SIGGRAPH 86, pp.143 150, (1986). computer graphics 에서의종합적인 rendering 방법 optics 이론의 approximation rendering equation 의다양한해석가능 다양한 illumination model light source, matter, 기타정보 rendering equation pixel 값의결정 4

Illumination Model shading model, lighting model a method to calculate the intensity of light at a given point on the surface of an object Light-Material interactions material 특성에따라 specular surface 정반사 diffuse surface 난반사 translucent surface 굴절

6.2 Light Sources

Light Sources light 관점에서의물체표면에서는 self-emission : 실제로빛을발생 ( 광원 ) reflection : 빛을반사 light source ( 광원光原 ) 광의 : 모든물체는광원 협의 : 빛을발생하는물체만 illumination function I(x, y, z, θ, φ,λ) point (x, y, z) 에서 (θ, φ) 방향으로가는파장이 λ 인빛의세기 θ φ 7

Light Sources additive behavior of light 물체의표면색 : integral of all lights color : R, G, B 각각따로계산 ),,,,, ( ),,,,, ( λ φ θ λ φ θ z y x I z y x I I I I r r four types of light sources ambient lighting point light source spotlight distant light ),,,,, ( ),,,,, ( λ φ θ λ φ θ z y x I z y x I I I I b g b g

Ambient Light uniform lighting (typically in the room) the combination of light reflections from various surfaces 여러물체들의난반사에의한균일한밝기의 light 예 : 실내전체가균일하게밝은경우 ambient light 가가해지면, 모든물체는대응되는밝기를가짐 ambient illumination : a scalar value I a 모든방향에서동일한밝기로들어오는빛 9

Point Light Sources ideal point light source 점 p 0 에서모든방향으로균일한양을방사 emits light equally in all directions light received from the point light source 거리에반비례 1 I( p, p0 ) I( p0 ) 2 p p 0 10

Point Light Sources point light source in real world 대표적인예 : 백열전구 ideal point light source 와의차이점 not point, but area light source 그림자에서차이 umbra : ( 진짜 ) 그림자 penumbra : 희미한그림자 11

Spotlights cone 형태로 emit 되는빛 p s : apex ( 정점 ) I s : light direction θ : angle point light source : θ 180 θ more realistic case 중심축과의각도 φ 빛의세기 cos e φ θ φ θ θ φ θ cos θ cos e θ 12

Distant Light Sources parallel light source 빛이일정한방향으로평행하게들어오는경우 예 : 태양광선 장점 : 계산이훨씬간단하다 in homogeneous coordinate, p 0 x y z 1 point light source p 0 x y z 0 parallel light source 13

6.3 The Phong Reflection Model

Phong Reflection Model Bui-T. Phong, Illumination for Computer Generated Pictures, Comm. ACM, 18(6):311 317, (1975). local illumination model 계산을빠르게하기위해서, 물체표면에서의방향관계만따진다. 그림자는계산불가능! light direction 광원방향 normal vector 물체표면에수직 view direction 눈의방향 ambient term diffuse term specular term reflection 정반사방향 15

Phong Reflection Model reflection on the surface ambient illumination indirect reflection 을 approximate diffuse illumination 난반사 specular illumination 정반사 16

Ambient Reflection ambient reflectoin I a 왜필요한가? a surface that is not exposed directly to a light source still will be visible if nearly objects are illuminated L a : 현재광원에서나오는 ambient light 의세기 k a : 물체표면의 ambient reflection coefficient 0 k 1 I a a k a L a L a I k a a L a 17

Diffuse Reflection 난반사 ( 亂반사 ) 물체표면이거칠면, 모든방향으로빛을반사 Lambertian surface : 빛을모든방향으로고루반사 I d k d L d cosθ k d (l n)l d k d : diffuse reflection coefficient L d : intensity of light source n : unit normal vector of surface l : unit light direction vector attenuation form : 거리 (d) 를감안 a, b, c : constants k d I d ( l n) 2 a+ bd+ cd L d d cosθ 18 θ

Specular Reflection 정반사에의한 highlight 생성 거울 : perfect specular reflection I s k s cos α φ L s k s (r v) α L s k s : specular reflection coefficient L s : intensity of light source highlight r : unit reflection vector v : unit view direction vector α : shineness coefficient attenuation form : 거리 (d) 를감안 a, b, c : constants I s ks ( r v) 2 a+ bd+ cd α L s 19

Phong Reflection Model Phong 의계산식 ambient, diffuse, specular term 모두를합성 s s d d a a s d a L k L k L k I I I I + + + + α ) ( ) ( 2 2 v r n l 20 ( ) a a s s d d s d a a L k L k L k cd bd a cd bd a cd bd a + + + + + + + + α ) ( ) ( 1 2 2 2 v r n l

6.4 Computation of Vectors

Normal Vector Phong shading model n : surface normal vector polygonal model surface equation ax+ by+ cz+ d 0 p 2 z ( x2, y2, 2 ) n ( p2 p0 ) ( p1 p0 ) p 1 z ( x1, y1, 1) a b c p 0 z ( x0, y0, 0 ) 22

Normal Vector implicit equation : 미분으로계산 예 : unit sphere 2 2 2 f ( x, y, z) x + y + z 1 0 f f x n y f z normal vector p ( x, y, z) 23

Normal Vector parametric equation : 미분으로계산 u v u z v u v u y v u v u x sin ), ( cos cos ), ( sin cos ), ( v u z v u y v u x v u p ), ( ), ( ), ( ), ( 24 v u v z v y v x v u z u y u x u p p n p p, normal vector

Normal Vector in OpenGL void glnormal3f(float x, float y, float z); void glnormal3fv(float v[3]); use the normal vector for a vertex example glbegin(gl_quads); glcolor3f(1.0, 1.0, 1.0); glnormal3f(0.0, 1.0, 1.0); glvertex3f(1.0, 1.0, 1.0); glend(gl_quads); normal vector: (0, 1, 1) color: white position: (1, 1, 1) 25

Reflection Vector light direction l: 광원방향 reflection vector r: 정반사각도 l, n, r 모두 normalize θ i θ r r n l 1 26 l n n l r n l r r n l n l r n n l r r n n l + + + + ) 2( 2 let cos cos cos cos 2 2 β αβ α β α β α θ θ θ θ θ θ r i r i r i

Halfway Vector J. Blinn, Models of Light Reflection For Computer Synthesized Pictures, SIGGRAPH 77, 192 198, (1977). specualr reflection : I s k s cos α φ L s k s (r v) α L s halfway vector h : 빠른계산을위해서 h l+ l+ v v θ r v cosφ n h cosψ < cos2ψ cosφ φ (r v) α (n h) α 이되도록, α 값을조절 approximation 이지만, 오차가별로크기않음 계산속도는빨라짐 27

Transmitted Light 굴절 (refraction) 시에사용 유리, 물의표현에필수적 Snell s law : 빛의굴절법칙 sinθ sin θ l t η η η t l η l, η t : index of refraction ( 굴절률 ) 1 cosθ t 1 2 η (1 cos θ ) t α n+ β l 1 1 t l cosθ t cosθ l n η η 2 l θ l θ t 28

6.5 Polygonal Shading

Polygon Shading polygonal object 를 shading 하는방법 대부분의물체가 polygonal object 임 부드러운물체도 polygonal mesh 로표현 계산량의증가에따라, flat shading Gouraud shading Phong shading 30

Flat Shading constant shading 가정 1: flat polygon n constant 가정 2: distant viewer v constant 가정 3: distant light l constant, r constant 결론적으로, 같은 polygon 내에서는같은 shading 결과사용가능 31

Flat Shading shading 값계산시는 Phong model 사용 α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd in OpenGL glshademodel(gl_flat); 문제점 : Mach band effect polygon 경계에서계단효과 32

Gouraud Shading interpolative shading Mach band effect 를줄이는방법? vertex normal은인접한 face들의 normal들을평균해서계산 face 내는 vertex 에서의 shading 결과를 bi-linear interpolation n 1 n 4 bi-linear interpolation n 2 n 3 n n n 1 1 + n + n 2 2 + n + n 3 3 + n + n 4 4 33

Gouraud Shading in OpenGL glshademodel(gl_smooth); 문제점 vertex normal 을계산하기위한 data structure 필요 주로, linked list 구조 34

Phong Shading Gouraud shading 의문제점 vertex 에서의 shading 결과를 interpolate highlight 계산불가능 Phong shading : normal vector를 interpolate shading 결과는각 pixel 에서다시계산 계산속도는당연히느려짐 N A N v bi-linear interpolation N B normal vector 만있으면, Phong model 로 pixel 값계산가능 35

Rendering Options 일반적인 graphics package 에서는선택사항 quality vs. speed 의 trade-off wireframe edge 만표시 flat-shading face 전체를같은색으로 Gouraud shading Phong shading mixed shading non-specular object : Gouraud shading specular object : Phong shading 36

Wire-frame 37

Ambient Illumination Only 38

Flat-Shading 39

Gouraud Shading 40

Phong Shading 41

6.6 Approximation of a Sphere

Unit Sphere implicit equation polygonal approximation f(x, y, z) x 2 + y 2 + z 2 1 0 recursion 으로구현 시작 : tetrahedron 각 face 를 subdivision 43

Unit Sphere pseudo code void triangle(vertex a, vertex b, vertex c, int level) { if (level > limit) { draw_triangle(a, b, c); c } return; ac bc vertex ab normalize( (a + b) / 2 ); vertex bc normalize( (b + c) / 2 ); vertex ac normalize( (a + c) / 2 ); a ab b triangle(a, ab, ac); triangle(ab, b, bc); triangle(c, ac, bc); triangle(ab, bc, ac); } 44

6.7 Light Sources in OpenGL

Light Sources in OpenGL Phong shading model I I a + I d + I s kd kala + a+ bd+ cd 1 kd Ld ( l n) + k a+ bd+ cd s ( l n) Ld + ( r v 2 2 k a+ bd+ cd α ( sls ( r v) ) + kal 2 a ) α L s at most 8 light sources GL_LIGHT0,, GL_LIGHT7 glenable(gl_lighting); // light source 사용 glenable(gl_light0); // light source #0 on 46

Light Sources in OpenGL light source 설정함수들 void gllightf(glenum light, GLenum name, GLfloat value); void gllightfv(glenum light, GLenum name, GLfloat* values); light source position (or direction) gllightfv(gl_light0, GL_POSITION, light0_pos); point light source, spotlight : position GLfloat light0_pos[ ] { 1.0, 2.0, 3.0, 1.0 }; distant light source : direction vector GLfloat light0_pos[ ] { 1.0, 2.0, 3.0, 0.0 }; α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd 47

Light Sources in OpenGL the amount of ambient, diffuse, specular light GLfloat ambient_0[ ] {1.0, 0.0, 0.0, 1.0}; // RGBA rep. gllightfv(gl_light0, GL_AMBIENT, ambient_0); gllightfv(gl_light0, GL_DIFFUSE, diffuse_0); gllightfv(gl_light0, GL_SPECULAR, specular_0); global ambient light (if necessary) gllightmodelfv(gl_light_model_ambient, global_ambient); α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd 48

Light Sources in OpenGL distance attenuation model gllightf(gl_light0, GL_CONSTANT_ATTENUATION, a); gllightf(gl_light0, GL_LINEAR_ATTENUATION, b); gllightf(gl_light0, GL_QUADRATIC_ATTENUATION, c); α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd 49

Light Sources in OpenGL spot light gllightf(gl_light0, GL_SPOT_CUTOFF, 30.0F); gllightf(gl_light0, GL_SPOT_EXPONENT, e); gllightfv(gl_light0, GL_SPOT_DIRECTOIN, vector); θ θ φ cos e θ θ 50

Light Sources in OpenGL viewer location default: infinite position ( 방향은 COP 방향 ) COP 에서보는것으로설정가능 큰차이는없지만, shading 계산시의 v 값변화 gllightmodeli(gl_light_model_local_viewer, GL_TRUE); α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd two-side shading back face 도 shading 시킬때 gllightmodeli(gl_light_model_two_sided, GL_TRUE); 51

6.8 Specification of Materials in OpenGL

Materials in OpenGL material functions void glmaterialf(glenum face, GLenum name, GLfloat value); 이후의모든 face 가정해진값을사용 face GL_FRONT, GL_BACK, GL_FRONT_AND_BACK GLfloat ambient[ ] {0.2, 0.2, 0.2, 1.0} glmaterialfv(gl_front_and_back, GL_AMBIENT, ambient); glmaterialfv(gl_front, GL_DIFFUSE, diffuse); glmaterialfv(gl_back, GL_SPECULAR, specular); α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd 53

Materials in OpenGL shininess glmaterialf(gl_back, GL_SHINESS, 100.0); α ( kd Ld ( l n) + ksls ( r ) ) kala 1 I v + 2 a+ bd+ cd self-emission surface 자체가빛을내는경우 GLfloat emission[ ] {0.0, 0.3, 0.3, 1.0}; glmaterialf(gl_front_and_back, GL_EMISSION, emission); I 1 a+ bd+ cd α ( k L ( l n) + k L ( r ) ) + k L emission d d s s v a a + 2 54

Materials in OpenGL color tracking set the materials parameters by tracking the colors set by glcolor*( ) glenable(gl_color_material); glcolormaterial(gl_front, GL_AMBIENT_AND_DIFFUSE); glcolor4fv(color); 자동설정 glmaterialfv(gl_front, GL_AMBIENT, color); glmaterialfv(gl_front, GL_DIFFUSE, color); 55

6.9 Shading of the Sphere Model

Unit Sphere Shading 2가지 shading model 선택가능 flat shading glshademodel(gl_flat); Gouraud shading glshademodel(gl_smooth); 자세한코드는교재참고 sphere.c 57

6.10 Global Rendering

Local and Global Illumination local illumination : Phong shading model 그림자, 반사광등의처리가힘들다 global illumination local illumination global illumination Ray Tracing : specular, 굴절, 그림자처리능력 Radiosity : diffuse 처리가완벽 59

Ray Tracing forward ray tracing : 실세계 광원 물체 카메라 backward ray tracing 계산량을줄이려면, 역추적 카메라 픽셀 물체 광원 60

Ray Tracing A. Glassner, An Introduction to Ray Tracing, Academic Press, (1989). 실제 ray 를 trace 하는효과가있으므로, 다양한기능 shadow rays 그림자처리가능 mirror effect 거울처리가능 refraction & reflection 투명한물체처리가능 61

Ray Tracing screen 상의 pixel 을지나가는 ray 를하나씩발사 construct a binary ray-tracing tree left branch : reflected ray path right branch : transmitted ray path limit depth 까지계속추적 tree를역추적하면서, 최종 pixel 값계산 62

Ray Tracing 결과 63

Radiosity C. Goral, et al., Modelling the Interaction of Light Between Diffuse Surfaces, SIGGRAPH 84, 212 222, (1984). Basic idea thermal-engineering models for the emission and reflection of radiation conservation of light energy in a closed environment 주로실내환경에서만적용 energy equilibrium 64

Radiosity real diffuse effect? 모든 surface 들간의 light interaction으로 modeling 모든 surface 들끼리서로반사광을주고받음 patch : 계산의기본단위 모든 surface 들을작은 patch 로분할 각 patch 마다 diffuse term을따로계산 form factor : pacth 1개에서다른 patch 로가는 energy 65

Radiosity form factors F ij 1/ A j A i A A i j (cosθ cosθ cosθ i cosθ da πr 2 i j H j ij /( πr 2 )) H ij da da j i da j N r θ j A j N θ i da i A i 66

Radiosity energy equilibrium equation B F j ij E i ρ i B j F ij B A i i B i F ij E A i A i E i i + ρ F + ρ ji i i n A j 1 j j B B j j F F ij ji A j radiosity B j : the rate of energy leaving the surface j emission E j : the rate of energy emitted from surface j reflectivity ρ j : the fraction of the light incident on a surface j which is reflected back into the environment form-fraction F ij : the fraction of energy leaving the surface i and landing on surface j 67

Radiosity 결과 68

Global Illumination ray tracing : specular effect 에최적 radiosity : diffuse effect 에최적 hybrid approach : 2 개모두적용 문제점? 수행시간! video card level에서구현불가능 보통몇시간정도의처리시간필요 구현자체도상당히까다로움 69

요약 70