PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.18k stars 1.23k forks source link

No support for rational spline curves #1554

Closed VikingScientist closed 1 year ago

VikingScientist commented 3 years ago

Describe the bug I cannot find any way to format rational spline curves within the framework. Please relabel this as "help wanted" if the functionality does exist, or "feature wanted" if it does not exist. The feature exist for surfaces, but not for curves.

Steps to reproduce Steps to reproduce the behavior:

  1. Go to the API for UsdGeomNurbsCurves
  2. Look for anywhere to specify the rational weights of the curve
  3. Realize that this is nowhere to be found

Expected behavior I expect that there exist a similar function as can be found in UsdGeomNurbsPatch called GetPointWeightsAttr to be implemented in the UsdGeomNurbsCurves class.

spiffmon commented 3 years ago

Hi @VikingScientist, You are correct that UsdGeomNurbsCurves does not encode weights, which means you must pre-weight your cv's when exporting from a DCC that supports them, as well as separately encoding them if you want to be able to round-trip them. I do not know if this omission was intentional, but I suspect not. The thing is that nurbs curves are not particularly important in our pipeline since RenderMan has never supported them, and we included a schema for them out of a duty to completeness since Maya uses them for modeling.
Our schema, therefore, was highly Maya-inspired, and Maya does not let you edit point weights. I just discovered from this post that they do exist in Maya's internal datastore, but the Maya USD exporter ignores them, by my code examination, so there's a bug to be filed against the Maya USD plugin, if you'd care to. It looks like Houdini does support weight editing, but the Houdini nurbs curve exporter also seems to ignore the weights.

There is currently no code in the USD codebase that evaluates nurbs curves (our usdImaging hydra delegate only draws the control hull), so we have very little skin in the game for nurbs. I think if you or someone else wanted to add support for weights, we'd be willing to accept a PR, since none of our code would become more or less correct as a result, though I don't think it would get you too far unless you also follow up with the vendors to get them to add I/O support for them.

jilliene commented 3 years ago

Filed as internal issue #USD-6784

VikingScientist commented 3 years ago

The community at the Maya USD plugin repository directed me here, when I filed the issue over there before posting it here.

Thanks for filing it as an internal issue. USD is seeing interest from multiple fields outside pure animation, and with applications such as rigid-body physics simulation or NURBS-based finite element analysis, then the need to support rational splines might become relevant sooner rather than later. I expect one would first add support for storing/retrieving these within the USD core library before modelling plugins start exporting the weights and renders start taking advantage of them.