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

The camera defines the viewpoint from which the scene is rendered. More...

#include <icamera.h>

Inheritance diagram for mi::neuraylib::ICamera:

Public Member Functions

General methods
virtual bool get_orthographic () const =0
 Returns the projection mode of the camera. More...
 
virtual void set_orthographic (bool orthographic)=0
 Sets the projection mode of the camera. More...
 
virtual Float64 get_focal () const =0
 Returns the focal length. More...
 
virtual void set_focal (Float64 focal)=0
 Sets the focal length. More...
 
virtual Float64 get_aperture () const =0
 Returns the aperture width. More...
 
virtual void set_aperture (Float64 aperture)=0
 Sets the aperture width. More...
 
virtual Float64 get_clip_min () const =0
 Returns the hither clipping distance. More...
 
virtual void set_clip_min (Float64 clip_min)=0
 Sets the hither clipping distance. More...
 
virtual Float64 get_clip_max () const =0
 Returns the yon clipping distance. More...
 
virtual void set_clip_max (Float64 clip_max)=0
 Sets the yon clipping distance. More...
 
virtual Float64 get_offset_x () const =0
 Returns the horizontal image plane shift. More...
 
virtual void set_offset_x (Float64 offset_x)=0
 Sets the horizontal image plane shift. More...
 
virtual Float64 get_offset_y () const =0
 Returns the vertical image plane shift. More...
 
virtual void set_offset_y (Float64 offset_y)=0
 Sets the vertical image plane shift. More...
 
virtual Uint32 get_resolution_x () const =0
 Returns the raster space X resolution. More...
 
virtual void set_resolution_x (Uint32 resolution_x)=0
 Sets the raster space X resolution. More...
 
virtual Uint32 get_resolution_y () const =0
 Returns the raster space Y resolution. More...
 
virtual void set_resolution_y (Uint32 resolution_y)=0
 Sets the raster space Y resolution. More...
 
virtual Float64 get_frame_time () const =0
 Returns the frame time in seconds. More...
 
virtual void set_frame_time (Float64 frame_time)=0
 Sets the frame time in seconds. More...
 
virtual Float64 get_aspect () const =0
 Returns the aspect ratio. More...
 
virtual void set_aspect (Float64 aspect)=0
 Sets the aspect ratio. More...
 
Methods related to the subwindow

The subwindow is given by [xl,xh] x [yl,yh], i.e., the upper right corner is part of the window. For rendering, these values are clipped against the window [0,0] x [res_x-1,res_y-1] defined by the resolution.

The subwindow allows to limit the rendered image to a rectangular subset of the full resolution. Pixels outside of the subwindow will not be modified by rendering. Render target canvases must either be large enough to fit the shifted subwindow, i.e. their resolution must be at least xh+1 x yh+1, or canvas resolutions must match the subwindow resolution exactly.

virtual Uint32 get_window_xl () const =0
 Returns the x-coordinate of the lower left corner of the subwindow in raster space. More...
 
virtual void set_window_xl (Uint32 window_xl)=0
 Sets the x-coordinate of the lower left corner of the subwindow in raster space. More...
 
virtual Uint32 get_window_yl () const =0
 Returns the y-coordinate of the lower left corner of the subwindow in raster space. More...
 
virtual void set_window_yl (Uint32 window_yl)=0
 Sets the y-coordinate of the lower left corner of the subwindow in raster space. More...
 
virtual Uint32 get_window_xh () const =0
 Returns the x-coordinate of the upper right corner of the subwindow in raster space. More...
 
virtual void set_window_xh (Uint32 window_xh)=0
 Sets the x-coordinate of the upper right corner of the subwindow in raster space. More...
 
virtual Uint32 get_window_yh () const =0
 Returns the y-coordinate of the upper right corner of the subwindow in raster space. More...
 
virtual void set_window_yh (Uint32 window_yh)=0
 Sets the y-coordinate of the upper right corner of the subwindow in raster space. More...
 
