第7章 レンダリング

Similar documents
第7章 レンダリング

Fair Curve and Surface Design System Using Tangent Control

2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut OpenGL glut C++ Linux, Windows (Visual C++, gcc), Macintosh glut glut GUI glut GUI CG glmultmatrix()

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t

libaux.dvi

/*p7-1-1*/

#include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 sta

第3章 OpenGL の基礎

第3章 OpenGL の基礎

3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程

OpenGL & GLUTの基本関数の説明

DrawArrays DrawElements References Kageyama (Kobe Univ.) Visualization / 34

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t

1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - >

Kageyama (Kobe Univ.) / 36

PowerPoint Presentation

Vol. 44 No. SIG 9(CVIM 7) ) 2) 1) 1 2) 3 7) 1) 2) 3 3) 4) 5) (a) (d) (g) (b) (e) (h) No Convergence? End (f) (c) Yes * ** * ** 1

TA TA TA abcdefgh abcdefgh C PC Wii bluetooth 2.2 Bluetooth USB Princeton PTM-UBT3S 1 1

Graphics Performance Tuning () Z 2

tnbp59-21_Web:P2/ky132379509610002944

Q E Q T a k Q Q Q T Q =

WebGL Safari WebGL Kageyama (Kobe Univ.) Visualization / 55

adv99_4.PDF

