Aug
3
2013

2D Grid Fake Shadow

2D_grid_visibility_shadow

Using the same code from previous 2D Raycasting Visibility Voxel Travelsal, but added dynamic grid array update (using screenshots..), so now the walls (obstacles) are updated realtime on the 2D grid.

FEATURES:
– Converted the whole thing to C#
– Any object visible to camera can block visibility (particles also, with adjustable alpha or color..see image#2, threshold was 0.15)
– Adjustable obstacle scan (in webplayer demo 3.0, tree casts shadows only from the trunk part, not as a whole object)
– Adjustable ray & shadow step resolution

TODO:
– Using GetPixel..change to GetPixels() Done
Make resolution adjustable (now its fixed size, 320×320 obstacle grid texture, thats why webplayer is 320×320 also) Done
– Could try this same method with the previous fake shadow shader (had problems getting a dynamic obstacle map back then..)
– Dynamic resolution? (near player = fine, far = coarse?), then scanning should be faster?
– Fade out based on distance (could be done in shader also..)

Webplayer:
http://unitycoder.com/upload/demos/VoxelTravelsalShadow/ (v2.0)
http://unitycoder.com/upload/demos/VoxelTravelsalShadow2/ (v3.0)

Image#2: Also particles can cast shadows (or anything that is visible to the camera..)

fake_shadows_particles_2D


1 Comment + Add Comment

  • Do you plan on release this little experiments you make as open source? It would be great for those looking to see how you accomplished things 😉

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Github Join Discord Twitch Instagram BlueSky

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.