Iray SDK API nvidia_logo_transpbg.gif Up
Example for Image Exporters
[Previous] [Next] [Up]

This example demonstrates the export of rendered pixel data to disk. Even though the Iray SDK already supports a wide range of image formats you might want to add support for your own image format. As an example we show the export of images in the Photoshop PSD file format [PFFS10]. In particular, we want to export several canvases with different content (rendered image, normals, z-buffer, etc.) into the same file.

There are two ways to add support for an image format: via an image plugin that adds support for this this file format, and via an explicit method that does the job. The image plugin has the advantage that it extends the generic export facilities with the new image format. The explicit method has the advantage that you have more freedom and are not bound to the framework of image plugins. In this example we go with the latter approach since we want export multiple canvases into one file, and in addition also their names; two features that are currently not supported by the framework for image plugins.

New Topics

  • Implementation of an image exporter
  • Usage of the PSD example exporter

Detailed Description

The example code is structured as follows:

  • auxiliary methods (from write_int8 to get_pixel_type()) that deal with low-level export of certain data formats and pixel type properties,
  • the main method export_psd() that accepts an array of canvases to export,
  • an adaptor of this main method with the same name that accepts an instance of mi::neuraylib::IRender_target to export,
  • an implementation of the mi::neuraylib::IRender_target interface with three canvases that will be used in this example, and
  • the example code to set up and to render a scene (essentially the same as in the simple rendering example).
Implementation of an image exporter


While the implementation of an image exporter heavily depends on the image format in question, there are often similarities in the file format structure and in the tasks to accomplish. Typically, there is some sort of file header with meta information, followed by the actual pixel data.

To export a PSD file, we first iterate over all the canvases to compute the needed metadata (width, height, number of layers, bits per channel) and reject invalid inputs. Next we open the file and write the file header.

The next section in the PSD file format is the layer and mask information section. This section is split into two parts. The first part contains all the layer records which are basically a header with metadata for each layer, including the name of the layer. The second part contains the actual pixel data for each layer (in the same order as described by the layer records).

Finally, there is a last section named image data section. This section is supposed to contain the pixel data of all layers merged. It is primarily needed for applications that do not deal with the layer and mask information section. In this example, we simply export the pixel data of the first canvas again.

When writing your own image exporter (or importer) there are a couple of conversion tasks you have to handle:

  • Mapping Iray pixel types (see Types) to pixel types of the image format and/or vice versa.
  • Conversion of pixel data to a different pixel type (if needed).
  • Flipping the scanline order (if needed). In the Iray SDK, scanlines are ordered bottom-up.
  • Different tiling of pixel data.

Note the methods mi::neuraylib::IImage_api::read_raw_pixels() and mi::neuraylib::IImage_api::write_raw_pixels() which can be very handy for the last three tasks. If requested, they can convert the pixel type as needed and flip the scanline order. They also convert the data between a possibly tiled canvas and a plain memory buffer.

Usage of the PSD example exporter


To demonstrate the PSD exporter we use almost the same example code as in the simple rendering example. Since we want to demonstrate the export of multiple canvases we use a different implementation of the mi::neuraylib::IRender_target interface: this implementation holds three canvases, one for the rendered image, one for the normals, and one for the z-buffer. An additional method normalize() modifies the values for the normals and z-buffer such that the data is in the range [0,1] as expected by most image formats.

After the image has been rendered, the render target is passed to our method export_psd() which exports all canvases of the render target into the given file. For comparison, the canvases are additionally exported into individual PNG files.

Source Code Location: examples/example_psd_exporter.cpp

