• 3D
  • Is it possible to cast shadows from a transparent or invisible object?

I'm using a plane with a transparent material to model the water in my game. To make the material transparent I need to set the transparent flag. However if I do so, the object stops casting a shadows. I would like the plane to cast a shadow to make the area below the water darker. Is there a way to make transparent objects cast shadows? I've been trying to set the 'depth draw mode' to 'opaque pre-pass' which allows transparent materials to cast shadows. ( https://godot.readthedocs.io/en/3.0/tutorials/3d/spatial_material.html?highlight=material ) Apparently this option was called 'alpha pre-pass' in Godot 2. However I was not able to cast any shadows from my transparent plane.

I would also be happy to simply have an invisible object that casts shadows but I don't know how to achieve this.

The best solution is to use shaders instead like multi texturing that will apply some underwater texture below some water height treshold.

However, there is a simple trick without shaders. Duplicate your water plane mesh, give it a transparent dark grey texture that will darker anything behind it. Place slightly it under the water plane.