{"id":493,"date":"2012-01-27T23:27:55","date_gmt":"2012-01-27T20:27:55","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=493"},"modified":"2016-06-21T13:35:46","modified_gmt":"2016-06-21T05:35:46","slug":"simple-shadow-casting-algorithm-unity","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2012\/01\/27\/simple-shadow-casting-algorithm-unity\/","title":{"rendered":"Simple Shadow Casting Algorithm"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"494\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2012\/01\/27\/simple-shadow-casting-algorithm-unity\/mshadowcaster1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/01\/mshadowcaster1.jpg?fit=680%2C497&amp;ssl=1\" data-orig-size=\"680,497\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"mshadowcaster1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/01\/mshadowcaster1.jpg?fit=680%2C497&amp;ssl=1\" class=\"alignnone size-full wp-image-494\" title=\"mshadowcaster1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/01\/mshadowcaster1.jpg?resize=680%2C497\" alt=\"\" width=\"680\" height=\"497\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/01\/mshadowcaster1.jpg?w=680&amp;ssl=1 680w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/01\/mshadowcaster1.jpg?resize=300%2C219&amp;ssl=1 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/p>\n<p>Converted part of this code into Unity(js) : <a href=\"http:\/\/freespace.virgin.net\/hugo.elias\/graphics\/x_shadow.htm\" target=\"_blank\">A Simple Algorithm For Casting Shadows<\/a><\/p>\n<p><strong>Screenshot info:<\/strong><br \/>\n&#8211; Red lines = from camera to vertex<br \/>\n&#8211; Green lines = from vertex to ground<br \/>\n&#8211; Blue lines = shadow plane vertices (no plane on this version yet, could use Triangulator.cs for it)<\/p>\n<p><strong>Current status:<\/strong><br \/>\n&#8211; Tried to implement some convex hull generation for the shadow plane points..but it doesnt work yet..<br \/>\n&#8211; See the new version: <a href=\"http:\/\/unitycoder.com\/blog\/2012\/03\/27\/shadow-casting-convex-hull-more-fake-shadows\/\">http:\/\/unitycoder.com\/blog\/2012\/03\/27\/shadow-casting-convex-hull-more-fake-shadows\/<\/a><\/p>\n<p><strong>Download source:<\/strong> (js + example scene)<br \/>\n<a title=\"Download\" href=\"http:\/\/unitycoder.com\/download\/index2.php?link=105&amp;uid=un1t3c0d5r\" target=\"_blank\">ShadowCastingVectors.unitypackage<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Converted part of this code into Unity(js) : A Simple Algorithm For Casting Shadows Screenshot info: &#8211; Red lines = from camera to vertex &#8211; Green lines = from vertex to ground &#8211; Blue lines = shadow plane vertices (no plane on this version yet, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":494,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[4,3],"tags":[93,133,134,40,56],"class_list":["post-493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-demos","category-unity3d","tag-algorithm","tag-casting","tag-lengthen","tag-shadow","tag-vector3"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/01\/mshadowcaster1.jpg?fit=680%2C497&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-7X","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":7,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":4270,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions\/4270"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/494"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}