{"id":15986,"date":"2025-04-30T08:51:28","date_gmt":"2025-04-29T23:51:28","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=15986"},"modified":"2025-05-02T10:02:12","modified_gmt":"2025-05-02T01:02:12","slug":"ray-sphere-%ea%b3%84%ec%82%b0","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=15986","title":{"rendered":"Ray-Sphere \uacc4\uc0b0"},"content":{"rendered":"<h3>\uc218\uc2dd<\/h3>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2025\/05\/20250501_081002.jpg\" alt=\"\" width=\"600\" class=\"aligncenter size-full wp-image-15987\" \/><\/p>\n<h3>\ucf54\ub4dc<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"glsl\">\r\nuniform vec3 uResolution;\r\nuniform float uTime;\r\nuniform vec4 uMouse;\r\n\r\n\/\/ v = a -> 0\r\n\/\/ v = b -> 1 \r\n\/\/ v = (a+b)\/2 -> 0.5\r\nfloat remap01(float a, float b, float v) {\r\n  return (v - a) \/ (b - a);\r\n}\r\n\r\nvoid main() {\r\n  vec2 uv = (gl_FragCoord.xy - .5 * uResolution.xy) \/ uResolution.y;\r\n\r\n  vec3 col = vec3(0);\r\n  vec3 Ro = vec3(0);\r\n  vec3 Rd = normalize(vec3(uv.x, uv.y, 1.));\r\n  vec3 S = vec3(0, 0, 3);\r\n  float R = 1.;\r\n\r\n  float tp = dot(S - Ro, Rd);\r\n  vec3 Ptp = Ro + Rd * tp;\r\n  float y = length(S - Ptp);\r\n  \r\n  if(y < R) {\r\n    float x = sqrt(R*R - y*y);\r\n    float t1 = tp - x;\r\n    float t2 = tp + x;\r\n\r\n    float c = remap01(S.z, S.z - R, t1);\r\n    col = vec3(c);\r\n  }\r\n  \r\n  gl_FragColor = vec4(col, 1.0);\r\n}\r\n<\/pre>\n<h3>\uacb0\uacfc<\/h3>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2025\/05\/\u1109\u1173\u110f\u1173\u1105\u1175\u11ab\u1109\u1163\u11ba-2025-05-01-08.50.13.png\" alt=\"\" width=\"700\" class=\"aligncenter size-full wp-image-15991\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc218\uc2dd \ucf54\ub4dc uniform vec3 uResolution; uniform float uTime; uniform vec4 uMouse; \/\/ v = a -> 0 \/\/ v = b -> 1 \/\/ v = (a+b)\/2 -> 0.5 float remap01(float a, float b, float v) { return (v &#8211; a) \/ (b &#8211; a); } void main() { vec2 uv = (gl_FragCoord.xy &#8211; .5 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=15986\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Ray-Sphere \uacc4\uc0b0&#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":[152,1],"tags":[],"class_list":["post-15986","post","type-post","status-publish","format-standard","hentry","category-glsl","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/15986","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=15986"}],"version-history":[{"count":6,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/15986\/revisions"}],"predecessor-version":[{"id":15994,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/15986\/revisions\/15994"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15986"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}