playcanvas / playcanvas/engine

Implement Textured Area Lights

Open
#4,320 10 comments 10 reactions 1 assignee View on GitHub

@marklundin is already working on this.

Since May 21, 2024.

area: graphics enhancement
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.

image

DEMO

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:

Open Questions:

  1. 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.
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.