Feature Preview: Decals
In the latest Flax Alpha update version 0.1.6156 we’ve shipped another exciting feature: Decals rendering.
Decals are special objects placed in the world that use a material to project it onto the other objects surfaces (including models and animated models). For example, a blood stain texture and decal material can be used to draw it on top of the player body when it gets hit by the bullet. Another example is to render footsteps on a sand when your player walks on it.
To learn more about decals please visit the related documentation here.
How to create a decal?
In this short tutorial, you will learn how to create and use a decal. Follow the instructions to create a simple blood stain. If you need the required texture check out the official Flax Samples to get one.
1. Create material
The first step is to create a new material asset (see Materials Basics page to learn how to do it).
2. Set Domain to Decal
Next step is to open the material editor and change the material Domain to Decal as shown in the picture below.
3. Add decal texture
Now drag and drop the texture you want to draw as a decal. Then connect it with material color and opacity properties as shown in the picture below. Also, you can see the preview of the decal in the Material Preview panel.
4. Save material
Press Ctrl+S or click the Save button to save the changes in the material asset.
5. Create Decal actor
Now add a new Decal actor to your scene. You can drag and drop it from the Toolbox Window (Visuals tab) or use a Scene Tree Window and the dedicated context menu.
6. Assign material
Select the created decal actor and assign the material to its property Material.
7. See the results
Your decal is ready. You can use it in your game. Also, decals can be spawned at runtime via C# script and you can create a virtual dynamic material instance to modify the decal parameters, for instance: fade off the decal after a timeout.
Right now we’re moving quickly forward. Evey alpha release is bringing a lot of new features and more stability to the engine.
Also, we’re getting many cool suggestions and ideas. Thanks for your contribution.
And as always: see you soon (or right now on a Discord)!