-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(wip) feat: Instancer LOD #604
base: main
Are you sure you want to change the base?
Conversation
4f7b76b
to
43ff44e
Compare
43ff44e
to
0cc19cf
Compare
src/terrain_3d_mesh_asset.h
Outdated
// Saved data | ||
real_t _height_offset = 0.f; | ||
real_t _visibility_range = 100.f; | ||
real_t _visibility_range = 100.f; // TODO: drop and discuss storage migration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need maintainer input: should we deal with the upgrade from visibility_range to _lod_visibility_ranges[0]? how?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
-
Leave the old variable.
-
Change the setter to call the new setter.
-
Move both to the bottom of the file headed with a comment:
//DEPRECATED 1.0 - Remove 1.1
-
Remove the getter.
-
_bind_methods(): Move the bound variables/functions to the bottom and add the comment.
-
_bind_methods(): change the property usage to no_editor so it doesn't show in the inspector, eg.
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "region_offsets", PROPERTY_HINT_ARRAY_TYPE, vformat("%tex_size/%tex_size:%tex_size", Variant::VECTOR2, PROPERTY_HINT_NONE), PROPERTY_USAGE_NO_EDITOR), "set_region_offsets", "get_region_offsets");
-
In the XML docs note it is deprecated and to see the new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 33a46e3
_shadow_lod = CLAMP(p_lod, 0, get_maximum_lod()); | ||
LOG(INFO, "Setting shadow LOD: ", _shadow_lod); | ||
emit_signal("instancer_setting_changed"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need maintainer input: every time I reopen the project, the maximum lod and shadow lod values are reset to -1,
I think this is because the mesh is not loaded when the editor tries to set the instance's value.
If you change the values and then close and reopen the scene, that'll work.
Is there an idiomatic way to avoid this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Godot loads the scene file it loads all settings from the scene file. You don't really know which one it will load first. If this is loaded before the scene, get_mesh_count() will be zero, which sets your _maximum_lod = -1.
If packed_scene.is_null() then you shouldn't check get_mesh_count() and accept the value as it is. It won't be used while the scene is null.
When packed_scene is loaded, you can verify that maximum_lod is valid. Same w/ shadow lod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in fcaccb9
5e09edf
to
cb2283d
Compare
b40c426
to
ccdc7ab
Compare
ccdc7ab
to
1f2af27
Compare
Introduce four levels of LODs for multimesh instance
See thread in Discord
Task list:
Regarding validation:
This PR introduces a bunch of fields that are related to each other:
Checking values in the setters will be super annoying to use, as in "I'm trying to lower the maximum lod, but nothing happens" > "yes, you need to lower the minimum shadow lod first".
This is a perfect use case for configuration warning, which is a work in progress: