Can i add a parameter to disable shadows?

Godot Version



i have a spatial shader that i’m using for foliage. i know that i can disable shadows with render_mode shadows_disabled; but i want to be able to turn shadows on or off on a per-material basis. is there any way for me to do that?

Shadow casting can be toggled on a per-MeshInstance3D basis using the Cast Shadow property, without requiring a separate shader.

Shadow receiving can be toggled on a per-material basis (including in BaseMaterial3D, so you don’t need to write a custom shader).

1 Like

my question is, for a custom shader, is there a way that i can make shadow receiving a parameter? i know that shadows_disabled will disable shadow receiving for all material instanced of that shader, but i would like to make a uniform boolean that you can check on and off per-material- for this shader

It’s a render mode, so it needs to be a separate Shader resource. You can’t expose it as a uniform, let alone a per-instance uniform.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.