PopcornFX v2.10

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.10
  4. Rendering
  5. Materials
  6. Custom Feature sets

Custom Feature sets

Overview

It is possible to extend the list of available feature sets by creating custom ones.

 

IMPORTANT: When creating custom feature sets for a production, make sure that it will be supported by the final game engine.

 

Note: If creating a custom feature set for UE4, Unity, Lumberyard, you will need to make sure expected features are supported by our plugins, contact us at support@popcornfx.com if in doubt.

 

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.

This page will describe how to create a custom feature set compatible with a billboard renderer. This remains experimental so it is recommended to follow those steps exactly, you can contact us at support@popcornfx.com if something doesn’t work as expected.

Developer mode

Developer mode

Before doing anything, it’s currently required to enable “Developer Mode” in your editor settings. This will allow edition of materials.

Recommended setup

To make sure everything is organized correctly for your production:

  • Never directly modify anything located in the Library/PopcornFXCore folder. Everything contained in that folder is subject to change when updating PopcornFX to a newer version
  • Create a custom folder for your project in Library/ (here, we’ll be creating one in Library/ExampleContent/)

Folder structure

To make sure Materials and Rendering interfaces are visible in the content browser, you can select the “Filters” dropdown and enable required assets:

Filters

Creating the material

No creation dialog is available to create materials or fragment/vertex shaders. It’s best to Clone an existing one (here, Default_Billboard.pkma)

Clone material

You’ll be prompted to name your material, you can uncheck “Open asset” as you need to relocate your asset first:

Rename material

This can be done by drag&dropping the newly created Example_Billboard.pkma into the desired folder:

Relocate material

Creating the fragment shader

Same process for fragment/vertex shaders, no creation dialog is available yet. You’ll have to clone an existing fragment shader (here, Default_Billboard.frag):

Clone fragment shader

Then, move it to the desired folder:

Relocate fragment shader

Note: PopcornFX Editor automatically generates a “passthrough” vertex shader for billboard, ribbon and mesh particles. If no custom vertex shader is assigned to the material, rendering will use that passthrough shader.

Material editor

Now that the material and its fragment shader are created, you can open the .pkma file by double clicking it:

Material editor

  1. Fragment shader code couldn’t be resolved (specified fragment shader path does not exist)
  2. Textbox and browse button to locate the fragment shader path
  3. List of rendering features contained in the original material (here, Default_Billboard.pkma). You can remove all you don’t need, and add the ones you’ll be using.

The created material uses for its fragment shader an incorrect .frag file, you will have to specify the correct .frag path. Doing so will refresh the UI and display the fragment shader code (see Material editor for more information):

Example shader

We now have a very simple fragment shader associated with our material, having few features for testing. It is now ready for use on a billboard renderer:Material applied

Every time you will re-save the fragment or vertex shaders, it will hot-reload in the effect editor and display your modifications.

Best pratices

As mentioned, it’s best to create a specific folder for your production(s) that will contain all public templates, materials, common content.

Inlined templates

Currently, there is no way to specify project wide what material is picked up by default when creating a particle renderer. Right now it defaults to Default_RendererType.pkma

This is something that can be addressed easily by creating your own renderer presets, using the “Inlined templates” system.

We’ll be using the same example folder structure, creating a new folder for templates, and an effect file containing them:

Renderer templates

Opening that effect file, you can create a template, with the following settings:

Template details

  1. Make sure the template is public
  2. Auto Inline needs to be checked, this means when this template is placed in a nodegraph, its content will be pasted in, instead of a template instance.
  3. Class type set to “Renderer” will color the template in yellow
  4. You can setup some category and keywords for the contextual menu and template shelf

Opening the template, you can now create a single billboard renderer, with the Feature set applied:

Inlined template setup

Once this is done, you can save and quit this templates file, opening an example effect, opening the contextual menu now properly lists our template as it’s public:

Contextual menu

Selecting our template, its content is inlined instead of having a regular template instance placed in the graph:

Pasted template

This setup is ideal so artists work with your materials and renderers.

 

 

Was this article helpful to you? Yes No

How can we help?