Hi!
I’m working on a shader that will take scene light data and use it to make light calculations in the shader.
To pass the light data from the scene to the uniforms I am using:
var u = THREE.UniformsUtils.merge(
[
THREE.UniformsLib['lights'],
{
flipUv1: { type: 'bool', value: 0 },
flipUv2: { type: 'bool', value: 1 },
}
])
And I have a single spotlight in my scene:
const spotLight = new THREE.SpotLight({
color: 'white',
intensity: 1,
distance: 5,
penumbra: 1,
decay: 0,
})
spotLight.position.set(-5, 5, 5)
scene.add(spotLight)
The problem is that if I console.log(spotLight) I get this position:
position: Vector3 {x: -5, y: 5, z: 5}
But when I console.log(THREE.UniformsLib[‘lights’]), what I get in the position for that same light is completely different, and color is Pi?:
color: Color {r: 3.141592653589793, g: 3.141592653589793, b: 3.141592653589793}
coneCos: 0.5000000000000001
decay: 1
direction: Vector3 {x: 0.8164965809277259, y: 0.4714045207910315, z: 0.3333333333333334}
distance: 0
penumbraCos: 0.5000000000000001
position: Vector3 {x: 7.071067811865478, y: 4.08248290463863, z: -2.3094010767585025}
I am a bit confused, is this expected behavior? Or am I doing something wrong?
Thank you!