ModdingAssistant / modding-ollama /skill /modules /texture-editing.md
Elmerfudge's picture
Upload folder using huggingface_hub
4befc65 verified
|
Raw History Blame Contribute Delete
3.34 kB

texture-editing

Mass and micro-tuned edits of loose texture files for any game: resize, colour, levels, per-file rules, regions, format conversion, undo.

Method

  1. Inspect first: texture_info(path) shows counts, sizes, formats, alpha and which files look like data maps.
  2. Confirm what the game expects (file names, folder paths, formats, size limits, mipmaps) from the game's module or the mod page. Loose-file mods usually only work if names and paths match the originals exactly.
  3. Dry run: texture_batch(src, ...) with dry_run left on. It lists the plan, skips and a few before/after sizes, and writes nothing.
  4. Apply with the same settings plus dry_run=false. Output goes to dest (default: workspace/textures_out). Use in_place=true only when the user agrees: originals are backed up in the session workspace.
  5. Report: textures written, skipped (and why), size change, job id. Undo with texture_undo(job).
  6. Ask the user to look at a few results in the game or an image viewer before a very large run.

Operations (all optional, combined in this order)

Geometry (applies to every file, including data maps): scale (0.5 halves, 2 doubles), max_size (longest side cap), resample (lanczos, bicubic, bilinear, nearest: use nearest for pixel art). Colour: levels ("in_black,in_white,out_black,out_white" 0-255), gamma, brightness, contrast, saturation (1 = unchanged, 0 = grey), hue_shift (degrees), channel_gain ("r,g,b" or "r,g,b,a" multipliers), tint ("#RRGGBB") with tint_strength 0-1, grayscale, invert, sharpen, blur. region ("x,y,w,h" in pixels) limits colour work to a rectangle. Alpha is preserved. Output: format (png, tga, jpg, bmp, webp, dds). JPG drops alpha. DDS saving depends on the installed Pillow; for BC1/BC3/BC5/BC7 control use the game's recommended tool (texconv, nvcompress, ImageMagick).

Mass first, then micro-tune with rules

rules is a JSON list; each rule has match (glob on the relative path or file name, case-insensitive) and any operations; later rules override earlier ones; skip: true excludes; include_maps: true allows colour edits on data maps. Example: halve everything, brighten foliage slightly, leave UI untouched, warm only the top half of one atlas: scale=0.5, rules=[{"match":"ui/*","skip":true},{"match":"*foliage*","brightness":1.1,"saturation":1.15},{"match":"atlas_01.png","region":"0,0,1024,512","tint":"#ffcc88","tint_strength":0.2}]

Data maps and safety

Normal, specular, roughness, metallic, ambient-occlusion, mask and height maps hold data, not colour: colour edits distort lighting. The tool guesses them by file name (suffixes like _n, _normal, _spec, _rough, _metal, _ao, _mask, _height); resizing still applies to them. Check the guess in the dry run and override with rules if the game uses other naming. Do not change dimensions of atlases, lightmaps or UI sprite sheets unless the game's data (UVs, config) is updated too. Power-of-two sizes are safest for older engines. Never overwrite originals without a backup. Protected folders the user declared are skipped.

Verification checklist

Counts match the plan; sizes are what you expected; no unreadable files; a sample opens correctly; names and paths unchanged; the game launches and loads (then use the log-debugging module if not).