This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

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

bluepangolin55bluepangolin55 Posts: 12Member
edited May 2018 in 3D

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.

Best Answer

  • MagicLordMagicLord Posts: 578
    Accepted Answer

    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.

Answers

  • MagicLordMagicLord Posts: 578Unconfirmed
    Accepted Answer

    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.

  • bluepangolin55bluepangolin55 Posts: 12Member

    Thanks! I was looking for a simple trick like that :)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.