Tweak default lighting and specularity for non-PBR scenes.
Most "classic" objects looked washed out. To "revert" to the old look, you can add the following to your XML files:
```
<custom>
<numeric name="filament.phong.specular_multiplier" data="0.1"/>
<numeric name="filament.fallback.scene_light_intensity" data="100000.0"/>
<numeric name="filament.fallback.environment_light_intensity" data="10000.0"/>
</custom>
```
PiperOrigin-RevId: 869725829
Change-Id: Icab0cedaa27915400497745db886c393709c14b1
This commit is contained in:
committed by
Copybara-Service
parent
5903d4826f
commit
6d8b6028e2
@@ -133,7 +133,7 @@ class ObjectManager {
|
|||||||
filament::Texture* fallback_normal_ = nullptr;
|
filament::Texture* fallback_normal_ = nullptr;
|
||||||
filament::Texture* fallback_orm_ = nullptr;
|
filament::Texture* fallback_orm_ = nullptr;
|
||||||
filament::IndirectLight* fallback_indirect_light_ = nullptr;
|
filament::IndirectLight* fallback_indirect_light_ = nullptr;
|
||||||
float specular_multiplier_ = 0.6f;
|
float specular_multiplier_ = 0.2f;
|
||||||
float shininess_multiplier_ = 0.1f;
|
float shininess_multiplier_ = 0.1f;
|
||||||
float emissive_multiplier_ = 0.3f;
|
float emissive_multiplier_ = 0.3f;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -166,6 +166,16 @@ SceneView::SceneView(filament::Engine* engine, ObjectManager* object_mgr)
|
|||||||
m, "filament.fog.inScatteringSize", fog_opts.inScatteringSize);
|
m, "filament.fog.inScatteringSize", fog_opts.inScatteringSize);
|
||||||
views_[kNormalIndex]->setFogOptions(fog_opts);
|
views_[kNormalIndex]->setFogOptions(fog_opts);
|
||||||
|
|
||||||
|
fallback_head_light_intensity_ =
|
||||||
|
ReadElement(m, "filament.fallback.head_light_intensity",
|
||||||
|
fallback_head_light_intensity_);
|
||||||
|
fallback_scene_light_intensity_ =
|
||||||
|
ReadElement(m, "filament.fallback.scene_light_intensity",
|
||||||
|
fallback_scene_light_intensity_);
|
||||||
|
fallback_environment_light_intensity_ =
|
||||||
|
ReadElement(m, "filament.fallback.environment_light_intensity",
|
||||||
|
fallback_environment_light_intensity_);
|
||||||
|
|
||||||
// Create an empty/black indirect light to ensure that the skybox is oriented
|
// Create an empty/black indirect light to ensure that the skybox is oriented
|
||||||
// to respect mujoco's Z-up convention.
|
// to respect mujoco's Z-up convention.
|
||||||
scene_->setIndirectLight(
|
scene_->setIndirectLight(
|
||||||
@@ -313,18 +323,12 @@ void SceneView::PrepareLights() {
|
|||||||
// dealing with a "classic renderer" scene. In this case, let's add a
|
// dealing with a "classic renderer" scene. In this case, let's add a
|
||||||
// default environment light and set the light intensity ourselves.
|
// default environment light and set the light intensity ourselves.
|
||||||
if (total_light_intensity == 0.0f) {
|
if (total_light_intensity == 0.0f) {
|
||||||
// Headlight is not required for Filament and often confusing, disable it by
|
SetFallbackEnvironmentLight(fallback_environment_light_intensity_);
|
||||||
// default.
|
const float intensity = fallback_scene_light_intensity_ / lights_.size();
|
||||||
constexpr float kHeadlightIntensityCandela = 0.f;
|
|
||||||
constexpr float kTotalSceneLightIntensityCandela = 100'000.f;
|
|
||||||
constexpr float kFallbackEnvironmentLightIntensityCandela = 10'000.f;
|
|
||||||
|
|
||||||
SetFallbackEnvironmentLight(kFallbackEnvironmentLightIntensityCandela);
|
|
||||||
const float intensity = kTotalSceneLightIntensityCandela / lights_.size();
|
|
||||||
for (auto& light : lights_) {
|
for (auto& light : lights_) {
|
||||||
if (light) {
|
if (light) {
|
||||||
light->SetIntensity(light->IsHeadlight() ? kHeadlightIntensityCandela
|
light->SetIntensity(
|
||||||
: intensity);
|
light->IsHeadlight() ? fallback_head_light_intensity_ : intensity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ class SceneView {
|
|||||||
ColorGradingOptions color_grading_options_;
|
ColorGradingOptions color_grading_options_;
|
||||||
DrawMode active_mode_ = DrawMode::kNumDrawModes;
|
DrawMode active_mode_ = DrawMode::kNumDrawModes;
|
||||||
float aspect_ratio_ = 1.0f;
|
float aspect_ratio_ = 1.0f;
|
||||||
|
float fallback_head_light_intensity_ = 0.f;
|
||||||
|
float fallback_scene_light_intensity_ = 80'000.f;
|
||||||
|
float fallback_environment_light_intensity_ = 5'000.f;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mujoco
|
} // namespace mujoco
|
||||||
|
|||||||
Reference in New Issue
Block a user