Data Structures | Macros | Variables
Camera Nodes

Camera initialization and update, and custom camera node implementation. More...

Data Structures

struct  AtCameraInput
 Camera ray creation inputs. More...
 
struct  AtCameraOutput
 Camera ray creation outputs. More...
 
struct  AtCameraNodeMethods
 Camera node methods structure. More...
 

Macros

#define AI_CAMERA_NODE_EXPORT_METHODS(tag)
 Camera node methods exporter. More...
 

Variables

float AtCameraInput::sx
 
float AtCameraInput::sy
 screen-space coordinates will range between (screen_window_min.x, screen_window_min.y/frame_aspect_ratio) and (screen_window_max.x, screen_window_max.y/frame_aspect_ratio)
 
float AtCameraInput::dsx
 
float AtCameraInput::dsy
 derivatives of the screen-space coordinates with respect to pixel coordinates
 
float AtCameraInput::lensx
 
float AtCameraInput::lensy
 lens sampling coordinates in [0,1)^2

 
float AtCameraInput::relative_time
 time relative to this camera (in [0,1))

 
AtVector AtCameraOutput::origin
 ray origin in camera space (required)

 
AtVector AtCameraOutput::dir
 ray direction in camera space (required)
 
AtVector AtCameraOutput::dOdx
 
AtVector AtCameraOutput::dOdy
 derivative of the ray origin with respect to the pixel coordinates (optional - defaults to 0)

 
AtVector AtCameraOutput::dDdx
 
AtVector AtCameraOutput::dDdy
 derivative of the ray direction with respect to the pixel coordinates (optional - defaults to 0)
 
AtRGB AtCameraOutput::weight
 weight of this ray (used for vignetting) (optional - defaults to AI_RGB_WHITE)
 
void(* AtCameraNodeMethods::CreateRay )(const AtNode *, const AtCameraInput &, AtCameraOutput &, uint16_t tid)
 
bool(* AtCameraNodeMethods::ReverseRay )(const AtNode *node, const AtVector &Po, float relative_time, AtVector2 &Ps)
 

API Methods for Camera Writers

AI_API void AiCameraInitialize (AtNode *node)
 Initialize the camera's internal data. More...
 
AI_API void AiCameraUpdate (AtNode *node, bool plane_distance)
 Updates camera's internal data. More...
 

Node Method Declarations

#define camera_create_ray   static void CameraCreateRay(const AtNode* node, const AtCameraInput& input, AtCameraOutput& output, uint16_t tid)
 Camera's camera_create_ray method declaration. More...
 
#define camera_reverse_ray   static bool CameraReverseRay(const AtNode* node, const AtVector &Po, float relative_time, AtVector2 &Ps)
 Camera's camera_reverse_ray method declaration. More...
 

Detailed Description

Camera initialization and update, and custom camera node implementation.

Macro Definition Documentation

◆ AI_CAMERA_NODE_EXPORT_METHODS

#define AI_CAMERA_NODE_EXPORT_METHODS (   tag)
Value:
camera_reverse_ray; \
static AtCameraNodeMethods ai_cam_mtds = { \
CameraCreateRay, \
CameraReverseRay \
}; \
static AtNodeMethods ai_node_mtds = { \
&ai_common_mtds, \
&ai_cam_mtds \
}; \
const AtNodeMethods* tag = &ai_node_mtds;
#define camera_create_ray
Camera's camera_create_ray method declaration.
Definition: ai_cameras.h:96
Camera node methods structure.
Definition: ai_cameras.h:50
Node methods.
Definition: ai_node_entry.h:86

Camera node methods exporter.

◆ camera_create_ray

#define camera_create_ray   static void CameraCreateRay(const AtNode* node, const AtCameraInput& input, AtCameraOutput& output, uint16_t tid)

Camera's camera_create_ray method declaration.

This function is called for the camera to return a ray origin and direction given a point in 2d screen coordinates.

Parameters
nodepointer to the camera node itself
inputAtCameraInput data required to generate a new ray (screen position, derivatives, etc...)
[out]outputCamera ray origin, direction and weight. Derivatives are set to zero by default. Estimates will be computed if they are not set.
tidthread ID that will cast this ray

◆ camera_reverse_ray

#define camera_reverse_ray   static bool CameraReverseRay(const AtNode* node, const AtVector &Po, float relative_time, AtVector2 &Ps)

Camera's camera_reverse_ray method declaration.

This function is the reverse of camera_create_ray: given a point in camera space 3d coordinates return the corresponding 2d screen coordinates.

Parameters
nodepointer to the camera node itself
PoPoint in camera space
relative_timeRelative time to compute the projection in
[out]PsOutput point in screen space
Returns
True if a screen space projection exists and False otherwise. Points that fall outside the frame should return True and compute the corresponding screen coordinates, only points with no projection at all should return False. False can also be returned if there's no implementation available.

Function Documentation

◆ AiCameraInitialize()

AI_API void AiCameraInitialize ( AtNode node)

Initialize the camera's internal data.

This must be called once and only once during node_initialize

Parameters
nodepointer to the camera node

◆ AiCameraUpdate()

AI_API void AiCameraUpdate ( AtNode node,
bool  plane_distance 
)

Updates camera's internal data.

This must be called during node_update

Parameters
nodepointer to the camera node
plane_distancewill the Z-depth and near/far clip be computed from the camera plane, or from the camera point?

© 2023 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com