Akdez
Akdez

Reputation: 23

Three.js Directional light looks like point light

I'm getting strange effect (it looks strange for me but i'm not sure) with directional light in Three.js.

enter image description here

Light setup is simple and attached to camera:

dirLight = new THREE.DirectionalLight(0xffffff, 1);
dirLight.position.set(0, 0, 1);
camera.add(dirLight);

Mesh positioned right at origin of the scene (0, 0, 0). Target of the light is same. Material of the mesh comes from MTL file:

newmtl mat_1
Ka 0.140196 0.147059 0.171569
Kd 0.560784 0.588235 0.686275
Ks 0.950000 0.930000 0.880000
Ns 750.000000

Shaders are default. Physically correct lights option is enabled (but the result is same for disabled as well)

That result with standard material:

THREE.MeshStandardMaterial( { color: 0x0033ff, roughness: 0.4, metalness: 0.5 } )

enter image description here

Changing roughness from 0 to 1 (metalness is 0 here):

enter image description here

I thought light should be distributed uniformly over the whole plane of mesh. But it looks like concentrated in one point. What can be wrong?

I'm trying to get the following behavior: enter image description here

Should I write my own shader for this?

Upvotes: 0

Views: 700

Answers (1)

tevemadar
tevemadar

Reputation: 13225

That is normal, assuming you have perspective projection: even if the light-to-surface vector is constant for the entire surface, the eye-to-surface vector is changing all the time (it would be constant with parallel projection). The specular component is the main one in your material, and indeed it uses the eye-to-surface direction.

Upvotes: 0

Related Questions