godot_heightmap_plugin
godot_heightmap_plugin copied to clipboard
Disabling detail shadows.
I've found that detail layers cast inconsistent shadows, flickering on and off depending on the camera position and angle. I'd like to disable detail shadows, is there a way to do it?
Here's what I'm dealing with, notice a patch of shadow in the middle ground:
Thanks.
If you want to turn off shadows completely for grass, that might be possible, the cast shadows
option needs to be exposed by detail_layer.gd
so that it sets the setting on all its internal multimeshes. I got some rough code to do it but I'll see a bit later for testing and pushing to the repo.
(sorry initially i thought you were reffering to "contact shadows" which often cause problems)
It's weird that shadows would cause these dark dots though. Maybe contact shadows are enabled and that's causing these artifacts?
Thanks for the reply. I double-checked and "contact shadows" is disabled. But this is a large terrain and Godot 3 lightning seems fairly rudimentary, so this is the kind of glitch I'd expect.
I managed to hack my way around this by editing direct_multimesh_instance.gd
, I believe this would disable shadows for all the detail layers while keeping terrain shadows. I'm not sure about the ramifications of this, so let me know if this is a terrible idea.
(addons/zylann.hterrain/util/direct_multimesh_instance.gd)
func set_multimesh(mm: MultiMesh):
VisualServer.instance_set_base(_multimesh_instance, mm.get_rid() if mm != null else RID())
VisualServer.instance_geometry_set_cast_shadows_setting(_multimesh_instance, 0)
Performace wise, it provided a significant boost to my fps. Perhaps this could be offered as an user configuration option.
I think disabling shadows for detail layers by default may be a good idea moving forward. Foliage shadows are expensive and aren't quite affordable on all GPUs, especially for grass.
@jcandres that's fine, the code I'm about to add does something similar but instead shows it as an option.
New option added in 02d6b18e9053cbf6bf677420871c6983995d6f8a