-
Notifications
You must be signed in to change notification settings - Fork 425
Closed
Description
Hello! I have found that when I try to add spotlights that cast shadows, only one (the first one) really casts shadow (see screenshot below). According to the default shader code, there are 10 spotlights supported. Am I missing something and how to cast shadows from all spotlights?
Code to reproduce the scene:
import gymnasium as gym
from tqdm import tqdm
import numpy as np
import sapien
import mani_skill.envs
from mani_skill.utils.building import actors
from mani_skill.utils.registration import register_env
from mani_skill.utils.scene_builder.table import TableSceneBuilder
from mani_skill.envs.sapien_env import BaseEnv
@register_env("MyEnv", max_episode_steps=50)
class MyEnv(BaseEnv):
cube_half_size = 0.02
SUPPORTED_REWARD_MODES = ["none"]
def _load_agent(self, options: dict):
# set a reasonable initial pose for the agent that doesn't intersect other objects
super()._load_agent(options, sapien.Pose(p=[-0.615, 0, 0]))
def _load_lighting(self, options: dict):
shadow = self.enable_shadow
intensity = 10.0
self.scene.add_spot_light([0, 0, 0.3],
[0, 0, -1],
inner_fov=10,
outer_fov=20,
color=[intensity, intensity, intensity],
shadow=shadow,
)
self.scene.add_spot_light([0.0, 0.8, 0.3],
[0, 0, -1],
inner_fov=10,
outer_fov=20,
color=[intensity, intensity, intensity],
shadow=shadow,
)
def _load_scene(self, options: dict):
self.table_scene = TableSceneBuilder(
env=self,
)
self.table_scene.build()
self.obj1 = actors.build_cube(
self.scene,
half_size=self.cube_half_size,
color=np.array([255, 0, 0, 255]) / 255,
name="cube1",
body_type="static",
initial_pose=sapien.Pose(p=[0.1, 0, 0.15]),
)
self.obj2 = actors.build_cube(
self.scene,
half_size=self.cube_half_size,
color=np.array([255, 0, 0, 255]) / 255,
name="cube2",
body_type="static",
initial_pose=sapien.Pose(p=[0.1, 0.8, 0.15]),
)
def main():
env_kwargs = dict(
render_mode='human',
num_envs=1,
enable_shadow=True,
viewer_camera_configs={'shader_pack': 'default'},
human_render_camera_configs={'shader_pack': 'default'},
robot_uids='panda',
)
env = gym.make(
'MyEnv',
**env_kwargs
)
env.reset()
episode_length = 10
for i in tqdm(range(episode_length)):
_, _, _, _, _ = env.step(None)
env.render()
viewer = env.render()
viewer.paused = True
while True:
if viewer.closed:
exit()
if viewer.window.key_down("c"):
break
env.render()
env.close()
if __name__ == '__main__':
main()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels