render_objaverse module#

Render a scene with two objects in Blender.

render_objaverse.add_objects_3drf(objects: List[Dict[str, Any]], config: Dict[str, Any], properties: Dict[str, Any]) List[Dict[str, Any]][source]#

Add random objects to the current blender scene.

Parameters:
  • objects – Objects to add to the scene.

  • config – Config file for the scene.

  • properties – JSON data containing object properties.

render_objaverse.check_overlap(obj1: <Mock name='mock.types.Object' id='140390608224512'>, obj2: <Mock name='mock.types.Object' id='140390608224512'>, camera: <Mock name='mock.types.Object' id='140390608224512'>, width: int, height: int, direction: str) bool[source]#

Determine if two objects overlap in the rendered image by analyzing their intersecting pixels.

Parameters:
  • obj1 – The first object in the scene.

  • obj2 – The second object in the scene.

  • camera – The camera object used for rendering the scene.

  • width – The width of the rendered image in pixels.

  • height – The height of the rendered image in pixels.

  • direction – The relative direction of the second object with respect to the first object.

Returns:

True if the two objects overlap, False otherwise. “Overlap” is defined as follows: (1) If the smaller object is behind the bigger one and the intersecting pixels exceed 75% of the smaller object’s pixels. (2) If the objects are side by side and there are any shared pixels between the objects. This function is used to skip scenes where one object is blocked by the other or if they are too close to each other.

render_objaverse.extract_masks_3drf(output_path: str, output_file: str) None[source]#

Render a masked image from the current scene and save it to disk.

Parameters:
  • output_path – Path to save the masked image.

  • output_file – Output file name for the masked image.

render_objaverse.render_scene_3drf(args: Namespace, config: Dict[str, Any], camera_settings: Dict[str, Any], properties: Dict[str, Any], index: int, output_image: str, output_scene: str, objects: List[Dict[str, Any]], direction: str) None[source]#

Render a scene and save it to disk.

Parameters:
  • args – Global parsed arguments.

  • config – Config file for the scene.

  • camera_settings – Camera settings for the scene.

  • properties – JSON data containing object properties.

  • index – Index of the scene.

  • output_image – Output image file path.

  • output_scene – Output scene file path.

  • objects – Configs for objects to add to the scene.

  • direction – Direction of the second object to the first object (in relative frame).