Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AY-7195_Allow project with multiple texture sets to export as one texture output #20

Open
ynbot opened this issue Nov 22, 2024 · 3 comments
Assignees
Labels
sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition

Comments

@ynbot
Copy link
Contributor

ynbot commented Nov 22, 2024

Please describe the enhancement you have in mind and explain what the current shortcomings are?

How would you imagine the implementation of the enhancemenent?

No response

Describe alternatives you've considered:

No response

Additional context:

link to discussion on Discord
(might be a private channel)

This issue was automatically created from Clickup ticket AY-7195

@ynbot ynbot added sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition labels Nov 22, 2024
@moonyuet
Copy link
Member

moonyuet commented Nov 25, 2024

For the current Substance Painter API, there is no way to export multiple texture sets as one texture output.
There are some related plugins which bridges the photoshop to send the texture sets and users can combine this. See comphonia/substance-painter-merger in github.
There is an executable to help on merging the texture. So, there should be the way that we can merge the images in a hacky way for merging the texture sets and output as one texture. https://app.gumroad.com/d/62b7fabfccada3c32a547729f24edd83
We can probably test with the pillow library to combine the texture sets into one before the publish.
But we need to make sure the data is correct (I mean the RGBA).
Take this code below as an example

from PIL import Image

# Load the images
image1 = Image.open(r'D:\udim_maps\Bread_Base_color_1001.png').convert("RGBA")
image2 = Image.open(r'D:\udim_maps\Table_Base_color_1001.png').convert("RGBA")

# Define the position where you want to place image_b onto image_a
position = (0, 0)  # Change the coordinates as needed

# Create a new image for the result
result = image1.copy()

# Paste image_b into image_a at the specified position
result.paste(image1, position, image2)

# Save the combined image
result.save(r'D:\udim_maps\combined_normal_map.png')

Meanwhile, we need to ask the Substance support if they have any suggestion/updates for this particular issue.
EDIT: The support from Adobe has answered the question, they told me there is no automated way in substance painter to do this.
He told that "it is best to not use multiple texture sets unless you have a very good reason to do so ie. different shader. If the intent is to just combine them in the end you're adding extra work for yourself. If the sets all would work being combined and not overlap you can just merge them as well post export with transparency." See https://discord.com/channels/179919948569640960/179930558439096321/1310607608998133832 for more info.

So the best solution to do so is to figure out how to merge the maps with transparency after exporting these maps from SP and uses pillow to combine all these maps. And this needs some refactoring on the collector and a new extractor for exporting the maps and combine them.

@moonyuet
Copy link
Member

Some additional points, this feature might be limited to certain color bit depth (16-bits for dithering and transparency) or image formats (exr, tiff). Image formats such as png and 8-bit color-depth can support but these two options need more time to write the script to combine images.

@BigRoy
Copy link
Contributor

BigRoy commented Nov 26, 2024

Some additional points, this feature might be limited to certain color bit depth (16-bits for dithering and transparency) or image formats (exr, tiff). Image formats such as png and 8-bit color-depth can support but these two options need more time to write the script to combine images.

This may be trivial with oiiotool? Something like oiiotool fg.exr bg.exr --over -o composite.exr or oiiotool fg.exr bg.exr -paste -o out.exr could put one layer on top of another.

You can even do it with sequences which may mean we can do the full UDIM sequence in one subprocess call?

Note that we are already providing oiiotool with AYON Third Parties package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

No branches or pull requests

3 participants