<!-- 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
- Preflight gate:
/dayz-preflight, or with--dry-runonly its read-onlyP:\check. - 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
.pngor.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 PNGIHDRchunk 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.tgaor a renamed PNG is refused here. No two inputs may map to the same.paa. - Resolve
ImageToPAA.exefrom DayZ Tools (env / registry / Steam paths) viafind_dayz_tools(). - With
--dry-run, list what would be written and stop with exit code 0. Otherwise, for each input, copy any existing.paato<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 invokeImageToPAA.exe <input> <output.paa>. If the backup copy itself fails, that input is skipped and the existing.paais left untouched. Streams the tool's output live. A conversion counts as failed if the tool exits non-zero, if no.paaappears, or if an existing.paawas 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.paabefore, 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. - Report a summary of successes and failures. Exit non-zero if any failed.
Refuses to run if
/dayz-preflightreturns non-zero (with--dry-run:P:\is not mounted).ImageToPAA.exeis not found under DayZ Tools.- An input file doesn't exist, is a folder (for example a folder named
x_co.png), or cannot be read. - An input doesn't end in
.pngor.tga. - An input's basename doesn't end with one of the suffixes above. ImageToPAA picks the compression from the suffix, and the rest of the pipeline (rvmat stages, reviewers) relies on it to tell what the texture is for. The message suggests a name from the stem: a trailing
_normalor_nrmbecomes_nohq,_specor_specularbecomes_smdi,_alphabecomes_ca,_diffuseor_albedobecomes_co, a role word elsewhere in the stem (for examplevestnormalmap) gets its suffix appended, and any other name gets_coappended. - Two inputs would write the same
.paa(for examplevest_co.pngandvest_co.tga, or the same file passed twice), since the second conversion would silently replace the first. - An input's width or height is not a power of two, or its size cannot be read from the header (a missing PNG signature or
IHDRchunk, or a TGA header with an invalid color map type, image type or bits per pixel). The message names the nearest vanilla size fromskills/_shared/textures/suffixes-and-sizes.md(for example 1000 x 1000 becomes 1024 x 1024). Nothing is converted until every input passes, and every failing input is listed in the same run.
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
- 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 onP:\. - Take the lowest risk route that meets the goal, from the table in
skills/_shared/textures/rvmat-cookbook.md, "Pick the route": a_co.paaandhiddenSelectionsTextures[]for a skin, a.rvmatfor a different highlight, relief or glow,healthLevels[]materials for a look per health level, a penetration.rvmatfor 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. _nohqis DirectX style, Y-. Do not guess a source map's convention from where it came from: runnormal_convention.pyfor 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_nohqas plain RGB.- Copy the closest vanilla
.rvmatof the same kind first, and set_smdi,_asand_colevels against the closest vanilla asset with matching material constants (skills/_shared/textures/smdi-and-levels.md). - A template is a draft until it holds the mod's real paths, selections and UV sets and was compared with a vanilla reference.
- UI textures: never change the tone curve from an offline model, and ship a
.paafrom ImageToPAA, not a hand written.edds(skills/_shared/textures/ui-textures.md). - Before borrowing a vanilla
.rvmat, measure its_asper channel and check Stage4, Stage5 and everyuvSource; before changing UV orientation or winding, decode the atlas and draw the affected faces over it (skills/_shared/textures/baked-atlas-checks.md). - 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
- Don't auto-rename inputs. If the user has
vest_camo.png(no suffix), they rename it themselves so they're explicit about what role it plays.