PointLight brightness at a close distance

I have two point lights illuminating an object, one has distance set to zero, so it doesn’t fall off; another has distance 100, so it does.

That works.

But it looks like at a close distance to the object both lights dim out and stop illuminating it, what is the reason for that effect?

https://jsfiddle.net/tfoller/9gp3z5f2/38/

Thank you!

1 Like

I believe, the PointLights behave like that, they are really small and dense objects that need a surface to disperse the lighting.

Changing to the PhongMaterial illustrates that: https://jsfiddle.net/mqg2b1ak/

Answering my own question:

Lambertian diffusion is calculated per vertex basis, i.e. illumination is calculated based on a vertex normal and the direction towards the light source and then interpolated thru baryonic weights in the fragment shader.

In my example, there are no subdivisions on cube’s faces and the only 4 vertices are at the corners of each face, so no details from Lambertian diffusion are visible in between.

Adding subdivisions solves the problem:

new THREE.BoxBufferGeometry(80, 100, 50, 8, 10, 5),

instead of

new THREE.BoxBufferGeometry(80, 100, 50, 1, 1, 1),

lights2

https://jsfiddle.net/tfoller/9gp3z5f2/43/

This leaves ugly wireframe-like artifacts at a close distance due to quad division into independent triangles but I believe there is no easy solution for that.

I wrote a simple Lambertian per-pixel shader that doesn’t require surface subdivision and doesn’t have quad artifacts:

lambert

https://jsfiddle.net/tfoller/0zcdjykL/171/