Skip to content

Instantly share code, notes, and snippets.

@xDShot
Created March 12, 2020 18:29
Show Gist options
  • Save xDShot/a0bd745d0702dcf90516d2a562cc54f5 to your computer and use it in GitHub Desktop.
Save xDShot/a0bd745d0702dcf90516d2a562cc54f5 to your computer and use it in GitHub Desktop.
#!/bin/bash
ffmpeg -y -i $1_bump.dds $1_bump.png
gmic $1_bump.png f "[A,B,G,R]" o $1_normal.png
#multiply red channel's each pixels by 0.707
gmic $1_normal.png f "[R*0.707,G,B,A]" o $1_normal.png
#Value invert output’s green channel
gmic $1_normal.png f "[R,255-G,B,A]" o $1_normal.png
#Curve level output’s blue channel with input 0 and output 128 (basically, need to make pixels values scaled to 128-255 range)
gmic $1_normal.png f "[R,G,B/2+128,A]" o $1_normal.png
ffmpeg -y -i $1_normal.png $1_normal.tga
rm $1_normal.png
rm $1_bump.png
vtex $1_normal.tga
rm $1_normal.tga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment