If you use PopcornFX with the UnrealEngine, Unity, or O3DE plugins, you do not need to do any baking ! The plugins take care of it internally and function with the original assets only, so this section is irrelevant.
This page is only useful for SDK users with custom in-house engine integrations.
PopcornFX assets exist in two forms:
- Source assets : Assets used in the PopcornFX editor, during content creation. They are usually written in text format.
- Baked assets : Assets used in the final game-engine runtime, optimized, stripped of unnecessary editor meta-data. They are usually written in binary format.
“Baking” is the process of going from the source assets to the game-ready assets.
Why baking ?
The editor is able to display and run the source assets, how bad can it be?
.pkfx source files are to the runtime VFX what .psd files are to runtime textures: you probably don’t want your final game to load .psd files directly.
Loading source effects in-engine means the effect graphs will have to be compiled, optimized, backend bytecodes built, and compute shaders generated.
Even if the editor does this every time an effect is opened, and every time the artist changes the graphs, it is still a very costly process where costs across multiple effects quickly add up to unacceptable loading times and framerate spikes.
Furthermore, it is almost never needed unless you have a very specific use-case of effect files, where you cannot pre-bake them offline.
For this reason, an in-house engine integration will usually need the baked assets.
However, the engine plugins (UE4, Unity, Lumberyard) handle baking internally, and you won’t have to worry about it. See the plugins pages for specific steps to import the effects into the target engines.
The asset-baker takes an input asset, some options, and writes the baked asset somewhere else.
Going from the source assets to the baked assets involves one of the following options:
- PK-AssetBaker command-line tool
Invoke it through batch files, a python script, or your own toolchain …
- PK-AssetBakerLib library
For SDK users / custom engine integrations: You can link it in your projects, and invoke it directly from your own deployment toolchain.
- Ctrl+B / Ctrl+Shift+B bake commands in the PopcornFX editor
Quickly bake your effect while editing it. Your engine can hot-reload the baked asset immediately so the artists can see their changes as they make them.
Bake config files
The asset baker is structured around “Resource ovens” that take care of baking a specific resource type. When given a specific resource, the asset-baker will choose the appropriate oven based on the resource extension. For example, *.pkfx files will be handled by the “Particle” oven.
You can tell the baker to bake for different build configurations. It will try to load the file “Config/AssetBaker.pkcf” in the source project. That config file will tell the baker how to bake each type of asset based on the config. It can contain one or multiple Oven configuration objects, for various target platforms.
You can explicitly give the asset-baker a specific config file per-project and/or per-file using the command-line arguments. Without explicit conf files, it will try to find one of the following:
- Base config file: in “Config/AssetBaker.pkcf”.
- Per-file config file: will look for a file with the same path and filename as the asset it’s baking, but with the .pkcf extension.
For example when baking “Meshes/MyMesh.fbx”, you can specify a custom config for this specific mesh by creating a “Meshes/MyMesh.pkcf”, containing a ‘COvenBakeConfig_Mesh’ object with the specific settings you need.
The per-file config file will override the objects contained in the base config file. So if an asset doesn’t have its own config file, it will use the project’s base config file instead.
NOTE: There is currently no in-editor UI to edit the baker’s base config file. You can edit the per-asset .pkcf config file for Meshes, Textures, and VectorFields using the bake settings panel in each of their asset editor windows.
The following topics will take you through the the baking options, and how to configure them.
If you have access to the PopcornFX C++ SDK, please see the CHM documentation, under “Engine integration > Baking assets”