Light Illumination Modes

Yo @Deltakosh and @sebavan… I am trying to match up Unity Lights to Babylon Lights…

If i take a POINT light, set it to green and put it in a dark room and set its range… WITH NO OTHER LIGHTS.

In unity there is green light that lights up the room nice and bright… But that same light in Babylon with the same exact color value, intensity (1.0) and range… it BARELY lights room and i mean BARELY.

And it does not seem like intensity is the key… i would have to crank up to like 25X just to brighten up room and then its looks a bit distorted with artifacts…

So my question is… Is there some kind of Illumination Mode that Unity is using that i can set babylon to to match the light illumination that unity. OR is there some FACTOR that you know about the lights between Unity and Babylon ???

every lights has a fall off mode: light.falloffType = BABYLON.

/**

  • Falloff Default: light is falling off following the material specification:
  • standard material is using standard falloff whereas pbr material can request special falloff per materials.
    */
    public static readonly FALLOFF_DEFAULT = 0;

/**

  • Falloff Physical: light is falling off following the inverse squared distance law.
    */
    public static readonly FALLOFF_PHYSICAL = 1;

/**

  • Falloff gltf: light is falling off as described in the gltf moving to PBR document
  • to enhance interoperability with other engines.
    */
    public static readonly FALLOFF_GLTF = 2;

/**

  • Falloff Standard: light is falling off like in the standard material
  • to enhance interoperability with other materials.
    */
    public static readonly FALLOFF_STANDARD = 3;

I would think the GLTF type might be the closest here. IT all comes down to the fact Unity does not use physical values for setting light intensity.

Thanks @sebavan… That helped ALOT…

FYI… STANDARD falloff seem to work best with Unity Exported Content.
Except Spot Lights… I use GLTF falloff and scale the inner angle by 80 percent of the angle (outer) to get the blurred cone edges for spot lights.

POINT lights are the ONLY ONE-TO-ONE intensity factors.

All other lights need a MAGIC SCALE FACTOR to properly REPRODUCE that Unity lighting in Babylon.

I Found them… Everything fell into place with proper setting of these magic
scale factors plus the proper per light settings for:

  • falloffType
  • lightmapMode
  • IntensityFactor

In Case Anyone Cares… These are the MAGIC Unity Light Factors:

Ambient Light

  • FalloffType: STANDARD
  • LightmapMode: DEFAULT
  • IntensityFactor: 0.33

Directional Light

  • FalloffType: STANDARD
  • LightmapMode: Mixed With Shadows (SPECULAR) OR DEFAULT
  • IntensityFactor: 2.66

Point Light

  • FalloffType: STANDARD
  • LightmapMode: Mixed With Shadows (SPECULAR) OR DEFAULT
  • IntensityFactor: 1.00

Spot Light

  • FalloffType: GLTF
  • LightmapMode: Note: Spot Light only effect whats in its cone (DEFAULT)
  • IntensityFactor: 6.66
  • InnerAngleOffset: 80 percent of angle (OUTER)

These values produce NEAR PICTURE PERFECT Unity Lighting for Realtime, Full Baked And Mixed Lights

The Unity Lighting Trifecta :slight_smile:

Ill post some demos soon … thanks again for the explanation i needed to to make my Babylon Scene Manager reproduce near picture perfect Unity Lighting :slight_smile:

4 Likes

How does Babylon’s default lighting mode compare to Three.js’s “physically correct lights” mode which it defaulted to in version 155?

In Three version 152, Three.js also moved to linear-sRGB working space, as in colors are accepted as sRGB from the outside (matching most CSS defaults from what I understood) and converted to linear-sRGB under the hood for working space (IIUC).

I’m wondering how this color handling and light handling together compare to what Babylon currently does (and will do in the future?).

Also curious how this compares to Blender, Unreal, Unity, etc.

cc @sebavan @PatrickRyan

It should be all the same if you use Babylon with PBR materials by default. Babylon lighting with PBR is a one one mapping with the GLTF definition of it which is pretty common across the various engines.

1 Like