blurstudio / TwistSpline

A smoothly reparameterizing Bezier spline that also interpolates orientations
MIT License
96 stars 43 forks source link

[Bug]: twistSpline node generates NaN values #23

Open mdilena opened 2 years ago

mdilena commented 2 years ago

Summary

The twistSpline node can randomly generate NaNs on certain frames of an animation - although on the project it has been used it's been seen only in a single shot - and these could change every time an attribute gets refreshed or a control position changes, so the previously broken frame would suddenly work again and another random one will break. The result is that the deformed geometry disappears over one or more frames.

Expected Behavior

The node should never generate NaNs unless its input do as well.

Steps to Reproduce Behavior

Unfortunately a pattern to reproduce the problem hasn't been found yet, and so far it only occurred in a single shot, on a single rig.

Solution

This is no solution, but the issue seem to have been solved - for now at least - by asking the animator to re-import a fresh rig and re-animate, but I suspect this could happen again.

Environment

Linux, CentOS 7

Additional Context

I can't share any images/file from the project.

mdilena commented 2 years ago

Hey @tbttfox!

I realise this description doesn't really help much with finding out what happens, but I can't do anything but flag it until I find how to reproduce this. I was wondering if you ever experienced something similar when using it in production.

Cheers! Matteo

tbttfox commented 2 years ago

I haven't experienced anything like that at all ... where is the NaN value showing up? As part of a rider matrix? Even if its not reproducible, knowing the exact settings where it did show up could be helpful. Also, even if its not consistent for inputs, if it's consistent for a file, you could try hooking it up to a debugger on your end, and help me narrow it down. Best guess? It's probably some kind of floating point precision error, and adding a [0 - 1] clamp, or normalizing a length somewhere will just fix it.

mdilena commented 2 years ago

So I can see the rotation values getting NaNs from the rider constraint outputs, but turning on "Debug Display" on the twistSpline node itself I can't see the curve's rotation axis when on the broken frame, that's why I thought the problem came from that node rather than the rider constraint. I also tried turning off parallel eval to see if it was related to that, but it was still happening in both Serial and DG mode, so it's most likely what you described. I guess I'll have to recompile in debug mode and attach gdb to see some extra info? Hopefully I'll find some time to do it over the next few days!

tbttfox commented 2 years ago

I just double checked with our lead rigger, and he said the only time he saw NaN's was when a spline segment had zero length, but that's easy to work around.

Hmm. That's not where I expected the error to be showing... I was expecting a mismatch between the length parameters and the actual length on a sub-section of the spline, but I don't think that would cause the debug axes to break. Interesting.