blenderproc.python.lighting.IntersectingSpotLight module

This module provides functionality to sample a spotlight, which intersects with the current camera frustum, without being inside the camera frustum.

blenderproc.python.lighting.IntersectingSpotLight._default_light_pose_sampling(frustum_vertices)[source]

Samples a new spotlight pose based on the camera frustum vertices.

Parameters:

frustum_vertices (ndarray) – The eight 3D coordinates of the camera frustum

Return type:

ndarray

Returns:

The newly sampled 3D spotlight pose

blenderproc.python.lighting.IntersectingSpotLight._default_look_at_pose_sampling(frustum_vertices, _sampled_light_pose)[source]

This function samples the default look at location and is used inside the add_intersecting_spot_lights_to_camera_poses.

Parameters:
  • frustum_vertices (ndarray) – The eight 3D coordinates of the camera frustum

  • _sampled_light_pose (ndarray) – The currently sampled light pose

Return type:

ndarray

Returns:

A new 3D look at pose

blenderproc.python.lighting.IntersectingSpotLight.add_intersecting_spot_lights_to_camera_poses(clip_start, clip_end, perform_look_at_intersection_check=True, perform_look_at_pose_visibility_check=True, light_pose_sampling=None, look_at_pose_sampling=None, max_tries_per_cam_pose=10000)[source]

This functions adds spotlights which intersect with the camera pose. This is useful to get a greater variety in lighting situations then the general full illumination from all sides.

The spotlights location is defined by the light_pose_sampling parameter, it gets the eight coordinates of the camera frustum vertices. This camera frustum starts at clip_start and ends at clip_end. It should return a single 3D point. This point is then checked to not be in the camera frustum, if it is inside a new point will be sampled.

After the defining a suitable light position, a look at pose is sampled via the look_pose_sampling function. It uses the same eight coordinates of the camera frustum and the current sampled light position to return a look at pose.

If the perform_look_at_intersection_check value is set an intersection check between the light position and the look at location is done, which ensures that no object is between these two points. Similarly, for the perform_look_at_pose_visibility_check, a newly sampled light pose does not have an intersecting object between this sampled pose and the camera location.

Parameters:
  • clip_start (float) – The distance between the camera pose and the near clipping plane, used for the sampling of a light and look at location

  • clip_end (float) – The distance between the camera pose and the far clipping plane, used for the sampling of a light and look at location

  • perform_look_at_intersection_check (bool) – If this is True an intersection check between the light pose and the look at pose is done, if an object is inbetween both poses are discarded.

  • perform_look_at_pose_visibility_check (bool) – If this is True, an intersection check between the look at pose and the camera location is done, to ensure that the light is visible and not hidden.

  • light_pose_sampling (Optional[Callable[[ndarray], ndarray]]) – This function samples a new 3D light pose based on the eight 3D coordinates of the camera frustum. If this is None, the _default_light_pose_sampling is used.

  • look_at_pose_sampling (Optional[Callable[[ndarray, ndarray], ndarray]]) – This function samples a new 3D look at pose based on the eight 3D coordinates of the camera frustum and the currently sampled light pose. If this is None, the _default_look_at_pose_sampling is used.

  • max_tries_per_cam_pose (int) – The amount of maximum tries per camera pose for finding a new light pose with look at pose.

Return type:

Light

Returns:

The newly generated light