UE4/Class PopcornFXEffect

From PopcornFX
Jump to: navigation, search
UE4-logo-g.png

(last edit version: v1.0.0-preview-5)


Class PopcornFXEffect

A PopcornFXEffect is the asset that will contain the sources of the PopcornFX Effect "pkfx".


Import

If needed, create a directory Particles in your /Game/.

Then Import a "pkfx" file, preferably one that is inside your "Source Pack":

  • Click the Import button
  • Simply drag & drop the source pkfx file into your project's content browser.

If everything went well, you should have now and PopcornFXEffect asset with the thumbnail imported from PK-Editor Pack thumbnails (Top toolbar: Capture thumbnail).

Ue-import-animated.gif

Effect Editor

Double-click on a PopcornFXEffect asset to open the PopcornFX Effect Editor

Ue-effect.png


Asset Dependencies

The Asset Dependencies property will list all the assets needed by the Effect. It can be Textures, Meshes, Sounds or other PopcornFXEffects.

You can choose to override any dependency by any asset as far as it resides inside the Pack Mount Point.

Renderer Materials

Particle Renderer Materials list all material overrides of the Effect to render particles/decals.

They are grouped by rendering compatibility (basically same draw call).

To un-group a particle renderer, in PK-Editor customize the UserData property of the particle renderer.


Material Types

MaterialType is more or less the BillboardingMaterial found in particle renderers:

  • Billboard_Additive
  • Billboard_Additive_NoAlpha
  • Billboard_AlphaBlend
  • Billboard_AlphaBlend_Lit
  • Billboard_AlphaBlendAdditive
  • Billboard_AlphaBlendAdditive_Lit
  • Billboard_Distortion
  • Decal_AlphaTest
  • Decal_Blended
  • Mesh_Solid
  • Mesh_Solid_Lit
  • Mesh_Additive
  • Mesh_Additive_NoAlpha
  • Mesh_Distortion

/!\ AlphaBlendAdditive does not exists in Unreal Engine 4 , though we provide a default material that approximates the desired result.

Default materials

We provide default materials for every particle renderer, but you can override them globally, per project.

  • Under Edit >> Project Settings >> PopcornFX Editor >> Default Materials

If you override, say Material Billboard Additive, every effect that uses a Billboard_Additive material will use your custom material, if you didn't override the material dependency.

Ue-default-materials.jpg

Material Parameters

  • Material parameters
    • CParticleRenderer_Billboard/Ribbon/Mesh
      • Texture DiffuseTexture: Diffuse
      • Texture NormalTexture: Normal
      • Scalar PopcornFX_SoftnessDistance: SoftnessDistance
    • CParticleRenderer_Billboard/Ribbon with AlphaRemap
      • Texture AlphaRemapper: AlphaRemapper
    • CParticleRenderer_Mesh
      • Texture SpecularTexture: Specular
  • useful Material inputs
    • CParticleRenderer_Billboard/Ribbon
      • Texcoord 0 : UV already build with the AtlasDefinition
      • Vertex Color : the particle Color
    • CParticleRenderer_Billboard/Ribbon with SoftAnimationBlending
      • Texcoord 0: the first texcoord to sample
      • Texcoord 1: the second texcoord to sample
      • DynamicParameter.X: the TextureID for lerping beetween first and second texture sample.
    • CParticleRenderer_Billboard/Ribbon with AlphaRemap
      • DynamicParameter.Y: the AlphaCursor used to determine the alpha remap.

Custom Material Compatibility

The best way to customize a Particle Renderer Material, is to start from a copy of the default material.

Make sure your custom Materials are setup properly:

  • Billboards and Ribbon: check Used With Particle Sprites and set Material Domain to Surface
  • Decals: set Material Domain to Deferred Decal
  • Meshes: check Used With Mesh Particles


Notes about Particle Renderer Mesh

CParticleRenderer_Mesh have sub-meshes, this add some subtleties:

SubMeshId mismatched beetween PK-Editor and UE4:

  • PK-Editor splits sub-meshes by MaterialID
  • UE4 splits sub-meshes by Material

(Here is 3dsmax script to create one material per poly elements so that UE will split all sub meshes at fbx import)

It is up to you to setup your FBX to be both compatible with UE4 and PK-Editor.

Other notes on SubMeshId:

  • If SubMeshId >= 0, in UE4, SubMeshId will be the Mesh Section index.
  • If SubMeshId == -1, in UE4 and PK-Editor, the whole Mesh will be rendered.
  • If SubMeshId == -1, Renderer Materials will not be used, we will use the Mesh's default materials.

Attributes

This section will list all attributes and attribute samplers.

Tweaking attributes values in this section will override default values for every instance of this effect, if their values aren't overriden.

Attributes can either be set from here, or in realtime with Blueprint/C++.

Effect actions

Ue-effect-actions.png

  • Edit : Opens the selected effect in the PopcornFX Editor
  • Reimport : Reimports your effect manually, keeping your attributes values
  • Reimport and Reset : Reimports your effect manually, overriding your attributes and dependencies values with the default ones
  • Find Source : Shows you the effect's location with the Windows File Explorer