summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2022-07-31 16:20:24 -0700
committerclayjohn <claynjohn@gmail.com>2022-08-31 12:14:46 -0700
commit385ee5c70b110fc4e6a47c847428bfe3da89e18e (patch)
tree79a98b11b042372e99ed209f033dd721f5a74e14 /editor/import
parent736632ee7ed00a3474448cfd227f696f82905ac7 (diff)
Implement Physical Light Units as an optional setting.
This allows light sources to be specified in physical light units in addition to the regular energy multiplier. In order to avoid loss of precision at high values, brightness values are premultiplied by an exposure normalization value. In support of Physical Light Units this PR also renames CameraEffects to CameraAttributes.
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/scene_import_settings.cpp6
-rw-r--r--editor/import/scene_import_settings.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 1ff771bcce..730aa3bd61 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -30,6 +30,7 @@
#include "scene_import_settings.h"
+#include "core/config/project_settings.h"
#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/editor_inspector.h"
@@ -1288,6 +1289,11 @@ SceneImportSettings::SceneImportSettings() {
base_viewport->add_child(camera);
camera->make_current();
+ if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
+ camera_attributes.instantiate();
+ camera->set_attributes(camera_attributes);
+ }
+
light = memnew(DirectionalLight3D);
light->set_transform(Transform3D().looking_at(Vector3(-1, -2, -0.6), Vector3(0, 1, 0)));
base_viewport->add_child(light);
diff --git a/editor/import/scene_import_settings.h b/editor/import/scene_import_settings.h
index b5cf82f64b..104a7a9f7e 100644
--- a/editor/import/scene_import_settings.h
+++ b/editor/import/scene_import_settings.h
@@ -74,6 +74,7 @@ class SceneImportSettings : public ConfirmationDialog {
SubViewport *base_viewport = nullptr;
Camera3D *camera = nullptr;
+ Ref<CameraAttributesPractical> camera_attributes;
bool first_aabb = false;
AABB contents_aabb;