Esempio n. 1
0
points = []
#for i in range(6):
#    points.append(
#        PointLight(
#            location=np.array([-3.0, 3.0-i, 3.0]),
#            color=np.array([1.0, 1.0, 1.0]),
#            strength=4.0
#        )
#    )
#
#for i, point in enumerate(points):
#    scene.add_light('point_{}'.format(i), point)

# Add the lights to the scene
scene.ambient_light = ambient  # only one ambient light per scene

dl = DirectionalLight(direction=np.array([0.0, 0.0, -1.0]),
                      color=np.array([1.0, 1.0, 1.0]),
                      strength=2.0)
scene.add_light('direc', dl)

#====================================
# Add a camera to the scene
#====================================

# Set up camera intrinsics
ci = CameraIntrinsics(frame='camera',
                      fx=525.0,
                      fy=525.0,
                      cx=320.0,
print("ADDED OBJECT SUCCESSFULLY")

# table_obj_properties = MaterialProperties(
#                       color = np.array([0, 0, 0]),
#                       )

# wrap the table as a SceneObject
# table_mesh = trimesh.load(PLANE_MESH)
# T_table_world = RigidTransform.load(PLANE_POSE)
# table = SceneObject(table_mesh, T_table_world, table_obj_properties)
# scene.add_object('table', table)

# add light
ambient = AmbientLight(color=np.array([1.0, 1.0, 1.0]), strength=1.0)

scene.ambient_light = ambient

dl = DirectionalLight(direction=np.array([0, 0, -1.0]),
                      color=np.array([1.0, 1.0, 1.0]),
                      strength=1.0)
scene.add_light('direc', dl)
print("Added directional light")

#====================================
# Add a camera to the scene
#====================================

# Set up camera intrinsics
ci = CameraIntrinsics(frame='camera',
                      fx=525.0,
                      fy=525.0,