Are Area Lights supported?

Hi!

Does anyone know if theres any plans to introduce runtime area lights into the engine? Just curious as we’re weighing up some options.

Thanks!

The closest we have right now are light cookies which can be used to create a light with a specific shape https://developer.playcanvas.com/en/tutorials/light-cookies/

3 Likes

Looping in @ray - hey, I’ve been wondering about area lights myself recently. This feature is actually listed in our roadmap spreadsheet. Any thoughts about how you’d go about implementing this?

Would be awesome to see that roadmap spreadsheet too :slight_smile:

2 Likes

Lots of engines seem to use the the linearly transformed cosines approach which gives great results and is super fast.

You can extend to use textures which fit in with the PBR pipeline, effectively you need to compute the specular and diffuse, however it requires prefiltered textures, which I’m assuming is similar to how you’re doing the prefiltered radiance environment maps

1 Like

@Mark_Lundin - support for Area Lights is, as @will mentioned, in the list of features to add to the engine - however, I don’t think we have a solid release date yet. Last time it was discussed, the thinking was Linearly Transformed Cosines based on Stephen Hill’s implementation: https://blog.selfshadow.com/ltc/webgl/ltc_quad.html - but we are open to other approaches? An existing problem to address is how to get good shadows from Area Lights - this would bring them in line with the other light types in the engine - and allow them to be used to great effect in the runtime light map generation.

2 Likes

Yep, I’ve not really seen any good solutions for shadowing LTC’s which would be a problem for light mapping.

I’d be interested in contributing LTC’s to the main engine as we’ve a nice solution for textures that work even under highly blurred conditions without any additional overhead. I’ve already prepared this for three.js but we have a specific project we’d like to use this on, and the playcanvas editor is going to be a life saver for us.

I guess I was wondering if you had any pointers where in the engine code we could start poking around? Essentially we’ll need to hack the standard material to add an array of area lights structs

2 Likes

@Mark_Lundin - impressive looking demo - I would love to get more insight into how your textured Area Lights implementation works - and I can help with where to potentially add code. We do have an existing github issue for Area Lights: https://github.com/playcanvas/engine/issues/774 - which could be a good place to continue discussing the approach to adding Area Light support into PlayCanvas?

It’s just an extension of the ltc’s that uses the lighting quad for uv’s but using the roughness as an index into the mipchain. The textured is prefiltered across the mipmaps which you have to do offline, but it means you get a good gaussian approximation for the blur.

Thanks for the reference to the github issue, I’ll follow up on there

@Mark_Lundin - I’ve added some comments on the github issue on what an engine implementation could look like - and where the area light data and shader code could be added.

BTW offline pre-filtered mip chain makes sense - not unlike the pre-filtered cube maps we use for IBL? Something maybe worth investigating is doing something similar to @slimbuck’s work on GPU based cube map pre-filtering at load-time?

yep, I was thinking the prefiltered cubemaps are a similar process. The only thing is that ideally it needs to be for each level in the mip chain, so I guess this would have to be then written to a compressed texture in the editor?

yes - pre-filtering at editor import time and compressing at import or in-editor would be most efficient for runtime memory and perf - load time could be more convenient if using jpgs and not so concerned about runtime memory.

Hijacking the cookie slot for these textured lights. It’s not a planar reflection so works with all surfaces, also have diffuse, specular and clear coat. Runs on mobile, but still one of the most expensive lights :smile: Overhead scales with the input texture size, so you can actually lod this effect to make it cheaper

8 Likes