ThreeJS - light doesn't illuminate surface unless behind? - three.js

I've got a collada model in ThreeJs with a simple point light that follows the mouse. When the light is behind the model, its front face is illuminated:
object with the light behind it:
But when the light is in front of it, only the sides receive light/specularity:
object with the light in front:
I'm losing a whole lotta hair over why on earth it does this. The normals are pointing the correct direction, everything else seems fine.
The materials are all just white lamberts, if that helps at all.
Anyone encountered this?

Related

Unity Lighting problems

I'm about to make a 3D Scene in Unity, where you can move through a house.
But right now I'm stuck with the lighting of the scene. What I wanted to try is to bake my directional light (Sun) into the Scene. But right there is my first problem:
If I didn't bake something (clear baked data) it looks quite good, but after baking, the Scene is really dark, what I don't understand, because I set Environment Light and before the Bake everything just looks fine.
Here are some samples before the baking, of the settings and after the baking:
notBaked(no Lightmaps!)-LightingSettings-Scene
notBaked(no Lightmaps!)-LightingSettings-Environment
not Baked(no Lightmps!)-DirectionalLight(Sun)
while Baking - ReflectionProbeSettings
Baked Light
As you can see, the Scene gets really dark and it seems that for any reason, the ambient Light/Environment Light is missing after the bake.
Another problem is the warning of overlapping UV's. What's the reason for that and how can I fix it?
The aim of the project is to also publish it as a WebGL version. But if I build it as a WebGL version and try it on my server, the textures doesn't work. I looked up in the internet and read that directional lightmaps doesn't work for WebGL. But if I switched the directional Mode to non-Directional and replaced the directional light and only baked a Point light, the Texturemaps also didn't work in WebGL.. Does anybody know, how to use lightmaps for WebGL?
Thanks a lot!!

three.js light leaking from object

I'm having an issue with three.js lighting. Not sure what am i doing wrong.
I have a plane that is set to receiveShadow to try and a cube that is set to castShadow. Overall all ok until I move the light into the cube. If the light is within 70% of the center of the cube, all good, no light comes outside but if within 30% of the cube's edged it's leaking light to ouside. Is this preventable?
What i mean is:
(this is ok)
this is not ok
Ok so I started reading a bit more about light properties and found out that in my case it was the following issue:
bulbLight.shadow.camera.near = 0.01;
Had to do with shadow camera frustrum. This fixed the issue. Now if the light is inside the cube (had to do with dimensions of the objects) it doesn't leak the light out. Practically speaking the light was never "fully inside" of my objects.

Light affecting all objects and passing through walls in three.js

I have a house scene where it has number of walls, when i add directional or spot lights the light passes through walls irrespective of the direction of light positioned.How can i make my light not to pass the wall ?
That is not a way how the WebGL 3D rendering works. All materials will be affected by light. You can render a shadows: http://learningthreejs.com/blog/2012/01/20/casting-shadows/
but, that means the light on the Meshes will be always rendered and after this will be rendered a shadow. That means, if you have a meshPhong material with a high shininess, it will be rendered visible and darkened by the shadow, which is not physically possible in real.

Area lights not affecting objects #Three.js

I found this code by #WestLangley in stackoverflow which creates an arealight over a basic plane. When i tried to use this code and modify for my room model which has objects,floor and wall, it's not casting any light in the scene, the area light works again only when i add a plane below it.
can any one tell me what changes has to be made in the code so that area light falls on objects inside the room, without adding a plane below it ?
codepen.io/Kuranes/pen/klgdJ

Light bleeding through objects

I probably miss some basic concept, because I tried all light forms and materials, but I can't stop the light going through the plane or vice-versa.
I'd expect that light from the pointlight source is stopped by the object, but it doesn't seem to be the case.
I'm such an idiot :)
Light source should be set to cast shadow. Plane should be set to cast shadow, box should be set to receive shadow.

Resources