Shader
The Damage FX Object consists of three essentials pieces:
Damage FX Shader
Let’s look at the basic application of the shader with the base layer which is rendering the initial or untouched mesh, and also the damage layer added by the Damage FX function. The universal example would be FORGE3D/DamageFX/PBR Specular Gloss shader in our case.
The damage is added dynamically upon providing an object space point and non empty value to the shader data array. The shader function will iterate through the available impact points building the required masks given the following values:
Hit Radius – Defines the size of the impact. Note the mesh import scale (Unity Mesh Inspector) may affect the tiling of the damage masks. Ranges [0f, ~]. Setting a zero value leaves a very subtle effect.
Dirt Mask – The strength of the dirtiness around the impact in a range of [0f,1f].
Burn Edge – The amount of burn color applied to the inner edge of the impact usually in between the clipped spot and the dirt layer. Ranges [0f, 1f]. This parameter works best with the positive Clip and will fade over time. The fading can be controlled from the Damage FX Script Component.
Heat Glow – Is a glowing spot on top of the impact. Ranges [0f, 1f]. This parameter will fade over time and can be controlled from the Damage FX Script Component.
Clip Mask – The amount of clip applied at the impact point. Ranges [0f, 1f]. The lower the value the less is the clip up to none. A value in between the range, e.g. 0.5f, leaves the most of the rough edges at the impact hole.
These five values are individual per impact point and you can experiment with them in the real-time by launching the example scenes.
Note the default configuration is set to 200 impact points per Damage FX Object. Adding more points over the limit will overwrite existing ones from the beginning of the shader array.
Last updated