BlenderProc icon indicating copy to clipboard operation
BlenderProc copied to clipboard

[BUG]: Haven texture leather_red_02 fails to load

Open Victorlouisdg opened this issue 3 years ago • 3 comments

The following line does not create a new material and does not load the texture:

bproc.api.loader.load_haven_mat(haven_textures_folder, ["leather_red_02"])

The reason is that the no color base texture was downloaded: image

When manually downloading the texture from Haven, the issue becomes apparent: image

This texture has two color variations, with names Coll1 and Coll2, which are not downloaded by the download_texture()

Possible solution:

  • add Coll1 and Coll2 to keys to be downloaded
  • check for _coll1_ in load_haven_mat() as well

Victorlouisdg avatar Feb 04 '22 10:02 Victorlouisdg

Maybe we should make two different materials in such cases, that we have one copy with Coll1 and one copy with Coll2. That way both materials could been used.

themasterlink avatar Feb 04 '22 12:02 themasterlink

Initially I had the same idea as you, but now I think I'd prefer a solution where this is handled by the HavenMaterialLoader.

When the loader encounters a folder with several color variations, it would then create Blender materials for all of them, e.g:

  • leather_red_02_coll1
  • leather_red_02_coll2

Another benefit of handling this with the loader is that it saves disk space, because we don't need to duplicate the other textures maps.

Victorlouisdg avatar Feb 08 '22 21:02 Victorlouisdg

I just realised that maybe you already meant that we should handle this during loading.

I'll try to implement a solution that:

  • Downloads the color variations into a single folder
  • Creates multiple Blender materials when loading a texture folder with several variations

Also, the names I suggested above are bad, because on the thrid line here, the material would not be found:

texture_name = "leather_red_02"
load_haven_mat(haven_folder, texture_name)
material = bpy.data.materials[texture_name]

Now I'm thinking we should load all the variations with the name leather_red_02, and Blender will automatically name the second material leather_red_02.001.

Victorlouisdg avatar Feb 12 '22 15:02 Victorlouisdg