{"id":546,"date":"2007-10-06T14:39:19","date_gmt":"2007-10-06T14:39:19","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=546"},"modified":"2017-01-29T11:01:58","modified_gmt":"2017-01-29T02:01:58","slug":"opengl-shader-26","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=546","title":{"rendered":"OpenGL Shader &#8211; 26"},"content":{"rendered":"<div align=\"center\"><strong>GLSL \uc608\uc81c : Lighting(Directional Lights 2) &#8211; 3\/6<br \/>\n<\/strong><\/div>\n<p>\uc6d0\ubb38 : <a href=\"http:\/\/www.lighthouse3d.com\/opengl\/glsl\/index.php?ogldir2\">http:\/\/www.lighthouse3d.com\/opengl\/glsl\/index.php?ogldir2<\/a><\/p>\n<p>OpenGL\uc758 Directional \ube5b\uc5d0 \ub300\ud55c Specular \uc694\uc18c\uc5d0 \ub300\ud55c \uc2dc\uac04\uc774\ub2e4. \uc0ac\uc6a9\ud55c \uad11\uc6d0\uacf5\uc2dd \ubaa8\ub378\uc740 Blinn-Phong \ubaa8\ub378\ub85c\uc368, \uc774 \ubaa8\ub378\uc740 Phong \ubaa8\ub378\uc744 \uac04\ub7b5\ud654\ud55c \uac83\uc774\ub2e4.<\/p>\n<p>Phong \ubaa8\ub378\uc740 Specular \uc694\uc18c\ub294 \ube5b\uc758 \ubc18\uc0ac\ubca1\ud130\uc640 \uc2dc\uc120\ubca1\ud130 \uc0ac\uc774\uc758 cosine\uc5d0 \ube44\ub840\ud568\uc744 \ub098\ud0c0\ub0b8\ub2e4.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1138461436.gif\" alt=\"\" width=\"379\" height=\"205\" \/>L\uc740 \uad11\uc6d0\uc5d0\uc11c \ubc84\ud14d\uc2a4\uae4c\uc9c0\ub85c \ud615\uc131\ub41c \ubca1\ud130\uc774\ub2e4. N\uc740 \ubc95\uc120\ubca1\ud130\uc774\uace0 Eye\ub294 \ubc84\ud14d\uc2a4\ub85c\ubd80\ud130 \ub208(\uce74\uba54\ub77c)\uae4c\uc9c0\uc758 \ubca1\ud130\uc774\ub2e4. R\uc740 \ubca1\ud130 L\uc774 \ud45c\uba74\uc5d0 \ubc18\uc0ac\ub418\uc5b4\uc9c4 \ubca1\ud130\ub2e4. Specular \uc694\uc18c\ub294 \uac01 alpha\uc758 consine\uc5d0 \ube44\ub840\ud55c\ub2e4.<\/p>\n<p>\ub9cc\uc57d \ub208(\uce74\uba54\ub77c) \ubca1\ud130(\uc2dc\uc120\ubca1\ud130)\uac00 \ubc18\uc0ac \ubca1\ud130\uc640 \uc77c\uce58\ud55c\ub2e4\uba74, \ucd5c\ub300\uc758 \uac15\ub3c4\ub97c \uac16\ub294 Specular\ub97c \uc5bb\uc744\uac83\uc774\ub2e4. \uc2dc\uc120\ubca1\ud130\uac00 \ubc18\uc0ac\ubca1\ud130\ub85c\ubd80\ud130 \uac08\ub77c\uc9c0\uba74, Specular \uac15\ub3c4\ub294 \uc1e0\ud1f4\ud55c\ub2e4. \uc1e0\ud1f4\uc815\ub3c4\ub294 Shininess \uac12\uc73c\ub85c \uc870\uc808\ud560 \uc218 \uc788\ub2e4. \ub354 \ub192\uc740 Shininess \uac12\uc740 \ub354 \ube60\ub974\uac8c Specular\ub97c \uac10\ud1f4\uc2dc\ud0a8\ub2e4. \uc774\uac83\uc758 \uc758\ubbf8\ub294 \ub192\uc740 Shininess\ub97c \uac00\uc9c4 \uac83\uc774 \ub354 \ub0ae\uc740 Shininess\ub97c \uac00\uc9c4\uac83\ubcf4\ub2e4 \ubc1d\uae30\uc2a4\ud31f\uc758 \ud06c\uae30\uac00 \uc791\uc544\uc9d0\uc744 \uc758\ubbf8\ud55c\ub2e4. OpenGL\uc5d0\uc11c Shininess\ub294 0~128 \uc0ac\uc774\uc758 \uac12\uc774\uace0 \ubc1d\uae30\uc2a4\ud31f\uc758 \ud06c\uae30\ub97c \uc870\uc808\ud558\ub294 \uac12\uc774\ub77c\uace0 \uc0dd\uac01\ud558\uba74 \uc27d\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1134152605.jpg\" alt=\"\" width=\"510\" height=\"109\" \/>\ubc18\uc0ac \ubca1\ud130\uc5d0 \ub300\ud55c \uacf5\uc2dd\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1355319321.gif\" alt=\"\" width=\"186\" height=\"33\" \/>\uadf8\ub9ac\uace0 Phong \ubaa8\ub378\uc2dd\uc744 \uc0ac\uc6a9\ud558\ub294 OpenGL\uc5d0\uc11c Specular \uc694\uc18c\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1189546437.gif\" alt=\"\" width=\"264\" height=\"42\" \/>\uc9c0\uc218 s\uac00 Shininess \uac12\uc774\uace0 Ls\ub294 \ube5b\uc758 Specular \uac15\ub3c4\uc774\uba70, Ms\ub294 \uc7ac\uc9c8\uc5d0 \ub300\ud55c Specular \uacc4\uc218\uc774\ub2e4.<\/p>\n<p>Blinn\uc740 \uc880\ub354 \ube60\ub974\uace0 \uc774\ud574\ud558\uae30 \uc26c\uc6b4 Phong \ubaa8\ub378\uc744 \uac04\ub7b5\ud654\ud574\uc11c \uc81c\uc548\ud558\uc600\ub294\ub370, \uadf8\uac83\uc774 \ubc14\ub85c Blinn-Phong \ubaa8\ub378\uc774\uba70 Half-Vector\uc5d0 \uae30\ubc18\ud55c\ub2e4. Half-Vector\ub294 \uc2dc\uc120\ubca1\ud130\uc640 \uad11\uc6d0\ubca1\ud130 \uc0ac\uc774\uc758 \uac01\uc744 \ubc18\uc73c\ub85c \ud558\uc5ec \uace0\ub824\ud55c\ub2e4\ub294 \uac83\uc73c\ub85c \ub2e4\uc74c \uadf8\ub9bc\uc744 \ubcf4\uba74 \uc774\ud574\uac00 \uc26c\uc6b8\uac83\uc774\ub2e4.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1101195605.gif\" alt=\"\" width=\"334\" height=\"207\" \/>Specular \uc694\uc18c\uc758 \uac15\ub3c4\ub294 \ubc95\uc120\ubca1\ud130\uc640 H \ubca1\ud130 \uc0ac\uc774\uc758 Cosine \uac12\uc5d0 \uc758\uc874\ud55c\ub2e4. Half-Vector\uc5d0 \ub300\ud55c \uacf5\uc2dd\uc740 \ubc18\uc0ac\ubca1\ud130\uc5d0 \ub300\ud55c \uac83\ubcf4\ub2e4 \ud6e8\uc52c \uac04\ub2e8\ud558\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1303151807.gif\" alt=\"\" width=\"137\" height=\"31\" \/>\uadf8\ub9ac\uace0 Blinn-Phong \ubaa8\ub378\uc744 \uc0ac\uc6a9\ud558\ub294 OpenGL\uc5d0\uc11c\uc758 Specualr \uc694\uc18c \uac12\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1078685516.gif\" alt=\"\" width=\"256\" height=\"38\" \/>\uc774\uac83\uc774 \uc2e4\uc81c \uadf8\ub798\ud53d\uc2a4 \ud558\ub4dc\uc6e8\uc5b4\uc758 \uace0\uc815\uae30\ub2a5\uc5d0\uc11c \uc77c\ubc18\uc801\uc73c\ub85c \uc0ac\uc6a9\ub418\ub294 \uc2dd\uc774\ub2e4. \uc6b0\ub9ac\ub294 \uc9c0\uae08 OpenGL\uc758 Directional \ube5b\uc744 \ubaa8\ubc29\ud558\uae38 \uc6d0\ud558\ubbc0\ub85c, \uc250\uc774\ub354\uc5d0\uc11c \uc774 \ub9c8\uc9c0\ub9c9 \uacf5\uc2dd\uc744 \uc0ac\uc6a9\ud55c\ub2e4. \uc5ec\uae30\uc5d0 \uc88b\uc740 \uc18c\uc2dd\uc774 \uc788\ub294\ub370, OpenGL\uc740 \uc6b0\ub9ac\ub97c \uc704\ud574 Half-Vector\ub97c \uacc4\uc0b0\ud574 \uc900\ub2e4\ub294 \uac83\uc774\ub2e4! \uc544\ub798 \ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uae38 \ubc14\ub780\ub2e4.<\/p>\n<pre><code class=\"html\">\/* compute the specular term if NdotL is larger than zero *\/\r\nif (NdotL > 0.0) {\r\n    \/\/ normalize the half-vector, and then compute the \r\n    \/\/ cosine (dot product) with the normal\r\n    NdotHV = max(dot(normal, gl_LightSource[0].halfVector.xyz),0.0);\r\n    specular = gl_FrontMaterial.specular * gl_LightSource[0].specular * \r\n        pow(NdotHV,gl_FrontMaterial.shininess);\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>GLSL \uc608\uc81c : Lighting(Directional Lights 2) &#8211; 3\/6 \uc6d0\ubb38 : http:\/\/www.lighthouse3d.com\/opengl\/glsl\/index.php?ogldir2 OpenGL\uc758 Directional \ube5b\uc5d0 \ub300\ud55c Specular \uc694\uc18c\uc5d0 \ub300\ud55c \uc2dc\uac04\uc774\ub2e4. \uc0ac\uc6a9\ud55c \uad11\uc6d0\uacf5\uc2dd \ubaa8\ub378\uc740 Blinn-Phong \ubaa8\ub378\ub85c\uc368, \uc774 \ubaa8\ub378\uc740 Phong \ubaa8\ub378\uc744 \uac04\ub7b5\ud654\ud55c \uac83\uc774\ub2e4. Phong \ubaa8\ub378\uc740 Specular \uc694\uc18c\ub294 \ube5b\uc758 \ubc18\uc0ac\ubca1\ud130\uc640 \uc2dc\uc120\ubca1\ud130 \uc0ac\uc774\uc758 cosine\uc5d0 \ube44\ub840\ud568\uc744 \ub098\ud0c0\ub0b8\ub2e4. L\uc740 \uad11\uc6d0\uc5d0\uc11c \ubc84\ud14d\uc2a4\uae4c\uc9c0\ub85c \ud615\uc131\ub41c \ubca1\ud130\uc774\ub2e4. N\uc740 \ubc95\uc120\ubca1\ud130\uc774\uace0 Eye\ub294 \ubc84\ud14d\uc2a4\ub85c\ubd80\ud130 \ub208(\uce74\uba54\ub77c)\uae4c\uc9c0\uc758 \ubca1\ud130\uc774\ub2e4. R\uc740 \ubca1\ud130 L\uc774 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=546\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;OpenGL Shader &#8211; 26&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[3,25],"class_list":["post-546","post","type-post","status-publish","format-standard","hentry","category-opengl","tag-opengl","tag-shader"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=546"}],"version-history":[{"count":1,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":3559,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions\/3559"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}