HaxeFlixel / flixel-demos

Collection of demos for HaxeFlixel
https://haxeflixel.com/demos
425 stars 290 forks source link

A more performant version of DynamicShadows for html5 #307

Closed UncertainProd closed 1 year ago

UncertainProd commented 1 year ago

(Related to DynamicShadows in #287 ) Since shadows were being calculated for every shape in the tilemap, the performance of the Dynamic Shadows demo was pretty bad on html5. By limiting the illuminated area around the light source, we can reduce the number of shapes for which shadows are calculated (which helps increase the framerate) while also keeping the demo looking good.

Current demo: before-pr before-pr-2

New demo: after-pr

after-pr-2

Geokureli commented 1 year ago

can't look right now, excited about this, though!

Geokureli commented 1 year ago

Sorry for ghosting you on this. TBH I wasn't super thrilled about making this less visually appealing just to make it function on html5, so I messed around with shaders and came up with this which seems to perform fantastically on html5 and desktop, but doesn't work on flash (so I'll keep the old version)

Geokureli commented 1 year ago

Thanks for getting the ball rolling on this, but gonna close this in light of the new shader solution

UncertainProd commented 1 year ago

Sorry for ghosting you on this. TBH I wasn't super thrilled about making this less visually appealing just to make it function on html5, so I messed around with shaders and came up with this which seems to perform fantastically on html5 and desktop, but doesn't work on flash (so I'll keep the old version)

At first I was also trying to recreate the effect with shaders but didn't get anywhere. Your version looks good 👍