the-simian Posted June 19, 2018 Share Posted June 19, 2018 I was browsing the dev logs and was curious about maybe adding a point light, like in this image. I know I could add a custom GL pipeline, but I figured since this image exists, maybe at once time there was a demo showing how to do this with Phaser 3. can this still be done (as of about v 3.10.x) or is this gone? Thank you to anyone who knows or this... Where the tilemap is blocking the point - light. samme 1 Link to comment Share on other sites More sharing options...
rich Posted June 19, 2018 Share Posted June 19, 2018 Wow, that's old stuff - right back from 2015 iirc! This never even made it past the very first R&D builds. There are no shadows in v3 currently (so you can't emulate the images above), although it's definitely something that will be added eventually. Link to comment Share on other sites More sharing options...
jdotr Posted June 20, 2018 Share Posted June 20, 2018 You can kind of fake it! ...it's distinctly slower than if it was all done in a GL pipeline but it still looks cool and is sufficiently performant if carefully applied (the jitter in the gif is a result of screencap, the scene runs at 60pfs): It's basically two layers: The background (becomes the unlit version) that has the tint set to the ambient color of the light. Next I add the layer that I want to have lit and apply a geometry mask based on a raycast from my light's point. Red Blob Games has a good guide on how raycasting works & how to implement it. My code is not quite in a state that it would be useful to share though I can try to nudge it in that direction if folks want. There are plenty of caveats and limitations on what you can do with this but for a lot of situations this can probably get you pretty close to what you had in mind. best of luck, lmk if you have any questions the-simian 1 Link to comment Share on other sites More sharing options...
Recommended Posts