📎Attached details

Since Calysto World v2, you can now attach details to objects in your world. This will work both on objects spawned by PCG and actors added manually!
Note that the attached details only work in a biome for now.
Attaching details to an actor or static mesh
You only need to use the tag system or write the tag AttachDetail to a static mesh/actor to tell the system that it can attach meshes to it. There is an example in the demo scene you can look at.

Attaching details to a biome-spawned mesh
In your biome vegetation database, there is a simple bool at the bottom, "Can Add Details". If set to true, it will tell the spawning system to add details to it.

Customizing your attached details
First, you need to right-click in your content browser and create a new data asset of type "PDA_AttachedDetails"

The database will look like this

Most of the attributes are self-explanatory, but here are a few additional details.
Weight: Determine the chance of one vegetation to spawn versus another.
Min/Max angle: Works in world space, you can tell the vegetation to only spawn under an object, for example, (like vines hanging on a branch), or only on the side, like mushrooms attached to a trunk.
useColorFilter, Spawn on Red, Green, and Blue allows you to paint on a static mesh and only spawn on certain colors (like the first screenshot above, the grass will only spawn on red). More on that later.
useNoiseMask, NoiseScaleXY, and NoiseScaleXZ: Determine if you want to use noise to remove some of the details. There are 2 noises, one for the horizontal direction and one vertical multiplied together.
Painting colors on a mesh
In order ot have more control over your mesh, you can paint 3 colors to determine where certain vegetation can spawn, like this grass spawning only on red.

Unreal made it really easy to paint those colors either in a mesh in the world or on the original mesh directly.
First, open the paint mode, then click on "Paint"
In "Paint Color" you can set the desired colors you want (Red, Green, or Blue), and Black will tell the tool not to spawn anything there.
Note that you can't paint on nanite meshes, so you need to disable nanite temporarily and enable it again when you are done.

When you are done, you can either leave it like this (so only the mesh in the world will be painted) or you can save the painting on the mesh so that every mesh in the world is affected.

Attached the details distance and density
Similar to the landscape details, the setting can't be exposed, so it needs to be done inside PCG. To change the detail spawning distance, you need to go to Calysto/World/PCG and open PCG_RuntimeScatter.
Click on the "Change Grid Size" node (commented in yellow) and in the detail set the distance to the one you desire.

To change the detail density, you need to open PCG_AttachDetailGenerator in the same folder
Click on "Custom HLSL" then change the "Num Element" to the desired value.

Last updated