IMPORTANT: In v2.1, creating custom feature sets is experimental and not recommended in production. The new experimental feature set editor will be improved in the coming versions.
Each renderer has an associated feature set defining properties for this renderer:
Default_Billboard feature set applied to a billboard renderer
Feature sets ?
Feature sets are regular assets contained in the PopcornFX project, with the “.pkma” extension:
They contain the following properties:
- Parent renderer interface (see rendering interface)
- Mandatory rendering features
- Optional rendering features (not enabled by default)
The following feature sets are available in all projects (one per renderer):
Custom feature sets:
The list of default feature sets available per project will be improved in v2.2.0
Rendering features ?
PopcornFX SDK does not take care of rendering particles, so feature sets contain rendering features. They are higher level representations (hints) of how the particles are drawn. Here are a couple of example rendering features which could be available in a feature set:
- “Lit” – Particles rendered by this renderer are lit by engine lights
- “Soft particles” – Particles rendered by this renderer require depth distance fade
- “Transparent” – Particles are either additive, alpha blended or premultiplied alpha
We designed rendering features to be modular, cross-engine and simple enough for everyone to understand. Some game engines might support custom rendering capabilities for particles: rendering features are designed for that.
Note: PopcornFX is designed to be compatible with all game engines, so we limit the list of default rendering features to a set supported on all engine integrations we develop. Nothing stops a production to design custom rendering features, but it will break rendering compatibility with other game engines (and could prevent selling engine-agnostic content on a marketplace).
See rendering interface for a list of rendering features available by default in an UE4/Unity/Lumberyard project.
Renderer, Feature set, Rendering features
By default, all renderers select their default feature set (ie. Default_Billboard.pkma for a billboard renderer):
- Renderer specific properties
- Renderer features can be enabled/disabled (List of “compatible features”)
- Feature set fil
- “Transparent” renderer feature is a “required feature” in Default_Billboard.pkma, its properties are always displayed
- “Diffuse” renderer feature is a “required feature” in Default_Billboard.pkma, its properties are always displayed
- “Atlas” renderer has been enabled in section #2, so its properties are displayed
- Renderer feature properties can add pins to renderers
Changing a renderer’s feature set changes the list of available rendering properties. Sections appear when rendering properties are enabled:
- Alpha remap properties appears when the feature is enabled
- Atlas properties appears when the feature is enabled
- Soft particle properties appear when the feature is enabled
- Different feature set selected changes the list of properties available for the renderer
Various rendering examples are available in the tutorials effect pack.
Materials / shaders
As renderer features are high level parameters and not shaders/material graphs, you might wonder how those renderer features are plugged in the final material/shader. Each PopcornFX integration handles that by remapping renderer features and their properties to the game engine material system.
UE4 billboard material:
- Diffuse texture, retrieved in the material via a Texture2D parameter named “DiffuseTexture”
- Particle color, retrieved using the “VertexColor” node
- Having an atlas provides the correct sub-UVs in the Texcoord node, ready for sampling.
- Linear atlas blending is enabled, another set of UVs is filled for the material
- Static switch set from c++ when linear atlas blending is enabled
- Lerp cursor is passed into DynamicParameter.x
Another example with a mesh material in UE4:
- Specular texture, retrieved in the material via a Texture2D parameter “SpecularTexture”
- Normal texture, retrieved in the material via a Texture2D parameter “NormalTexture”
- Static switch set from c++ when a valid specular map is available
- Static switch set from c++ when a valid normal map is available
PopcornFX Editor does not have a material graph editor, but supports an HLSL-like editor:
The vertex and fragment shaders of a feature-set can be edited in that editor (see feature set editor).
Note: That shader code is editor only, it is not exported to UE4, Unity, Lumberyard or custom game engines.
Custom feature sets
Creating custom feature sets for PopcornFX v2 remains a two-step process:
- Create the feature set editor shader(s) that will mirror the final game engine shader
- Create the game engine shader that has the same inputs
We want to streamline that process in future PopcornFX versions, and maybe provide a shader export API for engines that would support it.