autodesk-forks / MaterialX

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

MDL: Add support for geompropvalue and scene color data #1052

Open bernardkwok opened 3 years ago

bernardkwok commented 3 years ago

Currently both of these are not implemented.

  1. For geompropvalue the following can be used:

data_isvalid(geomprop_name);

with lookup using these variatns (taken from MDL 1.6 specification)

The standard scene data lookup functions exists in two versions, one for varying data and one for uniform data.

_ltype data_lookup_ltype( uniform string name, ltype defaultvalue = ltype() ) varying

Returns the scene data of the give name at the current shade point (for geometry scene data) or the global scene data. The argument to the name parameter must be a literal string value. A lookup on an unknown scene data name or one with incompatible type returns the default_value.

_uniform ltype data_lookup_uniform_ltype( uniform string name, uniform ltype defaultvalue = ltype() ) uniform

Returns the scene data of the give name at the current shade point (for geometry scene data) or the global scene data. The argument to the name parameter must be a literal string value. A lookup on an unknown scene data name or one with incompatible type or varying type returns the default_value.

  1. Unknown what to do with color, though could be treated the same as geompropvalue with a number which an application can derive the final lookup name.