_TJ…X…g†[…fi_0216

2 2 2 OpenGL Linux Linux Video for Linux(Video4Linux, v4l ) API Video4Linux USB IEEE1394 API Linux Video for Linux 2(Video4Linux2, v4l2 ) OpenCV API U

WebGL Safari WebGL WebGL Safari Kageyama (Kobe Univ.) / 5

WebGL X LR301 Kageyama (Kobe Univ.) Visualization / 45

(Compton Scattering) Beaming 1 exp [i (k x ωt)] k λ k = 2π/λ ω = 2πν k = ω/c k x ωt ( ω ) k α c, k k x ωt η αβ k α x β diag( + ++) x β = (ct, x) O O x

WebGL Kageyama (Kobe Univ.) Visualization / 39

WebGL OpenGL GLSL Kageyama (Kobe Univ.) Visualization / 57

ZEMAX Nagata DLL Volume-CAD c Copyright by RIKEN All Rights Reserved : : ( )

manual.dvi

プリント

\\afs001-0m0005\project02\A32\M

(4) モデルの消去 mqodeletemodel( model ); (5) 終了処理 ( プログラム終了時にやってください ) mqocleanup(); 3. 使い方 (2) 連番ファイルを読み込んで表示する場合 (1) 初期化 (ARToolKit の場合,argInit() の後に使用 )

x A Aω ẋ ẋ 2 + ω 2 x 2 = ω 2 A 2. (ẋ, ωx) ζ ẋ + iωx ζ ζ dζ = ẍ + iωẋ = ẍ + iω(ζ iωx) dt dζ dt iωζ = ẍ + ω2 x (2.1) ζ ζ = Aωe iωt = Aω cos ωt + iaω sin


j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E


OpenGL GLSL References Kageyama (Kobe Univ.) Visualization / 58

WebGL References Kageyama (Kobe Univ.) Visualization *4 2 / 54

Microsoft Word - ggbook.docx

ex01.dvi

2 T ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy ( ) ( ) ( ) ( ) u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a

Kageyama (Kobe Univ.) Visualization / 32

コンピューターグラフィックスS

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

2016.

第121回関東連合産科婦人科学会総会・学術集会 プログラム・抄録

1 (Berry,1975) 2-6 p (S πr 2 )p πr 2 p 2πRγ p p = 2γ R (2.5).1-1 : : : : ( ).2 α, β α, β () X S = X X α X β (.1) 1 2

量子力学 問題

プログラム


II ( ) (7/31) II ( [ (3.4)] Navier Stokes [ (6/29)] Navier Stokes 3 [ (6/19)] Re

Microsoft Word - mediaJikkenCG_no2_2007.doc

85 4

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

double rx[natom], ry[natom], rz[natom]; 原子の座標 速度 力 ポテンシャルエ double vx[natom], vy[natom], vz[natom]; ネルギーを受ける配列を準備 double fx[natom], fy[natom], fz[natom

untitled

A 99% MS-Free Presentation

floating horizon algorithm 1 DEM [ 01] [Luebke01] LDI Layered Depth Image [Shade98] DEM Digital Elevation Model Height field

vol5-honma (LSR: Local Standard of Rest) 2.1 LSR R 0 LSR Θ 0 (Galactic Constant) 1985 (IAU: International Astronomical Union) R 0 =8.5

y = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f() + f() + f(3) + f(4) () *4

1 (1) ( i ) 60 (ii) 75 (iii) 315 (2) π ( i ) (ii) π (iii) 7 12 π ( (3) r, AOB = θ 0 < θ < π ) OAB A 2 OB P ( AB ) < ( AP ) (4) 0 < θ < π 2 sin θ

Cercignani Shen Kuščer

Hanbury-Brown Twiss (ver. 2.0) van Cittert - Zernike mutual coherence


Tekutama AR ~ 拡張現実感によるオーバーレイ表示と動作 ~ 情報物理研究室 渡部 修平 1

14 2 5

Advanced Visual Inspection Technology with 2-Dimensional Motion Images for Film-shaped Products Sumitomo Chemical Co., Ltd. Industrial Technology & Re

Gmech08.dvi

N08

Microsoft Word - C.....u.K...doc

Microsoft PowerPoint - info_eng3_05ppt.pptx

1. 2 P 2 (x, y) 2 x y (0, 0) R 2 = {(x, y) x, y R} x, y R P = (x, y) O = (0, 0) OP ( ) OP x x, y y ( ) x v = y ( ) x 2 1 v = P = (x, y) y ( x y ) 2 (x

(interferometer) 1 N *3 2 ω λ k = ω/c = 2π/λ ( ) r E = A 1 e iφ1(r) e iωt + A 2 e iφ2(r) e iωt (1) φ 1 (r), φ 2 (r) r λ 2π 2 I = E 2 = A A 2 2 +

14 FEM [1] 1992 [3] 1(a)(b) 1(c) [2] 2 ( 財 ) 日本海事協会 36 平成 14 年度 ClassNK 研究発表会

( ) ,

Microsoft Word - mediaJikkenCG_no2_2012.doc

ex01.dvi

O x y z O ( O ) O (O ) 3 x y z O O x v t = t = 0 ( 1 ) O t = 0 c t r = ct P (x, y, z) r 2 = x 2 + y 2 + z 2 (t, x, y, z) (ct) 2 x 2 y 2 z 2 = 0

untitled

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裱£²²ó ¡Ý½ÉÂꣲ¤Î²òÀ⡤±é½¬£²¡Ý

<4D F736F F D B B83578B6594BB2D834A836F815B82D082C88C60202E646F63>

nsg02-13/ky045059301600033210

ẍ = kx, (k > ) (.) x x(t) = A cos(ωt + α) (.). d/ = D. d dt x + k ( x = D + k ) ( ) ( ) k k x = D + i D i x =... ( ) k D + i x = or ( ) k D i x =.. k.

1 level Level swtich ButtonPress ButtonRelease Expose Level

all.dvi

OpenGL Programming Course OpenGL Programming Course FAQ

Kageyama (Kobe Univ.) / 41

/* drawing function */ function_graph();// drawing graph glflush(); int main(int argc, char **argv ) glutinit( &argc, argv ); glutinitdisplaymode( GLU

A, B, C. (1) A = A. (2) A = B B = A. (3) A = B, B = C A = C. A = B. (3)., f : A B g : B C. g f : A C, A = C. 7.1, A, B,. A = B, A, A A., A, A

19 σ = P/A o σ B Maximum tensile strength σ % 0.2% proof stress σ EL Elastic limit Work hardening coefficient failure necking σ PL Proportional

1 (1) X = AB + AB, Y = C D + C D, Z = AD + AD P A, B, C, D P = (XY + X Y + X Y )(Y Z + Y Z + Y Z )(ZX + Z X + Z X ) (2) Q A, B, C, D Q = AB C D + AB C

医系の統計入門第 2 版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 第 2 版 1 刷発行時のものです.

演算増幅器

joho07-1.ppt

BW BW

TEX American Mathmastical Society WINDOWS Microsoft Corporation Adobe Illustrator Acrobat Adobe Systems Incorporated TM L A TEX 2ε(pL A TEX 2ε) L A TE

(5) 75 (a) (b) ( 1 ) v ( 1 ) E E 1 v (a) ( 1 ) x E E (b) (a) (b)

Transcription:

7 April 11, 2017 1 / 59

7.1 ( ) CG 3 ( ) 2 / 59

7.2 7.2.1 ( ) 3 (rendering) 1 / (hidden line/surface calculation) a (outer normal algorithm) b Z (Z-buffer algorithm) c (scan-line algorithm) 2 (shading) a (flat shading) (constant shading) b (smooth shading) i (Gourand) ii (Phong) 3 / 59

3 (texture mapping) a (surface texture mapping) b (bump mapping) c (environmental mapping) i (reflection mapping) ii (refraction mapping) d (solid texture mapping) 4 (ray tracing) 5 (volume visualization) a (volume rendering) b (surface rendering) 4 / 59

/ 7.3 / 7.3.1 ( / ) / 7.1: / 5 / 59

/ 7.3.1 7.3.2 ( ) ν R 3 e R 3 ν e 0 ν e < 0 ν p 0, p 1, p 2 ν = (p 1 p 0 ) (p 2 p 0 ) (p 1 p 0 ) (p 2 p 0 ) ( ) 6 / 59

/ º e p 2 p 0 p 1 e e º º 7.2: 7 / 59

/ Z 7.3.2 Z 7.3.3 (Z ) z z Z Z / Z 8 / 59

/ Z ( ) 1 f(x, y) Z b(x, y) 2 (x, y) f(x, y) b(x, y) 3 Z (x, y) z z(x, y) If z (x, y) < b (x, y), then b (x, y) := z (x, y) and f (x, y) := b(x, y) f(x, y) Z 1 2 9 / 59

/ 7.3.3 7.3.4 ( ) x e º y 7.3: 10 / 59

/ ( ) 1 y : / y / y y 2 a x : / x x ( ) b z : z z 1 2 3 Z 11 / 59

OpenGL 7.4 OpenGL OpenGL Z void glutinitdisplaymode(glut DEPTH) Z ( ) void glclear(gl COLOR BUFFER BIT GL DEPTH BUFFER BIT) glenable(gl DEPTH TEST) gldisable(gl DEPTH TEST) 12 / 59

OpenGL 7.4: 13 / 59

OpenGL program7 1.c... glutinitdisplaymode(glut_double GLUT_RGB GLUT_DEPTH);... /* DEPTH ON */ #if 0 glenable(gl_depth_test); #endif... glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT);... glutsolidtorus(0.5, 0.9, 50, 50);/* */... glrectf(-2.0, -2.0, 2.0, 2.0);/* */... 14 / 59

7.5 7.5.1 ( ) (shading) 1 RGB a (diffuse reflection): Lambert (Lambertian reflectance) b (specular reflection): Phong (Phong reflection model) c (ambient reflection) d (transmitted light) 2 a (flat shading) b Gouraud (Gouraud shading) c Phong (Phong shading) 15 / 59

7.5.1 l º 7.5: 16 / 59

1 ν R 3 l R 3 k d [0, 1], l ν 0 RGB i in i d = k d i in l ν (Lambert ) 2 ν, l R 3 r R 3 ν l R 3 e R 3 k s, 0 k s 1, n > 0 l ν 0 RGB i in i s (α) = k s i in (r e) n (Phong ) cos α = r e 0 k s cos θ = l ν 0 17 / 59

l º r e 7.6: 18 / 59

3 k a, 0 k a 1, i amb i a = k a i amb i d, i s 10 % 20 % i a 4 d, 0 d 1, i 0 i t = di 0 19 / 59

7.5.2 1 Gouraud Phong 7.7: 20 / 59

2 Gouraud 3 E N a j N E j E j i E j ν i i E j ν i ν j = E j j º j º i3 º i4 º i2 º i1 7.8: 21 / 59

b ν j i j, j N, c Ω i, i E, x (α)i R 3, α N i, i (α)i, ϕ (α)i : Ω i R ϕ (α)i ( x(β)i ) = δαβ, α, β N i, x Ω i i h (x) = α N i ϕ (α)i (x) i (α)i ϕ (α)i i (3)i i (2)i i h i (1)i Á (3)i x (3)i Á (2)i Á (1)i 1 i x (2)i x (1)i 7.9: Gouraud 22 / 59

3 Phong a j N E j E j ν i i E j i E j ν i ν j = E j j b Ω i, i E, x (α)i R 3, α N i, ν (α)i, ϕ (α)i : Ω i R ϕ (α)i ( x(β)i ) = δαβ, α, β N i, x Ω i ν h (x) = α N i ϕ (α)i (x) ν (α)i c ν h (x) i (x) 23 / 59

º (3)i º h º (2)i º (1)i Á (3)i x (3)i Á (2)i Á (1)i x (1)i 1 i x (2)i 7.10: Phong 24 / 59

OpenGL 7.6 OpenGL gllightfv() void gllightfv(glenum light, GLenum pname, const GLfloat *params) light (GL LIGHT0 GL LIGHT7) param GL AMBIENT : RGBA GL DIFFUSE : RGBA GL SPECULAR : RGBA GL POSITION : (x, y, z, w) GL SPOT DIRECTION : (x, y, z) GL EXPONENT : GL SPOT CUTOFF : ( ) GL CONSTANT ATTENUATION : k c GL LINEAR ATTENUATION : k l GL QUADRATIC ATTENUATION : 2 k q 25 / 59

OpenGL d 1 k c + k l d + k q d 2 glmaterialfv() void glmaterialfv(glenum face, GLenum pname, const GLfloat *params); face GL FRONT: GL BACK : GL FRONT AND BACK : 26 / 59

OpenGL pname GL AMBIENT (RGBA) : GL DIFFUSE (RGBA ) : GL SPECULAR (RGBA ) : GL EMISSION (RGBA ) : GL SHININESS (0 128) : GL AMBIENT AND DIFFUSE (RGBA, RGBA): GL SPECULAR (1 1 1 1) GL SHININESS GL SPECULAR GL DIFFUSE GL AMBIENT 0 27 / 59

OpenGL program7 2.c void display(void)... /* */ gllightfv(gl_light0, GL_AMBIENT, light0_ambient); /* */ gllightfv(gl_light0, GL_DIFFUSE, light0_diffuse); /* */ gllightfv(gl_light0, GL_SPECULAR, light0_specular); /* */ /* */ glmaterialfv(gl_front, GL_SPECULAR, material_specular); glmaterialfv(gl_front, GL_SHININESS, shininess); /* */... 28 / 59

OpenGL 7.6.1 ( ) program7 2.c 1 2 29 / 59

7.7 3 (texture) 1 2 3 4 30 / 59

1 2 3 a b c d 7.11: 31 / 59

2 (bump mapping) 7.12: 3 (environment mapping) a (reflection mapping) 1 b (refraction mapping) 1 32 / 59

7.13: 4 3 (solid texture) 33 / 59

7.14: 34 / 59

OpenGL 7.8 OpenGL glpixelstorei() void glpixelstorei(glenum pname, GLint param); pname GL UNPACK ALIGNMENT param 1, 2, 4, 8 1 RGBA 1 4 1 RGB 1 1 3 35 / 59

OpenGL gltexparameteri() void gltexparameteri(glenum target, GLenum pname, GLint param); target GL TEXTURE 2D 1 pname GL TEXTURE MAG FILTER param GL NEAREST GL LINEAR 36 / 59

OpenGL pname GL TEXTURE MIN FILTER param GL NEAREST GL LINEAR GL NEAREST MIPMAP NEAREST GL NEAREST MIPMAP LINEAR GL LINEAR MIPMAP NEAREST GL LINEAR MIPMAP LINEAR MIPMAP pname GL TEXTURE WRAP S GL TEXTURE WRAP T param s t GL REPEAT GL CLAMP( ) 37 / 59

OpenGL glteximage2d() void glteximage2d(glenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); Target GL TEXTURE 2D Level MIPMAP MIPMAP 0 internalformat GL RGB, GL RGBA, GL ALPHA, GL LUMINANCE, GL LUMINANCE ALPHA, GL INTENSITY 38 38 / 59

OpenGL width, height border 0 format pixels GL RGB, GL RGBA, GL COLOR INDEX, GL RED, GL GREEN, GL BLUE, GL ALPHA, GL LUMINANCE, GL LUMINANCE ALPHA type pixels GL UNSIGNED BYTE unsigned char, GL BYTE, GL SHORT, GL UNSIGNED SHORT, GL INT, GL UNSIGNED INT, GL FLOAT, GL BITMAP pixels 39 / 59

OpenGL gltexenvi() void gltexenvi(glenum target, GLenum pname, GLint param); target GL TEXTURE ENV pname GL TEXTURE ENV MODE param GL MODULATE ( ) GL DECAL ( ) GL BLEND ( ) GL REPLACE ( ) 40 / 59

OpenGL program7 3.c int main(int argc, char **argv)... /* */ make_image(); init_texture();... void display(void)... glenable(gl_texture_2d);... gltexenvi(gl_texture_env, GL_TEXTURE_ENV_MODE, GL_MODULATE);... 41 / 59

OpenGL 7.15: 42 / 59

7.9 (ray tracing) 7.16: 43 / 59

1 2 a ( ) b (1) (2) 44 / 59

1 x 0 R 3 L i di (x 0 ), i si (x 0 ) i L x 0 x 0 i (x 0 ) = i L (i di (x 0 ) + i si (x 0 )) + k r (x 0 ) i r (x r ) + k t (x 0 ) i t (x t ) x r x t k r, k t 45 / 59

2 x r x t i r (x r ) = i L (i di (x r ) + i si (x r )) + k r (x r ) i r (x rr ) + k t (x r ) i t (x rt ) i t (x t ) = i L (i di (x t ) + i si (x t )) + k r (x t ) i r (x tr ) + k t (x t ) i t (x tt ) x rr,, x tt 3 4 i (x 0 ) 46 / 59

7.10 3 3 (X CT X ) ( ) 1 3 Ω R 3 Ω i, i E, Ω i (voxel) 2 X CT X v : Ω R 3 v i : E i v R V = {v i } i E (voxel data) (volume data) 47 / 59

v i i v i (a) Ω i (b) 7.17: Ω i v i 48 / 59

7.10.1 ( ) (volume visualization) 1 (volume rendering) 2 (surface rendering) (a) (b) 7.18: 49 / 59

7.10.1 7.10.2 ( ) ( ) 3 (volume rendering) Intensity of light r g b Intensity of light attribute value v attribute value v (a) (b) 7.19: 50 / 59

1 v R c = (r (v), g (v), b (v)) α (v) (c, α) : R R 4 ( 7.19) 2 x j, j S, x j Ω i x (α) R 3, α {1,, 8} v (α) v j = v h (x j ) = α {1,,8} ϕ (α) (x j ) v (α) ϕ (α) : Ω i R ϕ (α) ( x(β) ) = δαβ, α, β {1,, 8}, (x 1, x 2, x 3 3 1 ) ϕ (α) 51 / 59

x ixi+1 x i+2 s s 7.20: 3 x j, j S, α j = α (v j ) j={1,,m} α j = 1 m c m x m i m := c m for i = m 1 to 0 do i i := α i c i + (1 α i ) c i+1 52 / 59

i := i 0 3 i = (i R, i G, i B ) 53 / 59

x ijk = (x i1, x j2, x k3 ), i, j, k {1,, m}, v x ijk v (x ijk ) = 1 v (x i+1 1, x j2, x k3 ) v (x i 1 1, x j2, x k3 ) v (x i1, x j+1 2, x k3 ) v (x i1, x j 1 2, x k3 ) 2 v (x i1, x j2, x k+1 3 ) v (x i1, x j2, x k 1 3 ) 1 x ijk α ijk v (x ijk ) v (x ijk ) 2 v (x ijk ) 3 Phong 54 / 59

7.21: 55 / 59

7.10.2 7.10.3 ( ) (surface rendering) (marching cubes method) ( ) v 0 x (α) R 3, α {1,, 8} v (α) v (α) v 0 0 v (α) > v 0 1 x (α) 8 0, 1 2 8 = 256 7.22 (b) 15 56 / 59

1 1 1 1 0 0 0 (a) 0 (b) 7.22: {0, 1} 57 / 59

7.11 CG 3 1 / / / / Z 2 3 4 5 3 58 / 59

[1] James D. Foley, Steven K. Feiner, Andries van Dam, John F. Hughes, ( ).., 2001. [2],. CG., 2004. [3],. OpenGL 3 CG., 2003. 59 / 59