Lighting and shadows from within a hollow 3D mesh

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By plasmid

I’m making a 3D game where the action is taking place within an egg – the players and enemies are moving around on the inner surface of the eggshell. I put an omni light in the middle of the egg hoping that it would cast shadows of enemies onto the inner surface of the eggshell so the player can more easily tell where they are in 3D, but it’s not casting shadows. In fact, it’s not lighting the inner surface of the eggshell at all – the eggshell’s inner surface will be lit by ambient light, but is pitch black if I turn off ambient light and depend on the omni light (which explains why it’s not making shadows like I want).

The egg shell’s material has Cull Mode set to Disabled so it’s visible from within the egg, and all other material parameters are default. All of the other player and enemy objects are lit by the omni light just fine, and they cast shadows correctly on other objects. So I’m guessing this is an issue with the “wrong” normal surface of the eggshell being lit.

Is there a straightforward way to flip the eggshell normals to see if that helps? Or some other approach I should try (in case I decide to make action also happen on the outside of the egg and have both faces of the eggshell be lit independently)?

:bust_in_silhouette: Reply From: klaas

there is a setting in the mesh inspector “Flip faces”. Use this instead of the cull mode.

Ah, I was using a regular MeshInstance so I didn’t have that option, but after seeing your reply I found that CSGMeshes have it. Switching my MeshInstance node to a CSGMesh and turning it on worked, thanks!

plasmid | 2021-07-23 02:46