SpotLight.range is not working

In the BBJS Documentation, it says .range is for controling how far light travels.
However, when I run the following Code:

    var BABYLON = require("@babylonjs/core/Legacy/legacy")
        var light1 = new BABYLON.SpotLight("spotLight1", new BABYLON.Vector3(1, 1, 1), new BABYLON.Vector3(0, -1, 0), Math.PI / 2, 50, scene)
        light1.diffuse = new BABYLON.Color3(1, 1, 1)
        light1.specular = new BABYLON.Color3(1 , 1, 1)
        light1.intensity = 100
        light1.range = 100

The light source works, however .range doesnt. Any ideas?


Keep in mind that range is ignored for PBR materials. If that’s not the issue, we’d be better able to help you out if you could make a minimal example available on the playground.

Not sure what the problem is. When I take the range down to 1.5 it gets noticeably dimmer, not visible with range lower than 1. Works pretty much as i’d expect it to. What would you expect to see that isn’t happening?

Well, I thought it would extend the light. I want to to be a bigger light. When I change the range it just gets darker/lighter.

Oh, I fixed it. I just had to increase the height.

1 Like