Shadows for semi-transparent objects

Godot Version

Godot 4.7 Stable release

Question

I have a glass bottle scene that is see through and I want it to cast shadows but couldn’t figure out how to do it.

The bottle is made up of a few meshes containing a glass material and a cap with its own material. The cap of the bottle is opaque so it casts a shadow.

The material for the glass :

Setting the transparency mode to “depth pre-pass” should allow for a transparent object to cast shadows.

If this still behaves wonky, you can add an invisible shadow casting mesh to the bottle hierarchy. Keep that mesh’s material opaque so it cast shadows but set its transparency to 1.0 (under GeometryInstance3D in the inspector)