Methods related to MDL
virtual Sint32 set_backplate_function (const char *name)=0
 Sets the backplate function. More...
 
virtual const char * get_backplate_function () const =0
 Returns the backplate function. More...
 
virtual void set_backplate_background_color (const Color_struct &color)=0
 Sets the background color of the backplate. More...
 
virtual Color_struct get_backplate_background_color () const =0
 Returns the background color of the backplate. More...
 
virtual void set_backplate_tonemapping_enabled (bool flag)=0
 Enables or disables tonemapping of the backplate. More...
 
virtual bool get_backplate_tonemapping_enabled () const =0
 Indicates whether tonemapping of the backplate is enabled. More...
 
virtual void set_backplate_lens_effects_enabled (bool flag)=0
 Enables or disables lens effects on the backplate. More...
 
virtual bool get_backplate_lens_effects_enabled () const =0
 Indicates whether lens effects on the backplate are enabled. More...
 
virtual Sint32 set_aperture_function (const char *name)=0
 Sets the aperture function. More...
 
virtual const char * get_aperture_function () const =0
 Returns the aperture function. More...
 
Methods related to irradiance probes
virtual Sint32 set_irradiance_probes (const char *probes)=0
 Sets the scene element containing the irradiance probes. More...
 
virtual const char * get_irradiance_probes () const =0
 Returns the scene element containing the irradiance probes. 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

- Public Types inherited from mi::base::Interface_declare< 0xb23d7fee, ... >
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...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xb23d7fee, ... >
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

The camera defines the viewpoint from which the scene is rendered.

Multiple cameras can be defined but only one can be used for rendering at a time, which is the camera referenced by mi::neuraylib::IScene::get_camera_instance().

The camera defines various characteristics such as focal length, aperture, and aspect ratio, as well as the sizes of rendered frame buffers.

The camera is fixed at the origin, looking down the negative Z-axis, with up being the positive Y-axis. The camera can be placed anywhere in world space using a transformation in an mi::neuraylib::IInstance class, in the same way that objects are placed anywhere in world space.

Environment

To specify the environment via MDL use the attribute environment_function on mi::neuraylib::IOptions. See Section "Environment dome" of the Iray Programmer's Manual.

Stereo Camera

While this camera interface has no built-in support for stereo cameras, it is flexible enough to support such a setup. Suppose the camera for both views is separated by the horizontal distance eye_distance and the distance to the screen is given by screen_distance. The difference between the offset_x values of both views is then given by

delta = eye_separation * focal_length * resolution_x / (screen_distance * aperture)

So when rendering the view for the left eye you should increase offset_x by delta/2, and decrease it by delta/2 for the right eye. If no explicit distance to the screen is known, the focal length might be used instead.

Member Function Documentation

 get_aperture()

virtual Float64 mi::neuraylib::ICamera::get_aperture ( ) const
pure virtual

Returns the aperture width.

 get_aperture_function()

virtual const char * mi::neuraylib::ICamera::get_aperture_function ( ) const
pure virtual

Returns the aperture function.

The aperture function is of type mi::neuraylib::IFunction_call.

See also
Section "Lens" of the Iray Programmer's Manual for details.
Returns
The name of the aperture function, or NULL if no aperture function is attached.

 get_aspect()

virtual Float64 mi::neuraylib::ICamera::get_aspect ( ) const
pure virtual

Returns the aspect ratio.

 get_backplate_background_color()

virtual Color_struct mi::neuraylib::ICamera::get_backplate_background_color ( ) const
pure virtual

Returns the background color of the backplate.

See also
Section "Virtual backplate" of the Iray Programmer's Manual for details.

 get_backplate_function()

virtual const char * mi::neuraylib::ICamera::get_backplate_function ( ) const
pure virtual

Returns the backplate function.

The backplate function is of type mi::neuraylib::IFunction_call.

See also
Section "Virtual backplate" of the Iray Programmer's Manual for details.
Returns
The name of the backplate function, or NULL if no backplate function is attached.

 get_backplate_lens_effects_enabled()

