blenderproc.python.loader.Front3DLoader module

Loads the 3D FRONT and FUTURE dataset

class blenderproc.python.loader.Front3DLoader._Front3DLoader[source]

Bases: object

Loads the 3D-Front dataset.

https://tianchi.aliyun.com/specials/promotion/alibaba-3d-scene-dataset

Each object gets the name based on the category/type, on top of that you can use a mapping specified in the resources/front_3D folder.

The dataset already supports semantic segmentation with either the 3D-Front classes or the nyu classes. As we have created this mapping ourselves it might be faulty.

The Front3DLoader creates automatically lights in the scene, by adding emission shaders to the ceiling and lamps.

static create_mesh_objects_from_file(data, front_3D_texture_path, ceiling_light_strength, label_mapping, json_path)[source]

This creates for a given data json block all defined meshes and assigns the correct materials. This means that the json file contains some mesh, like walls and floors, which have to built up manually.

It also already adds the lighting for the ceiling

Parameters:
  • data (dict) – json data dir. Must contain “material” and “mesh”

  • front_3D_texture_path (str) – Path to the 3D-FRONT-texture folder.

  • ceiling_light_strength (float) – Strength of the emission shader used in the ceiling.

  • label_mapping (LabelIdMapping) – A dict which maps the names of the objects to ids.

  • json_path (str) – Path to the json file, where the house information is stored.

Return type:

List[MeshObject]

Returns:

The list of loaded mesh objects.

static extract_hash_nr_for_texture(given_url, front_3D_texture_path)[source]

Constructs the path of the hash folder and checks if the texture is available if not it is downloaded

Parameters:
  • given_url (str) – The url of the texture

  • front_3D_texture_path (str) – The path to where the texture are saved

Return type:

str

Returns:

The hash id, which is used in the url

static get_used_image(hash_folder_path, saved_image_dict)[source]

Returns a texture object for the given hash_folder_path, the textures are stored in the saved_image_dict, to avoid that texture are loaded multiple times

Parameters:
  • hash_folder_path (str) – Path to the hash folder

  • saved_image_dict (Mapping[str, Texture]) – Dict which maps the hash_folder_paths to bpy.types.Texture

Return type:

Texture

Returns:

The loaded texture bpy.types.Texture

static load_furniture_objs(data, future_model_path, lamp_light_strength, label_mapping)[source]

Load all furniture objects specified in the json file, these objects are stored as “raw_model.obj” in the 3D_future_model_path. For lamp the lamp_light_strength value can be changed via the config.

Parameters:
  • data (dict) – json data dir. Should contain “furniture”

  • future_model_path (str) – Path to the models used in the 3D-Front dataset.

  • lamp_light_strength (float) – Strength of the emission shader used in each lamp.

  • label_mapping (LabelIdMapping) – A dict which maps the names of the objects to ids.

Return type:

List[MeshObject]

Returns:

The list of loaded mesh objects.

static move_and_duplicate_furniture(data, all_loaded_furniture)[source]

Move and duplicate the furniture depending on the data in the data json dir. After loading each object gets a location based on the data in the json file. Some objects are used more than once these are duplicated and then placed.

Parameters:
  • data (dict) – json data dir. Should contain “scene”, which should contain “room”

  • all_loaded_furniture (list) – all objects which have been loaded in load_furniture_objs

Return type:

List[MeshObject]

Returns:

The list of loaded mesh objects.

blenderproc.python.loader.Front3DLoader.load_front3d(json_path, future_model_path, front_3D_texture_path, label_mapping, ceiling_light_strength=0.8, lamp_light_strength=7.0)[source]

Loads the 3D-Front scene specified by the given json file.

Parameters:
  • json_path (str) – Path to the json file, where the house information is stored.

  • future_model_path (str) – Path to the models used in the 3D-Front dataset.

  • front_3D_texture_path (str) – Path to the 3D-FRONT-texture folder.

  • label_mapping (LabelIdMapping) – A dict which maps the names of the objects to ids.

  • ceiling_light_strength (float) – Strength of the emission shader used in the ceiling.

  • lamp_light_strength (float) – Strength of the emission shader used in each lamp.

Return type:

List[MeshObject]

Returns:

The list of loaded mesh objects.