10
2014
Shadow Casting 2D
Another fake shadow test.. (similar to the old raycast version, but should work with Physics2D).
*This is currently abandoned..
See also:
http://unitycoder.com/blog/2014/10/12/2d-visibility-shadow-for-unity-indie/
Info:
– Testing PseudoAngle to sort object positions
Todo:
– Take shadow caster PolygonCollider2D vertices, check which one are visible to play
– ..
Webplayer:
http://unitycoder.com/upload/demos/Dynamic2DShadows1/ (v1, update speed is 0.1f)
Related forum topic:
http://forum.unity3d.com/threads/165283-2D-Dynamic-Shadows
—
Snippets:
PseudoAngle (c#)
float pseudoAngle(float dx,float dy) { float ax = Mathf.Abs(dx); float ay = Mathf.Abs(dy); float p = dy/(ax+ay); if (dx < 0) p = 2 - p; //# elif dy < 0: p = 4 + p return p; }
Related Posts
5 Comments + Add Comment
Leave a comment
Recent posts
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
Recent Comments
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- ffmpeg stream raw video into Unity Texture2D on
2D Geometry calculations:
http://tog.acm.org/resources/GraphicsGems/category.html
Faster Line Segment Intersection for Unity3D/C#
http://www.stefanbader.ch/faster-line-segment-intersection-for-unity3dc/
FasterLineSegmentIntersection (source)
http://forum.unity3d.com/threads/17384-Line-Intersection?p=1135726&viewfull=1#post1135726
raycasting, optimized shadows (web javascript example)
http://gamemechanicexplorer.com/#raycasting-3
seems like good explanation here: (with sources)
how to create 2D visibility/shadow effects for your game
http://ncase.me/sight-and-light/
how light works
https://ciechanow.ski/lights-and-shadows/