Expose vsm blur width parameter.
PiperOrigin-RevId: 875733943 Change-Id: Ic8cb423104d2e62ce295f6a2ab6fd67d548910a6
This commit is contained in:
committed by
Copybara-Service
parent
b71cdfb4ec
commit
07d7bc95e3
@@ -72,6 +72,11 @@ Light::Light(ObjectManager* object_mgr, const Params& params)
|
|||||||
type == filament::LightManager::Type::DIRECTIONAL ? 4 : 1;
|
type == filament::LightManager::Type::DIRECTIONAL ? 4 : 1;
|
||||||
opts.shadowBulbRadius = params.bulbradius;
|
opts.shadowBulbRadius = params.bulbradius;
|
||||||
opts.mapSize = params.shadow_map_size;
|
opts.mapSize = params.shadow_map_size;
|
||||||
|
if (params.vsm_blur_width > 0.0f) {
|
||||||
|
opts.vsm.elvsm = true;
|
||||||
|
opts.vsm.blurWidth = params.vsm_blur_width;
|
||||||
|
}
|
||||||
|
|
||||||
builder.shadowOptions(opts);
|
builder.shadowOptions(opts);
|
||||||
|
|
||||||
entity_ = utils::EntityManager::get().create();
|
entity_ = utils::EntityManager::get().create();
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ class Light {
|
|||||||
float bulbradius = 0.0f;
|
float bulbradius = 0.0f;
|
||||||
// The size of the shadow map.
|
// The size of the shadow map.
|
||||||
int shadow_map_size = 2048;
|
int shadow_map_size = 2048;
|
||||||
|
// Blur width for EL VSM.
|
||||||
|
float vsm_blur_width = 0.0f;
|
||||||
// Whether or not the light is a headlight.
|
// Whether or not the light is a headlight.
|
||||||
bool headlight = false;
|
bool headlight = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ SceneView::SceneView(filament::Engine* engine, ObjectManager* object_mgr)
|
|||||||
|
|
||||||
default_shadow_map_size_ = ReadElement(
|
default_shadow_map_size_ = ReadElement(
|
||||||
m, "filament.shadows.map_size", default_shadow_map_size_);
|
m, "filament.shadows.map_size", default_shadow_map_size_);
|
||||||
|
default_vsm_blur_width_ = ReadElement(
|
||||||
|
m, "filament.shadows.vsm_blur_width", default_vsm_blur_width_);
|
||||||
|
|
||||||
auto shadow_type = views_[kNormalIndex]->getShadowType();
|
auto shadow_type = views_[kNormalIndex]->getShadowType();
|
||||||
shadow_type = ReadElement(m, "filament.shadows.type", shadow_type);
|
shadow_type = ReadElement(m, "filament.shadows.type", shadow_type);
|
||||||
@@ -298,6 +300,7 @@ void SceneView::PrepareLights() {
|
|||||||
params.range = model->light_range[i];
|
params.range = model->light_range[i];
|
||||||
params.intensity = model->light_intensity[i];
|
params.intensity = model->light_intensity[i];
|
||||||
params.shadow_map_size = default_shadow_map_size_;
|
params.shadow_map_size = default_shadow_map_size_;
|
||||||
|
params.vsm_blur_width = default_vsm_blur_width_;
|
||||||
if (params.type == mjLIGHT_SPOT) {
|
if (params.type == mjLIGHT_SPOT) {
|
||||||
params.spot_cone_angle = model->light_cutoff[i];
|
params.spot_cone_angle = model->light_cutoff[i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class SceneView {
|
|||||||
DrawMode active_mode_ = DrawMode::kNumDrawModes;
|
DrawMode active_mode_ = DrawMode::kNumDrawModes;
|
||||||
float aspect_ratio_ = 1.0f;
|
float aspect_ratio_ = 1.0f;
|
||||||
int default_shadow_map_size_ = 2048;
|
int default_shadow_map_size_ = 2048;
|
||||||
|
float default_vsm_blur_width_ = 0.0f;
|
||||||
float fallback_head_light_intensity_ = 0.f;
|
float fallback_head_light_intensity_ = 0.f;
|
||||||
float fallback_scene_light_intensity_ = 80'000.f;
|
float fallback_scene_light_intensity_ = 80'000.f;
|
||||||
float fallback_environment_light_intensity_ = 5'000.f;
|
float fallback_environment_light_intensity_ = 5'000.f;
|
||||||
|
|||||||
Reference in New Issue
Block a user