Skip to content

Commit

Permalink
Updated scaling and color function for badump
Browse files Browse the repository at this point in the history
  • Loading branch information
xavion-lux committed Oct 10, 2023
1 parent d5a6fec commit 49b92cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 1 addition & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
### Changelog

I renamed shaders and moved files in this release so to avoid any problems please delete older versions from your project before updating. (Sorry)

- Renamed HRDisplay to HRDisplayTriple
- Fixed a bug with the heart color not changing when beating
- Added prefabs using [Modular Avatar](https://github.com/bdunderscore/modular-avatar) for easy installation on VRC avatars
- Added animations and fx layers for VRC avatars
- Moved regular prefabs to "OtherPrefabs" folder
Improved scale and color fonction to get a nice badump effect instead of smooth continuous scaling and color change.
7 changes: 3 additions & 4 deletions HRDisplay/Shaders/HRDisplaySingle.shader
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);

half targetscale = sin(_Time * _BPM * 2) * half(0.8) + 4;


half targetscale = 4 - (pow(sin(_Time * _BPM), int(20)) + pow(sin(_Time * _BPM - half(1.1)), int(10)) * half(0.5));

v.uv += half2(-0.325, -0.015);
o.uv = scale(v.uv, targetscale);

Expand All @@ -211,7 +210,7 @@

fixed4 frag(v2f i) : SV_Target
{
fixed m = sin(_Time * _BPM * 2 + fixed(3.14))/2 + fixed(0.7);
fixed m = (pow(abs(sin(_Time * _BPM + half(3.14))), int(15)) + pow(abs(sin(_Time * _BPM + half(3.14) - half(1.1))), int(10)) * half(0.5))*0.7 + half(0.35);
fixed4 col = UNITY_SAMPLE_TEX2D(_HeartTex, i.uv);
col.r *= m;
col.g *= m;
Expand Down
4 changes: 2 additions & 2 deletions HRDisplay/Shaders/HRDisplayTriple.shader
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Shader "xavion-lux/HRDisplayTriple"

o.bpm = _Hundreds * 100 + _Tens * 10 + _Units;

half targetscale = sin(_Time * o.bpm * 2) * half(0.8) + 4;
half targetscale = 4 - (pow(abs(sin(_Time * o.bpm)), int(20)) + pow(abs(sin(_Time * o.bpm - half(1.1))), int(10)) * half(0.5));


v.uv += half2(-0.325, -0.015);
Expand All @@ -221,7 +221,7 @@ Shader "xavion-lux/HRDisplayTriple"

fixed4 frag(v2f i) : SV_Target
{
fixed m = sin(_Time * i.bpm * 2 + fixed(3.14))/2 + fixed(0.7);
fixed m = (pow(abs(sin(_Time * i.bpm + half(3.14))), int(15)) + pow(abs(sin(_Time * i.bpm + half(3.14) - half(1.1))), int(10)) * half(0.5))*0.7 + half(0.35);
fixed4 col = UNITY_SAMPLE_TEX2D(_HeartTex, i.uv);
col.r *= m;
col.g *= m;
Expand Down

0 comments on commit 49b92cc

Please sign in to comment.