0
votes

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?

1
What type of material? If it's THREE.MeshStandardMaterial(), then you can play around .roughness and .metalness parameters. - prisoner849
@prisoner849, the first material comes from MTL and added to OBJ loader. I've also tried with default OBJ loader material (just didn't set any other) and standard material (attached the picture of it to the post). In all cases the light looks the same. - Akdez
As a desperate option, to use THREE.MeshLambertMaterial(), but there can be issues with shadows from multiple light sources. - prisoner849
Just out of curiousity, what about THREE.MeshStandardMaterial( { color: 0x0033ff, roughness: 1, metalness: 0 } )? - prisoner849
@prisoner849, I've add gif with roughness changing from 0 to 1 - Akdez

1 Answers

0
votes

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.