Iray SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IMaterial_instance Class Referenceabstract

This interface represents a material instance. More...

#include <imaterial_instance.h>

Inheritance diagram for mi::neuraylib::IMaterial_instance:

Public Types

enum  Compilation_options {
  DEFAULT_OPTIONS = 0 ,
  CLASS_COMPILATION = 1 ,
  COMPILATION_OPTIONS_FORCE_32_BIT = 0xffffffffU
}
 Various options for the creation of compiled materials. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x037ec156, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x8a2a4da9, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x1bcb8d48, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 

Public Member Functions

virtual ICompiled_materialcreate_compiled_material (Uint32 flags, IMdl_execution_context *context=0) const =0
 Creates a compiled material. More...
 
- Public Member Functions inherited from mi::neuraylib::IScene_element
virtual Element_type get_element_type () const =0
 Indicates the actual scene element represented by interfaces derived from this interface. More...
 
- Public Member Functions inherited from mi::neuraylib::IAttribute_set
virtual IDatacreate_attribute (const char *name, const char *type)=0
 Creates a new attribute name of the type type. More...
 
template<class T>
T * create_attribute (const char *name, const char *type)
 Creates a new attribute name of the type type. More...
 
template<class T>
T * create_attribute (const char *name)
 Creates a new attribute name of the type T. More...
 
virtual bool destroy_attribute (const char *name)=0
 Destroys the attribute name. More...
 
virtual const IDataaccess_attribute (const char *name) const =0
 Returns a const pointer to the attribute name. More...
 
template<class T>
const T * access_attribute (const char *name) const
 Returns a const pointer to the attribute name. More...
 
virtual IDataedit_attribute (const char *name)=0
 Returns a mutable pointer to the attribute name. More...
 
template<class T>
T * edit_attribute (const char *name)
 Returns a mutable pointer to the attribute name. More...
 
virtual bool is_attribute (const char *name) const =0
 Indicates existence of an attribute. More...
 
virtual const char * get_attribute_type_name (const char *name) const =0
 Returns the type of an attribute. More...
 
virtual Sint32 set_attribute_propagation (const char *name, Propagation_type value)=0
 Sets the propagation type of the attribute name. More...
 
virtual Propagation_type get_attribute_propagation (const char *name) const =0
 Returns the propagation type of the attribute name. More...
 
virtual const char * enumerate_attributes (Sint32 index) const =0
 Returns the name of the attribute indicated by index. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mi::base::Interface_declare< 0x037ec156, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x8a2a4da9, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x1bcb8d48, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

This interface represents a material instance.

This interface is almost obsolete. The only remaining purpose is the method create_compiled_material() and the associated enum Compilation_options. Use mi::neuraylib::IFunction_call for all other purposes.

Member Enumeration Documentation

 Compilation_options

Various options for the creation of compiled materials.

See also
create_compiled_material()
Enumerator
DEFAULT_OPTIONS 

Default compilation options (e.g., instance compilation).

CLASS_COMPILATION 

Selects class compilation instead of instance compilation.

Member Function Documentation

 create_compiled_material()

virtual ICompiled_material * mi::neuraylib::IMaterial_instance::create_compiled_material ( Uint32  flags,
IMdl_execution_context context = 0 
) const
pure virtual

Creates a compiled material.

Parameters
flagsA bitmask of flags of type Compilation_options.
[in,out]contextAn optional pointer to an execution context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • mi::Float32 "meters_per_scene_unit": The conversion ratio between meters and scene units for this material. Default: 1.0f.
  • mi::Float32 "wavelength_min": The smallest supported wavelength. Default: 380.0f.
  • mi::Float32 "wavelength_max": The largest supported wavelength. Default: 780.0f.
The following options are supported in class compilation mode:
  • bool "fold_ternary_on_df": Fold all ternary operators of *df types. Default: false.
  • bool "fold_all_bool_parameters": Fold all bool parameters. Default: false.
  • bool "fold_all_enum_parameters": Fold all enum parameters. Default: false.
  • mi::base::IInterface *"fold_parameters": A static or dynamic array of strings of the parameters to fold. The names of the parameters are those that would otherwise be reported in mi::neuraylib::ICompiled_material::get_parameter_name(). Default: NULL
  • bool "fold_trivial_cutout_opacity": Fold the expression for geometry.cutout_opacity if it evaluates to a constant with value 0.0f or 1.0f. Default: false.
  • bool "fold_transparent_layers": Calls to the functions df::weighted_layer(), df::fresnel_layer(), df::custom_curve_layer(), df::measured_curve_layer(), and their equivalents with color weights, are replaced by their base argument, if the weight argument evaluates to a constant with value 0.0f, and the layer argument is one of df::diffuse_transmission_bsdf(), df::specular_bsdf(), df::simple_glossy_bsdf(), or df::microfacet_*_bsdf(), and the scatter_mode argument (if present) is either df::scatter_transmit or df::scatter_reflect_transmit. In addition, the layer argument might be a combination of such BSDFs using the ternary operator.
During material compilation, messages like errors and warnings will be passed to the context for later evaluation by the caller. Possible error conditions:
  • Type mismatch, call of an unsuitable DB element, or call cycle in the graph of this material instance.
  • The thin-walled material instance has different transmission for surface and backface.
  • An argument type of the graph of this material instance is varying but the corresponding parameter type is uniform.
  • An element in the array for the context option "fold_parameters" does not have the type mi::IString.
Returns
The corresponding compiled material, or NULL in case of failure.