1 Star 1 Fork 0

天天编程/godot-docs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
class_directionallight.rst 12.02 KB
一键复制 编辑 原始数据 按行查看 历史
github_url: hide

DirectionalLight

Inherits: :ref:`Light<class_Light>` < :ref:`VisualInstance<class_VisualInstance>` < :ref:`Spatial<class_Spatial>` < :ref:`Node<class_Node>` < :ref:`Object<class_Object>`

Directional light from a distance, as from the Sun.

Description

A directional light is a type of :ref:`Light<class_Light>` node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene to model sunlight or moonlight. The worldspace location of the DirectionalLight transform (origin) is ignored. Only the basis is used to determine light direction.

Tutorials

Properties

:ref:`float<class_float>` :ref:`directional_shadow_bias_split_scale<class_DirectionalLight_property_directional_shadow_bias_split_scale>` 0.25
:ref:`bool<class_bool>` :ref:`directional_shadow_blend_splits<class_DirectionalLight_property_directional_shadow_blend_splits>` false
:ref:`ShadowDepthRange<enum_DirectionalLight_ShadowDepthRange>` :ref:`directional_shadow_depth_range<class_DirectionalLight_property_directional_shadow_depth_range>` 0
:ref:`float<class_float>` :ref:`directional_shadow_fade_start<class_DirectionalLight_property_directional_shadow_fade_start>` 0.8
:ref:`float<class_float>` :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>` 100.0
:ref:`ShadowMode<enum_DirectionalLight_ShadowMode>` :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` 2
:ref:`float<class_float>` :ref:`directional_shadow_normal_bias<class_DirectionalLight_property_directional_shadow_normal_bias>` 0.8
:ref:`float<class_float>` :ref:`directional_shadow_split_1<class_DirectionalLight_property_directional_shadow_split_1>` 0.1
:ref:`float<class_float>` :ref:`directional_shadow_split_2<class_DirectionalLight_property_directional_shadow_split_2>` 0.2
:ref:`float<class_float>` :ref:`directional_shadow_split_3<class_DirectionalLight_property_directional_shadow_split_3>` 0.5
:ref:`float<class_float>` shadow_bias O: 0.1

Enumerations

enum ShadowMode:

  • SHADOW_ORTHOGONAL = 0 --- Renders the entire scene's shadow map from an orthogonal point of view. May result in blockier shadows on close objects.
  • SHADOW_PARALLEL_2_SPLITS = 1 --- Splits the view frustum in 2 areas, each with its own shadow map.
  • SHADOW_PARALLEL_4_SPLITS = 2 --- Splits the view frustum in 4 areas, each with its own shadow map.

enum ShadowDepthRange:

  • SHADOW_DEPTH_RANGE_STABLE = 0 --- Keeps the shadow stable when the camera moves, at the cost of lower effective shadow resolution.
  • SHADOW_DEPTH_RANGE_OPTIMIZED = 1 --- Tries to achieve maximum shadow resolution. May result in saw effect on shadow edges.

Property Descriptions

Default 0.25
Setter set_param(value)
Getter get_param()

Amount of extra bias for shadow splits that are far away. If self-shadowing occurs only on the splits far away, increasing this value can fix them.


Default false
Setter set_blend_splits(value)
Getter is_blend_splits_enabled()

If true, shadow detail is sacrificed in exchange for smoother transitions between splits.


Default 0
Setter set_shadow_depth_range(value)
Getter get_shadow_depth_range()

Optimizes shadow rendering for detail versus movement. See :ref:`ShadowDepthRange<enum_DirectionalLight_ShadowDepthRange>`.


Default 0.8
Setter set_param(value)
Getter get_param()

Default 100.0
Setter set_param(value)
Getter get_param()

The maximum distance for shadow splits.


Default 2
Setter set_shadow_mode(value)
Getter get_shadow_mode()

The light's shadow rendering algorithm. See :ref:`ShadowMode<enum_DirectionalLight_ShadowMode>`.


Default 0.8
Setter set_param(value)
Getter get_param()

Can be used to fix special cases of self shadowing when objects are perpendicular to the light.


Default 0.1
Setter set_param(value)
Getter get_param()

The distance from camera to shadow split 1. Relative to :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`. Only used when :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` is SHADOW_PARALLEL_2_SPLITS or SHADOW_PARALLEL_4_SPLITS.


Default 0.2
Setter set_param(value)
Getter get_param()

The distance from shadow split 1 to split 2. Relative to :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`. Only used when :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` is SHADOW_PARALLEL_2_SPLITS or SHADOW_PARALLEL_4_SPLITS.


Default 0.5
Setter set_param(value)
Getter get_param()

The distance from shadow split 2 to split 3. Relative to :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`. Only used when :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` is SHADOW_PARALLEL_4_SPLITS.

Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ttcode-net/godot-docs.git
git@gitee.com:ttcode-net/godot-docs.git
ttcode-net
godot-docs
godot-docs
master

搜索帮助