Skip to content

Commit 37f8d2a

Browse files
SeanCurtis-TRIWawasCode
authored andcommitted
Upgrade meshcat to latest commit (RobotLocomotion#20442)
Note: This qualitatively changes the output renderings. Meshcat's rendered result has moved from linear-srgb to srgb. Things are generally less saturated now as part of three.js's move towards more realistic lighting. We've amended meshcat.html to accommodate some of the fundamental changes: - Silence a console warning. - Beef up the lighting so that it's more aesthetically pleasing.
1 parent 41f9d0a commit 37f8d2a

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

geometry/meshcat.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,32 @@
109109
requestAnimationFrame( animate );
110110
// Set background to match the legacy ``drake_visualizer`` application of
111111
// days past.
112-
viewer.set_property(['Background'], "top_color", [.95, .95, 1.0])
113-
viewer.set_property(['Background'], "bottom_color", [.32, .32, .35])
112+
viewer.set_property(['Background', '<object>'], "top_color",
113+
[.95, .95, 1.0])
114+
viewer.set_property(['Background', '<object>'], "bottom_color",
115+
[.32, .32, .35])
114116
// Set the initial view looking up the y-axis.
115117
viewer.set_property(['Cameras', 'default', 'rotated', '<object>'],
116118
"position", [0.0, 1.0, 3.0])
117119

120+
// With meshcat's upgrade of three.js, the default lighting conditions are
121+
// no longer appropriate. Meshcat has boosted them slightly to account for
122+
// a hidden change in three.js's lighting math, but it's not enough. The
123+
// ambient and directional lights don't decay with distance, but point and
124+
// spotlight do. The default lighting is now dominated by the non-decaying
125+
// light sources. So, we're going to significantly bump the decaying sources
126+
// to give them illuminating power and increase image contrast. These values
127+
// don't live in upstream meshcat because in some of meshcat's test/*.html
128+
// files, these defaults look horrible..
129+
viewer.set_property(["Lights", "SpotLight", "<object>"], "intensity", 30);
130+
viewer.set_property(["Lights", "PointLightNegativeX", "<object>"],
131+
"intensity", 25);
132+
viewer.set_property(["Lights", "PointLightPositiveX", "<object>"],
133+
"intensity", 25);
134+
viewer.set_property(["Lights", "AmbientLight", "<object>"], "intensity",
135+
0.3);
136+
viewer.set_property(["Lights", "FillLight", "<object>"], "intensity", 0.5);
137+
118138
<!-- CONNECTION BLOCK BEGIN -->
119139
// The lifespan of the server may be much shorter than this visualizer
120140
// client. We'd like the user to not have to explicitly reload when they

tools/workspace/meshcat/repository.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def meshcat_repository(
1010
Updating this commit requires local testing; see
1111
drake/tools/workspace/meshcat/README.md for details.
1212
""",
13-
commit = "44eac463725f048c47debfe34d3f935d01aa6bac",
14-
sha256 = "7ac5e9fdcc407abb4770bad1cee849de939f1dc856ef38d601a1982abec68ac3", # noqa
13+
commit = "fa29aecebd5f1712844c3b98967a7d21707df5a0",
14+
sha256 = "bdd505e90ab4e46958714a909f0a45d42d905eee0fa87637b97092035a4df7a3", # noqa
1515
build_file = ":package.BUILD.bazel",
1616
mirrors = mirrors,
1717
)

0 commit comments

Comments
 (0)