Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 2D Point Light / Visibility Shadows (with code)

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 3rd Oct 2017 19:51 Edited at: 3rd Oct 2017 19:51
I posed a YouTube video on one of the AppGameKit Facebook groups and people wanted me to share the code for my 2D shadow effects that don't require shaders. Obviously, shaders are the way to go if you want to get really serious, but this method has okay performance on a modern PC. The bottleneck seems to be the SetImageMask() function which the documentation recommends you not use every frame. However, by working on an image that is smaller than the screen it still gives good results.

https://youtu.be/Up49DWoG7HA

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 3rd Oct 2017 21:51 Edited at: 3rd Oct 2017 21:54
Nice !!
I had the same approach some years ago which you can read about here and here... with top and bottom triangles like you did.
Even though I really like shaders ... the advantage on this approach is that you can check if an enemy is in view or other way around, if the enemy can see you...very useful for stealth games
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 6th Oct 2017 20:53
Very cool. thank you!
Regards Sph!nx

Login to post a reply

Server time is: 2024-09-30 09:24:56
Your offset time is: 2024-09-30 09:24:56