I’ve been experimenting a little bit with deferred rendering now that we have MRT support. Although it wasn’t a showstopper, but it’s a lot easier and performant with.
There’s a bunch of things to improve and fix, but it’s a start anyway.
TODO:
Attenuation is a bit simple and not exactly physically correct since linear + quadratic attenuation doesn’t work with light volumes
Fix culling + depth testing for volumes to avoid light leaking
Better light volume batching, they can’t be rendered in a single batch right now
Some minor performance improvements, like culling and depth testing
Here’s a video with 256 lights:
Down the line I’d like to merge this with a PBR pipeline, I think I have an example of that somewhere but right now I’d rather wait until @JCash new gltf model importer has been merged so I can access the tangents without having custom buffers There’s a PR for that in the works so it should be available soon, can’t wait!
There’s at least one PR that needs to be merged before we can enable MRTs on webgl I think but I don’t have a good idea, it really depends on your needs. Bigger light volumes will take more power since more fragments are rendered, you’ll have to test and see there’s more optimization I need to look at, all lights are separate draw calls for example. And you could always turn off lights far away in game code
As a Defold user who’s not dipping too deep into shaders and other more complex graphic manipulation it’s wonderful to see videos like this to see what might be possible to do in the future with Defold.
It would be great, for people like me, to learn what practical applications improvements like this might have in my game.
In this case, having read up on “deferred rendering” it seems effectively rendered multiple light sources is the goal. This is especially exciting, because I’ve been toying with the idea to add a “night mode” to a 3D racing game I’m dabbling with in my spare time. I haven’t yet come up with a good way to illuminate the scene with streetlights or other points of light around the scene.