# Anata Retexturing Notes 1 - ready for retexturing 2 - ready for retexturing 3 - ready for retexturing First need to extract textures from VRM files for convenience zip pre atlas hairs to be atlassed with character studio (manually done for now until CLI tool is made) ```bash! find ./3/ -type f -iname "*1.vrm" -exec dirname {} \; | sort -u | xargs zip -r 3_pre-atlas-hairs.zip ``` verify zip has all the right files ```bash! ## Measure how many *1.vrm files there are find ./3/ -type f -iname "*1.vrm" | wc ## see how many are in zip unzip -l 3_pre-atlas-hairs.zip | awk '$4 ~ /.*1.vrm$/ {print $4}' | xargs dirname | sort -u | wc ``` drag and drop into character studio to atlas the textures see which folder doesn't have "*2.vrm" files ```bash! for dir in */; do if [ -z "$(find "$dir" -maxdepth 1 -name "*2.vrm" -print -quit)" ]; then echo "$dir does not contain *2.vrm files." fi done ``` use `separate_textures_vrm.sh -c` to separate textures into `textures` subfolder ```bash! #!/bin/bash cleanup=false # Parse command line options while getopts ":c" opt; do case $opt in c) cleanup=true ;; \?) echo "Invalid option: -$OPTARG" >&2 exit 1 ;; esac done # Iterate through numbered folders for dir in */; do if [[ $dir =~ ^[0-9]+/$ ]]; then echo "Processing folder: $dir" # Create textures folder textures_dir="${dir}textures/" mkdir -p "$textures_dir" # Copy VRM files and convert to GLB for vrm_file in "$dir"*.vrm; do if [ -f "$vrm_file" ]; then glb_file="${textures_dir}$(basename "$vrm_file" .vrm).glb" cp "$vrm_file" "$glb_file" # Create subfolder in textures folder subfolder="${textures_dir}$(basename "$vrm_file" .vrm)/" mkdir -p "$subfolder" # Convert GLB to GLTF with separate textures gltf-pipeline -i "$glb_file" -o "${subfolder}$(basename "$glb_file" .glb).gltf" --separate fi done # Cleanup non-texture files if [ "$cleanup" = true ]; then find "$textures_dir" -type f \( -name '*.glb' -o -name '*.gltf' -o -name '*.bin' \) -delete fi fi done ``` zip relevant files for retexture artist ```bash! find ./ -type f -iname "*2.vrm" -exec dirname {} \; | sort -u | xargs -I {} bash -c 'folder=$(basename {}); filename=$(basename {} .vrm); zip -r "all_folders.zip" "." -i "${folder}/${folder}_attributes.json" -i "${folder}/ref_${folder}.jpg" -i "${folder}/*2.vrm" -i "${folder}/textures/*2/*"' ``` then make a tmp directory, move the zip to there and extract. > yes, didn't have to make a zip, fix later now move hair textures in each folder root directory for convenience like so: `for i in *; do cd "$i" && mv textures/*/standard_opaque.png . && rm -rf textures && cd ../; done` ta-da, much easier now ![image](https://hackmd.io/_uploads/By0qmwidT.png)