/******************************************************************************
* Copyright 2023 NVIDIA Corporation. All rights reserved.
*****************************************************************************/
// examples/example_psd_exporter.cpp
//
// Imports a scene file, renders the scene, and writes the image to disk as PSD file.
//
// The example expects the following command line arguments:
//
// example_psd_exporter <scene_file> <mdl_path>
//
// scene_file some scene file, e.g., main.mi
// mdl_path path to the MDL modules, e.g., iray-<version>/mdl
//
// The rendered images are written to files named "example_psd_exporter_*.png".
#include <cassert>
#include <cstdio>
#include <iostream>
#include <limits>
#include <mi/neuraylib.h>
// Include code shared by all examples.
#include "example_shared.h"
// for htons, ntohs
#ifndef MI_PLATFORM_WINDOWS
#include <arpa/inet.h>
#else
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <winsock2.h>
#endif
// A simple implementation of the IRender_target interface with three canvases, one for the
// rendering result, for the normals, and one for the z-buffer.
class Render_target : public mi::base::Interface_implement<mi::neuraylib::IRender_target>
{
public:
// Constructor. Creates a render target with three canvases.
Render_target( mi::Uint32 width, mi::Uint32 height, mi::neuraylib::IImage_api* image_api);
// Implement the interface of mi::neuraylib::IRender_target.
mi::Uint32 get_canvas_count() const;
mi::neuraylib::Canvas_type get_canvas_type( mi::Uint32 index) const;
const char* get_canvas_name( mi::Uint32 index) const;
const mi::neuraylib::ICanvas_parameters* get_canvas_parameters( mi::Uint32) const;
const mi::neuraylib::ICanvas* get_canvas( mi::Uint32 index) const;
mi::neuraylib::ICanvas* get_canvas( mi::Uint32 index);
// Normalizes the contents of the second and third canvas.
void normalize();
private:
// The three canvases of this render target.
};
// The PSD file for export. Global variable to avoid passing it to every write function below.
FILE* g_file;
// Writes the 8-bit integer \p data to \p g_file.
void write_int8( mi::Uint8 data)
{
fwrite( &data, 1, 1, g_file);
}
// Writes the 16-bit integer \p data to \p g_file (converts data to network byte order).
void write_int16( mi::Uint16 data)
{
data = htons( data);
fwrite( &data, 2, 1, g_file);
}
// Writes the 32-bit integer \p data to \p g_file (converts data to network byte order).
void write_int32( mi::Uint32 data)
{
data = htonl( data);
fwrite( &data, 4, 1, g_file);
}
// Writes\p length bytes from buffer \p p to \p g_file.
void write_buf( const void* p, mi::Size length)
{
fwrite( p, length, 1, g_file);
}
// Writes the string \p s to \p g_file.
void write_str( const char* s)
{
write_buf( s, strlen( s));
}
// Writes the string \p s to \p g_file as Pascal string, using a multiple of \p padding bytes.
void write_str_pascal( const char* s, mi::Size padding)
{
mi::Size len = strlen( s);
if( len > 255)
len = 255;
write_int8( static_cast<mi::Uint8>( len));
write_buf( s, len);
for( mi::Size i = (len % padding) + 1; i < padding; ++i)
write_int8( 0);
}
// Writes pixel data of a channel to \p g_file, starting at \p input (converts data to network byte
// order).
void write_channel(
const mi::Uint8* input,
mi::Uint32 width,
mi::Uint32 height,
mi::Uint32 bytes_per_channel,
mi::Uint32 stride)
{
mi::Uint8* output = new mi::Uint8[width * height * bytes_per_channel];
for( mi::Uint32 i = 0; i < width * height; ++i)
for( mi::Uint32 b = 0; b < bytes_per_channel; ++b)
output[i*bytes_per_channel + b] = input[i*stride + bytes_per_channel-1-b];
write_buf( output, width * height * bytes_per_channel);
delete[] output;
}
// Returns the channel count used for the PSD file depending on the neuray pixel type.
// (Pixel types with only 1 or 2 channels are converted to types with 3 channels.)
mi::Uint32 get_channel_count( const char* pixel_type)
{
if( strcmp( pixel_type, "Float32<4>") == 0) return 4;
if( strcmp( pixel_type, "Rgba" ) == 0) return 4;
if( strcmp( pixel_type, "Rgbea" ) == 0) return 4;
if( strcmp( pixel_type, "Rgba_16" ) == 0) return 4;
if( strcmp( pixel_type, "Color" ) == 0) return 4;
return 3;
}
// Returns the number of bytes per channel for the PSD file depending on the neuray pixel type.
mi::Uint32 get_bytes_per_channel( const char* pixel_type)
{
if( strcmp( pixel_type, "Sint8" ) == 0) return 1;
if( strcmp( pixel_type, "Sint32" ) == 0) return 1;
if( strcmp( pixel_type, "Rgb" ) == 0) return 1;
if( strcmp( pixel_type, "Rgba" ) == 0) return 1;
return 2;
}
// Returns the RGB(A) pixel type for given bytes per channel and number of channels.
const char* get_pixel_type( mi::Uint32 bytes_per_channel, mi::Uint32 channels)
{
assert( channels == 3 || channels == 4);
switch( bytes_per_channel) {
case 1: return channels == 3 ? "Rgb" : "Rgba";
case 2: return channels == 3 ? "Rgb_16" : "Rgba_16";
default: assert( false); return "Rgb";
}
}
// Exports an array of canvases as PSD file.
//
// This method creates PSD files (version 1 only). It supports only 8 and 16 bits per channel
// (other pixel types converted accordingly). It does not support compression.
//
// \param canvases The array of canvases to export.
// \param names Optional array of canvas names.
// \param filename The name of the file to export to.
// \param image_api API component IImage_api (needed for pixel type conversion).
//
// \see "Adobe Photoshop File Formats Specification", July 2010 for file format details.
bool export_psd(
const mi::IArray* canvases,
const mi::IArray* names,
const char* filename,
{
if( !canvases || !filename || !image_api)
return false;
// Check consistent array length
if( names && names->get_length() != canvases->get_length())
return false;
// Compute maximum width, height, bytes per channel, and total number of layers
mi::Uint32 total_width = 0;
mi::Uint32 total_height = 0;
mi::Uint32 total_layers = 0;
mi::Uint32 bytes_per_channel = 0;
for( mi::Uint32 i = 0; i < canvases->get_length(); ++i) {
if( !canvas.is_valid_interface())
return false;
total_width = std::max( total_width, canvas->get_resolution_x());
total_height = std::max( total_height, canvas->get_resolution_y());
total_layers += canvas->get_layers_size();
bytes_per_channel = std::max( bytes_per_channel,
get_bytes_per_channel( canvas->get_type()));
}
// Reject canvases too large for PSD files version 1
if( total_width > 30000 || total_height > 30000)
return false;
// Reject if too many layers in total
if( total_layers == 0 || total_layers > 56)
return false;
// Check names
bool has_result = false;
for( mi::Uint32 i = 0; names && i < names->get_length(); ++i) {
names->get_element<mi::IString>( i));
if( !name.is_valid_interface())
return false;
if( strcmp( name->get_c_str(), "result") == 0)
has_result = true;
}
g_file = fopen( filename, "wb");
if( !g_file)
return false;
// File header section
write_str( "8BPS"); // signature
write_int16( 1); // version
write_buf( "\0\0\0\0\0\0", 6); // reserved
write_int16( 3); // number of channels
write_int32( total_height); // height
write_int32( total_width); // width
write_int16( static_cast<mi::Uint16>( 8*bytes_per_channel)); // bits per channel
write_int16( 3); // color mode (RGB)
write_int32( 0); // length of color mode data section
write_int32( 0); // length of image resource section
// Layer and mask information section
write_int32( 0); // length of layer and mask information section (dummy)
long lamis_start = ftell( g_file);
// Layer and mask information section: Layer info subsection
write_int32( 0); // length of layer information section (dummy)
long lis_start = ftell( g_file);
write_int16( static_cast<mi::Uint16>( total_layers)); // layer count
// Layer records
for( mi::Size i = 0; i < canvases->get_length(); ++i) {
mi::Uint32 width = canvas->get_resolution_x();
const char* name = "";
if( names) {
name = s->get_c_str();
}
bool is_result = strcmp( name, "result") == 0;
for( mi::Size j = 0; j < canvas->get_layers_size(); ++j) {
mi::Uint32 channels = get_channel_count( canvas->get_type());
write_int32( 0); // top
write_int32( 0); // left
write_int32( total_height); // bottom
write_int32( width); // right
write_int16( static_cast<mi::Uint16>( channels)); // number of channels
mi::Uint32 channel_size = width * total_height * bytes_per_channel + 2;
write_int16( 0); // channel ID red
write_int32( channel_size); // byte count red
write_int16( 1); // channel ID green
write_int32( channel_size); // byte count green
write_int16( 2); // channel ID blue
write_int32( channel_size); // byte count blue
if( channels == 4) {
write_int16( 0xFFFF); // channel ID alpha
write_int32( channel_size); // byte count alpha
}
write_str( "8BIM"); // blend mode signature
write_str( "norm"); // blend mode key
write_int8( 255); // opacity
write_int8( 0); // clipping
mi::Uint8 flags = static_cast<mi::Uint8>( !has_result || is_result ? 0 : 2);
write_int8( flags); // flags (invisible = 2)
write_int8( 0); // filler
write_int32( 0); // extra data length (dummy)
long extra_data_start = ftell( g_file);
write_int32( 0); // layer mask data length
write_int32( 0); // layer blending ranges length
write_str_pascal( name, 4); // layer name
// extra data length
long extra_data_end = ftell( g_file);
fseek( g_file, extra_data_start-4, SEEK_SET);
write_int32( static_cast<mi::Uint32>( extra_data_end-extra_data_start));
fseek( g_file, extra_data_end, SEEK_SET);
}
}
// Channel image data
for( mi::Size i = 0; i < canvases->get_length(); ++i) {
mi::Uint32 width = canvas->get_resolution_x();
mi::Uint32 height = canvas->get_resolution_y();
for( mi::Uint32 j = 0; j < canvas->get_layers_size(); ++j) {
mi::Uint32 channels = get_channel_count( canvas->get_type());
mi::Uint8* buffer = new mi::Uint8[width * total_height * channels * bytes_per_channel];
memset( buffer, 0, width * total_height * channels * bytes_per_channel);
mi::Size offset = width * (total_height-height) * channels * bytes_per_channel;
const char* pixel_type = get_pixel_type( bytes_per_channel, channels);
image_api->read_raw_pixels(
width, height, canvas.get(), 0, 0, j, buffer + offset, true, pixel_type);
for( mi::Uint32 channel = 0; channel < channels; ++channel) {
write_int16( 0); // channel compression method (raw)
mi::Uint8* start = buffer + channel * bytes_per_channel;
mi::Uint32 stride = channels * bytes_per_channel;
write_channel( start, width, total_height, bytes_per_channel, stride);
}
delete[] buffer;
}
}
// length of layer information section
long lis_end = ftell( g_file);
fseek( g_file, lis_start-4, SEEK_SET);
write_int32( static_cast<mi::Uint32>( lis_end-lis_start));
fseek( g_file, lis_end, SEEK_SET);
// length of global layer mask info
write_int32( 0);
// length of layer and mask inform. section
long lamis_end = ftell( g_file);
fseek( g_file, lamis_start-4, SEEK_SET);
write_int32( static_cast<mi::Uint32>( lamis_end-lamis_start));
fseek( g_file, lamis_end, SEEK_SET);
// Image data section
mi::Uint32 width = canvas->get_resolution_x();
mi::Uint32 height = canvas->get_resolution_y();
for( mi::Uint32 j = 0; j < canvas->get_layers_size(); ++j) {
mi::Uint32 channels = 3;
mi::Uint8* buffer
= new mi::Uint8[total_width * total_height * channels * bytes_per_channel];
memset( buffer, 0, total_width * total_height * channels * bytes_per_channel);
mi::Size offset = total_width * (total_height-height) * channels * bytes_per_channel;
mi::Uint32 padding = (total_width - width) * channels * bytes_per_channel;
const char* pixel_type = get_pixel_type( bytes_per_channel, channels);
image_api->read_raw_pixels(
width, height, canvas.get(), 0, 0, j, buffer + offset, true, pixel_type, padding);
write_int16( 0); // compression method (raw)
for( mi::Uint32 channel = 0; channel < channels; ++channel) {
mi::Uint8* start = buffer + channel * bytes_per_channel;
mi::Uint32 stride = channels * bytes_per_channel;
write_channel( start, width, total_height, bytes_per_channel, stride);
}
delete[] buffer;
}
fclose( g_file);
return true;
}
// Exports a render target as PSD file.
//
// This method creates PSD files (version 1 only). It supports only 8 and 16 bits per channel
// (other pixel types converted accordingly). It does not support compression.
//
// \param render_target The render target to export.
// \param filename The name of the file to export to.
// \param factory API component IFactory (needed to create new data types).
// \param image_api API component IImage_api (needed for pixel type conversion).
bool export_psd(
Render_target* render_target,
const char* filename,
{
if( !render_target || !filename || !image_api)
return false;
factory->create<mi::IDynamic_array>( "Interface[]"));
check_success( canvases.is_valid_interface());
factory->create<mi::IDynamic_array>( "String[]"));
check_success( names.is_valid_interface());
for( mi::Uint32 i = 0; i < render_target->get_canvas_count(); ++i) {
mi::base::Handle<mi::neuraylib::ICanvas> canvas( render_target->get_canvas( i));
canvases->push_back( canvas.get());
mi::base::Handle<mi::IString> name( factory->create<mi::IString>( "String"));
name->set_c_str( render_target->get_canvas_name( i));
names->push_back( name.get());
}
return export_psd( canvases.get(), names.get(), filename, image_api);
}
void configuration( mi::neuraylib::INeuray* neuray, const char* mdl_path)
{
// Configure the neuray library. Here we set the search path for .mdl files.
check_success( rc->add_mdl_path( mdl_path) == 0);
check_success( rc->add_mdl_path( ".") == 0);
// Load the OpenImageIO, Iray Photoreal, and .mi importer plugins.
check_success( pc->load_plugin_library( "nv_openimageio" MI_BASE_DLL_FILE_EXT) == 0);
check_success( pc->load_plugin_library( "libiray" MI_BASE_DLL_FILE_EXT) == 0);
check_success( pc->load_plugin_library( "mi_importer" MI_BASE_DLL_FILE_EXT) == 0);
}
// Constructor. Creates a render target with three canvases.
Render_target::Render_target( mi::Uint32 width, mi::Uint32 height, mi::neuraylib::IImage_api* image_api)
{
m_canvas[0] = image_api->create_canvas( "Color", width, height, 1);
m_canvas[1] = image_api->create_canvas( "Float32<3>", width, height, 1);
m_canvas[2] = image_api->create_canvas( "Float32", width, height, 1);
}
// Implement the interface of mi::neuraylib::IRender_target.
mi::Uint32 Render_target::get_canvas_count() const { return 3; }
mi::neuraylib::Canvas_type Render_target::get_canvas_type( mi::Uint32 index) const
{
switch (index) {
case 2: return mi::neuraylib::TYPE_DEPTH;
}
}
const char* Render_target::get_canvas_name( mi::Uint32 index) const
{
switch (index) {
case 0: return "result";
case 1: return "normal";
case 2: return "depth";
default: return 0;
}
}
const mi::neuraylib::ICanvas_parameters* Render_target::get_canvas_parameters( mi::Uint32) const
{ return 0; }
const mi::neuraylib::ICanvas* Render_target::get_canvas( mi::Uint32 index) const
{
if( index >= 3)
return 0;
m_canvas[index]->retain();
return m_canvas[index].get();
}
mi::neuraylib::ICanvas* Render_target::get_canvas( mi::Uint32 index)
{
if( index >= 3)
return 0;
m_canvas[index]->retain();
return m_canvas[index].get();
}
// Normalizes the contents of the second and third canvas.
void Render_target::normalize()
{
// Map values in m_canvas[1] linearly from [-1,1] to [0,1].
mi::base::Handle<mi::neuraylib::ITile> tile( m_canvas[1]->get_tile());
mi::Size n_pixels = tile->get_resolution_x() * tile->get_resolution_y();
mi::Float32_3* data1 = static_cast<mi::Float32_3*>( tile->get_data());
for( mi::Size i = 0; i < n_pixels; ++i) {
data1[i].x = mi::math::clamp( 0.5f*data1[i].x + 0.5f, 0.0f, 1.0f);
data1[i].y = mi::math::clamp( 0.5f*data1[i].y + 0.5f, 0.0f, 1.0f);
data1[i].z = mi::math::clamp( 0.5f*data1[i].z + 0.5f, 0.0f, 1.0f);
}
// Map values in m_canvas[2] (excluding huge values) linearly to [0,1].
tile = m_canvas[2]->get_tile();
n_pixels = tile->get_resolution_x() * tile->get_resolution_y();
mi::Float32* data2 = static_cast<mi::Float32*>( tile->get_data());
mi::Float32 min_value = std::numeric_limits<mi::Float32>::max();
mi::Float32 max_value = std::numeric_limits<mi::Float32>::min();
for( mi::Size i = 0; i < n_pixels; ++i) {
if (data2[i] < min_value) min_value = data2[i];
if (data2[i] > max_value && data2[i] < 1.0E38f) max_value = data2[i];
}
if( min_value == max_value)
min_value = max_value-1;
for( mi::Size i = 0; i < n_pixels; ++i)
if( data2[i] < 1.0E38f)
data2[i] = 1.0f - (data2[i] - min_value) / (max_value - min_value);
else
data2[i] = 0.0f;
}
void rendering(
mi::neuraylib::INeuray* neuray, const char* scene_file)
{
// Get the database, the global scope of the database, and create a transaction in the global
// scope for importing the scene file and storing the scene.
check_success( database.is_valid_interface());
database->get_global_scope());
scope->create_transaction());
check_success( transaction.is_valid_interface());
// Import the scene file
check_success( import_api.is_valid_interface());
mi::base::Handle<const mi::IString> uri( import_api->convert_filename_to_uri( scene_file));
import_api->import_elements( transaction.get(), uri->get_c_str()));
check_success( import_result->get_error_number() == 0);
// Create the scene object
transaction->create<mi::neuraylib::IScene>( "Scene"));
scene->set_rootgroup( import_result->get_rootgroup());
scene->set_options( import_result->get_options());
scene->set_camera_instance( import_result->get_camera_inst());
transaction->store( scene.get(), "the_scene");
// Create the render context using the Iray Photoreal render mode
scene = transaction->edit<mi::neuraylib::IScene>( "the_scene");
scene->create_render_context( transaction.get(), "iray"));
check_success( render_context.is_valid_interface());
mi::base::Handle<mi::IString> scheduler_mode( transaction->create<mi::IString>());
scheduler_mode->set_c_str( "batch");
render_context->set_option( "scheduler_mode", scheduler_mode.get());
scene = 0;
// Create the render target and render the scene
mi::base::Handle<Render_target> render_target( new Render_target( 512, 384, image_api.get()));
check_success(
render_context->render( transaction.get(), render_target.get(), 0) >= 0);
// Write the image to disk (entire render target as one PSD file)
render_target->normalize();
check_success( export_psd(
render_target.get(), "example_psd_exporter.psd", factory.get(), image_api.get()));
// Write the image to disk (individual canvases as PNG files)
check_success( export_api.is_valid_interface());
mi::base::Handle<mi::neuraylib::ICanvas> canvas0( render_target->get_canvas( 0));
export_api->export_canvas( "file:example_psd_exporter_0.png", canvas0.get());
mi::base::Handle<mi::neuraylib::ICanvas> canvas1( render_target->get_canvas( 1));
export_api->export_canvas( "file:example_psd_exporter_1.png", canvas1.get());
mi::base::Handle<mi::neuraylib::ICanvas> canvas2( render_target->get_canvas( 2));
export_api->export_canvas( "file:example_psd_exporter_2.png", canvas2.get());
transaction->commit();
}
int main( int argc, char* argv[])
{
// Collect command line parameters
if( argc != 3) {
std::cerr << "Usage: example_psd_exporter <scene_file> <mdl_path>" << std::endl;
keep_console_open();
return EXIT_FAILURE;
}
const char* scene_file = argv[1];
const char* mdl_path = argv[2];
// Access the neuray library
mi::base::Handle<mi::neuraylib::INeuray> neuray( load_and_get_ineuray());
check_success( neuray.is_valid_interface());
// Configure the neuray library
configuration( neuray.get(), mdl_path);
// Start the neuray library
mi::Sint32 result = neuray->start();
check_start_success( result);
// Do the actual rendering
rendering( neuray.get(), scene_file);
// Shut down the neuray library
check_success( neuray->shutdown() == 0);
neuray = 0;
// Unload the neuray library
check_success( unload());
keep_console_open();
return EXIT_SUCCESS;
}
This interface represents static arrays, i.e., arrays with a fixed number of elements.
Definition: iarray.h:37
virtual const base::IInterface * get_element(Size index) const =0
Returns the index -th element of the array.
virtual Size get_length() const =0
Returns the size of the array.
This interface represents dynamic arrays, i.e., arrays with a variable number of elements.
Definition: idynamic_array.h:36
A simple string class.
Definition: istring.h:22
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:113
Mixin class template for deriving interface implementations.
Definition: interface_implement.h:41
Fixed-size math vector class template with generic operations.
Definition: vector.h:286
Abstract interface for render target canvas parameters.
Definition: irender_target.h:106
Abstract interface for a canvas represented by a rectangular array of tiles.
Definition: icanvas.h:85
This interface is used to interact with the distributed database.
Definition: idatabase.h:293
This interface is used to export files.
Definition: iexport_api.h:38
This API component allows the creation, assignment, and cloning of instances of types.
Definition: ifactory.h:35
virtual base::IInterface * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=0)=0
Creates an object of the type type_name.
This interface provides various utilities related to canvases and buffers.
Definition: iimage_api.h:49
virtual ICanvas * create_canvas(const char *pixel_type, Uint32 width, Uint32 height, Uint32 layers=1, bool is_cubemap=false, Float32 gamma=0.0f) const =0
Creates a canvas with given pixel type, resolution, and layers.
virtual Sint32 read_raw_pixels(Uint32 width, Uint32 height, const ICanvas *canvas, Uint32 canvas_x, Uint32 canvas_y, Uint32 canvas_layer, void *buffer, bool buffer_topdown, const char *buffer_pixel_type, Uint32 buffer_padding=0) const =0
Reads raw pixel data from a canvas.
This interface is used to import files.
Definition: iimport_api.h:100
This is an object representing the Iray library.
Definition: ineuray.h:44
virtual Sint32 shutdown(bool blocking=true)=0
Shuts down the library.
virtual base::IInterface * get_api_component(const base::Uuid &uuid) const =0
Returns an API component from the Iray SDK API.
virtual Sint32 start(bool blocking=true)=0
Starts the operation of the Iray library.
This interface is used to load plugins and to query information about loaded plugins.
Definition: iplugin_configuration.h:24
This interface is used to query and change the rendering configuration.
Definition: irendering_configuration.h:109
The scene is the top-level element describing a subset of DB elements to be rendered.
Definition: iscene.h:44
#define MI_BASE_DLL_FILE_EXT
The operating system specific default filename extension for shared libraries (DLLs)
Definition: config.h:340
virtual Uint32 retain() const =0
Increments the reference count.
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
float Float32
32-bit float.
Definition: types.h:51
unsigned short Uint16
16-bit unsigned integer.
Definition: types.h:48
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Float32 length(Float32 a)
Returns the Euclidean norm of the scalar a (its absolute value).
Definition: function.h:1114
Color clamp(const Color &c, const Color &low, const Color &high)
Returns the color c elementwise clamped to the range [low, high].
Definition: color.h:525
Canvas_type
The type of a canvas in an mi::neuraylib::IRender_target_base.
Definition: irender_target.h:32
@ TYPE_DEPTH
"Float32" orthogonal distance to sensor
Definition: irender_target.h:42
@ TYPE_UNDEFINED
not a valid canvas type
Definition: irender_target.h:62
@ TYPE_RESULT
"Color" (includes alpha) or "Rgb_fp" result
Definition: irender_target.h:33
@ TYPE_NORMAL
"Float32_3" shading normal
Definition: irender_target.h:46
Iray SDK API.
[Previous] [Next] [Up]