; this is where you specify and configure the V4K pipeline. ; tweak the pipeline and add new importers just by editing this file. ; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom. ; ------------------------------------------------------------------------------ ; let's create a symbol. symbols are uppercase words always. ; syntax: symbols are defined in KEY=value form, as seen below. TOOLS=./ ; folder where our pipeline tools are located ART=../demos/art/,../engine/art/,../depot/art/common/,../depot/art/{{V4K_TITLE}}/ ; comma-separated folder(s) that store all our asset files ; lines starting with @windows, @linux or @osx will be processed only where OS matches. ; we are defining here some symbols differently for each platform. ; syntax: lines starting with @keyword. valid keywords are win/dows, lin/ux, and osx. @linux NUL=/dev/null @osx NUL=/dev/null @window NUL=NUL @linux .EXE=.linux @osx .EXE=.osx @windows .EXE=.exe ; you can invoke shell commands directly with `command` at anytime. ; also, once a symbol is found, it is replaced by its value always. ; some predefined symbols: INPUT (input filename), OUTPUT (output filename), PRETTY (clean input filename), PROGRESS (cook progress). @windows `echo Cooking PROGRESS% PRETTY...` @linux `echo "Cooking PROGRESS% PRETTY..."` @osx `echo "Cooking PROGRESS% PRETTY..."` ; ------------------------------------------------------------------------------ ; groups below are collection of files that we want to cook, and then package. ; by default, no assets are cooked unless explictly listed below. ; syntax: group=ext1,ext2[...] [cook] icon=ico image=jpg,jpeg,png,bmp,psd,pic,pnm,hdr texture=pvr,ktx,ktx2,dds,astc,basis,tga anim=fbx model=iqm,iqe,gltf,gltf2,glb,fbx,obj,dae,blend,md3,md5,ms3d,smd,x,3ds,bvh,dxf,lwo audio=wav,flac,ogg,mp1,mp3,mid,sfxr ; ,mod,xm audio-module=mod,xm,s3m,it audio-furnace=fur font=ttf,ttc,otf text=json,xml,csv,ini,cfg,doc,txt,md,c,h,inl,cpp,hpp,htm,html shader=hlsl,fx,dxil,dxbc,glsl,vert,frag,geom,tese,tesc,comp,vs,fs,gs,ts,cs,spirv,spv,slang script=lua,tl video=mp4,ogv,avi,mkv,wmv,mpg,mpeg tiled=tmx,tsx ;excel=xlsx ; ------------------------------------------------------------------------------ ; let's convert mod,s3m,xm,it and flac as streamable ogg files ; ; hint: remember that both INPUT and OUTPUT symbols are automatically provided. ; hint: the ->ogg and ->wav parts below do signal the pipeline that the commands we are about ; to execute are performing a data conversion (from flac to ogg for example). [cook audio-module] TOOLS/mod2wav.EXE INPUT OUTPUT -> wav TOOLS/ffmpeg.EXE -hide_banner -nostdin -loglevel fatal -y -i INPUT -f ogg -b:a 192k OUTPUT -> ogg ; -stats [cook flac] TOOLS/ffmpeg.EXE -hide_banner -nostdin -loglevel fatal -y -i INPUT -f ogg -b:a 384k OUTPUT -> ogg ; -stats ; cook midis as wavs here [cook audio && mid] SOUNDBANK=AweROMGM.sf3 ; note: GeneralUser_GS_v1_471.sf3 or FluidR3.sf3 likely to produce better results TOOLS/mid2wav.EXE INPUT OUTPUT TOOLS/SOUNDBANK -> wav ; and furs as wavs... [cook audio-furnace] TOOLS/furnace.EXE INPUT -output OUTPUT 2> NUL -> wav ; ...and sxfrs as wavs [cook audio && sfxr] TOOLS/sfxr2wav.EXE INPUT OUTPUT -> wav ; then any audio (except mp3 and ogg) gets converted into adpcm_ms finally ; note that all the recently generated wav files from previous steps are included in here as well (like those from the flac->wav recipe above). [cook audio && !mp3 && !ogg] TOOLS/ffmpeg.EXE -hide_banner -nostdin -loglevel fatal -y -i INPUT -f wav -acodec adpcm_ms OUTPUT -> wav ; -stats ; ------------------------------------------------------------------------------ ; cook all videos that are not mpeg, into mpeg. ; FLAGS symbols contain the default encoding options when cooking videos. ; ; hint: we're checking that ffmpeg is returning 0 exitcode (see `==0` below) [cook video && !mpg] FLAGS1+=-hide_banner -nostdin -loglevel fatal -y ; -stats FLAGS2+=-qscale:v 4 -y -c:v mpeg1video -c:a mp2 -ac 1 -b:a 128k -ar 44100 -format mpeg ;FLAGS_EXTRA_QUALITY=-vf scale=iw*2:ih*2 TOOLS/ffmpeg.EXE FLAGS1 -i INPUT FLAGS2 OUTPUT ==0 -> mpg ; ------------------------------------------------------------------------------ ; let's cook all images into ktx [cook image && !png && !jpg && !hdr] TOOLS/cuttlefish.EXE -q -i INPUT -o OUTPUT -f R8G8B8A8 -> png [cook texture && tga] TOOLS/cuttlefish.EXE -q -m -i INPUT -o OUTPUT -f BC1_RGB -> ktx [cook texture && !dds && !ktx] TOOLS/PVRTexToolCLI.EXE -noout -m -i INPUT -o OUTPUT -> dds [cook dds] ; @todo: support per-asset options. ie, you can override ; or expand the FLAGS symbol, per asset basis. let's say that for each input `file.ext` ; asset, there could be a sibling `file.ext.ini` file that would contain all the ; initial symbols and flags. then, we can merge (+=), remove (-=) or replace (=) them. ; FLAGS+=-quality 75.00 -p ; merge (+=) these flags on top of any existing per-asset flags. TOOLS/cuttlefish.EXE -q -m -i INPUT -o OUTPUT -f BC1_RGBA -> ktx ; # Compatibility and modes. What to choose. ; - iOS: PVRTC1_4_RGB or PVRTC1_4 (RGBA) with q:pvrtcnormal. ; - Desktop (OSX/Linux/Windows): BC1, BC1a or BC3 with q:normal. ; - Android: ETC2_RGB or ETC2_RGBA with q:etcfast. ASTC_4x4 or ASTC_8x8 with q:astcmedium, as a fallback. ; - [ref] https://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/ ; ; PVRTexToolCLI > DDS ; PVR, KTX, KTX2, [DDS,] ASTC or BASIS ; ; Cuttlefish > KTX ; BMP,CUT,DDS,EXR,G3,GIF,HDR,ICO,IFF,JBIG,JNG,JPEG,JPEG2K,JPEGXR,KOALA,MNG,PCD, ; PCX,PBM/PGM/PPM,PFM,PNG,PIC,PSD,RAW,RAS,SGI,TARGA,TIFF,WBMP,WebP,XBM,XPM ; ; >> bin\cuttlefish -i uv_checker_1k.png -o uv_checker_1k.png.ktx -f bc1_rgba ; R4G4,R4G4B4A4,B4G4R4A4,A4R4G4B4,R5G6B5,B5G6R5,R5G5B5A1,B5G5R5A1,A1R5G5B5,R8,R8G8,R8G8B8,B8G8R8,R8G8B8A8,B8G8R8A8,A8B8G8R8, ; A2R10G10B10,A2B10G10R10,R16,R16G16,R16G16B16,R16G16B16A16,R32,R32G32,R32G32B32,R32G32B32A32,B10G11R11_UFloat,E5B9G9R9_UFloat, ; BC1_RGB,BC1_RGBA,BC2,BC3,BC4,BC5,BC6H,BC7,ETC1,ETC2_R8G8B8,ETC2_R8G8B8A1,ETC2_R8G8B8A8,EAC_R11,EAC_R11G11, ; ASTC_4x4,ASTC_5x4,ASTC_5x5,ASTC_6x5,ASTC_6x6,ASTC_8x5,ASTC_8x6,ASTC_8x8,ASTC_10x5,ASTC_10x6,ASTC_10x8,ASTC_10x10,ASTC_12x10,ASTC_12x12, ; PVRTC1_RGB_2BPP,PVRTC1_RGBA_2BPP,PVRTC1_RGB_4BPP,PVRTC1_RGBA_4BPP,PVRTC2_RGBA_2BPP,PVRTC2_RGBA_4BPP, ; ; >> bin\PVRTexToolCLI -i uv_checker_1k.png -o uv_checker_1k.png.ktx -f bc1 ; PVRTC1_2, PVRTC1_4, PVRTC1_2_RGB, PVRTC1_4_RGB, PVRTC2_2, PVRTC2_4, PVRTC1_HDR_6, PVRTC1_HDR_8, PVRTC2_HDR_6, PVRTC2_HDR_8, ; ETC1, BC1, DXT2, BC2, DXT4, BC3, BC4, BC5, UYVY, YUY2, 1BPP, RGBE9995, RGBG8888, GRGB8888, ETC2_RGB, ETC2_RGBA, ETC2_RGB_A1, EAC_R11, EAC_RG11, ; ASTC_4x4, ASTC_5x4, ASTC_5x5, ASTC_6x5, ASTC_6x6, ASTC_8x5, ASTC_8x6, ASTC_8x8, ASTC_10x5, ASTC_10x6, ASTC_10x8, ASTC_10x10, ASTC_12x10, ASTC_12x12, ; ASTC_3x3x3, ASTC_4x3x3, ASTC_4x4x3, ASTC_4x4x4, ASTC_5x4x4, ASTC_5x5x4, ASTC_5x5x5, ASTC_6x5x5, ASTC_6x6x5, ASTC_6x6x6, BASISU_ETC1S, BASISU_UASTC, RGBM, RGBD ; ; -f [UB, UBN, SB, SBN, US, USN, SS, SSN, UI, UIN, SI, SIN, UF, SF] ; -f [lRGB, sRGB] ; -q [pvrtcfastest,pvrtcfast,pvrtcnormal,pvrtchigh,pvrtcbest] ; -q [etcfast,etcslow,etcfastperceptual,etcslowperceptual] ; -q [astcveryfast,astcfast,astcmedium,astcthorough,astcexhaustive] ; ; -m 16 -mfilter cubic ;; mipmaps ; -c ;; debug mipmap tail chain with saturated colours: truncate upper mipmaps if dont see any original colors ; ; -l ;; bleed ; -flip y,flag ;; flip ; -p ;; premultiply ; -r 512,256 -rfilter cubic ;; resize ; -rotate 0 ;; rotate ; -dither ;; dither ; ; ------------------------------------------------------------------------------ ; finally, let's cook all models. the logic here is: ; 1. cook all models into iqe (ass2iqe), then into iqm (iqe2iqm): any -> iqe -> iqm ; 2. unless input is iqe. these models will run iqe2iqm only (no ass2iqe): iqe -> iqm. ; 3. unless input is iqm. these models will not run any conversion at all: iqm. ; 4. also, dae models need to flip their UVs coordinates (see -U flag below). [cook model && dae] ; pass dae, reject iqm,iqe or any other model FLAGS= TOOLS/ass2iqe.EXE FLAGS -o OUTPUT INPUT -U 2> NUL -> iqe [cook model && !dae && !iqm && !iqe] ; pass anything which is not iqm,iqe or dae FLAGS= TOOLS/ass2iqe.EXE FLAGS -o OUTPUT INPUT 2> NUL -> iqe [cook model && !iqm] TOOLS/iqe2iqm.EXE OUTPUT INPUT > NUL -> iqm [cook anim] FLAGS= TOOLS/ass2iqe.EXE FLAGS -L -o OUTPUT INPUT 2> NUL -> animlist.txt ; ------------------------------------------------------------------------------ ; cook localization files ;[cook excel] ;TOOLS/xlsx2ini.EXE INPUT OUTPUT -> ini ; ------------------------------------------------------------------------------ ; assets that need to be compressed at end of whole pipeline process are specified here. ; by default, no assets are compressed unless explictly listed below. ; supported compressors: DEFLATE (default), LZMA, LZ4, ULZ, BALZ, BCM, CRUSH, LZW3, LZSS and PPP. ; syntax: compression quality[0..15]|optional_compressor on the left, and type names on the right. ; where: level [0:fastest compression .. 10 max level .. anything >=11 is expensive ... 15 is uber] ; ; valid examples: 0, 3, 4, 6|LZMA, 6|DEFLATE, 6|ULZ, 9|ULZ, 9|LZ4, 2|BALZ, 3|BCM, 1|CRUSH, ... ; ; hint: use plain `0` to exclude non-compressible files (jpg,png,...) ; hint: use plain `0` to exclude those usually large files that compress poorly (<1%) (like mpg) ; hint: use plain `0` to exclude those files we would like to directly stream within the final zipfile (flac,mp3,adpcm wav,...) [compress] 0|ULZ=texture,image,model,audio,font,text,shader,script 0=video,flac,ogg,wav,mp1,mp3,jpg,png