Reputation: 23
I'm getting strange effect (it looks strange for me but i'm not sure) with directional light in Three.js.
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 } )
Changing roughness from 0 to 1 (metalness is 0 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:
Should I write my own shader for this?
Upvotes: 0
Views: 700
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