{"id":594,"date":"2007-10-12T19:32:00","date_gmt":"2007-10-12T19:32:00","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=594"},"modified":"2025-02-24T12:24:40","modified_gmt":"2025-02-24T03:24:40","slug":"opengl-shader-33","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=594","title":{"rendered":"OpenGL Shader &#8211; 32"},"content":{"rendered":"<div align=\"center\"><strong>GLSL \uc608\uc81c : Texture(MultiTexture) &#8211; 3\/3<\/strong><\/div>\n<p>\uc6d0\ubb38 : <a href=\"http:\/\/www.lighthouse3d.com\/opengl\/glsl\/index.php?textureMulti\">http:\/\/www.lighthouse3d.com\/opengl\/glsl\/index.php?textureMulti<\/a><\/p>\n<p>\uba40\ud2f0 \ud14d\uc2a4\uccd0\ub9c1\uc740 GLSL\uc5d0\uc11c\ub294 \uc815\ub9d0 \uc27d\ub2e4. \ud574\uc57c\ud560 \uac83\uc740 \ub450\uac1c\uc758 \ud14d\uc2a4\uccd0\uc5d0 \uc811\uadfc\ud558\ub294 \uc77c\uc774 \uc804\ubd80\ub2e4. \uadf8\ub9ac\uace0 \uc774 \uc7a5\uc5d0\uc11c\ub294 \ub3d9\uc77c\ud55c \ud14d\uc2a4\uccd0 \uc88c\ud45c\ub97c \uc0ac\uc6a9\ud560 \uac83\uc774\uae30 \ub54c\ubb38\uc5d0 \ubc84\ud14d\uc2a4 \uc250\uc774\ub354\ub97c \uc7ac\uc791\uc131\ud558\uc9c0 \uc54a\uace0 \uc774\uc804 \uac15\uc88c\uc758 \uac83\uc744 \uadf8\ub300\ub85c \uc0ac\uc6a9\ud55c\ub2e4. \ud504\ub808\uadf8\uba3c\ud2b8 \uc250\uc774\ub354 \ub610\ud55c \ub450\uac1c\uc758 \ud14d\uc2a4\uccd0 \uc0c9\uc0c1\uc744 \ucd94\uac00\ud558\ub294 \ucd5c\uc18c\ud55c\uc758 \ubcc0\ud654\ub9cc \uc788\ub2e4.<\/p>\n<pre><code class=\"html\">varying vec3 lightDir,normal;\r\nuniform sampler2D tex,l3d;\r\n\r\nvoid main()\r\n{\r\n    vec3 ct,cf;\r\n    vec4 texel;\r\n    float intensity,at,af;\r\n\t\t\r\n    intensity = max(dot(lightDir,normalize(normal)),0.0);\r\n\t\r\n    cf = intensity * (gl_FrontMaterial.diffuse).rgb + \r\n         gl_FrontMaterial.ambient.rgb;\r\n    af = gl_FrontMaterial.diffuse.a;\r\n\t\r\n    texel = texture2D(tex,gl_TexCoord[0].st)+\r\n            texture2D(l3d,gl_TexCoord[0].st);\r\n\r\n    ct = texel.rgb;\r\n    at = texel.a;\r\n\t\r\n    gl_FragColor = vec4(ct * cf, at * af);\t\r\n}<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1269123695.jpg\" alt=\"\" width=\"340\" height=\"140\" \/>\uadf8\ub9ac\uace0 \uc774\uc81c, \uc57d\uac04 \ub2e4\ub978 \ud2b9\ubcc4\ud55c \uac83\uc744 \ud574\ubcf4\uc790: Glow in the Drak Effect. \uc774 \ud2b9\ubcc4\ud55c \ud6a8\uacfc\ub294 \ub450\ubc88\uc9f8 \ud14d\uc2a4\uccd0\ub97c \uc5b4\ub460\uc18d\uc5d0\uc11c \ud0c0\uc624\ub974\ub294\ub4ef\ud558\uac8c \ubcf4\uc774\ub294 \uac83\uc774\ub2e4. \uc608\ub97c\ub4e4\uc5b4, \uc644\uc804\uc774 \ubc1d\uc544\uc84c\ub2e4\uac00 \uc5b4\ub450\uc6cc\uc9c0\ub294 \ub4ef\ud55c \ud6a8\uacfc.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1360824208.jpg\" alt=\"\" width=\"290\" height=\"137\" \/>\ub450 \ub2e8\uacc4\ub85c \ucd5c\uc885 \uc0c9\uc0c1\uc744 \ub2e4\uc2dc \uacc4\uc0b0\ud574\uc57c \ud558\ub294\ub370, \uba3c\uc800 \uccab\ubc88\uc9f8 \ud14d\uc2a4\uccd0\ub97c \ud504\ub808\uadf8\uba3c\ud2b8 \uc0c9\uc0c1\uc73c\ub85c \uc870\uc815\ub41c \uc0c1\ud0dc\uc758 \uc0c9\uc0c1\uc744 \uacc4\uc0b0\ud558\uace0, \uc774\ud6c4\uc5d0 \ub450\ubc88\uc9f8 \ud14d\uc2a4\uccd0 \uc720\ub2db\uc744 \uac15\ub3c4\uc5d0 \uae30\ubc18\ud574\uc11c \ucd94\uac00\ud558\ub294 \uac83\uc774\ub2e4.<\/p>\n<p>intensity\uac00 0\uc774\ub77c\uba74, \ub450\ubc88\uc9f8 \ud14d\uc2a4\uccd0\uac00 \uc804\uccb4\uc801\uc73c\ub85c \uc644\uc804\ud558\uac8c \ud45c\uc2dc\ub41c\ub2e4. \ubc18\ub300\ub85c intensity\uac00 1\uc774\ub77c\uba74, \ub450\ubc88\uc9f8 \ud14d\uc2a4\uccd0\ub97c 10% \uc815\ub3c4\ub9cc \ud45c\uc2dc\ub418\ub3c4\ub85d \ud55c\ub2e4. \uc774\ub7f0 \ud45c\uc2dc\ub97c \uc704\ud574 smoothStep\ub77c\ub294 \ud568\uc218\ub97c \ud1b5\ud574 \uad6c\ud604\ud560 \uac83\uc774\ub2e4. \uc774 \ud568\uc218\uc758 \uc2dc\uadf8\ub2c8\uccd0\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre><code class=\"html\">genType smoothStep(genType edge0, genType edge1, genType x);<\/code><\/pre>\n<p>\ub9cc\uc57d x&lt;=edge0\uc774\uba74 \uacb0\uacfc\ub294 0\uc774\uace0, \u00a0x&gt;=edge1\uc774\uba74 1 \uadf8\ub9ac\uace0 edge0&lt; x &lt;edge1\uc774\uba74 Hermit \ubcf4\uac04 \uc5f0\uc0b0\uc774 \uc218\ud589\ub41c\ub2e4. \uc6b0\ub9ac\uc758 \uacbd\uc6b0 \ub2e4\uc74c \ud568\uc218\ub97c \ud638\ucd9c\ud55c\ub2e4.<\/p>\n<pre><code class=\"html\">coef = smoothStep(1.0, 0.2, intensity);<\/code><\/pre>\n<p>\ub2e4\uc74c\uc740 \ud504\ub808\uadf8\uba3c\ud2b8 \uc250\uc774\ub354 \ucf54\ub4dc\uc774\ub2e4.<\/p>\n<pre><code class=\"html\">varying vec3 lightDir,normal;\r\nuniform sampler2D tex,l3d;\r\n\r\nvoid main()\r\n{\r\n    vec3 ct,cf,c;\r\n    vec4 texel;\r\n    float intensity,at,af,a;\r\n\t\r\n    intensity = max(dot(lightDir,normalize(normal)),0.0);\r\n\t\r\n    cf = intensity * (gl_FrontMaterial.diffuse).rgb + \r\n             gl_FrontMaterial.ambient.rgb;\r\n    af = gl_FrontMaterial.diffuse.a;\r\n\t\r\n    texel = texture2D(tex,gl_TexCoord[0].st);\r\n\t\t\r\n    ct = texel.rgb;\r\n    at = texel.a;\r\n\t\r\n    c = cf * ct;\r\n    a = af * at;\r\n\t\t\r\n    float coef = smoothstep(1.0,0.2,intensity);\r\n    c += coef *  vec3(texture2D(l3d,gl_TexCoord[0].st));\r\n\t\r\n    gl_FragColor = vec4(c, a);\t\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>GLSL \uc608\uc81c : Texture(MultiTexture) &#8211; 3\/3 \uc6d0\ubb38 : http:\/\/www.lighthouse3d.com\/opengl\/glsl\/index.php?textureMulti \uba40\ud2f0 \ud14d\uc2a4\uccd0\ub9c1\uc740 GLSL\uc5d0\uc11c\ub294 \uc815\ub9d0 \uc27d\ub2e4. \ud574\uc57c\ud560 \uac83\uc740 \ub450\uac1c\uc758 \ud14d\uc2a4\uccd0\uc5d0 \uc811\uadfc\ud558\ub294 \uc77c\uc774 \uc804\ubd80\ub2e4. \uadf8\ub9ac\uace0 \uc774 \uc7a5\uc5d0\uc11c\ub294 \ub3d9\uc77c\ud55c \ud14d\uc2a4\uccd0 \uc88c\ud45c\ub97c \uc0ac\uc6a9\ud560 \uac83\uc774\uae30 \ub54c\ubb38\uc5d0 \ubc84\ud14d\uc2a4 \uc250\uc774\ub354\ub97c \uc7ac\uc791\uc131\ud558\uc9c0 \uc54a\uace0 \uc774\uc804 \uac15\uc88c\uc758 \uac83\uc744 \uadf8\ub300\ub85c \uc0ac\uc6a9\ud55c\ub2e4. \ud504\ub808\uadf8\uba3c\ud2b8 \uc250\uc774\ub354 \ub610\ud55c \ub450\uac1c\uc758 \ud14d\uc2a4\uccd0 \uc0c9\uc0c1\uc744 \ucd94\uac00\ud558\ub294 \ucd5c\uc18c\ud55c\uc758 \ubcc0\ud654\ub9cc \uc788\ub2e4. varying vec3 lightDir,normal; uniform sampler2D tex,l3d; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=594\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;OpenGL Shader &#8211; 32&#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,153],"tags":[3,25],"class_list":["post-594","post","type-post","status-publish","format-standard","hentry","category-opengl","category-shader","tag-opengl","tag-shader"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/594","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=594"}],"version-history":[{"count":1,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/594\/revisions"}],"predecessor-version":[{"id":3550,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/594\/revisions\/3550"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}