Shadow is reversed in babylon but correct in Blender

In my project there a lot of objects, but for a few objects or part of them shadow is reversed under light, Like this table it’s surface (not legs) is dark when get in front of light and get lighter when get behind to the light.
This is screenshot when surface is under light and it is dark:
2

This is screenshot when surface is behind the light and it is light:
1

It is correct in blender:
In front of light:

behind the light:

and this is .gltf file:
table54.zip (701.3 KB)

I have other 3D files with .obj and .babylon files has same issue.

Could you reproduce your setup in the playground ??? it is pretty strange and would normally mean the light is having the wrong direction for some reasons.

Thanks for fast response. I made PG,
Look at this: The light is set under the table y = 1

And in this the light is upon the table y = 15

You can change “y” to see what will happen.

You were not adding the meshes to the caster list:

and

No, not the shadow on the ground. The shadow on surface of table. It is still black on your PG. In your PG when light is under the table, underneath of table’s surface accept the light and get bright but the top of surface still black in both PG

1 = Under table is lighted when light is under table:
1

2 = Top of table NOT lighted when light is top of the table:
2

This is simply cause the light units between PBR/GLTF/Standard material are different and you are using different type of materials in this scene.

1 Like

I add this line to my PG and everything gets correct, but in my main code when I add this nothing change and issue persists.

light1.falloffType = BABYLON.Light.FALLOFF_STANDARD;

Do I have to do anything more?
I spend hours, I changed my light, shadowGenerator and… remove lines

Please provide a repro in the playground, it is definitely a setup issue here but without your exact use case it is impossible to troubleshoot.

Thanks @sebavan for caring about issue. Thanks god, I recently upload my website. Now I can show you in one .gltf object has two direction of lightening and shadowing.
My Website
In right panel add sofa in the picture, sits getting opposite shadows like this screen shots:

And this

Big note: In one of these situation, In blender I rotate the part that getting reverse shadow , then try it in scene and problem resolved

You can access scene in console via:
homePage.scene
Lights:
homePage.light
homePage.lightRoof
homePage.hemisLights
For example you can write this in console:
homePage.light.falloffType = BABYLON.Light.FALLOFF_STANDARD;
Shadow:
homePage.shadowGenerator

I will add full code in PG very soon, but I am very busy right now to seperate it from other parts.
The sofa .gltf file:
sofa120.zip (1.6 MB)

Looks like the faces are reversed on the model ???

Definitely an export problem I would think

Flip your normals, or re-calculate outside in edit, after selecting all, on the cushion. Not my exporter, but think it is probably a model problem.

2 Likes

Thanks, at last solved. The issue is from normals.