NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::ICamera Class Referenceabstract

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

Inheritance diagram for mi::ICamera:
Inheritance graph
[legend]

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 Uint32  get_window_xl () const =0
  Returns the x-coordinate of the lower left corner of the render 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 render subwindow in raster space. More...
 
virtual Uint32  get_window_yl () const =0
  Returns the y-coordinate of the lower left corner of the render 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 render subwindow in raster space. More...
 
virtual Uint32  get_window_xh () const =0
  Returns the x-coordinate of the upper right corner of the render 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 render subwindow in raster space. More...
 
virtual Uint32  get_window_yh () const =0
  Returns the y-coordinate of the upper right corner of the render 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 render subwindow in raster space. 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 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...
 
Methods related to MDL and MetaSL
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_dof_enabled (bool flag)=0
  Enables or disables depth of field of the backplate. More...
 
virtual bool  get_backplate_dof_enabled () const =0
  Indicates whether depth of field of the backplate is enabled. 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...
 
Methods related to MetaSL (deprecated)
virtual Sint32  attach_shader (Shader_type type, const char *name)=0
  Attaches a shader to the camera. More...
 
virtual Sint32  detach_shader (Shader_type type)=0
  Detaches a shader from the camera. More...
 
virtual const IShader access_shader (Shader_type type) const =0
  Returns a shader attached to the camera. More...
 
virtual IShader edit_shader (Shader_type type) const =0
  Returns the specified shader. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xb23d7fee, 0xffb9, 0x4076, 0xa0, 0x3a, 0x34, 0xbb, 0xa1, 0x08, 0x75, 0x91, IScene_element >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IScene_element
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xb23d7fee, 0xffb9, 0x4076, 0xa0, 0x3a, 0x34, 0xbb, 0xa1, 0x08, 0x75, 0x91, IScene_element >
static bool  compare_iid (const Uuid &iid)
  Compares the interface ID iid against the interface ID of this interface and of its ancestors. 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::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::IOptions, see the Programmer's Manual section Environment dome and implicit groundplane for details. For the MetaSL variant use the methods attach_shader() etc. on this class. If both MDL and MetaSL environment functions are present then the MDL settings have precedence.

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

virtual const IShader* mi::ICamera::access_shader ( Shader_type  type) const
pure virtual

Returns a shader attached to the camera.

Parameters
type The shader type to return. Valid shader types are mi::VOLUME_SHADER and mi::ENVIRONMENT_SHADER.
Returns
The shader of the specified type, or NULL if there is no such shader attached.
virtual Sint32 mi::ICamera::attach_shader ( Shader_type  type,
const char *  name 
)
pure virtual

Attaches a shader to the camera.

Any previously attached shader of that type is automatically detached.

Parameters
type The shader type to attach. Valid shader types are mi::VOLUME_SHADER and mi::ENVIRONMENT_SHADER.
name The shader to attach.
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer or invalid enum value).
  • -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::IShader, mi::IShader_graph, or mi::IMaterial.
virtual Sint32 mi::ICamera::detach_shader ( Shader_type  type)
pure virtual

Detaches a shader from the camera.

Parameters
type The shader type to detach. Valid shader types are mi::VOLUME_SHADER and mi::ENVIRONMENT_SHADER.
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer or invalid enum value).
  • -2: There was no shader of that type attached.
virtual IShader* mi::ICamera::edit_shader ( Shader_type  type) const
pure virtual

Returns the specified shader.

Parameters
type The shader type to return. Valid shader types are mi::VOLUME_SHADER and mi::ENVIRONMENT_SHADER.
Returns
The shader of the specified type, or NULL if there is no such shader attached.
virtual Float64 mi::ICamera::get_aperture ( ) const
pure virtual

Returns the aperture width.

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

Returns the aspect ratio.

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

Returns the background color of the backplate.

See Also
Section Virtual backplate of the Programmer's Manual for details.
virtual bool mi::ICamera::get_backplate_dof_enabled ( ) const
pure virtual

Indicates whether depth of field of the backplate is enabled.

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

Returns the backplate function.

The backplate function is of type mi::IMdl_function_call.

See Also
Section Virtual backplate of the Programmer's Manual for details.
Returns
The name of the backplate function, or NULL if no backplate function is attached.
virtual bool mi::ICamera::get_backplate_tonemapping_enabled ( ) const
pure virtual

Indicates whether tonemapping of the backplate is enabled.

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

Returns the yon clipping distance.

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

Returns the hither clipping distance.

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

Returns the focal length.

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

Returns the frame time in seconds.

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

Returns the scene element containing the irradiance probes.

The irradiance probes backplate function is of type mi::IIrradiance_probes.

Returns
The name of the irradiance probes, or NULL if no irradiance probes are attached to the camera.
virtual Float64 mi::ICamera::get_offset_x ( ) const
pure virtual

Returns the horizontal image plane shift.

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

Returns the vertical image plane shift.

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

Returns the projection mode of the camera.

Returns
true for orthographic cameras, false for perspective cameras (default).
virtual Uint32 mi::ICamera::get_resolution_x ( ) const
pure virtual

Returns the raster space X resolution.

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

Returns the raster space Y resolution.

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

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

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

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

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

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

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

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

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

Sets the aperture width.

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

Sets the aspect ratio.

virtual void mi::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 Programmer's Manual for details.
virtual void mi::ICamera::set_backplate_dof_enabled ( bool  flag)
pure virtual

Enables or disables depth of field of the backplate.

By default, depth of field of the backplate is disabled.

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

Sets the backplate function.

See Also
Section Virtual backplate of the Programmer's Manual for details.
Parameters
name The 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::IMdl_function_call.
virtual void mi::ICamera::set_backplate_tonemapping_enabled ( bool  flag)
pure virtual

Enables or disables tonemapping of the backplate.

By default, tonemapping of the backplate is disabled.

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

Sets the yon clipping distance.

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

Sets the hither clipping distance.

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

Sets the focal length.

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

Sets the frame time in seconds.

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

Sets the scene element containing the irradiance probes.

See Also
mi::IIrradiance_probes
Parameters
probes The 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::IIrradiance_probes.
virtual void mi::ICamera::set_offset_x ( Float64  offset_x)
pure virtual

Sets the horizontal image plane shift.

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

Sets the vertical image plane shift.

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

Sets the projection mode of the camera.

Parameters
orthographic true for orthographic cameras, false for perspective cameras (default)
virtual void mi::ICamera::set_resolution_x ( Uint32  resolution_x)
pure virtual

Sets the raster space X resolution.

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

Sets the raster space Y resolution.

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

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

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

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

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

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

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

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