|
109 | 109 | requestAnimationFrame( animate ); |
110 | 110 | // Set background to match the legacy ``drake_visualizer`` application of |
111 | 111 | // 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]) |
114 | 116 | // Set the initial view looking up the y-axis. |
115 | 117 | viewer.set_property(['Cameras', 'default', 'rotated', '<object>'], |
116 | 118 | "position", [0.0, 1.0, 3.0]) |
117 | 119 |
|
| 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 | + |
118 | 138 | <!-- CONNECTION BLOCK BEGIN --> |
119 | 139 | // The lifespan of the server may be much shorter than this visualizer |
120 | 140 | // client. We'd like the user to not have to explicitly reload when they |
|
0 commit comments