blenderproc.python.constructor.RandomRoomConstructor module

The RandomRoomConstructor can construct a random shaped room, based on a given floor size. It also places objects without collision inside the created room.

blenderproc.python.constructor.RandomRoomConstructor._assign_materials_to_floor_wall_ceiling(floor_obj, wall_obj, ceiling_obj, assign_material_to_ceiling, materials)[source]

Assigns materials to the floor, wall and ceiling. These are randomly selected from the CCMaterials. This means it is required that the CCMaterialLoader has been executed before, this module is run.

blenderproc.python.constructor.RandomRoomConstructor._construct_random_room(used_floor_area, amount_of_extrusions, fac_from_square_room, corridor_width, wall_height, amount_of_floor_cuts, only_use_big_edges, create_ceiling)[source]

This function constructs the floor plan and builds up the wall. This can be more than just a rectangular shape.

If amount_of_extrusions is bigger than zero, the basic rectangular shape is extended, by first performing random cuts in this base rectangular shape along the axis. Then one of the edges is randomly selected and from there it is extruded outwards to get to the desired floor_area. This process is repeated amount_of_extrusions times. It might be that a room has less than the desired amount_of_extrusions if the random splitting reaches the floor_area beforehand.

Return type:

Tuple[MeshObject, MeshObject, MeshObject]

blenderproc.python.constructor.RandomRoomConstructor._sample_new_object_poses_on_face(current_obj, face_bb, bvh_cache_for_intersection, placed_objects, wall_obj)[source]

Sample new object poses on the current floor_obj.

Parameters:

face_bb

Returns:

True, if there is no collision

blenderproc.python.constructor.RandomRoomConstructor.construct_random_room(used_floor_area, interior_objects, materials, amount_of_extrusions=0, fac_from_square_room=0.3, corridor_width=0.9, wall_height=2.5, amount_of_floor_cuts=2, only_use_big_edges=True, create_ceiling=True, assign_material_to_ceiling=False, placement_tries_per_face=3, amount_of_objects_per_sq_meter=3.0)[source]

Constructs a random room based on the given parameters, each room gets filled with the objects in the interior_objects list.

Parameters:
  • used_floor_area (float) – The amount of square meters used for this room (e.g. 25 qm)

  • interior_objects (List[MeshObject]) – List of interior objects, which are sampled inside this room

  • materials (List[Material]) – List of materials, which will be used for the floor, ceiling, and the walls

  • amount_of_extrusions (int) – Amount of extrusions performed on the basic floor shape, zero equals a rectangular room

  • fac_from_square_room (float) – Maximum allowed factor between the length of two main sides of a rectangular room

  • corridor_width (float) – Minimum corridor width in meters, is used for the extrusions

  • wall_height (float) – Height of the walls of the room

  • amount_of_floor_cuts (int) – The floor plan gets cut with each iteration, allowing for the finding of new edges which are used to create extrusions.

  • only_use_big_edges (bool) – If this is all edges are sorted by length and only the bigger half is used

  • create_ceiling (bool) – If this is true a ceiling is created for the room

  • assign_material_to_ceiling (bool) – If this is True the ceiling also gets a material assigned

  • placement_tries_per_face (int) – How many tries should be performed per face to place an object, a higher amount will ensure that the amount of objects per sq meter are closer to the desired value

  • amount_of_objects_per_sq_meter (float) – How many objects should be placed on each square meter of room