From ee3cc3085102b6854d2a80911fa15a712ec3659c Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 3 Oct 2022 01:29:01 -0700 Subject: [PATCH] Animator renormalizes quantized weights; It would be nice to do this in the importer, but it was 50+ lines and was really tricky to write without reading from uncached GPU-mapped memory. Instead, it's 1 line here. I hope zero-weight vertices aren't a thing? --- etc/shaders/animator.comp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/shaders/animator.comp b/etc/shaders/animator.comp index 27a5f20a..70c3f569 100644 --- a/etc/shaders/animator.comp +++ b/etc/shaders/animator.comp @@ -39,6 +39,9 @@ void lovrmain() { uint i3 = (indices >> 24) & 0xff; vec4 weights = unpackUnorm4x8(skin[vertexIndex].weights); + // Model loader does not currently renormalize weights post-quantization + weights /= weights[0] + weights[1] + weights[2] + weights[3]; + mat4 matrix = mat4(0); matrix += joints[i0] * weights[0]; matrix += joints[i1] * weights[1];