{"id":2116,"date":"2013-08-03T18:57:56","date_gmt":"2013-08-03T15:57:56","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=2116"},"modified":"2013-08-04T07:02:51","modified_gmt":"2013-08-04T04:02:51","slug":"2d-grid-fake-shadow","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2013\/08\/03\/2d-grid-fake-shadow\/","title":{"rendered":"2D Grid Fake Shadow"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2117\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/08\/03\/2d-grid-fake-shadow\/2d_grid_visibility_shadow\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow.jpg?fit=374%2C353&amp;ssl=1\" data-orig-size=\"374,353\" 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=\"2D_grid_visibility_shadow\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow.jpg?fit=300%2C283&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow.jpg?fit=374%2C353&amp;ssl=1\" class=\"alignnone size-medium wp-image-2117\" alt=\"2D_grid_visibility_shadow\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow-300x283.jpg?resize=300%2C283\" width=\"300\" height=\"283\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow.jpg?resize=300%2C283&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow.jpg?w=374&amp;ssl=1 374w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Using the same code from previous <a title=\"http:\/\/unitycoder.com\/blog\/2012\/10\/29\/2d-raycasting-visibility-voxel-travelsal\/\" href=\"http:\/\/unitycoder.com\/blog\/2012\/10\/29\/2d-raycasting-visibility-voxel-travelsal\/\" target=\"_blank\">2D Raycasting Visibility Voxel Travelsal<\/a>, but added dynamic grid array update (using screenshots..),\u00a0so now the walls (obstacles) are updated realtime on the 2D grid.<\/p>\n<p><strong>FEATURES:<\/strong><br \/>\n&#8211; Converted the whole thing to C#<br \/>\n&#8211; Any object visible to camera can block visibility (particles also, with adjustable alpha or color..see image#2, threshold was 0.15)<br \/>\n&#8211; Adjustable obstacle scan (in webplayer demo 3.0, tree casts shadows only from the trunk part, not as a whole object)<br \/>\n&#8211; Adjustable ray &amp; shadow step resolution<\/p>\n<p><strong>TODO:<\/strong><br \/>\n<del> &#8211; Using GetPixel..change to GetPixels()<\/del> Done<br \/>\n&#8211; <del>Make resolution adjustable (now its fixed size, 320&#215;320 obstacle grid texture, thats why webplayer is 320&#215;320 also)<\/del> Done<br \/>\n&#8211; Could try this same method with the previous <a title=\"http:\/\/unitycoder.com\/blog\/2012\/03\/15\/fake-realtime-shadows-with-surface-shader\/\" href=\"http:\/\/unitycoder.com\/blog\/2012\/03\/15\/fake-realtime-shadows-with-surface-shader\/\" target=\"_blank\">fake shadow shader<\/a> (had problems getting a dynamic obstacle map back then..)<br \/>\n&#8211; Dynamic resolution? (near player = fine, far = coarse?), then scanning should be faster?<br \/>\n&#8211; Fade out based on distance (could be done in shader also..)<\/p>\n<p><strong>Webplayer:<\/strong><br \/>\n<a title=\"http:\/\/unitycoder.com\/upload\/demos\/VoxelTravelsalShadow\/\" href=\"http:\/\/unitycoder.com\/upload\/demos\/VoxelTravelsalShadow\/\" target=\"_blank\">http:\/\/unitycoder.com\/upload\/demos\/VoxelTravelsalShadow\/<\/a> (v2.0)<br \/>\n<a title=\"http:\/\/unitycoder.com\/upload\/demos\/VoxelTravelsalShadow2\/\" href=\"http:\/\/unitycoder.com\/upload\/demos\/VoxelTravelsalShadow2\/\" target=\"_blank\">http:\/\/unitycoder.com\/upload\/demos\/VoxelTravelsalShadow2\/<\/a> (v3.0)<\/p>\n<p>&#8212;<\/p>\n<p><strong>Image#2:<\/strong> Also particles can cast shadows (or anything that is visible to the camera..)<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2120\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/08\/03\/2d-grid-fake-shadow\/fake_shadows_particles_2d\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/fake_shadows_particles_2D.jpg?fit=347%2C341&amp;ssl=1\" data-orig-size=\"347,341\" 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=\"fake_shadows_particles_2D\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/fake_shadows_particles_2D.jpg?fit=300%2C294&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/fake_shadows_particles_2D.jpg?fit=347%2C341&amp;ssl=1\" class=\"alignnone size-medium wp-image-2120\" alt=\"fake_shadows_particles_2D\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/fake_shadows_particles_2D-300x294.jpg?resize=300%2C294\" width=\"300\" height=\"294\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/fake_shadows_particles_2D.jpg?resize=300%2C294&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/fake_shadows_particles_2D.jpg?w=347&amp;ssl=1 347w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using the same code from previous 2D Raycasting Visibility Voxel Travelsal, but added dynamic grid array update (using screenshots..),\u00a0so now the walls (obstacles) are updated realtime on the 2D grid. FEATURES: &#8211; Converted the whole thing to C# &#8211; Any object visible to camera can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,3],"tags":[65,269,354,52,524,40,172,525],"class_list":["post-2116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-demos","category-unity3d","tag-2d","tag-dynamic","tag-grid","tag-light","tag-obstacle","tag-shadow","tag-visibility","tag-wall"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/2D_grid_visibility_shadow.jpg?fit=374%2C353&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-y8","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2116","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=2116"}],"version-history":[{"count":10,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2116\/revisions"}],"predecessor-version":[{"id":2128,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2116\/revisions\/2128"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/2117"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=2116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=2116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=2116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}