Skip to content

xavion-lux/HRDisplay

Repository files navigation

HRDisplay

GitHub release (latest by date) License GitHub all releases

HRDisplay is a custom shader written in HLSL for Unity's built-in render pipeline, designed to display the user's heart rate along with an animated heart beating at the same pace. The shader is primarily created for use in VRChat but can be adapted for other Unity projects as well.

Table of Contents

Preview

Unity_RKsFVk2wbK

Getting Started

Usage

This shader is primarily designed to be used with other projects like VRCOSC or Pulsoid-to-VRChat-OSC to control avatar parameters with OSC.
For installation on VRChat avatars, skip to Installation for VRChat.

Two variants of the shader exist. One controlled with a single property, HRDisplaySingle, and HRDisplayTriple with 3 properties, one for each decimal place. Choose the easiest version to set up with your environment.

The display can be controlled using the Hundreds, Tens and Units material properties or the BPM property depending on which variant of the shader you use.

Customization

You can customize the shader by providing your own textures for the heart as well as the numbers.
A template for the number texture is provided for you to create your own number textures.
If you experience issues with your textures from a long distances double check the mipmap settings for your texture in Unity.

Installation for VRChat

hrdisplay_tutorial.mp4
  1. Import Modular Avatar in your already existing project with the VRChat Creator Companion or by downloading the latest release from here.
  2. Download and import the latest release of HRDisplay from here.
  3. Go to the VRChat folder in HRDisplay and drag and drop the one of the prefab (using one or three parameters to control the display) to the desired location in your armature.
  4. Move and resize the display to your liking.
  5. Select the prefab, and remap the parameter(s) listed in the MA Parameter component to the path(s) of the parameter(s) sent by your OSC provider. (ex.: VRCOSC/Heartrate/Normalised)
  6. You're avatar is now ready for upload! Modular Avatar will take care of merging the FX layers and parameters when uploading automatically, without permanently modifying your avatar.

Note: If you use the Single variant, the animation provided is made for values normalised from 0 to 240 (defaults for VRCOSC). Set your lower and upper normalisation bounds to 0 and 240 respectively in your OSC software or edit the animations provided in the package to match your normalisation range.

Contributions

This is my first shader, made as a small side-project. It is hand-written from scratch in HLSL so there is probably room for various improvements.
Contributions to the project are therefore welcome.

License

HRDisplay is licensed under the AGPLv3 License. You are free to use, modify, and distribute the shader as per the terms and conditions of the license.

"heart.png" from "small-n-flat" by Paomedia is licensed under CC0 1.0.