playcanvas / playcanvas/engine
Implement Textured Area Lights
@marklundin is already working on this.
Since May 21, 2024.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
This ticket is a request for comments/progress tracker for adding textured area lights as an extension to the current LTC implementation.
The above example includes an custom version of the engine (v1.54) that implements textured area lights using the current LTC shader chunks. It's using the cookie texture slot on the lighting system as the light source. Works with diffuse/specular/CC.
The blurriness/roughness is an approximation of a gaussian kernel that uses weighted samples of the mip-chain. This appears to be a better quality blur than many other approaches (especially at higher blurriness levels) but is cheaper to compute than most solutions of a similar quality. The cost is bound to the texture resolution (1k is 10 taps) and independent of the blur strength.
Tasks:
- Update Standard Material + shader chunks
- Integrate with clustered lighting.
Optional:
- Implement a mipmap-less approach similar to https://github.com/playcanvas/engine/pull/3783 by @slimbuck may be suitable
- Allow lower quality/cheaper solution using 2 taps of the mip-chain
Open Questions:
- Should the textured area lights use the cookie texture slot or a dedicated one. The semantics are different but there may also be some practical issues if one light has a cookie and another is a textured area light. This will also have implications for the cookie atlas in clustered lighting.
- Is it preferable to pre-compute a mipmap-less texture in a similar way to https://github.com/playcanvas/engine/pull/3783. This may not always be required if using dynamic/video textures for example but for static ones it may be better (same code path for all devices)
Related PRs
Clustered Area Lights
Clustered Lights
mipmap-less environment lighting
Any feedback welcome @mvaligursky @slimbuck @willeastcott
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.
