three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Lights: Add selective lighting via layers

Open FarazzShaikh opened this issue 8 months ago • 4 comments

Related issue: #5180

Description

Adds support for selective lighting via Layers - Lights and object mask are passed in an uniforms, then, a light is only calculated if it passes the mask test.

Potential issue

This impl uses logical AND & which is only supported in GLSL ES version 3. Do we want to support version 1 and 2 as well? In which case I will be looking for a way to polyfill AND.

TODO

  • [ ] Fix support for multiple lights
  • [ ] Add support for all other light types (Currently only supports point light)
  • [ ] Polyfill logical AND

https://github.com/mrdoob/three.js/assets/55190601/ece20768-066b-4405-a899-80722dcf68dc

FarazzShaikh avatar Jun 12 '24 17:06 FarazzShaikh