Materials (MDL)
[Scene elements]
Description
Materials comprise a set of interfaces related to the Material Definition Language (MDL). See [MDLTI] for a technical introduction into the Material Definition Language and [MDLLS] for the language specification.
The unit of compilation in MDL is a module. Importing an MDL module creates an instance of mi::neuraylib::IMdl_module in the DB. A module allows to retrieve the referenced (aka imported) modules, as well as the exported material and function definitions. For all exported definitions, instances of mi::neuraylib::IMdl_material_definition and mi::neuraylib::IMdl_function_definition are created in the DB accordingly. Both, material and function definitions can be instantiated. Those instantiations are represented by the interfaces mi::neuraylib::IMdl_material_instance and mi::neuraylib::IMdl_function_call.
The DB names of all scene elements related to MDL always carry the prefix "mdl". This prefix is followed by the fully qualified MDL name of the entity including two initial colons, e.g., the DB element representing the df module has the DB name "mdl::df". Since function definitions can be overloaded in MDL, the DB names contain the function signature, e.g., if there are two functions "bool foo(int n)" and "bool foo(float f)" in module bar, the DB name of these are "mdl::bar::foo(int)" and "mdl::bar::foo(float)" respectively. Note that the function signature uses MDL type names, not neuray API type names.
When instantiating a material or function definitions, its formal parameters are provided with actual arguments. If the parameter has a default initializer, the argument can be omitted in which case the default initializer is used. Arguments of instances can also be changed after instantiation.
The default initializers of material and function definitions, as well as the arguments of material instances and function calls are always of type mi::IAttachable, which is a discriminated union of mi::IRef and the corresponding parameter type itself. For example, the MDL type float of a parameter is mapped to the neuray API type "Float32", and the default or argument for this parameter will be exposed as "Attachable<Float32>". The value of this type either refers to a constant value, or is a reference to another MDL function call (with return type "Float32").
Defaults initializers can also be of type "Attachable<Parameter>". The mi::IParameter type is used to represent default initializers that refer to an earlier parameter in the parameter list: the value identifies the parameter via its position in the parameter list.
Classes
- class
- This interface represents a compiled material. More...
- class
- Factory for MDL interfaces, e.g., modules with presets. More...
- class
- This interface represents a function call. More...
- class
- This interfaces represents a function definition. More...
- class
- This interfaces represents a material definition. More...
- class
- This interface represents a material instance. More...
- class
- This interfaces represents an MDL module. More...
- class
- A wrapper around the interfaces for MDL material instances and function calls. More...
- class
- A wrapper around the interfaces for MDL material and function definitions. More...
Enumerations
- enum mi::neuraylib::Material_slot{ SLOT_THIN_WALLED, SLOT_SURFACE_SCATTERING, SLOT_SURFACE_EMISSION_EDF_EMISSION, SLOT_SURFACE_EMISSION_INTENSITY, SLOT_BACKFACE_SCATTERING, SLOT_BACKFACE_EMISSION_EDF_EMISSION, SLOT_BACKFACE_EMISSION_INTENSITY, SLOT_IOR, SLOT_VOLUME_SCATTERING, SLOT_VOLUME_ABSORPTION_COEFFICIENT, SLOT_VOLUME_SCATTERING_COEFFICIENT, SLOT_GEOMETRY_DISPLACEMENT, SLOT_GEOMETRY_CUTOUT_OPACITY, SLOT_GEOMETRY_NORMAL, SLOT_FORCE_32_BIT = 0xffffffffU}
- Material slots identify parts of a material. More...
Enums
- enum mi::neuraylib::Material_slot
-
Material slots identify parts of a material.
See also:
mi::neuraylib::IMdl_compiled_material::get_slot_hash()
Enumerator:
- SLOT_THIN_WALLED
- Slot thin_walled.
- SLOT_SURFACE_SCATTERING
- Slot surface.scattering.
- SLOT_SURFACE_EMISSION_EDF_EMISSION
- Slot surface.emission.emission.
- SLOT_SURFACE_EMISSION_INTENSITY
- Slot surface.emission.intensity.
- SLOT_BACKFACE_SCATTERING
- Slot backface.scattering.
- SLOT_BACKFACE_EMISSION_EDF_EMISSION
- Slot backface.emission.emission.
- SLOT_BACKFACE_EMISSION_INTENSITY
- Slot backface.emission.intensity.
- SLOT_IOR
- Slot ior.
- SLOT_VOLUME_SCATTERING
- Slot volume.scattering.
- SLOT_VOLUME_ABSORPTION_COEFFICIENT
- Slot volume.absorption_coefficient.
- SLOT_VOLUME_SCATTERING_COEFFICIENT
- Slot volume.scattering_coefficient.
- SLOT_GEOMETRY_DISPLACEMENT
- Slot geometry.displacement.
- SLOT_GEOMETRY_CUTOUT_OPACITY
- Slot geometry.cutout_opacity.
- SLOT_GEOMETRY_NORMAL
- Slot geometry.normal.
- SLOT_FORCE_32_BIT = 0xffffffffU