pyrender_visualizer_7.py 1.3 KB

12345678910111213141516171819202122232425262728
  1. def init_pyrender(self):
  2. # ==============================================================================
  3. # Light creation
  4. # ==============================================================================
  5. self.spot_l = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
  6. innerConeAngle=np.pi / 16.0,
  7. outerConeAngle=np.pi / 6.0)
  8. # ==============================================================================
  9. # Camera creation
  10. # ==============================================================================
  11. cam = PerspectiveCamera(yfov=np.pi / 2.0)
  12. R = _get_cam_rotation(self.cam_p,
  13. np.zeros((3)),
  14. self.up_axis)
  15. self.cam_pose = conversions.Rp2T(R, self.cam_p)
  16. # ==============================================================================
  17. # Scene creation
  18. # ==============================================================================
  19. self.scene = Scene(ambient_light=np.array([0.1, 0.1, 0.1, 1.0]))
  20. self.spot_l_node = self.scene.add(self.spot_l, pose=self.cam_pose, name="spot_light")
  21. self.cam_node = self.scene.add(cam, pose=self.cam_pose, name="camera")
  22. self.r = OffscreenRenderer(viewport_width=320, viewport_height=240)