Export textures of PBR Materials

Hello,

I know we can use TextureWriter to export the textures into files, but how can we export the PBR textures (for Example the Metallic/Roughness textures )?

Thanks,
Márton

Currently, the only way is to go through the Texture object and convert to an ImageRep, then save it out.

matl_name = "Some PBR Material"
material = Sketchup.active_model.materials[matl_name]
if material.metalness_enabled?
  file_path = File.join(ENV["HOME"],"some/path/textures", "#{matl_name}.png")
  material.metallic_texture.image_rep.save_file(file_path)
end

Thanks, this is actually a great solution for me!

Márton

1 Like