Why can't the light shine into the interior of the tube?

I don’t understand why there is no reasonable self shadow when the light shines on the tube Generate self shadows as shown in the example in the picture.

The dark part is the area cast by one’s self shadow, while the bright part is illuminated by the light because it is not obstructed by oneself

If you create the tube as double sided, it works.

sideOrientation: BABYLON.Mesh.DOUBLESIDE

Actually I spoke too soon. It sort of works :slight_smile:

You’ll likely need to add some thickness/offset to the tube interior and exterior walls or play with the shadow bias and other settings to make it better.

It’s improved with …

sideOrientation: BABYLON.Mesh.DOUBLESIDE

tunnelMaterial.backFaceCulling = true
1 Like

Can sideOrientation only be set during initialization creation? How can I apply this attribute to gltf

Yes, I think I’m correct in saying that sideOrientation is used by the MeshBuilder to determine the triangles and windings, so Mesh.DOUBLESIDE generates two sets of triangles with each triangle pair’s normals facing in opposite directions.

With imported meshes (GLTF etc) you’d need to ensure the mesh had these separate “inside” and “outside” faces with unique UVs, before exporting, to best support self-shadowing. By simply giving a mesh some thickness (e.g. in Blender use the Solidify modifier) you’d solve this, but at the cost of more triangles and larger file size etc.


thank you

1 Like