Sword Reveal Over Time


Author: Zak Levine

Date May 25, 2023

An overlooked aspect of Slimegeon is the slime's attack. The slime spawns a sword and uses it for combat. Although the blade has the same material as the slime, it feels unnatural or random. To improve this ability, I changed the sword's material to appear from the base to the tip slowly.


The first step in creating this material was duplicating the original slime material to make a separate one. Next, I added a parameter called MinPivotAxis. The intended use is at 0; I entirely hide the sword, while at 1, I would reveal the blade thoroughly. In between 0 and 1, the sword reveals itself from the base to the tip.

To make the function work, I had to make the material take an opacity mask, so I masked the blend mode. I needed to subtract the object position from Local Space and the Absolute World Position from Local Space to get from bottom to top. Swapping those two around would reveal from tip to base instead. I then divided that value by the Local Bounds Size to ensure it would begin at the bottom no matter where the pivot was. After, I added the MinPivotAxis to change the pivot based on how much of the sword I wanted to reveal. Finally, I masked B to get the vertical gradient and used an Alpha threshold before plugging that output into the Opacity Mask. The shader ensured that I could get different sword outcomes while always having the base to the parameter revealed.

After creating that shader feature, I needed to make a dynamic material for the sword. I then called this material on a timeline and altered the parameter MinPivotAxis based on a lerp from 0 to 1 and 1 to 0 for retracting. I also made the retraction on a separate timeline from the return swing to delay the attack between uses.


Overall, the feature adds some excellent feedback to the player's swing, making it look more natural and reducing its overall power by adding a longer cooldown.

Leave a comment

Log in with itch.io to leave a comment.