Skip to main content
Participant
August 16, 2024
Question

Different resolution for different maps via Python API

  • August 16, 2024
  • 1 reply
  • 142 views

I am trying to export different resolution for different map instead of texture set resolution but I am unable to figure out what should be actual settings for export via python. ( The below code only consider the first resolution override for each texture set )
Here is my sample code :

from substance_painter import export
export_config = {
    "exportShaderParams": False,
    "exportPath": "",
    "exportUSD": False,
    "defaultExportPreset": "custom_export",
    "exportPresets": [
        {
            "name": "custom_export",
            "maps": [
                {
                    "channels": [
                        {
                            "destChannel": "L",
                            "srcChannel": "L",
                            "srcMapName": "roughness",
                            "srcMapType": "documentMap",
                            "srcPath": ""
                        }
                    ],
                    "fileName": "$textureset_4K_roughness(.$udim)",
                    "parameters": {
                        "bitDepth": "8",
                        "dithering": False,
                        "fileFormat": "png",
                        "sizeLog2": [
                            12,
                            12
                        ]
                    }
                },
                {
                   "channels": [
                        {
                            "destChannel": "R",
                            "srcChannel": "R",
                            "srcMapName": "basecolor",
                            "srcMapType": "documentMap",
                            "srcPath": ""
                        },
                        {
                            "destChannel": "G",
                            "srcChannel": "G",
                            "srcMapName": "basecolor",
                            "srcMapType": "documentMap",
                            "srcPath": ""
                        },
                        {
                            "destChannel": "B",
                            "srcChannel": "B",
                            "srcMapName": "basecolor",
                            "srcMapType": "documentMap",
                            "srcPath": ""
                        }
                    ],
                    "fileName": "$textureset_1K_diffuse_color(.$udim)",
                    "parameters": {
                        "bitDepth": "8",
                        "dithering": False,
                        "fileFormat": "png",
                        "sizeLog2": [
                            11,
                            11
                        ]
                    }
                },
                
            ]
        }
    ],
    "exportList": [
        {
            "rootPath": "texture_set1",
        },
    ],
    "exportParameters": [
        {   
            "parameters": {
                "paddingAlgorithm": "infinite",
            }
        }
    ]
}

result = export.export_project_textures( export_config )
print( result )



1 reply

Participant
March 10, 2025

I have run into the same issue.
My pipeline requires a different resolution for Albedo and Mask maps.

I was able to set this in the same way as the OP inside the export_preset. It will work properly if only one of the two maps is exported, however if both are, the first definition of "parameters" is used. I have also tried using a filter to call out the map and override parameters using the example from the Python API documentation.

"exportParameters": [
        {
            "filter": {
                "outputMaps": ["$textureSet_color"]
            },
            "parameters": {
                "sizeLog2": 11
            }
        }
    ]

 
I suspect substance is unable to export maps of different resolutions at the same time, and you need to que up another export for a resolution change.  There also doesn't seem to be any controls for this inside the default UI.