summaryrefslogtreecommitdiff
path: root/scene/3d/light_3d.cpp
AgeCommit message (Collapse)Author
2022-10-10Show warning when scaling Light3D nodesRedMser
2022-09-19Change return type of `get_configuration_warnings` to `PackedStringArray`Marc Gilleron
2022-08-31Implement Physical Light Units as an optional setting.clayjohn
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.
2022-08-30Add a per-light volumetric fog energy propertyHugo Locurcio
Per-light energy gives more control to the user on the final result of volumetric fog. Specific lights can be fully excluded from volumetric fog by setting their volumetric fog energy to 0, which improves performance slightly. This can also be used to prevent short-lived dynamic effects from poorly interacting with volumetric fog, as it's updated over several frames by default unless temporal reprojection is disabled. Volumetric fog shadows now obey Light3D's Shadow Opacity property as well. The shadow fog fade property was removed as it had little visible impact on the final scene's rendering.
2022-08-26Rename `str2var` to `str_to_var` and similarMicky
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too. - `var2str` -> `var_to_str` - `str2var` -> `str_to_var` - `bytes2var` -> `bytes_to_var` - `bytes2var_with_objects` -> `bytes_to_var_with_objects` - `var2bytes` -> `var_to_bytes` - `var2bytes_with_objects` -> `var_to_bytes_with_objects` - `linear2db` -> `linear_to_db` - `db2linear` -> `db_to_linear` - `deg2rad` -> `deg_to_rad` - `rad2deg` -> `rad_to_deg` - `dict2inst` -> `dict_to_inst` - `inst2dict` -> `inst_to_dict`
2022-08-22Make `_validate_property` a multilevel methodYuri Sizov
2022-08-07Add a shadow opacity property to Light3DHugo Locurcio
This can be used to make shadows translucent for a specific light. The light distance fade system also uses this to smoothly fade the shadow when the light fade transition distance is greater than 0.
2022-07-25Fix missing Distance Fade category in OmniLight3D/SpotLight3D inspectorHugo Locurcio
2022-06-23Fix editor-only visibility for lightsreduz
* Update visibility again for editor-only lights if owner changes. Fixes #26399, supersedes #52327
2022-06-17Fix Light3D `angular_distance` property hint being in radiansHugo Locurcio
The unit is internally stored as degrees and is treated as such, so it should be displayed as-is in the inspector.
2022-06-13Tweak Light3D property hints for greater flexibilityHugo Locurcio
- Specular can now be set above 1.0. - Blur can be set to 0 to disable shadow blurring entirely, which is useful on lights that have a non-zero size. - When shadow blurring is disabled, lights that have a non-zero size will not use PCSS-like soft shadows, speeding up shadow rendering considerably. - Some property hints now allow more precise values.
2022-06-11Add suffixes to all nodes and resourcesFireForge
2022-05-19Use suffixes for units in nodes and resourcesAaron Franke
2022-03-28String: Remove TTR and DTR defines in non-tools buildRémi Verschelde
This ensures we don't use TTR in runtime code, as it's specifically meant to source translations for the editor.
2022-03-17Replace DirectionalLight3D's `use_in_sky_only` with `sky_mode` enumHugo Locurcio
3 options are available: - Light and Sky (default) - Light Only (new) - Sky Only (equivalent to `use_in_sky_only = true`) Co-authored by: clayjohn <claynjohn@gmail.com>
2022-03-10Discern between virtual and abstract class bindingsreduz
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract". * Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions. * Converted a large amount of classes from "abstract" to "virtual" where it makes sense. Most classes that make sense have been converted. Missing: * Physics servers * VideoStream * Script* classes. which will go in a separate PR due to the complexity involved.
2022-03-04Remove unused `shadow_color` property from Light3DHugo Locurcio
This shadow color property was no longer effective since the shaders were optimized to improve occupancy.
2022-02-25Implement distance fade properties in OmniLight3D and SpotLight3DHugo Locurcio
This can be used to fade lights and their shadows in the distance, similar to Decal nodes. This can bring significant performance improvements, especially for lights with shadows enabled and when using higher-than-default shadow quality settings. While lights can be smoothly faded out over distance, shadows are currently "all or nothing" since per-light shadow color is no longer customizable in the Vulkan renderer. This may result in noticeable pop-in when leaving the shadow cutoff distance, but depending on the scene, it may not always be that noticeable.
2022-02-15Use `switch` consistently in `_notification` (`scene` folder)Rémi Verschelde
2022-01-20Merge pull request #55360 from Calinou/rename-bake-mode-propertiesRémi Verschelde
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-14Rename and reorder bake mode properties for consistencyHugo Locurcio
The order now goes from least to most computationally expensive: - Disabled - Static - Dynamic
2021-11-03Rename `PROPERTY_USAGE_NOEDITOR` to `PROPERTY_USAGE_NO_EDITOR`Hugo Locurcio
This is consistent with other constants that include `NO`, such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-10-25Fix properties being displayed when they shouldn't in DirectionalLight3DHugo Locurcio
The parent `_validate_property()` wasn't called, which led to shadow properties being visible even if shadows were disabled on a DirectionalLight3D node.
2021-10-25Merge pull request #54084 from reduz/node3d-rotation-optionsRémi Verschelde
2021-10-25Refactored Node3D rotation modesreduz
* Made the Basis euler orders indexed via enum. * Node3D has a new rotation_order property to choose Euler rotation order. * Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations. The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-25Only show relevant properties in the DirectionalLight3D inspectorHugo Locurcio
Some split distance properties are unused depending on the current shadow mode. Also, Blend Splits can only be used if the shadow mode is PSSM 2 Splits or PSSM 4 Splits. This also moves the Fade Start property to be located after the split properties. This avoids intertwining "conditional" properties with a property that's always available.
2021-09-16Display a editor gizmo icon for Listener3DHugo Locurcio
The icon was present in `editor/icons/`, but it was never implemented in the editor gizmos code. This also removes some unused gizmo drawing code (overridden methods that are no longer called anywhere).
2021-08-19Improvements to SpotLight3D and OmniLight3D's shadowsjfons
OmniLight3D: * Fixed lack of precision in cube map mode by scaling the projection's znear. * Fixed aliasing issues by making the paraboloids use two square regions instead of two half squares. * Fixed shadowmap atlas bleeding by adding padding. * Fixed sihadow blur's inconsistent radius and unclamped sampling. SpotLight3D: * Fixed lack of precision by scaling the projection's znear. * Fixed normal biasing. Both: * Tweaked biasing to make sure it works out of the box in most situations.
2021-08-13Merge pull request #51025 from reduz/fix-directional-shadow-biasRémi Verschelde
Fix directional shadow bias
2021-08-13Fix some unnecessary includesAaron Franke
2021-08-03Use real_t in 3D nodesAaron Franke
2021-07-29Fix directional shadow biasreduz
* Simplified code a lot, bias based on normalized cascade size. * Lets scale cascades, max distance, etc. without creating acne. * Fixed normal biasing in directional shadows. I removed normal biasing in both omni and spot shadows, since the technique can't be easily implemented there. Will need to be replaced by something else.
2021-07-23Node3D gizmo improvementsjfons
* Clean-up of node_3d_editor_plugin.{h,cpp}: removed unused code, fixed some bugs. * Moved node_3d_editor_gizmos.{h,cpp} to editor/plugins. * Added support for multiple gizmos per node. This means custom gizmos will no longer override the built-in ones and that multiple gizmos can be used in more complex nodes. * Added support for handle IDs. When adding handles to a gizmo, an ID can be specified for each one, making it easier to work with gizmos that have a variable number of handles. * Added support for subgizmos, selectable elements that can be transformed without needing a node of their own. By overriding _subgizmo_intersect_frustum() and/or _subgizmo_intersect_ray() gizmos can define which subgizmos should be selected on a region or click selection. Subgizmo transformations are applied using get/set/commit virtual methods, similar to how handles work.
2021-07-02Remove leftovers from the DirectionalLight3D Optimized shadow depth rangeHugo Locurcio
The Optimized shadow depth range was removed in late 2020 in favor of the Stable shadow depth range, but it still had a (broken) property that allowed to enable it.
2021-07-01Use PROPERTY_USAGE_NONE instead of 0 for no property usageAaron Franke
Also use const more often.
2021-06-30Fix editor suffixes and degrees conversionreduz
* Functions to convert to/from degrees are all gone. Conversion is done by the editor. * Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees. * Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m" * In general, can add suffixes for EditorSpinSlider Not covered by this PR, will have to be addressed by future ones: * Ability to switch radians/degrees in the inspector for angle properties (if actually wanted). * Animations previously made will most likely break, need to add a way to make old ones compatible. * Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes. * Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-04-11Use Array for node configuration warningsNathan Franke
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-03-03Hide more options of disabled propertiesMichael Alexsander
2021-03-02Hide extra options from various nodes if they're not enabledMichael Alexsander
2021-02-10Removed _change_notifyreduz
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap. -For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed() -Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-07Initialize class variables with default values in scene/ [1/2]Rafał Mikrut
2021-02-06Simplify Volumetric Fogreduz
-Always use temporal reproject, it just loos way better than any other filter. -By always using termporal reproject, the shadowmap reduction can be done away with, massively improving performance. -Disadvantage of temporal reproject is update latency so.. -Made sure a gaussian filter runs in XY after fog, this allows to keep stability and lower latency.
2021-01-19Added GPU based cluster builderreduz
Clustering is now GPU based, uses an implementation based on the Activision algorithm.
2021-01-15Merge pull request #38562 from Calinou/3d-light-size-property-hintRémi Verschelde
Tweak the 3D light size property to only allow reasonable values
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-11-28Merge pull request #42987 from clayjohn/VULKAN-sky-onlyRémi Verschelde
Add sky_only setting to DirectionalLight3Ds
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code