• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Image to Material API

New Here ,
Dec 27, 2023 Dec 27, 2023

Copy link to clipboard

Copied

Hi all,

 

I was wondering if it's possible to script an Image to Material pipeline using the Command Line Tools/Automation Toolkit or the Sampler Python API?

 

Thanks,
Ryan

TOPICS
How to , Image to Material , Scripting

Views

221

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

New Here , Dec 28, 2023 Dec 28, 2023

Hello, @ryangold333 !
I had the same issue. You can write this functionin your script in pycharm and save it as the .py file. Then import to the Sampler Edit->Preferences-> Plugins and Scripts.

def image_to_material_batch(folder_path):
    for file in os.listdir(folder_path):
        #here you can define texture format to avoid importing unnecessary files
        if file.endswith(".png"):
            image_path_list = [os.path.join(folder_path, file)]
            asset_name = os.path.basename(file
...

Votes

Translate

Translate
New Here ,
Dec 28, 2023 Dec 28, 2023

Copy link to clipboard

Copied

Hello, @ryangold333 !
I had the same issue. You can write this functionin your script in pycharm and save it as the .py file. Then import to the Sampler Edit->Preferences-> Plugins and Scripts.

def image_to_material_batch(folder_path):
    for file in os.listdir(folder_path):
        #here you can define texture format to avoid importing unnecessary files
        if file.endswith(".png"):
            image_path_list = [os.path.join(folder_path, file)]
            asset_name = os.path.basename(file).split('.')[0]
            asset = ssa.create_asset(asset_name, ssa.material)
            asset.import_images(image_path_list, 0, ssa.image_to_material_AI_powered, False)

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 28, 2023 Dec 28, 2023

Copy link to clipboard

Copied

Of course you will then need to run this function and define your directory. I used project file dir. After importing script to Sampler you just run it from the top menu and it should work.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

LATEST

Hey thanks so much! That's what I needed 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines