第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

tnbp59-21_Web:P2/ky132379509610002944

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

Graphics Performance Tuning () Z 2

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

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

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

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


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

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

Kageyama (Kobe Univ.) Visualization / 32

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

( ) 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回関東連合産科婦人科学会総会・学術集会 プログラム・抄録

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

プログラム


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

A 99% MS-Free Presentation

untitled

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

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

Microsoft Word - mediaJikkenCG_no2_2007.doc

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

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

Cercignani Shen Kuščer

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 θ


Gmech08.dvi

14 2 5

量子力学 問題

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

N08

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

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

(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 +

Microsoft PowerPoint - info_eng3_05ppt.pptx

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

nsg02-13/ky045059301600033210

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

SOWC04....

untitled

TOP URL 1

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

all.dvi

<4D F736F F D B B83578B6594BB2D834A836F815B82D082C88C60202E646F63>

ẍ = 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

Kageyama (Kobe Univ.) / 41

OpenGL Programming Course OpenGL Programming Course FAQ

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

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

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

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

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

inkiso.dvi

joho07-1.ppt

演算増幅器

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

(iii) 0 V, x V, x + 0 = x. 0. (iv) x V, y V, x + y = 0., y x, y = x. (v) 1x = x. (vii) (α + β)x = αx + βx. (viii) (αβ)x = α(βx)., V, C.,,., (1)

Transcription:

7 May 18, 2012 1 / 60

71 ( ) CG 3 ( ) 2 / 60

72 71 ( ) 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 / 60

72 (cnt) 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 / 60

73 / 72 ( / ) / 1: / 5 / 60

731 73 ( ) ν 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 / 60

731 (cnt) º e p 1 e e p 2 p 0 º º 2: 7 / 60

Z 732 Z 74 (Z ) z z Z Z / Z 8 / 60

Z 732 Z (cnt) ( ) 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 / 60

733 75 ( ) x e º y 3: 10 / 60

733 (cnt) ( ) 1 y : / y / y y 2 a x : / x x ( ) b z : z z 1 2 3 Z 11 / 60

74 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 / 60

74 OpenGL (cnt) 4: 13 / 60

74 OpenGL (cnt) program7 1c 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(05, 09, 50, 50);/* */ glrectf(-20, -20, 20, 20);/* */ 14 / 60

75 76 ( ) (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 / 60

751 1 ν R 3 l R 3 k d [0, 1], l ν 0 RGB i in i d = k d i in l ν (Lambert ) l º 5: 16 / 60

751 (cnt) 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 / 60

751 (cnt) l º r e 6: 18 / 60

751 (cnt) 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 / 60

752 1 Gouraud Phong 7: 20 / 60

752 (cnt) 2 Gouraud 3 E N a j N E j E j i E j ν i ν j i E ν = j i E j j º j º i3 º i4 º i2 º i1 8: 21 / 60

752 (cnt) 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) = ϕ (α)i (x) i (α)i α N i ϕ (α)i 22 / 60

752 (cnt) i (1)i Á (1)i 1 x (1)i i (3)i i h Á 3)i x (3)i i i (2)i Á (2)i x (2)i 9: Gouraud 23 / 60

752 (cnt) 3 Phong a j N E j E j ν i i E j ν j = i E j ν i 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) 24 / 60

752 (cnt) º (3)i º (1)i Á (1)i 1 x (1)i º h Á 3)i x (3)i i Á (2)i x (2)i º (2)i 10: Phong 25 / 60

76 OpenGL gllightfv() void gllightfv(glenum light, GLenum pname, const GLfloat *params) light (GL LIGHT0 GL LIGHT7) pname 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 param 26 / 60

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

76 OpenGL (cnt) 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 28 / 60

76 OpenGL (cnt) program7 2c 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); /* */ 29 / 60

76 OpenGL (cnt) 71 ( ) program7 2c 1 2 30 / 60

