How to Export Textures at Different Resolutions in ArmorPaint
ArmorPaint determines export resolution from the global g_config structure, which you can modify via the Export dialog's Resolution dropdown or programmatically using config_set_texture_res() to export textures at 2K, 4K, 8K, or custom sizes.
ArmorPaint provides flexible texture resolution controls that allow artists to generate high-quality exports for various production pipelines. Whether you are preparing assets for mobile devices or cinematic rendering, understanding how to export textures at different resolutions in ArmorPaint ensures your output matches technical requirements. The export system reads resolution values from a centralized configuration that propagates through the entire baking and file-writing pipeline.
Understanding Texture Resolution Configuration
ArmorPaint stores the active texture resolution in the global configuration object g_config. When the export pipeline initializes, it queries the current resolution using config_get_texture_res_x() and config_get_texture_res_y() to determine the output dimensions.
In paint/sources/io/export_texture.c, lines 7–8, the export routine reads these values at the start of export_texture_write_texture() to size the destination image correctly. This resolution is subsequently reused for creating render targets, packing texture files, and writing final PNG, JPG, or EXR outputs. Because the configuration is global, any change to the resolution setting immediately affects all subsequent export operations without requiring additional parameters.
Exporting Textures via the UI Dialog
The most user-friendly approach to change export resolution uses the built-in Export dialog. This interface provides a Resolution dropdown (offering presets like 2K, 4K, and 8K) that updates the global configuration before the export begins.
According to the ArmorPaint source code in paint/sources/ui/box_export.c at line 56, selecting a resolution triggers config_set_texture_res(base_res), which stores the chosen value in g_config->layer_res. The exporter then calls export_texture_run() to process the textures using the newly configured dimensions.
To export at a different resolution using the UI:
- Open File → Export from the menu bar.
- Locate the Resolution dropdown in the Export dialog.
- Select the desired resolution (for example, 4K for 4096×4096 pixels).
- Click Export to trigger the pipeline with the updated settings.
Programmatic Texture Export via the API
For automated pipelines or plugin development, you can set the export resolution programmatically by calling the configuration API directly. The function config_set_texture_res(pos), implemented in paint/sources/config.c at line 425, updates g_config->layer_res based on a preset index.
Use the helper function config_get_texture_res_pos() to map a specific pixel dimension to its corresponding preset index, then trigger the export:
// Set export resolution to 4096×4096 (4K)
i32 pos = config_get_texture_res_pos(4096); // Maps size to preset index
config_set_texture_res(pos); // Updates global g_config
// Execute the export (false indicates a standard texture export)
export_texture_run("/tmp/my_export", false);
After calling config_set_texture_res(), any subsequent invocation of export_texture_write_texture() or export_texture_run() will utilize the new resolution for all output files. This approach is essential when integrating ArmorPaint into larger asset processing workflows that require batch exports at varying resolutions.
How the Export Pipeline Applies Resolution Settings
The export pipeline respects the global resolution configuration throughout the entire execution chain. When export_texture_run() initiates, it delegates to export_texture_write_texture() in paint/sources/io/export_texture.c, which immediately queries config_get_texture_res_x() and config_get_texture_res_y() (lines 7–8) to establish the output buffer size.
This resolution is then applied consistently to:
- Render target allocation for baking operations
- Texture packing when combining material channels
- File encoding for final image writes
Because the resolution is read once at the start and stored in local variables for the duration of the export, changing g_config after an export has begun will not affect that particular operation, ensuring deterministic output.
Summary
- ArmorPaint stores the active export resolution in the global
g_configstructure, accessible viaconfig_get_texture_res_x()andconfig_get_texture_res_y(). - The UI method uses
box_export.cto callconfig_set_texture_res()before invoking the export pipeline. - Programmatic control is available through
config_set_texture_res()inpaint/sources/config.c, allowing scripted resolution changes. - The export pipeline reads resolution at the start of
export_texture_write_texture()and applies it consistently to all output files and render targets. - Resolution changes take effect immediately for subsequent exports but do not affect operations already in progress.
Frequently Asked Questions
What is the maximum texture resolution supported by ArmorPaint?
ArmorPaint supports industry-standard high-resolution presets including 8K (8192×8192) and potentially higher depending on your GPU memory and the specific build configuration. The available options in the UI dropdown are defined by the preset indices mapped through config_get_texture_res_pos(), which typically covers resolutions from 1K to 16K.
Does changing the export resolution affect the viewport preview?
Yes. The same g_config->layer_res value drives viewport preview rendering in addition to export operations. UI files such as paint/sources/ui/tab_layers.c reference config_get_texture_res_* functions to size preview panels, meaning a higher export resolution will also increase the resolution of layer previews within the interface.
Can I export different materials at different resolutions in the same session?
No. ArmorPaint uses a single global resolution configuration (g_config->layer_res) for all operations. To export different materials at different resolutions, you must change the resolution via the Export dialog or config_set_texture_res() between export operations, processing each material separately.
Where does ArmorPaint store the default texture resolution setting?
The default resolution is persisted in the application's configuration storage, managed through paint/sources/config.c. The config_set_texture_res() function writes to g_config, and the configuration is typically saved to disk when the application closes or when explicitly requested, ensuring your preferred resolution persists across sessions.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →