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?
This commit is contained in:
bjorn 2022-10-03 01:29:01 -07:00
parent ef87ec8cba
commit ee3cc30851
1 changed files with 3 additions and 0 deletions

View File

@ -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];