77 3 (texture) 1 2 3 4 31 / 60

77 (cnt) 1 2 3 a b c d 11: 32 / 60

77 (cnt) 2 (bump mapping) 12: 33 / 60

77 (cnt) 3 (environment mapping) a (reflection mapping) 1 b (refraction mapping) 1 13: 34 / 60

77 (cnt) 4 3 (solid texture) 14: 35 / 60

78 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 36 / 60

78 OpenGL (cnt) gltexparameteri() void gltexparameteri(glenum target, GLenum pname, GLint param); target GL TEXTURE 2D 1 pname GL TEXTURE MAG FILTER param GL NEAREST GL LINEAR 37 / 60

78 OpenGL (cnt) 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( ) 38 / 60

78 OpenGL (cnt) 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 39 / 60

78 OpenGL (cnt) 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 40 / 60

78 OpenGL (cnt) 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 ( ) 41 / 60

78 OpenGL (cnt) program7 3c 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); 42 / 60

78 OpenGL (cnt) 15: 43 / 60

79 (ray tracing) 16: 44 / 60

79 (cnt) 1 2 a ( ) b (1) (2) 45 / 60

79 (cnt) ( 1 x 0 R 3 L i ) ( di x 0, i ) si x 0 i L x 0 x 0 ( ( idi x 0 ) ( + i si x 0 )) i ( x 0) = i L ( + k r x 0 ) i r (x r ( ) + k t x 0 ) ( i t x t ) x r x t k r, k t 46 / 60

79 (cnt) 2 x r x t i r (x r ) = (i di (x r ) + i si (x r )) i L + k r (x r ) i r (x rr ) + k t (x r ( ) i t x rt ) ( ( idi x t ) ( + i si x t )) ( i t x t ) = i L ( + 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) 47 / 60

710 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} (voxel i E data) (volume data) 48 / 60

710 (cnt) v i i v i (a) Ω i (b) 17: Ω i v i 49 / 60

710 (cnt) 77 ( ) (volume visualization) 1 (volume rendering) 2 (surface rendering) (a) (b) 18: 50 / 60

7101 78 ( ) ( ) 3 (volume rendering) 1 v R c = (r (v), g (v), b (v)) α (v) (c, α) : R R 4 ( 19) Intensity of light r g b Intensity of light attribute value v attribute value v (a) (b) 19: 51 / 60

7101 (cnt) 2 x j, j S, x j Ω i x (α) R 3, α {1,, 8} v (α) v j ( = v h x j ) = ϕ (α) ( x j) v (α) α {1,,8} ϕ (α) : Ω i R ϕ (α) ( x (β)) = δ αβ, α, β {1,, 8}, (x 1, x 2, x 3 3 1 ) ϕ (α) 52 / 60

7101 (cnt) x ixi+1 x i+2 s s 20: 53 / 60

7101 (cnt) 3 x j, j S, α j = α ( v j) m j=1 α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 i := i 0 3 i = (i R, i G, i B ) 54 / 60

7101 (cnt) ( ) x ijk = x i 1, x j 2, xk 3, i, j, k {1,, m}, v x ijk ( ) ( ) v ( v x i+1 x ijk) = 1 1, x j 2, xk 3 v x i 1 1, x j 2, xk 3 ( ) ( ) v x i 2 1, x j+1 2, x k 3 v x i 1, x j 1 2, x k 3 ( ) ( ) v x i 1, x j 2, xk+1 3 v x i 1, x j 2, xk 1 3 1 x ijk α ijk v ( x ijk) v ( x ijk) 2 v ( x ijk) 3 Phong 55 / 60

7101 (cnt) 21: 56 / 60

7102 79 ( ) (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 22 (b) 15 57 / 60

7102 (cnt) 1 1 1 1 0 0 0 (a) 0 (b) 22: {0, 1} 58 / 60

711 CG 3 1 / / / / Z 2 3 4 5 3 59 / 60

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