virtual bool mi::neuraylib::ICamera::get_backplate_lens_effects_enabled ( ) const
pure virtual

Indicates whether lens effects on the backplate are enabled.

 get_backplate_tonemapping_enabled()

virtual bool mi::neuraylib::ICamera::get_backplate_tonemapping_enabled ( ) const
pure virtual

Indicates whether tonemapping of the backplate is enabled.

 get_clip_max()

virtual Float64 mi::neuraylib::ICamera::get_clip_max ( ) const
pure virtual

Returns the yon clipping distance.

 get_clip_min()

virtual Float64 mi::neuraylib::ICamera::get_clip_min ( ) const
pure virtual

Returns the hither clipping distance.

 get_focal()

virtual Float64 mi::neuraylib::ICamera::get_focal ( ) const
pure virtual

Returns the focal length.

 get_frame_time()

virtual Float64 mi::neuraylib::ICamera::get_frame_time ( ) const
pure virtual

Returns the frame time in seconds.

 get_irradiance_probes()

virtual const char * mi::neuraylib::ICamera::get_irradiance_probes ( ) const
pure virtual

Returns the scene element containing the irradiance probes.

The irradiance probes are of type mi::neuraylib::IIrradiance_probes.

Returns
The name of the irradiance probes, or NULL if no irradiance probes are attached to the camera.

 get_offset_x()

virtual Float64 mi::neuraylib::ICamera::get_offset_x ( ) const
pure virtual

Returns the horizontal image plane shift.

 get_offset_y()

virtual Float64 mi::neuraylib::ICamera::get_offset_y ( ) const
pure virtual

Returns the vertical image plane shift.

 get_orthographic()

virtual bool mi::neuraylib::ICamera::get_orthographic ( ) const
pure virtual

Returns the projection mode of the camera.

Returns
true for orthographic cameras, false for perspective cameras (default).

 get_resolution_x()

virtual Uint32 mi::neuraylib::ICamera::get_resolution_x ( ) const
pure virtual

Returns the raster space X resolution.

 get_resolution_y()

virtual Uint32 mi::neuraylib::ICamera::get_resolution_y ( ) const
pure virtual

Returns the raster space Y resolution.

 get_window_xh()

virtual Uint32 mi::neuraylib::ICamera::get_window_xh ( ) const
pure virtual

Returns the x-coordinate of the upper right corner of the subwindow in raster space.

 get_window_xl()

virtual Uint32 mi::neuraylib::ICamera::get_window_xl ( ) const
pure virtual

Returns the x-coordinate of the lower left corner of the subwindow in raster space.

 get_window_yh()

virtual Uint32 mi::neuraylib::ICamera::get_window_yh ( ) const
pure virtual

Returns the y-coordinate of the upper right corner of the subwindow in raster space.

 get_window_yl()

virtual Uint32 mi::neuraylib::ICamera::get_window_yl ( ) const
pure virtual

Returns the y-coordinate of the lower left corner of the subwindow in raster space.

 set_aperture()

virtual void mi::neuraylib::ICamera::set_aperture ( Float64  aperture)
pure virtual

Sets the aperture width.

 set_aperture_function()

virtual Sint32 mi::neuraylib::ICamera::set_aperture_function ( const char *  name)
pure virtual

Sets the aperture function.

See also
Section "Lens" of the Iray Programmer's Manual for details.
Parameters
nameThe name of the aperture function, or NULL to remove the current aperture function.
Returns
  • 0: Success.
  • -2: There is no element with that name.
  • -3: The element can not be attached to the camera because it is in a more private scope than the camera.
  • -4: The element does not have the correct type mi::neuraylib::IFunction_call.

 set_aspect()

virtual void mi::neuraylib::ICamera::set_aspect ( Float64  aspect)
pure virtual

Sets the aspect ratio.

 set_backplate_background_color()

virtual void mi::neuraylib::ICamera::set_backplate_background_color ( const Color_struct color)
pure virtual

Sets the background color of the backplate.

See also
Section "Virtual backplate" of the Iray Programmer's Manual for details.

 set_backplate_function()

