Light distribution from scene elements
Iray provides the mi::neuraylib::ILight element for the implementation of point, spot, directional and area lighting. Iray extends the notion of the environmental contribution to lighting calculation with an environment dome.
Iray also provides the ability to specify an emission distribution function in the material attached to an object instance. In this way, any object can be a source of light emission, but may also have reflective and transmissive properties as well.
The mi::neuraylib::ILight::set_type() and mi::neuraylib::ILight::get_type() methods of mi::neuraylib::ILight use the mi::neuraylib::Light_type enum to define and acquire the type of light geometry.
Field in mi::neuraylib::Light_type | Meaning |
---|---|
mi::neuraylib::LIGHT_POINT | Emits in all directions from origin |
mi::neuraylib::LIGHT_INFINITE | No origin, all light rays parallel |
Point and spot lights
In Iray, point lights are positioned at the coordinate origin of the local light space. Spot lights are not defined by an enum field value of mi::neuraylib::Light_type, but by providing a light of type mi::neuraylib::LIGHT_POINT and using the spot_edf distribution function. Spot lights point down the negative z-axis, like the camera. This differs from some traditional scene description formats, in which a light can have an origin, a direction, and area edge and axis vector. Instead, Iray folds this information into the light instance transformation.
Directional lights
A directional light is a light at infinity that emits light in the direction of the negative z-axis. A different emission direction can be set by attaching the mi::neuraylib::ILight representing the directional light to an instance node of type mi::neuraylib::IInstance and setting its transformation matrix.
The mi::neuraylib::LIGHT_INFINITE type defines a direction but does not have a position, as point and spot lights do. The traditional use of a directional light is as an approximation of the rays of the sun, which is at such a great distance to the earth that at human scale the light rays are effectively parallel.
Area lights
Area lights specify a geometric shape that defines the source of light energy. Like directional lights, area lights are oriented through the transformation matrix of the mi::neuraylib::IInstance to which they are attached.
The mi::neuraylib::ILight::set_area_shape() and mi::neuraylib::ILight::get_area_shape() methods of mi::neuraylib::ILight use the mi::neuraylib::Light_area_shape enum to define and acquire the shape of an area light.
Field in mi::neuraylib::Light_area_shape | Meaning |
---|---|
mi::neuraylib::AREA_NONE | The mi::neuraylib::ILight instance is not an area light |
mi::neuraylib::AREA_RECTANGLE | Rectangular shape |
mi::neuraylib::AREA_DISC | Disc shape |
mi::neuraylib::AREA_SPHERE | Sphere shape |
mi::neuraylib::AREA_CYLINDER | Cylinder shape |
Light-emitting objects
A material defined in the Material Definition Language (MDL) specifies distribution functions for light scattering and emission. In this way, any object in the scene may be defined as a light source and the light it emits is evaluated in a physically based manner in rendering. However, because the MDL material can also define scattering properties, an object can both emit and reflect light. In this manner, illumination effects like a dimly glowing glass sphere with reflections can also be implemented.