In order to use the merge of multiple obj files into a single gltf on linux, you can use the following script:
!/bin/bash
merge_files() {
echo "Merging OBJ files into GLTF..."
obj_files=(*.obj)
if [ ${#obj_files[@]} -eq 0 ]; then
echo "No OBJ files found in the current directory."
exit 1
fi
merged_file="merged.gltf"
obj2gltf -i "${obj_files[@]}" -o "$merged_file"
if [ $? -eq 0 ]; then
echo "Merging successful. Merged file: $merged_file"
else
echo "Error occurred while merging OBJ files."
exit 1
fi
if [ $? -eq 0 ]; then
echo "Optimization successful. Optimized file: $optimized_file"
else
echo "Error occurred while optimizing the GLTF file."
exit 1
fi
}
merge_files
optimize_file
But first install:
sudo npm install -g obj2gltf
sudo npm install -g gltf-pipeline
In order to use the merge of multiple obj files into a single gltf on linux, you can use the following script:
!/bin/bash
merge_files() { echo "Merging OBJ files into GLTF..." obj_files=(*.obj) if [ ${#obj_files[@]} -eq 0 ]; then echo "No OBJ files found in the current directory." exit 1 fi
}
optimize_file() { echo "Optimizing the merged GLTF file..." optimized_file="optimized.gltf" gltf-pipeline -i merged.gltf -o "$optimized_file"
}
merge_files optimize_file