Skip to content

Commit c714b43

Browse files
authored
Fix ambient lighting intensity in capture_360_images (#566)
The ambient_intensity parameter in lighting_config was not being properly applied during 360-degree image capture. This change ensures that the directional light intensity scales with the ambient_intensity value, making brightness adjustments work as expected. - Scale DirectionalLight intensity with ambient_intensity parameter - Improve ambient light reset in cleanup method
1 parent 918611f commit c714b43

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

skrobot/viewers/_pyrender.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,9 @@ def _setup_scene_lighting(self, lighting_config=None):
505505
ambient_intensity])
506506

507507
# Add a single directional light for some definition
508-
light = pyrender.DirectionalLight(color=[1.0, 1.0, 1.0], intensity=0.2)
508+
# Scale its intensity with ambient_intensity
509+
light = pyrender.DirectionalLight(color=[1.0, 1.0, 1.0],
510+
intensity=ambient_intensity * 2.0)
509511
pose = np.eye(4)
510512
# Point downward from above
511513
pose[:3, :3] = transformations.euler_matrix(np.pi / 4, 0, 0)[:3, :3]
@@ -544,7 +546,7 @@ def _cleanup_scene_lighting(self, light_nodes):
544546
for light_node in light_nodes:
545547
self.scene.remove_node(light_node)
546548
# Reset ambient light to default
547-
self.scene.ambient_light = None
549+
self.scene.ambient_light = np.array([0., 0., 0.])
548550

549551
def _update_scene_meshes(self):
550552
"""Update scene meshes with latest transforms."""

0 commit comments

Comments
 (0)