Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in HdResampleRawTimeSamples() #1549

Closed
GrangerFX opened this issue Jun 30, 2021 · 2 comments
Closed

Bug in HdResampleRawTimeSamples() #1549

GrangerFX opened this issue Jun 30, 2021 · 2 comments

Comments

@GrangerFX
Copy link

Description of Issue

There is a bug in the templated function HdResampleRawTimeSamples that causes errors in motion blur streaks.
HdResampleRawTimeSamples() is called from HdTimeSampleArray::Resample().
The functions are in pxr\imaging\hd\timeSampleArray.h
The bug is in this line:
// Linear blend of neighboring samples.
float alpha = (us[i]-u) / (us[i]-us[i-1]);

Alpha is used to interpolate between vs[i-1] and vs[i] in the next line:
return HdResampleNeighbors(alpha, vs[i-1], vs[i]);

As u gets closer to us[i], alpha gets closer to zero. As u gets closer to us[i-1], alpha gets closer to 1.
This is backwards. Alpha should get closer to 1 as u gets closer to us[i] and closer to 0 as u gets closer to us[i-1].

The fix is as follows:
// Linear blend of neighboring samples.
float alpha = (u-us[i-1]) / (us[i]-us[i-1]);

Steps to Reproduce

Any use of HdTimeSampleArray::Resample() with a different number of samples than count will show an error in the resulting time sample values.

System Information (OS, Hardware)

Any/NA

Package Versions

USD v21.05

Build Flags

Any/NA

@jilliene
Copy link

jilliene commented Jul 7, 2021

Filed as internal issue #USD-6776

@blevin
Copy link
Member

blevin commented Jul 15, 2021

Thanks for calling this out. We checked in a fix to our internal tree today and it should be on the the github dev branch soon after the USD 21.08 release.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants