DS - Decal Spawns on NPC and Players

Decals are handled very differently if they need to spawn on character and creature meshes. This page will address the Material, Particle System and Blueprint systems needed for them to work properly. Also, these systems can become very heavy on performance, so they may not work well if they need to be persistent in the level and should be used only as a last resort.

Decal Spawn Material

Material Setup

The base material is more expensive when using normals. So if you can get away with translucency without normals and can turn off directional shading then it would be good to do so. The shader is laid out in the following image. You can ignore World Position offset and leave it detached unless it’s absolutely necessary. It is also good to note that this setup only works with translucency. They are not actual deferred decal materials.

Texture Position Setup

Below is the setup for the core functionality of the decal projection. Particle Position can be swapped with Object or Actor position depending on how the decals will be spawned. In this case they are being spawned through emitters, so that is why they use the Particle Position node. The only value that should change in this setup is the Position Fade Parameter , controlled in the Material Instance , which will determine how strong the decal projection is on the mesh.

Material Instance

Below is the Material Instance setup and what fields currently exist. The parameters that will be consistently tweaked together per use case are the Depth Fade Distance and the Position Fade . These parameters will help blend the mesh edges and decal as they project onto the character meshes.

Decal Spawn Particle Systems

Overall, in the case of bi-pedal characters, there are 18 particle systems created. There is one per body region, both right and left. This may not always be the case, you may find that you only need a hand full of emitters or less to accomplish where decal spawns need to happen. This is an extreme case since spider webs needed to encapsulate the character. However, these systems can be duplicated and reused for other character spawn uses.

Emitter Setup

Below is an example of the particle system structure for these decal emitters.

In each particle system there are about 3 emitters. The two to the left that are disabled are for debugging. This way it is easier to visualize mesh position. You’ll see that the Initial Location module is shared between all 3 so that whenever you move the debug mesh you will also change the location of the decal mesh. This is the same for Lifetime and Initial Size .

The emitters for all systems use the same basic mesh which can be seen below. It is the static mesh called WebSphere . Despite the name, this mesh can be reused for any type of body decal as it is a simple sphere.

The same material instance in this case is shared across all systems.

Decal Spawn Function

Unreal Location: Content > VFX > Blueprints > FL_DecalSpawns

The decal spawn function, Decal Projections Human in this case, handles up to 18 particle systems currently. If more are need in the future a new function should be created for that use. The goal would be to keep the use cases to as many applications as possible instead of creating very niche functions.

Function Inputs

Each input in blue attaches to the Spawn Emitter Attached node while the Set Relative Scale input attaches to an additional node to handle a uniform scale across all of the emitters.

Despite there being Location and Rotation values in the functions themselves, all translation should be handled in the individual particle systems. The Attach Point Name is defined based on the Human Skeleton rig names. That’s why a new function should be created if the use case changes to a different skeletal structure.

Decal Spawn Blueprint Setup

The function can be used in different pipelines across multiple blueprints, so the following examples are use cases of how they may flow in a BP.

All 18 Particle Systems do not need to be defined. In this case all 18 are used, but you can use as few as you need. The Attach to Component will be hooked up to the desired mesh. Again that mesh MUST have the correct bone names defined in the function for it to work.

If the decals are going to be projected consistently with no additional factors you can define them uniformly in the Set Relative Scale input without connecting additional nodes. In this case the spider webs needed to project on naked characters as well as characters with armor so a variable system was created to handle the scale difference.

Below is the front end setup for how the armor scale was applied.

Decal Spawn Flipbook Setup

If you look at the image below you will notice that there are also spiders crawling through and over the webs projected on the character. The previous setup described how the web decals worked, however, it differs slightly when using flipbooks to handle animations like the spiders crawling seen below.

Flipbook Material

In the setup below, you will notice that the projection functionality is the same, but a new structure exists for flipbooks. Currently there is no BASE material for this, so if new ones are created they can be duplicated from the one below. M_ZathSpiderDecalProjection_FB

The flipbook animation is timed according to the Lifetime of the particle emitters. There is also a dynamic parameter setup for handling the UV scaling of a flipbook. It is rare that it will be needed, but the functionality does exist.

Flipbook Material Instance

In the material instance you can swap out the textures and define the Columns and Rows of another flipbook. You can also change the Depth Fade Distance and Position Fade as previously described.

Flipbook Particle Systems

The Particle systems will look very similar to the other ones. Notice there are no Subimage Index modules for handling flipbooks nor do they need to be defined in the Required module since they are handles through the material.

Flipbook Blueprint Setup

There may be some differences with how these are handled in the BP, but in this case the Decal Spawn function was created in a separate BP so that Spider and Web spawns could be handled uniquely, but they could exist in the same BP if necessary.