Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

PhysicalSkyMaterial

繼承: Material < Resource < RefCounted < Object

透過一組物理屬性定義 Sky 資源的天空的材質。

說明

該 PhysicalSkyMaterial 使用 Preetham 解析日光模型,根據物理屬性繪製一個天空。這會產生比 ProceduralSkyMaterial 更加逼真的天空,但速度稍慢且靈活性較差。

該 PhysicalSkyMaterial 僅支援一個太陽。太陽的顏色、能量和方向,取自場景樹中的第一個 DirectionalLight3D。

屬性

float

energy_multiplier

1.0

Color

ground_color

Color(0.1, 0.07, 0.034, 1)

float

mie_coefficient

0.005

Color

mie_color

Color(0.69, 0.729, 0.812, 1)

float

mie_eccentricity

0.8

Texture2D

night_sky

float

rayleigh_coefficient

2.0

Color

rayleigh_color

Color(0.3, 0.405, 0.6, 1)

float

sun_disk_scale

1.0

float

turbidity

10.0

bool

use_debanding

true


屬性說明

float energy_multiplier = 1.0 🔗

  • void set_energy_multiplier(value: float)

  • float get_energy_multiplier()

天空整體亮度的乘數。數值越高,天空就越亮。


Color ground_color = Color(0.1, 0.07, 0.034, 1) 🔗

  • void set_ground_color(value: Color)

  • Color get_ground_color()

調變天空下半部分的 Color,這部分代表地面。


float mie_coefficient = 0.005 🔗

  • void set_mie_coefficient(value: float)

  • float get_mie_coefficient()

控制天空中米氏散射的強度。米氏散射是光與較大的粒子(例如水)碰撞的結果。在地球上,米氏散射的結果是太陽和地平線周圍的顏色發白。


Color mie_color = Color(0.69, 0.729, 0.812, 1) 🔗

  • void set_mie_color(value: Color)

  • Color get_mie_color()

控制天空中米氏散射效果的 Color。雖然在物理上並不準確,但可以創造出看上去像的外星球的天空。


float mie_eccentricity = 0.8 🔗

  • void set_mie_eccentricity(value: float)

  • float get_mie_eccentricity()

控制米氏散射的方向。值為 1 表示當光照到粒子時會直接穿過。值為-1 表示所有的光都是向後散射的。


Texture2D night_sky 🔗

用於夜空的 Texture2D。會新增到天空中,所以足夠亮的話在白天也可能會看到。


float rayleigh_coefficient = 2.0 🔗

  • void set_rayleigh_coefficient(value: float)

  • float get_rayleigh_coefficient()

控制瑞利散射的強度。瑞利散射是光與較小粒子碰撞的結果,是天空呈藍色的原因。


Color rayleigh_color = Color(0.3, 0.405, 0.6, 1) 🔗

  • void set_rayleigh_color(value: Color)

  • Color get_rayleigh_color()

控制瑞利散射的 Color。雖然在物理上並不準確,但可以創造出看上去像的外星球的天空。例如,將其設為紅色 Color,可以得到火星大氣的外觀,日落時為藍色。


float sun_disk_scale = 1.0 🔗

  • void set_sun_disk_scale(value: float)

  • float get_sun_disk_scale()

設定太陽圓盤的大小。預設值基於從地球對太陽的感知大小。


float turbidity = 10.0 🔗

  • void set_turbidity(value: float)

  • float get_turbidity()

設定大氣的厚度。高濁度會產生霧狀外觀的大氣,而低濁度會產生更清晰的大氣。


bool use_debanding = true 🔗

  • void set_use_debanding(value: bool)

  • bool get_use_debanding()

如果為 true,則啟用去色帶。去色帶會增加少量噪點,這有助於減少天空中顏色的平滑變化而出現的色帶。