The asset baker is a command-line tool used to bake and deploy PopcornFX assets into a runtime-friendly layout. It allows you to specify a source project, and various platforms / output directories.
It is available by command-line, invoked through batch files, but it is also integrated in the PopcornFX editor
Depending on your licensing option, you can also get the AssetBakerLib, so you can link it in your projects, and invoke it directly from your own deployment toolchain if necessary.
Command-line options
-v | Prints the PK-AssetBaker build version and exits. |
-p=path | ‘path’ = path to the source pack where the assets to bake are located, can have double-quotes. Should only appear once, ex: -p=”C:\popcorn\test pack” |
-o=platform:path | Specifies the bake target to bake for, with its output path. ‘platform’ = one of the target platforms, ‘path’ = the output pack path. Can appear multiple times to bake for multiple bake targets in one invocation to the baker. Ex: -o=XboxOne:”T:\builds\Durango\test pack” |
-O | [v2.4.1] Forces baking in the output directory specified by the lowercase -o option. It ignores the subdirectory structure of the baked files. This option will not patch asset dependencies. This option forces single-threaded baking, and does not ensure colliding names safety: The last baked file with a same name will override a previously baked one. |
-i=path | Bakes the asset without including its dependencies. ‘path’ = path to the input asset file to bake, relative to the source pack. Can appear multiple times. ex: -i=”Particles/blast.pkfx” |
-I=path | Same as -i, but also bakes the asset’s dependencies. |
-d=path | Prints the asset’s dependencies. ‘path’ = path to the input asset file, relative to the source pack. |
-cfg=path | Config file to use. Interpretation depends on context. If specified before any -i args, will be treated as a global config file. Otherwise, will be applied to the previous file. ‘path’ = path to an asset config file, relative to the source pack. |
-s | Enables silent mode: Baker does not print any output |
-st | Enables single-threaded baking (multithreaded by default since v2.3.0) |
-f | Force full rebuild of all assets. If not specified, baker will try to look in the ‘Cache’ folder of the source pack for already baked assets (for example meshes). |
-stop-on-error | Stops baking the entire asset list whenever an asset fails. |
-x=axis | Specifies the axis-system to bake the assets into. Available values are:
Where ‘XYZ’ is a 3-character code representing the absolute axis-system, each character can be choosen from ‘l'(left), ‘r'(right), ‘d'(down), ‘u'(up), ‘b'(backward), ‘f'(forward) and must form a valid coordinate frame. |
-h | Prints the help screen and exits. |
Example .bat usage
Assuming we have the following directory layout:
(The editor authors effects directly in “H:\popcorn-packs\Editor\Packs\”, and we have a single pack named “Game1_Spells”
And the following “BakePacks.bat”:
@echo off echo Launching Popcorn-Fx asset ovens... PK-AssetBaker.exe -p="Packs\Game1_Spells" -o=x32:"..\builds\Game1Resources_x32\Particles\Spells" -o=x64:"..\builds\Game1Resources_x64\Particles\Spells" -I="Particles/*.pkfx" pause
Let’s dissect that command-line:
- -p=”Packs\Game1_Spells”
gives the source-pack path (one per invocation of asset-baker) - -o=x32:”..\builds\Game1Resources_x32\Particles\Spells”
asks to bake an “x32” configuration into directory “..\builds\Game1Resources_x32\Particles\Spells” - -o=x64:”..\builds\Game1Resources_x64\Particles\Spells”
asks to bake an “x64” configuration into directory “..\builds\Game1Resources_x64\Particles\Spells” - -I=”Particles/*.pkfx”
asks to bake all resource files that match “%SOURCE_PACK%/Particles/*.pkfx” (case-insensitive), including their dependencies
Running the batch file:
After running the batch file, the asset-baker will have produced the following output structure:
You can of course chain any number of calls to the asset baker in your batch file, to bake multiple packs at once:
@echo off echo Launching Popcorn-Fx asset ovens... PK-AssetBaker.exe -p="Packs\Game1_Spells" -o=x32:"..\builds\Game1Resources_x32\Particles\Spells" -o=x64:"..\builds\Game1Resources_x64\Particles\Spells" -I="Particles/*.pkfx" PK-AssetBaker.exe -p="Packs\Game1_Atmospheric" -o=x32:"..\builds\Game1Resources_x32\Particles\Atmospheric" -o=x64:"..\builds\Game1Resources_x64\Particles\Atmospheric" -I="Particles/*.pkfx" PK-AssetBaker.exe -p="Packs\Game1_WildLife" -o=x32:"..\builds\Game1Resources_x32\Particles\WildLife" -o=x64:"..\builds\Game1Resources_x64\Particles\WildLife" -I="Particles/*.pkfx" pause