Skip to content

Commit cb57b52

Browse files
havesscopybara-github
authored andcommitted
Fix fallback metallic texture in Filament renderer.
Set fallback_textures_[mjTEXROLE_METALLIC] to fallback_white_ rather than fallback_black_, so that materials defining metallicness without an explicit metallic texture map do not have their metallic factor zeroed out by the texture multiplier in pbr.mat. PiperOrigin-RevId: 975852073 Change-Id: I366f10891e1b249655f921ca23adc2d3b40b8946
1 parent 34f099c commit cb57b52

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

‎doc/changelog.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ Bug fixes
5757

5858
- Rewrote the Plane-Mesh collider to fix bugs and improve performance. Fixes :issue:`3524`.
5959

60+
Rendering
61+
^^^^^^^^^
62+
63+
.. admonition:: Breaking API changes
64+
:class: attention
65+
66+
- For materials with physically-based rendering parameters that do *not* provide a metallic texture the fallback is
67+
now white. Previously the fallback was black, which caused scalar metallic values to be discarded when multiplied
68+
in the PBR shader.
69+
6070
Version 3.12.0 (August 20, 2026)
6171
--------------------------------
6272

‎src/render/filament/core/object_manager.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ ObjectManager::ObjectManager(filament::Engine* engine) : engine_(engine) {
126126
fallback_textures_[mjTEXROLE_OPACITY] = fallback_white_;
127127
fallback_textures_[mjTEXROLE_OCCLUSION] = fallback_white_;
128128
fallback_textures_[mjTEXROLE_ROUGHNESS] = fallback_white_;
129-
fallback_textures_[mjTEXROLE_METALLIC] = fallback_black_;
129+
fallback_textures_[mjTEXROLE_METALLIC] = fallback_white_;
130130
fallback_textures_[mjTEXROLE_NORMAL] = fallback_normal_;
131131
fallback_textures_[mjTEXROLE_EMISSIVE] = fallback_white_;
132132
fallback_textures_[mjTEXROLE_ORM] = fallback_orm_;

‎test/render/testdata/emissive_bloom.xml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<material name="floor" texture="dark" texrepeat="6 6" texuniform="true" reflectance="0.4" metallic="0.5" roughness="0.2"/>
77
<material name="wall" rgba="0.13 0.13 0.16 1" metallic="0.05" roughness="0.85"/>
8-
<material name="chrome" rgba="0.95 0.95 0.95 1" metallic="1.0" roughness="0.05" emission="1.0"/>
8+
<material name="white" rgba="0.95 0.95 0.95 1" metallic="0.0" roughness="0.05" emission="1.0"/>
99
</asset>
1010

1111
<custom>
@@ -26,21 +26,21 @@
2626
<geom name="backwall" type="box" pos="0 1.6 0.9" size="3 0.05 0.9" material="wall"/>
2727

2828
<light type="point" pos="-2.0 -0.2 0.40" diffuse="1.00 0.20 0.20" intensity="180000" range="3" bulbradius="120"/>
29-
<geom type="sphere" pos="-2.0 0.20 0.18" size="0.18" material="chrome"/>
29+
<geom type="sphere" pos="-2.0 0.20 0.18" size="0.18" material="white"/>
3030

3131
<light type="point" pos="-1.2 -0.2 0.40" diffuse="1.00 0.50 0.10" intensity="180000" range="3" bulbradius="120"/>
32-
<geom type="sphere" pos="-1.2 0.20 0.18" size="0.18" material="chrome"/>
32+
<geom type="sphere" pos="-1.2 0.20 0.18" size="0.18" material="white"/>
3333

3434
<light type="point" pos="-0.4 -0.2 0.40" diffuse="1.00 0.95 0.30" intensity="180000" range="3" bulbradius="120"/>
35-
<geom type="sphere" pos="-0.4 0.20 0.18" size="0.18" material="chrome"/>
35+
<geom type="sphere" pos="-0.4 0.20 0.18" size="0.18" material="white"/>
3636

3737
<light type="point" pos=" 0.4 -0.2 0.40" diffuse="0.20 1.00 0.40" intensity="180000" range="3" bulbradius="120"/>
38-
<geom type="sphere" pos=" 0.4 0.20 0.18" size="0.18" material="chrome"/>
38+
<geom type="sphere" pos=" 0.4 0.20 0.18" size="0.18" material="white"/>
3939

4040
<light type="point" pos=" 1.2 -0.2 0.40" diffuse="0.30 0.55 1.00" intensity="180000" range="3" bulbradius="120"/>
41-
<geom type="sphere" pos=" 1.2 0.20 0.18" size="0.18" material="chrome"/>
41+
<geom type="sphere" pos=" 1.2 0.20 0.18" size="0.18" material="white"/>
4242

4343
<light type="point" pos=" 2.0 -0.2 0.40" diffuse="1.00 0.30 0.95" intensity="180000" range="3" bulbradius="120"/>
44-
<geom type="sphere" pos=" 2.0 0.20 0.18" size="0.18" material="chrome"/>
44+
<geom type="sphere" pos=" 2.0 0.20 0.18" size="0.18" material="white"/>
4545
</worldbody>
4646
</mujoco>

‎test/render/testdata/reflection.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<!-- packed occlusion(R)/roughness(G)/metallic(B): smooth copper -->
2626
<texture name="orm" type="2d" builtin="flat" rgb1="1 .3 1" width="8" height="8"/>
2727
<material name="floor" texture="grid" texrepeat="3 3" texuniform="true" reflectance=".5"/>
28-
<material name="mirror" rgba=".03 .03 .04 1" reflectance=".9" metallic="1" roughness=".04"/>
28+
<material name="mirror" rgba=".03 .03 .04 1" reflectance=".9" metallic="0" roughness=".04"/>
2929
<material name="copper_mirror" rgba=".95 .64 .38 1" reflectance=".9">
3030
<layer texture="orm" role="orm"/>
3131
</material>

0 commit comments

Comments
 (0)
⌂ 换网址