While most games have HP meters on the screen, this was unfortunately not a good fit for our VR title, as it would disrupt the player's vision and ruin the aesthethic of the game. Instead, we decided to do a Vignette to show the Player's health.
The first issue with a Vignette is that usually they'd be done through a Widget Blueprint, but as elaborated on in my Pause Menu post, that's not possible in VR.
Instead, I decided to make a new material that would be shown through a Post-Processing volume.
I first multiplied a Lava Material with a Vignette Material.
Then, I set it up so the scene would have a Post Process input, and multiplied it with a green tint.
Finally, I created a parameter called Intensity, which serves as the catalyst for how strong the Shader should be.
Then, I set up a "Set Post Processing Material Instance" in the Player Blueprint. First of all, I had the Construction Script have it set up upon player construction.
I then created the Dynamic Material Instance of the PostProcess shader I just made above, and set that as the "Post Process Damage Dynamic Material"
I then created a Post Process Volume class, and connected it to set the Post Process Settings, which determine how bright the Shader is.
This was now functional, however, I needed to set it up so that it shows when the Player's health lowers. To do this, I first set up a Macro that divided Health by Max Health, which would produce the value needed to set the intensity for the Vignette.
Then, through an event tick, set the Scalar Parameter Value, and set the Intensity as the Parameter. With the Health Ratio constantly subtracting as the Value, the player would be able to see their Vignette be based on their personal health in real time.
Comments