autodesk-forks / MaterialX

MaterialX C++ and Python libraries
http://www.materialx.org/
Apache License 2.0
106 stars 23 forks source link

Adding explicit default units #1400

Closed zicher3d closed 3 months ago

zicher3d commented 4 months ago

Seemed like units defaulted to meters also for angle units. Adding explicit defaults so that conversion does not try to convert meters to degrees.

zicher3d commented 4 months ago

There is no specific test for legacy_checker (or example) and the only procedural used in the graphs is legacy_noise. (Checker is there because a customer could use checker in a custom material. It's just one of the many protein procedurals, and I made it mainly to learn and test the process.)

Legacy_noise does have inputs for distance and angle values, and they have been adjusted in this commit. But the sample file testing all the protein classes do not provide values and relies on defaults, mainly because I cannot specify a unittype and unit in the graph editor for legacy_noise nodes that exist within a graph (no connections to nodedef inputs).

We might have to do some ad-hoc tests to test these, keeping in mind that most of the legacy_noise nodes are used for bump maps and so their effect is not visible as procedurals do not work as bump. When those work, we can then adjust the nodegraphs manually, remembering to check that the units attributes are maintained if we edit the graphs again in the graph_editor.