Overcome limitation of max. 4 light sources

I had an idea this morning how to break the limitation of bjs to use max. four light sources.
With this idea you can use any number of light sources.

First pictures are created with one (or max. 4) light(s) source each:

Scene 1 rendered with Light 1:
image

Scene 2 rendered with Light 2:
image

Afterwards these pictures simply have to be added!
The result:
image

Is that possible devolpers?

Max lights is a settable property on a mesh or material. On mobile, so cannot check, but no games need to be played.

1 Like

As @JCPalmer indicated Lights - Babylon.js Documentation

1 Like

Sometimes I want just create beautiful landscapse without the need to play… :slight_smile:

https://www.babylonjs-playground.com/#BIVOB#9

There’s a 10-pack on a single material. That’s the max I could get today, without shader flop.

I once had 64 lights running in that PG, but that was the old days, and I think it had around 15 FPS.

My OLD fake street-lights thing is still around: https://playground.babylonjs.com/#KVRKS#6

Hey Necips… thx for the work/concern, about lights. (hug)

I’ve just begun reading about “stencil buffers” lately, and IT might be able to fake some lights, too, possibly 255 of them with non-soft-edge, or 25 with 10-step edges-falloff. But really, aren’t all webGL lights… faked? Still studying. :slight_smile:

… so this lead me to the question : are there in the world no other ways to work with lights?

Mrs. Google gave me a wink to the dome light technique.

“… not having the background enabled can save on render speed, as the computer only needs to render the areas that are visible.”

Even though that wasn’t the answer to my question… interessting.

IBL (Image based lightning) is definitely the way to go with PBR material. YOu provide a light dome that will give a really nice and natural lightning without using dynamic lights

https://doc.babylonjs.com/how_to/use_hdr_environment