Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

CameraAttributesPhysical

继承: CameraAttributes < Resource < RefCounted < Object

基于物理的相机设置。

描述

CameraAttributesPhysical 用于根据基于物理的相机的设置来设置渲染设置。它负责曝光、自动曝光、以及景深。

当在 WorldEnvironment 中使用时,它提供了曝光、自动曝光、以及景深的默认设置,这些设置将由所有没有自己的 CameraAttributes 的相机使用,包括编辑器相机。当在 Camera3D 中使用时,它将覆盖 WorldEnvironment 中设置的任何 CameraAttributes,并将覆盖 Camera3DCamera3D.farCamera3D.nearCamera3D.fov、以及 Camera3D.keep_aspect 属性。当在 VoxelGILightmapGI 中使用时,将只会使用曝光设置。

默认设置适用于室外环境,可在每个设置的文档中找到有关在室内环境中使用的设置的提示。

注意:景深模糊只支持 Forward+ 和移动渲染方式,不支持兼容模式。

教程

属性

float

auto_exposure_max_exposure_value

10.0

float

auto_exposure_min_exposure_value

-8.0

float

exposure_aperture

16.0

float

exposure_shutter_speed

100.0

float

frustum_far

4000.0

float

frustum_focal_length

35.0

float

frustum_focus_distance

10.0

float

frustum_near

0.05

方法

float

get_fov ( ) const


属性说明

float auto_exposure_max_exposure_value = 10.0

  • void set_auto_exposure_max_exposure_value ( float value )

  • float get_auto_exposure_max_exposure_value ( )

计算自动曝光时使用的最大亮度(单位:EV100)。在计算场景平均亮度时,颜色值将至少被钳制在这个值上。这限制了自动曝光在低于一定的亮度进行曝光时,导致场景将保持明亮的一个截止点。


float auto_exposure_min_exposure_value = -8.0

  • void set_auto_exposure_min_exposure_value ( float value )

  • float get_auto_exposure_min_exposure_value ( )

计算自动曝光时使用的最小亮度(单位:EV100)。在计算场景平均亮度时,颜色值将至少被钳制在这个值上。这限制了自动曝光在超过一定的亮度进行曝光时,导致场景将保持黑暗的一个截止点。


float exposure_aperture = 16.0

  • void set_aperture ( float value )

  • float get_aperture ( )

相机光圈的大小,以 f 档为单位进行测量。f 档是相机焦距与光圈直径之间的一个无单位比率。高光圈设置将产生一个更小的光圈,从而导致更暗的图像和更清晰的焦点。低光圈会产生一个大光圈,让更多的光线进入,从而产生一个更亮、更不聚焦的图像。默认值适用于白天的室外(即与默认 DirectionalLight3D 一起使用),对于室内照明,2 到 4 之间的值更合适。

仅在启用 ProjectSettings.rendering/lights_and_shadows/use_physical_light_units 时可用。


float exposure_shutter_speed = 100.0

  • void set_shutter_speed ( float value )

  • float get_shutter_speed ( )

快门打开和关闭的时间,计算方式为 1 / shutter_speed 秒。较高的值将允许较少的光线(导致图像较暗),而较低的值将允许更多的光线(导致图像较亮)。

仅当启用 ProjectSettings.rendering/lights_and_shadows/use_physical_light_units 时可用。


float frustum_far = 4000.0

覆盖 Camera3D.far 的值。在内部计算景深时使用。当被附加到 Camera3D 作为其 Camera3D.attributes 时,它将覆盖 Camera3D.fov 属性。


float frustum_focal_length = 35.0

  • void set_focal_length ( float value )

  • float get_focal_length ( )

相机镜头和相机光圈之间的距离,单位:毫米。控制视野和景深。较大的焦距会导致较小的视野和较窄的景深,这意味着更少的对象将在焦点中。较小的焦距会导致更宽的视野和更大的景深,这意味着更多的物体将在焦点中。当被附加到 Camera3D 作为其 Camera3D.attributes 时,它将覆盖 Camera3D.fov 属性和 Camera3D.keep_aspect 属性。


float frustum_focus_distance = 10.0

  • void set_focus_distance ( float value )

  • float get_focus_distance ( )

将在焦点中的物体与相机的距离,以米为单位进行测量。在内部,这将被钳制为至少比 frustum_focal_length 大 1 毫米。


float frustum_near = 0.05

  • void set_near ( float value )

  • float get_near ( )

覆盖 Camera3D.near 的值。在内部计算景深时使用。当被附加到 Camera3D 作为其 Camera3D.attributes 时,它将覆盖 Camera3D.near 属性。


方法说明

float get_fov ( ) const

返回对应于 frustum_focal_length 的垂直视野。每当 frustum_focal_length 发生变化时,该值都会在内部计算。