virtual Sint32 mi::neuraylib::ICamera::set_backplate_function ( const char *  name)
pure virtual

Sets the backplate function.

See also
Section "Virtual backplate" of the Iray Programmer's Manual for details.
Parameters
nameThe name of the backplate function, or NULL to remove the current backplate function.
Returns
  • 0: Success.
  • -2: There is no element with that name.
  • -3: The element can not be attached to the camera because it is in a more private scope than the camera.
  • -4: The element does not have the correct type mi::neuraylib::IFunction_call.

 set_backplate_lens_effects_enabled()

virtual void mi::neuraylib::ICamera::set_backplate_lens_effects_enabled ( bool  flag)
pure virtual

Enables or disables lens effects on the backplate.

By default, lens effects on the backplate is disabled.

 set_backplate_tonemapping_enabled()

virtual void mi::neuraylib::ICamera::set_backplate_tonemapping_enabled ( bool  flag)
pure virtual

Enables or disables tonemapping of the backplate.

By default, tonemapping of the backplate is disabled.

 set_clip_max()

virtual void mi::neuraylib::ICamera::set_clip_max ( Float64  clip_max)
pure virtual

Sets the yon clipping distance.

 set_clip_min()

virtual void mi::neuraylib::ICamera::set_clip_min ( Float64  clip_min)
pure virtual

Sets the hither clipping distance.

 set_focal()

virtual void mi::neuraylib::ICamera::set_focal ( Float64  focal)
pure virtual

Sets the focal length.

 set_frame_time()

virtual void mi::neuraylib::ICamera::set_frame_time ( Float64  frame_time)
pure virtual

Sets the frame time in seconds.

 set_irradiance_probes()

virtual Sint32 mi::neuraylib::ICamera::set_irradiance_probes ( const char *  probes)
pure virtual

Sets the scene element containing the irradiance probes.

See also
mi::neuraylib::IIrradiance_probes
Parameters
probesThe name of the irradiance probes, or NULL to remove the current irradiance probes from the camera.
Returns
  • 0: Success.
  • -2: There is no element with that name.
  • -3: The element can not be attached to the camera because it is in a more private scope than the camera.
  • -4: The element does not have the correct type mi::neuraylib::IIrradiance_probes.

 set_offset_x()

virtual void mi::neuraylib::ICamera::set_offset_x ( Float64  offset_x)
pure virtual

Sets the horizontal image plane shift.

 set_offset_y()

virtual void mi::neuraylib::ICamera::set_offset_y ( Float64  offset_y)
pure virtual

Sets the vertical image plane shift.

 set_orthographic()

virtual void mi::neuraylib::ICamera::set_orthographic ( bool  orthographic)
pure virtual

Sets the projection mode of the camera.

Parameters
orthographictrue for orthographic cameras, false for perspective cameras (default)

 set_resolution_x()

virtual void mi::neuraylib::ICamera::set_resolution_x ( Uint32  resolution_x)
pure virtual

Sets the raster space X resolution.

 set_resolution_y()

virtual void mi::neuraylib::ICamera::set_resolution_y ( Uint32  resolution_y)
pure virtual

Sets the raster space Y resolution.

 set_window_xh()

virtual void mi::neuraylib::ICamera::set_window_xh ( Uint32  window_xh)
pure virtual

Sets the x-coordinate of the upper right corner of the subwindow in raster space.

 set_window_xl()

virtual void mi::neuraylib::ICamera::set_window_xl ( Uint32  window_xl)
pure virtual

Sets the x-coordinate of the lower left corner of the subwindow in raster space.

 set_window_yh()

virtual void mi::neuraylib::ICamera::set_window_yh ( Uint32  window_yh)
pure virtual

Sets the y-coordinate of the upper right corner of the subwindow in raster space.

 set_window_yl()

virtual void mi::neuraylib::ICamera::set_window_yl ( Uint32  window_yl)
pure virtual

Sets the y-coordinate of the lower left corner of the subwindow in raster space.