Dayz pack texture

From DayZ-n-Chill/Agentic-Z · View interactive version

Dayz pack texture is an AI agent skill from the GitHub repository DayZ-n-Chill/Agentic-Z. Converts PNG or TGA images to DayZ .paa textures with ImageToPAA, after checking each filename has a texture-role suffix such as _co, _ca, _nohq or _smdi. Also ships three offline material scripts: an .rvmat linter, an .rvmat template writer and a normal map convention check (OpenGL or DirectX). Use

How to use this skill

Skill file

<!-- skill-dir-note -->

Path note: <skill-dir> in commands below is the absolute path of this skill's folder. When the agent loads this skill the harness exposes the skill's base directory; substitute it before running. Sibling skills are reached via <skill-dir>\..\dayz-X\.

/dayz-pack-texture

Convert one or more PNG/TGA images to .paa (DayZ's texture format) using DayZ Tools' ImageToPAA.exe. Each input file must end in a texture-role suffix. ImageToPAA reads the suffix to pick the compression and color space (its rules are in <DayZ Tools>\Bin\ImageToPAA\TexConvert.cfg). The skill accepts the suffixes below; each has a rule there and is used by vanilla textures under P:\DZ. A few rarer suffixes also have a rule and appear on a handful of vanilla .paa files, and the skill refuses them: _can (3 files), _nofhq (2), _raw (1) and the format suffixes _dxt5 (25), _dxt1 (1) and _4444 (2) (a scan of the .paa file names under P:\DZ).

| Suffixes | Role |

|---|---|

| _co, _ca | Color / diffuse, without and with alpha |

| _lco, _lca | Terrain layer color (satellite and mask textures), without and with alpha |

| _nohq, _no, _non, _nopx | Normal map: high quality, plain, with noise in alpha (vegetation), parallax |

| _smdi, _sm | Specular (_smdi is the higher-bit-depth form vanilla gear uses) |

| _as, _ads, _adshq | Ambient shadow (_ads, _adshq: ambient, diffuse and shadow) |

| _mc, _mco | Macro texture, multiply color |

| _dt, _detail, _cdt, _dtsmdi | Detail textures |

| _mask, _sky | Masks, sky |

Most mod gear needs only _co (or _ca), _nohq and _smdi.

A file like vest_camo_co.png becomes vest_camo_co.paa next to it. If a .paa of that name already exists, it is first copied to vest_camo_co.paa.bak, then overwritten. There is one rolling backup per texture: each repack replaces the .bak from the previous run, so iterating on a 2048 texture never piles up copies in data\ (and the build's *.bak exclude matches it). If that conversion fails, the backup is copied back over the .paa automatically, so config.cpp and .rvmat never point at a broken file. To get the previous .paa back after a successful run, delete the new one and rename the backup before you repack again; the next repack replaces it. Keep a hand-tuned .paa you want to preserve outside the folder. Numbered backups (.paa.bak.1, .paa.bak.2) left by older releases of this skill are never touched; each run prints how many there are so you can delete them. Run with --dry-run first to see what would be written.

Follow skills/_shared/dayz-conventions.md.

How to run

python "<skill-dir>\pack_texture.py" [--dry-run] <input1> [<input2> ...]

| Argument | Required? | Notes |

|---|---|---|

| --dry-run | no | Check that P:\ is mounted (read-only), validate every input, resolve ImageToPAA, and list each .paa that would be written and each existing .paa that would be backed up (with the backup name, and whether it replaces a current .bak). Converts nothing and writes no file. It skips the full /dayz-preflight, because that creates the P:\Mods junction when it is missing. |

| <input> | yes (one or more) | Path to a .png or .tga file with a valid suffix in the basename. Pass each file explicitly; cmd.exe does not expand globs. |

What it does

  1. Preflight gate: /dayz-preflight, or with --dry-run only its read-only P:\ check.
  2. Validate every input before converting any, and report every problem found across all inputs in one run (then exit 1, converting nothing): the input exists and is a file (not a folder) that can be read, the extension is .png or .tga (any case), the basename ends with one of the suffixes above (any case) before the extension, and both sides of the image are powers of two. The size comes from the PNG IHDR chunk after the PNG signature, or from the TGA header once its color map type (0 or 1), image type (1 to 3, or 9 to 11 for RLE) and bits per pixel (8, 15, 16, 24 or 32) are valid, so a corrupt .tga or a renamed PNG is refused here. No two inputs may map to the same .paa.
  3. Resolve ImageToPAA.exe from DayZ Tools (env / registry / Steam paths) via find_dayz_tools().
  4. With --dry-run, list what would be written and stop with exit code 0. Otherwise, for each input, copy any existing .paa to <name>.paa.bak (through a temporary file, so a failed copy leaves the previous backup intact; a [WARN] line counts any numbered backups from older releases), then invoke ImageToPAA.exe <input> <output.paa>. If the backup copy itself fails, that input is skipped and the existing .paa is left untouched. Streams the tool's output live. A conversion counts as failed if the tool exits non-zero, if no .paa appears, or if an existing .paa was left unchanged (its modification time did not move), so a stale file from an earlier run is never reported as packed. On a failure the backup is copied back over the .paa (and kept), or, when there was no .paa before, any partial file the failed run wrote is removed; each step is printed. If that undo fails, a [FAIL] line names the file to copy back by hand.
  5. Report a summary of successes and failures. Exit non-zero if any failed.

Refuses to run if

Output

DayZ preflight
... (preflight output)
Preflight complete.

[OK]   ImageToPAA: C:\...\DayZ Tools\Bin\ImageToPAA\ImageToPAA.exe

[Pack] vest_camo_co.png  ->  vest_camo_co.paa
... (ImageToPAA output) ...
[OK]   Wrote vest_camo_co.paa (123,456 bytes)

[Pack] vest_camo_nohq.png  ->  vest_camo_nohq.paa
[OK]   Backed up existing vest_camo_nohq.paa to vest_camo_nohq.paa.bak (replaced the previous backup)
... (ImageToPAA output) ...
[OK]   Wrote vest_camo_nohq.paa (98,765 bytes)

[OK]   2 of 2 textures packed.

Material scripts

Three offline scripts in scripts\ check and draft the material side. They only read the files they are given and print a report or a template, so they do not run /dayz-preflight; nothing here needs DayZ Tools except decoding a .paa to PNG with ImageToPAA before normal_convention.py reads it.

| Script | What it does | Arguments, exit codes and how to read the result |

|---|---|---|

| rvmat_lint.py | Lints one or more .rvmat files (and a companion .emat), standard library only | skills/_shared/textures/rvmat-cookbook.md, "The template writer and the linter" |

| rvmat_template.py | Writes a starter super, damage, emissive, multi or penetration .rvmat, standard library only | the same section |

| normal_convention.py | Proposes whether a normal map is DirectX (Y-) or OpenGL (Y+) from the normal and its albedo; needs numpy and Pillow | skills/_shared/textures/normal-maps.md, "Measuring a source map" |

python "<skill-dir>\scripts\rvmat_lint.py" <file.rvmat> [<more.rvmat> ...] [--pdrive-root P:\] [--warnings-as-errors] [--json]
python "<skill-dir>\scripts\rvmat_template.py" <super|damage|emissive|multi> --prefix <packed\path\name> [--output <file.rvmat>]
python "<skill-dir>\scripts\rvmat_template.py" penetration [--surface <packed\path.bisurf>] [--output <file.rvmat>]
python -m pip install -r "<skill-dir>\scripts\requirements.txt"
python "<skill-dir>\scripts\normal_convention.py" --normal <normal.png> --albedo <albedo.png> [--json]

Each script takes --help; the two .rvmat scripts also take --self-test. Outside an agent session, scripts\dayz\rvmat-lint.bat, scripts\dayz\rvmat-template.bat and scripts\dayz\normal-convention.bat in the repo run them with the same arguments. Which route, map and material to make, and the checks before handing the work over, are in the texture pack, skills/_shared/textures/README.md.

Rules for material work

  1. Check before you write. Read every path, config key and material pattern in the mod or in the unpacked vanilla data on P:\ before it goes into an answer or a file. Never edit a file on P:\.
  2. Take the lowest risk route that meets the goal, from the table in skills/_shared/textures/rvmat-cookbook.md, "Pick the route": a _co.paa and hiddenSelectionsTextures[] for a skin, a .rvmat for a different highlight, relief or glow, healthLevels[] materials for a look per health level, a penetration .rvmat for bullet and surface response, Multi only once the section count and the two UV sets justify it, and MatPBR only for a metallic and roughness set with no damage look that is not terrain.
  3. _nohq is DirectX style, Y-. Do not guess a source map's convention from where it came from: run normal_convention.py for a candidate, then confirm it with the baker's export setting or a raking light render (skills/_shared/textures/normal-maps.md). Do not read a shipped _nohq as plain RGB.
  4. Copy the closest vanilla .rvmat of the same kind first, and set _smdi, _as and _co levels against the closest vanilla asset with matching material constants (skills/_shared/textures/smdi-and-levels.md).
  5. A template is a draft until it holds the mod's real paths, selections and UV sets and was compared with a vanilla reference.
  6. UI textures: never change the tone curve from an offline model, and ship a .paa from ImageToPAA, not a hand written .edds (skills/_shared/textures/ui-textures.md).
  7. Before borrowing a vanilla .rvmat, measure its _as per channel and check Stage4, Stage5 and every uvSource; before changing UV orientation or winding, decode the atlas and draw the affected faces over it (skills/_shared/textures/baked-atlas-checks.md).
  8. A material set from script is judged by the frame, not by GetObjectMaterial, and a health level change wipes it (skills/_shared/textures/runtime-material-swaps.md).

Ask before writing final files

Ask when any of these is unknown: the mod's root folder and packed path; the exact selections that get a texture or material swap; whether the model has one UV set or two; whether the texture is cosmetic only or must change surface, damage, glass, light or penetration behaviour; whether the result is a change to the mod or a standalone reference.

Do not

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.