blenderproc.python.modules.constructor.RandomRoomConstructorModule module

class blenderproc.python.modules.constructor.RandomRoomConstructorModule.RandomRoomConstructorModule(config)[source]

Bases: blenderproc.python.modules.main.Module.Module

This module constructs random rooms with different dataset objects. It first samples a random room, uses CCMaterial on the surfaces, which contain no alpha textures, to avoid that the walls or the floor is see through.

Then this room is randomly filled with the objects from the proposed datasets.

It is possible to randomly construct rooms, which are not rectangular shaped, for that you can use the key amount_of_extrusions, zero is the default, which means that the room will get no extrusions, if you specify, 3 then the room will have up to 3 corridors or bigger pieces extruding from the main rectangular.

Example 1, in this first example a random room will be constructed it will have a floor area of 20 square meters. The room will then be filled with 15 randomly selected objects from the IKEA dataset, belonging to the categories “bed” and “chair”. Checkout the examples/datasets/ikea if you want to know more on that particular dataset.

{
  "module": "constructor.RandomRoomConstructor",
  "config": {
    "floor_area": 20,
    "used_loader_config": [
      {
        "module": "loader.IKEALoader",
        "config": {
          "category": ["bed", "chair"]
        },
        "amount_of_repetitions": 15
      }
    ]
  }
}

Configuration:

Parameter Description Type
floor_area The amount of floor area used for the created room, the value is specified in square meters. float
amount_of_extrusions The amount of extrusions specify how many times the room will be extruded to form more complicated shapes than single rectangles. The default is zero, which means that no extrusion is performed and the room consist out of one single rectangle. Default: 0. int
fac_base_from_square_room After creating a squared room, the room is reshaped to a rectangular, this factor determines the maximum difference in positive and negative direction from the squared rectangular. This means it looks like this: fac * rand.uniform(-1, 1) * square_len + square_len. Default: 0.3. float
minimum_corridor_width The minimum corridor width of an extrusions, this is used to avoid that extrusions are super slim. Default: 0.9. float
wall_height This value specifies the height of the wall in meters. Default: 2.5. float
amount_of_floor_cuts This value determines how often the basic rectangle is cut vertically and horizontally. These cuts are than used for selecting the edges which are then extruded. A higher amount of floor cuts leads to smaller edges, if all edges are smaller than the corridor width no edge will be selected. Default: 2. int
only_use_big_edges If this is set to true, all edges, which are wider than the corridor width are sorted by their size and then only the bigger half of this list is used. If this is false, the full sorted array is used. Default: True. bool
create_ceiling If this is True, the ceiling is created as its own object. If this is False no ceiling will be created. Default: True. bool
assign_material_to_ceiling If this is True a material from the CCMaterial set is assigned to the ceiling. This is only possible if a ceiling was created. Default: False. bool
placement_tries_per_face The amount of tries, which are performed per floor segment to place an object, a higher number, will get a better accuracy on the amount_of_objects_per_sq_meter value. But, it will also increase the computation time. Default: 3. int
amount_of_objects_per_sq_meter The amount of objects, which should be placed in one square meter, this value is only used as approximation. Especially, if the objects have very different sizes this might lead to different results. Default: 3.0 float
run()[source]