three.js light leaking from object - three.js

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.

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!!

Light on wireframes in DoubleSide

I can't get light on wireframes inside the geometry.
For example I create IcosahedronGeometry (MeshPhongMaterial) and set point light. When side is set to DoubleSide or BackSide, I can see light on the faces. But when I set on wireframes, then in BackSide there is light on frames, but in DoubleSide there isn't.
In my opinion in DoubleSide and wireframes there should be light seen on the frames inside and outside the geometry.

Three.js: point light strange spot on the ground

Example here
I'm using PointLight in scene and ground reflects big light spot. What should I do to remove it? I only need to highlight some area on scene. So, I can decrease distance but it only decreasing size of spot. Not exactly I've expected. Should I use specific material on the ground or something like this?
Answer is very easy: set ground material's roughness to 1. I've updated example to see how roughness changes material.

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.

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