threedb.controls.blender.occlusion

Cover the subject object with another object. An example config file using this control can be found here: https://github.com/3db/3db/tree/main/examples/unit_tests/occlusion.yaml.

class threedb.controls.blender.occlusion.OcclusionControl(root_folder)

Bases: threedb.controls.base_control.PreProcessControl

Control that adds an occlusion object infront of the main object in the scene.

Continuous Dimensions:

  • occlusion_ratio: Ratio of the occluded part of the object of interest. e.g., parameter 0.01 would occlude 1% of the object, and parameter 0.8 would occlude 80% of the object. (default range: (0.01, .8))

  • zoom: Controls distance from the occluder to the object of interest. The occluder is placed between the object of interest and the camera at a distance of zoom * D, measured from the object of interest. D is the distance between the object of interest and the camera. (default range: (0.01, 0.4))

  • scale: rescale the occlusion object by a factor of scale. Parameter 0.5 halves the occluder’s size, and parameter 2 doubles the occluder’s size. (default range: (0.01, 1))

Discrete Dimensions:

  • direction: The direction from which the occluder approaches the object of interest. Takes a value between 0 and 7 represeting the indices of the DIRECTIONS vectors.

  • occluder: The occlusion object. This is an index of the list of the occlusion objects which is automatically initialized when the OcclusionControl is created (see Note).

Example images

Varying all the parameters.

DIRECTIONS = [(1, -1), (1, 0), (1, 1), (0, -1), (0, 1), (-1, -1), (-1, 0), (-1, 1)]
OOD_DIR = 'ood_objects'
__init__(root_folder)

Initializes the OcclusionControl

Parameters

root_folder – The root folder where the ood_objects folder containing the possible occluders exist

apply(context: Dict[str, Any], control_args: Dict[str, Any])None

Modify the target give a combination of the inputs the control needs

Parameters
  • context (Dict[str, Any]) – A dictionary representation of the current scene.

  • control_args (Dict[str, Any]) – a dict containing an entry for each of the discrete and continuous parameters declared by the Control

  • the scene in-place (Modifies) –

  • return value. (no) –

unapply(context: Dict[str, Any])None

Deletes the occlusion objects. This is important to avoid clutering the scene with unneeded objects at the subsequent frames.

Parameters

context (Dict[str, Any]) – The scene context object

threedb.controls.blender.occlusion.Control

alias of threedb.controls.blender.occlusion.OcclusionControl