Created
October 12, 2018 17:51
-
-
Save garyritchie/aa52dc76e6e39086cc9f3a4d4e87dac2 to your computer and use it in GitHub Desktop.
Compile an Occlusion-Roughness-MEtallic map from individual images as per "Art Pipeline for glTF" https://www.khronos.org/blog/art-pipeline-for-gltf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL=/bin/bash | |
help: | |
@grep -E '^[a-zA-Z_-%]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | |
### https://www.digitalocean.com/community/tutorials/how-to-use-makefiles-to-automate-repetitive-tasks-on-an-ubuntu-vps | |
%_orm.png: %_*.png ## Make a glTF-compliant Occlusion-Roughness-Metallic map from individual files named accordingly | |
@if [ -f '$*_occlusion.png' ] ; then \ | |
FILER="$*_occlusion.png"; CHANNELR="R"; \ | |
echo "Found $$FILER --> $$CHANNELR"; \ | |
elif [ -f '$*_ao.png' ] ; then \ | |
FILER="$*_ao.png"; CHANNELR="R"; \ | |
echo "Found $$FILER --> $$CHANNELR"; \ | |
else \ | |
echo "occlusion will be missing in $@"; \ | |
fi; \ | |
if [ ! -f '$*_roughness.png' ] ; then \ | |
echo "roughness will be missing in $@"; \ | |
else \ | |
FILEG="$*_roughness.png"; CHANNELG="G"; \ | |
echo "Found $$FILEG --> $$CHANNELG"; \ | |
fi; \ | |
if [ ! -f '$*_metallic.png' ] ; then \ | |
echo "metallic will be missing in $@"; \ | |
else \ | |
FILEG="$*_metallic.png"; CHANNELB="B"; \ | |
echo "Found $$FILEB --> $$CHANNELB"; \ | |
fi; \ | |
echo "Files found: $$FILER $$FILEG $$FILEB"; \ | |
echo "Channels used: $$CHANNELR $$CHANNELG $$CHANNELB"; \ | |
convert $$FILER $$FILEG $$FILEB -background black -channel $$CHANNELR$$CHANNELG$$CHANNELB -combine $@ | |
@echo "$@ created" | |
cp $@ DEPLOY/asset/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment