Skip to content

Commit

Permalink
Merge pull request #993 from DLR-RM/iss992_cctextures_filename_changes
Browse files Browse the repository at this point in the history
fix(cctextures): Adapts cctextures loader to new filenames
  • Loading branch information
cornerfarmer authored Oct 17, 2023
2 parents 455cc0a + fa5e7af commit c0d689b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions blenderproc/python/loader/CCMaterialLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def load_ccmaterials(folder_path: str = "resources/cctextures", used_assets: lis
current_path = os.path.join(folder_path, asset)
if os.path.isdir(current_path):
base_image_path = os.path.join(current_path, f"{asset}_2K_Color.jpg")
# Filenames have been changed (https://docs.ambientcg.com/updates/2023/08/29/minor-changes-to-the-filename-structure-of-pbr-materials/)
if not os.path.exists(base_image_path):
base_image_path = os.path.join(current_path, f"{asset}_2K-JPG_Color.jpg")

if not os.path.exists(base_image_path):
continue

Expand All @@ -78,6 +82,9 @@ def load_ccmaterials(folder_path: str = "resources/cctextures", used_assets: lis
roughness_image_path = base_image_path.replace("Color", "Roughness")
alpha_image_path = base_image_path.replace("Color", "Opacity")
normal_image_path = base_image_path.replace("Color", "Normal")
# Filenames have been changed (blender uses opengl normal maps)
if not os.path.exists(normal_image_path):
normal_image_path = base_image_path.replace("Color", "NormalGL")
displacement_image_path = base_image_path.replace("Color", "Displacement")

# if the material was already created it only has to be searched
Expand Down

0 comments on commit c0d689b

Please sign in to comment.