From ff4afc8725a348a43aa1bd0c0f486335b3a61a53 Mon Sep 17 00:00:00 2001 From: Max Palmer Date: Thu, 19 Jun 2025 11:30:10 +0100 Subject: [PATCH 1/2] Updated GenericHand shader to normalise normals to prevent outline scaling issues with hand rigs that don't normalize the normal vector --- .../Runtime/Shaders/BiRP and URP/GenericHandShader.shader | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader b/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader index 53a464f926..8f1bc1da9e 100644 --- a/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader +++ b/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader @@ -349,7 +349,9 @@ #if _USEOUTLINE_ON float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal); - float2 offset = TransformViewToProjection(norm.xy); + // Some hand models may include non normalized (length) normals + float3 normalizedVector = normalize(norm); + float2 offset = TransformViewToProjection(normalizedVector.xy); o.pos.xy += offset * _Outline; #endif From d157dced26ee7ea9d907b21cb162a5b0b4166709 Mon Sep 17 00:00:00 2001 From: Max Palmer Date: Thu, 19 Jun 2025 11:34:45 +0100 Subject: [PATCH 2/2] Updated changelog and shader comment --- Packages/Tracking/CHANGELOG.md | 1 + .../Runtime/Shaders/BiRP and URP/GenericHandShader.shader | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Packages/Tracking/CHANGELOG.md b/Packages/Tracking/CHANGELOG.md index be2b881613..fe176e69b3 100644 --- a/Packages/Tracking/CHANGELOG.md +++ b/Packages/Tracking/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Text on the toggle button in the UI Input example scene now shows On or Off based on the toggled state - Clients were not able to subscribe to the events on the PinchDetector and GrabDetector scripts as the properties were exposed as readonly. - GrabDetector detection logic was inverted, so open hands were interpreted as grabs. Now fixed. +- Fixed issue with scale of outline in GenericHandShader if hand model normals are not a normalized length ### Known Issues - Pose detection scene does not illuminate all poses in green if built for mobile headsets when using URP (2022.3), spotlights don't work as intended on Unity 6. diff --git a/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader b/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader index 8f1bc1da9e..f7a4055580 100644 --- a/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader +++ b/Packages/Tracking/Hands/Runtime/Shaders/BiRP and URP/GenericHandShader.shader @@ -1,4 +1,4 @@ -Shader "Ultraleap/GenericHandShader" +Shader "Ultraleap/GenericHandShader" { Properties { @@ -349,7 +349,7 @@ #if _USEOUTLINE_ON float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal); - // Some hand models may include non normalized (length) normals + // Some hand models may include non normalized (length) normals, so we normalize the length of the normal first float3 normalizedVector = normalize(norm); float2 offset = TransformViewToProjection(normalizedVector.xy); o.pos.xy += offset * _Outline;