mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Addition of FogVolumes, FogShaders, FogMaterial, and overhaul of VolumetricFog
Co-authored-by: Brian Semrau <brian.semrau@gmail.com>
This commit is contained in:
@@ -782,7 +782,7 @@ void Environment::_update_fog() {
|
||||
// Volumetric Fog
|
||||
|
||||
void Environment::_update_volumetric_fog() {
|
||||
RS::get_singleton()->environment_set_volumetric_fog(environment, volumetric_fog_enabled, volumetric_fog_density, volumetric_fog_light, volumetric_fog_light_energy, volumetric_fog_length, volumetric_fog_detail_spread, volumetric_fog_gi_inject, volumetric_fog_temporal_reproject, volumetric_fog_temporal_reproject_amount);
|
||||
RS::get_singleton()->environment_set_volumetric_fog(environment, volumetric_fog_enabled, volumetric_fog_density, volumetric_fog_albedo, volumetric_fog_emission, volumetric_fog_emission_energy, volumetric_fog_anisotropy, volumetric_fog_length, volumetric_fog_detail_spread, volumetric_fog_gi_inject, volumetric_fog_temporal_reproject, volumetric_fog_temporal_reproject_amount, volumetric_fog_ambient_inject);
|
||||
}
|
||||
|
||||
void Environment::set_volumetric_fog_enabled(bool p_enable) {
|
||||
@@ -795,26 +795,39 @@ bool Environment::is_volumetric_fog_enabled() const {
|
||||
return volumetric_fog_enabled;
|
||||
}
|
||||
void Environment::set_volumetric_fog_density(float p_density) {
|
||||
p_density = CLAMP(p_density, 0.0000001, 1.0);
|
||||
volumetric_fog_density = p_density;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
float Environment::get_volumetric_fog_density() const {
|
||||
return volumetric_fog_density;
|
||||
}
|
||||
void Environment::set_volumetric_fog_light(Color p_color) {
|
||||
volumetric_fog_light = p_color;
|
||||
void Environment::set_volumetric_fog_albedo(Color p_color) {
|
||||
volumetric_fog_albedo = p_color;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
Color Environment::get_volumetric_fog_light() const {
|
||||
return volumetric_fog_light;
|
||||
Color Environment::get_volumetric_fog_albedo() const {
|
||||
return volumetric_fog_albedo;
|
||||
}
|
||||
void Environment::set_volumetric_fog_light_energy(float p_begin) {
|
||||
volumetric_fog_light_energy = p_begin;
|
||||
void Environment::set_volumetric_fog_emission(Color p_color) {
|
||||
volumetric_fog_emission = p_color;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
float Environment::get_volumetric_fog_light_energy() const {
|
||||
return volumetric_fog_light_energy;
|
||||
Color Environment::get_volumetric_fog_emission() const {
|
||||
return volumetric_fog_emission;
|
||||
}
|
||||
void Environment::set_volumetric_fog_emission_energy(float p_begin) {
|
||||
volumetric_fog_emission_energy = p_begin;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
float Environment::get_volumetric_fog_emission_energy() const {
|
||||
return volumetric_fog_emission_energy;
|
||||
}
|
||||
void Environment::set_volumetric_fog_anisotropy(float p_anisotropy) {
|
||||
volumetric_fog_anisotropy = p_anisotropy;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
float Environment::get_volumetric_fog_anisotropy() const {
|
||||
return volumetric_fog_anisotropy;
|
||||
}
|
||||
void Environment::set_volumetric_fog_length(float p_length) {
|
||||
volumetric_fog_length = p_length;
|
||||
@@ -824,6 +837,7 @@ float Environment::get_volumetric_fog_length() const {
|
||||
return volumetric_fog_length;
|
||||
}
|
||||
void Environment::set_volumetric_fog_detail_spread(float p_detail_spread) {
|
||||
p_detail_spread = CLAMP(p_detail_spread, 0.5, 6.0);
|
||||
volumetric_fog_detail_spread = p_detail_spread;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
@@ -838,6 +852,13 @@ void Environment::set_volumetric_fog_gi_inject(float p_gi_inject) {
|
||||
float Environment::get_volumetric_fog_gi_inject() const {
|
||||
return volumetric_fog_gi_inject;
|
||||
}
|
||||
void Environment::set_volumetric_fog_ambient_inject(float p_ambient_inject) {
|
||||
volumetric_fog_ambient_inject = p_ambient_inject;
|
||||
_update_volumetric_fog();
|
||||
}
|
||||
float Environment::get_volumetric_fog_ambient_inject() const {
|
||||
return volumetric_fog_ambient_inject;
|
||||
}
|
||||
|
||||
void Environment::set_volumetric_fog_temporal_reprojection_enabled(bool p_enable) {
|
||||
volumetric_fog_temporal_reproject = p_enable;
|
||||
@@ -1295,18 +1316,24 @@ void Environment::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_enabled", "enabled"), &Environment::set_volumetric_fog_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_volumetric_fog_enabled"), &Environment::is_volumetric_fog_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_light", "color"), &Environment::set_volumetric_fog_light);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_light"), &Environment::get_volumetric_fog_light);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_emission", "color"), &Environment::set_volumetric_fog_emission);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_emission"), &Environment::get_volumetric_fog_emission);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_albedo", "color"), &Environment::set_volumetric_fog_albedo);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_albedo"), &Environment::get_volumetric_fog_albedo);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_density", "density"), &Environment::set_volumetric_fog_density);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_density"), &Environment::get_volumetric_fog_density);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_light_energy", "begin"), &Environment::set_volumetric_fog_light_energy);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_light_energy"), &Environment::get_volumetric_fog_light_energy);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_emission_energy", "begin"), &Environment::set_volumetric_fog_emission_energy);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_emission_energy"), &Environment::get_volumetric_fog_emission_energy);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_anisotropy", "anisotropy"), &Environment::set_volumetric_fog_anisotropy);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_anisotropy"), &Environment::get_volumetric_fog_anisotropy);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_length", "length"), &Environment::set_volumetric_fog_length);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_length"), &Environment::get_volumetric_fog_length);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_detail_spread", "detail_spread"), &Environment::set_volumetric_fog_detail_spread);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_detail_spread"), &Environment::get_volumetric_fog_detail_spread);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_gi_inject", "gi_inject"), &Environment::set_volumetric_fog_gi_inject);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_gi_inject"), &Environment::get_volumetric_fog_gi_inject);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_ambient_inject", "enabled"), &Environment::set_volumetric_fog_ambient_inject);
|
||||
ClassDB::bind_method(D_METHOD("get_volumetric_fog_ambient_inject"), &Environment::get_volumetric_fog_ambient_inject);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_temporal_reprojection_enabled", "enabled"), &Environment::set_volumetric_fog_temporal_reprojection_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_volumetric_fog_temporal_reprojection_enabled"), &Environment::is_volumetric_fog_temporal_reprojection_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_volumetric_fog_temporal_reprojection_amount", "temporal_reprojection_amount"), &Environment::set_volumetric_fog_temporal_reprojection_amount);
|
||||
@@ -1315,11 +1342,14 @@ void Environment::_bind_methods() {
|
||||
ADD_GROUP("Volumetric Fog", "volumetric_fog_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "volumetric_fog_enabled"), "set_volumetric_fog_enabled", "is_volumetric_fog_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_density", PROPERTY_HINT_RANGE, "0,1,0.0001,or_greater"), "set_volumetric_fog_density", "get_volumetric_fog_density");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "volumetric_fog_light", PROPERTY_HINT_COLOR_NO_ALPHA), "set_volumetric_fog_light", "get_volumetric_fog_light");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_light_energy", PROPERTY_HINT_RANGE, "0,1024,0.01,or_greater"), "set_volumetric_fog_light_energy", "get_volumetric_fog_light_energy");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_gi_inject", PROPERTY_HINT_RANGE, "0.00,16,0.01,exp"), "set_volumetric_fog_gi_inject", "get_volumetric_fog_gi_inject");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "volumetric_fog_albedo", PROPERTY_HINT_COLOR_NO_ALPHA), "set_volumetric_fog_albedo", "get_volumetric_fog_albedo");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "volumetric_fog_emission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_volumetric_fog_emission", "get_volumetric_fog_emission");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_emission_energy", PROPERTY_HINT_RANGE, "0,1024,0.01,or_greater"), "set_volumetric_fog_emission_energy", "get_volumetric_fog_emission_energy");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_gi_inject", PROPERTY_HINT_RANGE, "0.0,16,0.01,exp"), "set_volumetric_fog_gi_inject", "get_volumetric_fog_gi_inject");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_anisotropy", PROPERTY_HINT_RANGE, "-0.9,0.9,0.01"), "set_volumetric_fog_anisotropy", "get_volumetric_fog_anisotropy");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_length", PROPERTY_HINT_RANGE, "0,1024,0.01,or_greater"), "set_volumetric_fog_length", "get_volumetric_fog_length");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_detail_spread", PROPERTY_HINT_EXP_EASING, "0.01,16,0.01"), "set_volumetric_fog_detail_spread", "get_volumetric_fog_detail_spread");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_detail_spread", PROPERTY_HINT_EXP_EASING), "set_volumetric_fog_detail_spread", "get_volumetric_fog_detail_spread");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_ambient_inject", PROPERTY_HINT_RANGE, "0.0,16,0.01,exp"), "set_volumetric_fog_ambient_inject", "get_volumetric_fog_ambient_inject");
|
||||
ADD_SUBGROUP("Temporal Reprojection", "volumetric_fog_temporal_reprojection_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "volumetric_fog_temporal_reprojection_enabled"), "set_volumetric_fog_temporal_reprojection_enabled", "is_volumetric_fog_temporal_reprojection_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volumetric_fog_temporal_reprojection_amount", PROPERTY_HINT_RANGE, "0.0,0.999,0.001"), "set_volumetric_fog_temporal_reprojection_amount", "get_volumetric_fog_temporal_reprojection_amount");
|
||||
@@ -1381,11 +1411,6 @@ void Environment::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(SDFGI_Y_SCALE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(SDFGI_Y_SCALE_75_PERCENT);
|
||||
BIND_ENUM_CONSTANT(SDFGI_Y_SCALE_50_PERCENT);
|
||||
|
||||
BIND_ENUM_CONSTANT(VOLUMETRIC_FOG_SHADOW_FILTER_DISABLED);
|
||||
BIND_ENUM_CONSTANT(VOLUMETRIC_FOG_SHADOW_FILTER_LOW);
|
||||
BIND_ENUM_CONSTANT(VOLUMETRIC_FOG_SHADOW_FILTER_MEDIUM);
|
||||
BIND_ENUM_CONSTANT(VOLUMETRIC_FOG_SHADOW_FILTER_HIGH);
|
||||
}
|
||||
|
||||
Environment::Environment() {
|
||||
|
||||
Reference in New Issue
Block a user