diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-10-31 14:32:46 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-12-19 14:52:44 +0100 |
commit | 7ae487d2bbc8cd89be2d972ae04ef18f07da26e6 (patch) | |
tree | 89277a02444d8af0ef42155ce318b05a9bdcc1b1 /editor | |
parent | 229fb888a3b8538952858e688ada21e2ff53bb15 (diff) |
Increase the default Camera Zfar to 4000
This makes it possible to view far away objects without
having to tweak any settings. This results in a more usable
editor when working on large-scale levels.
This change should have no impact on performance, but note that
Z-fighting will be visible at a distance. This can be made less
visible by increasing the Znear value (however, doing so will cause
nearby surfaces to disappear).
This change was also applied to the editor, but it will only
apply to newly created scenes.
This also changes the default camera settings in the glTF importer
to match the Camera node's defaults.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_settings.cpp | 8 | ||||
-rw-r--r-- | editor/import/collada.h | 4 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.h | 6 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 16 |
4 files changed, 20 insertions, 14 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 0840707886..e88f27c857 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -549,9 +549,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("editors/3d/grid_xy_plane", false); _initial_set("editors/3d/grid_yz_plane", false); + // Use a lower default FOV for the 3D camera compared to the + // Camera3D node as the 3D viewport doesn't span the whole screen. + // This means it's technically viewed from a further distance, which warrants a narrower FOV. _initial_set("editors/3d/default_fov", 70.0); + hints["editors/3d/default_fov"] = PropertyInfo(Variant::FLOAT, "editors/3d/default_fov", PROPERTY_HINT_RANGE, "1,179,0.1"); _initial_set("editors/3d/default_z_near", 0.05); - _initial_set("editors/3d/default_z_far", 500.0); + hints["editors/3d/default_z_near"] = PropertyInfo(Variant::FLOAT, "editors/3d/default_z_near", PROPERTY_HINT_RANGE, "0.01,10,0.01,or_greater"); + _initial_set("editors/3d/default_z_far", 4000.0); + hints["editors/3d/default_z_far"] = PropertyInfo(Variant::FLOAT, "editors/3d/default_z_far", PROPERTY_HINT_RANGE, "0.1,4000,0.1,or_greater"); // 3D: Navigation _initial_set("editors/3d/navigation/navigation_scheme", 0); diff --git a/editor/import/collada.h b/editor/import/collada.h index 3b6b508b28..29d49d4aa7 100644 --- a/editor/import/collada.h +++ b/editor/import/collada.h @@ -96,8 +96,8 @@ public: }; float aspect = 1; - float z_near = 0.1; - float z_far = 100; + float z_near = 0.05; + float z_far = 4000; CameraData() {} }; diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h index 6390f46524..e6163a46be 100644 --- a/editor/import/editor_scene_importer_gltf.h +++ b/editor/import/editor_scene_importer_gltf.h @@ -205,9 +205,9 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { struct GLTFCamera { bool perspective = true; - float fov_size = 64; - float zfar = 500; - float znear = 0.1; + float fov_size = 75; + float zfar = 4000; + float znear = 0.05; }; struct GLTFLight { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index f0d512e4b2..082537582e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6181,9 +6181,9 @@ void Node3DEditor::_bind_methods() { } void Node3DEditor::clear() { - settings_fov->set_value(EDITOR_DEF("editors/3d/default_fov", 70.0)); - settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near", 0.05)); - settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far", 1500.0)); + settings_fov->set_value(EDITOR_GET("editors/3d/default_fov")); + settings_znear->set_value(EDITOR_GET("editors/3d/default_z_near")); + settings_zfar->set_value(EDITOR_GET("editors/3d/default_z_far")); for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->reset(); @@ -6475,22 +6475,22 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { settings_fov = memnew(SpinBox); settings_fov->set_max(MAX_FOV); settings_fov->set_min(MIN_FOV); - settings_fov->set_step(0.01); - settings_fov->set_value(EDITOR_DEF("editors/3d/default_fov", 70.0)); + settings_fov->set_step(0.1); + settings_fov->set_value(EDITOR_GET("editors/3d/default_fov")); settings_vbc->add_margin_child(TTR("Perspective FOV (deg.):"), settings_fov); settings_znear = memnew(SpinBox); settings_znear->set_max(MAX_Z); settings_znear->set_min(MIN_Z); settings_znear->set_step(0.01); - settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near", 0.05)); + settings_znear->set_value(EDITOR_GET("editors/3d/default_z_near")); settings_vbc->add_margin_child(TTR("View Z-Near:"), settings_znear); settings_zfar = memnew(SpinBox); settings_zfar->set_max(MAX_Z); settings_zfar->set_min(MIN_Z); - settings_zfar->set_step(0.01); - settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far", 1500)); + settings_zfar->set_step(0.1); + settings_zfar->set_value(EDITOR_GET("editors/3d/default_z_far")); settings_vbc->add_margin_child(TTR("View Z-Far:"), settings_zfar); for (uint32_t i = 0; i < VIEWPORTS_COUNT; ++i) { |