PopcornFX v2.19

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.19
  4. Baking
  5. Using the command-line tool

Using the command-line tool

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

-vPrints the PK-AssetBaker build version and exits.
-p=pathpath = path to the source pack where the assets to bake are located, can have double-quotes if the path contains spaces. Should only appear once, ex: -p="C:\popcorn\test pack"
‑o=platform:pathSpecifies 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=pathBakes 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=pathSame as -i, but also bakes the asset’s dependencies.
-d=pathPrints the asset’s dependencies.
path = path to the input asset file, relative to the source pack.
-cfg=pathPath to the global bake config file to use.
-sEnables silent mode: Baker does not print any output
-stEnables single-threaded baking (multithreaded by default since v2.3.0)
-fForce full rebuild of all assets.
If not specified, baker will look at file timestamps to avoid rebaking assets that are already baked and up to date.
The baker will also try to look in the Editor/Cache folder of the source pack to find already baked assets (for example meshes), if they are not present in the target bake directory.
-stop-on-errorStops baking the entire asset list whenever an asset fails.
-x=axisSpecifies the axis-system to bake the assets into. Available values are:

  • -x=rhyup
  • -x=rhzup
  • -x=lhyup
  • -x=lhzup
  • -x=XYZ

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.
Ex: -x=rub is OK, -x=buf is not valid, as it specifies two depth axes and no side axis.

-log=nLogging severity level.

  • -log=0: log errors only
  • -log=1: log errors + warnings
  • -log=2: log errors + warnings + infos
-hPrints 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”

Asset baker: Source folder example

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"


Let’s dissect that command-line:

  1. -p=”Packs\Game1_Spells”
    gives the source-pack path (one per invocation of asset-baker)
  2. -o=x32:”..\builds\Game1Resources_x32\Particles\Spells”
    asks to bake an “x32” configuration into directory “..\builds\Game1Resources_x32\Particles\Spells”
  3. -o=x64:”..\builds\Game1Resources_x64\Particles\Spells”
    asks to bake an “x64” configuration into directory “..\builds\Game1Resources_x64\Particles\Spells”
  4. -I=”Particles/*.pkfx”
    asks to bake all resource files that match “%SOURCE_PACK%/Particles/*.pkfx” (case-insensitive), including their dependencies


Running the batch file:

Asset baker: Command-line output

After running the batch file, the asset-baker will have produced the following output structure:

Asset baker: Output folder example

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"
Was this article helpful to you? Yes No

How can we help?