Fovia's C++ Client/Server API
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
RENDER_PARAMS Struct Reference

Public Member Functions

void CombineWith (const RENDER_PARAMS &src)
 
RENDER_PARAMSoperator= (const RENDER_PARAMS &r)
 
 RENDER_PARAMS (const RENDER_PARAMS &r)
 
void RoundUpImageSize ()
 
signed int SetDefaults ()
 
signed int Validate (VOLUME_DATA_PARAMS *vdp, signed int bNormalizeTF)
 

Static Public Member Functions

static signed int IsRenderTypePerspective (ENUM_RENDER_TYPE renderType)
 

Public Attributes

unsigned int Ambience
 
short AutoNav
 
double AutoNavSpeed
 
signed int BackColor
 
signed int Brightness
 
signed int cbSize
 
ENUM_COLOR_MODEL ColorModel
 
CROP_BOX_PARAMS CropBox
 
CUT_PLANE_PARAMS CutPlanes [MAX_CUTPLANES]
 
ENUM_CUT_PLANE_MODE CutPlanesMode
 
signed int DesiredFPS
 
ENUM_RENDER_FLAGS Flags
 
ENUM_RENDER_FLAGS FlagsMask
 
unsigned int FrontSlabPolygonTransparency
 
signed int GradInsenSlab
 
ENUM_LIGHT_MODEL LightModel
 
LIGHT_DEFINITION LightParams
 
ENUM_RENDER_PARAMS_MASK Mask
 
signed int MinQualityBias
 
signed int NumRenderingThreads
 
ENUM_RENDER_QUALITY Quality
 
signed int RaycastingPrecision
 
unsigned int RearSlabPolygonTransparency
 
signed int Reflection
 
SIZE RenderImageSize
 
signed int RenderRangeMax
 
signed int RenderRangeMin
 
RENDER_RANGE_PARAMS RenderRanges [MAX_RENDER_RANGES_PARAMS]
 
signed int RenderSamples
 
ENUM_RENDER_TYPE RenderType
 
signed int Reserved
 
signed int Shininess
 
float SlabThickness
 
ENUM_STEREO_MODE StereoMode
 
double StereoSeparation
 
MATRIX44D Transform
 
float ViewAngle
 
float Zoom
 

Detailed Description

Specifies rendering parameters to a rendering engine.

RENDER_PARAMS::Mask allows you to set/get a part of the rendering parameters. It will be generally a bit faster to update the changing part of rendering parameters instead of setting all of them. For instance, when only orientation is changed the RENDER_PARAMS::Mask should be set to RPM_TRANSFORM.

Similarly, RENDER_PARAMS::FlagsMask specifies which of the flags are valid in this object. For example. A FlagsMask of RF_DONT_NORMALIZE_TF and Flags of 0 means that RF_DONT_NORMALIZE_TF is valid in this object and it is being set to false. If Flags were set to RF_NO_NORMALIZE as well, it would be set to true.

As a rule of thumb, zero(s) are considered the default value, but the following fields
must be initialized on first call:
  @li #RenderType -- the rendering type
  @li #Transform -- must have meaningful values (i.e. at least identity matrix)
  @li #RenderRanges -- must be filled for parallel/perspective rendering @ref p_transferfunc
  @li #RenderRangeMin-- must be filled for mpr/mip/ave rendering
  @li #RenderRangeMax -- must be filled for mpr/mip/ave rendering

Member Function Documentation

void RENDER_PARAMS::CombineWith ( const RENDER_PARAMS src)
inline

Combines all of the valid fields in src into this object. The valid fields are specified by the Mask and FlagsMask fields.

Parameters
srcRENDER_PARAMS

References PLANEEQF::a, Ambience, RENDER_RANGE_PARAMS::aPnt, LIGHT_DEFINITION::attachment, PLANEEQF::b, BackColor, Brightness, PLANEEQF::c, COLORED_POINT::c, COLORED_POINT::c2, ColorModel, CropBox, CutPlanes, CutPlanesMode, SIZE::cx, SIZE::cy, PLANEEQF::d, DesiredFPS, LIGHT_DEFINITION::dir, Flags, FlagsMask, FrontSlabPolygonTransparency, GradInsenSlab, RENDER_RANGE_PARAMS::iPnt, COLORED_POINT::lighting1, COLORED_POINT::lighting2, LightModel, LightParams, Mask, MinQualityBias, NumRenderingThreads, CUT_PLANE_PARAMS::Plane, COLORED_POINT::pt, Quality, RaycastingPrecision, RearSlabPolygonTransparency, Reflection, RenderImageSize, RenderRangeMax, RenderRangeMin, RenderRanges, RenderSamples, RenderType, RPM_AMBIENCE, RPM_BACK_COLOR, RPM_BRIGHTNESS, RPM_COLOR_MODEL, RPM_CROP_BOX, RPM_CUT_PLANES, RPM_DESIRED_FPS, RPM_FRONT_SLAB_POLYGON_TRANSPARENCY, RPM_GRAD_INSEN_SLAB, RPM_LIGHT_MODEL, RPM_LIGHT_PARAMS, RPM_MIN_QUALITY_BIAS, RPM_NUM_RENDERING_THREADS, RPM_QUALITY, RPM_RAYCASTING_PRECISION, RPM_REAR_SLAB_POLYGON_TRANSPARENCY, RPM_REFLECTION, RPM_RENDER_IMAGE_SIZE, RPM_RENDER_RANGE_MIN_MAX, RPM_RENDER_RANGES, RPM_RENDER_SAMPLES, RPM_RENDER_TYPE, RPM_SHININESS, RPM_SLAB_THICKNESS, RPM_STEREO_MODE, RPM_TRANSFORM, RPM_TRANSFORM_RSS, RPM_TRANSFORM_XPOS, RPM_TRANSFORM_YPOS, RPM_TRANSFORM_ZPOS, RPM_VIEW_ANGLE, RPM_ZOOM, Shininess, SlabThickness, RENDER_RANGE_PARAMS::Status, CUT_PLANE_PARAMS::Status, StereoMode, StereoSeparation, Transform, RENDER_RANGE_PARAMS::Type, CUT_PLANE_PARAMS::Type, ViewAngle, POINT::x, POINT::y, COLORED_POINT::y2, and Zoom.

Member Data Documentation

unsigned int RENDER_PARAMS::Ambience

Phong ambience coefficient. Only applicable for RT_PARALLEL and RT_PERSPECTIVE rendering modes. Values from [0..255] will map to coefficients of [0..1] in the lighting calculation.

Referenced by CombineWith().

short RENDER_PARAMS::AutoNav

Used by the client/server APIs for autonavigation. If you are not using the client/server APIs, this can be considered a free user field.

double RENDER_PARAMS::AutoNavSpeed

Used by the client/server APIs for autonavigation. If you are not using the client/server APIs, this can be considered a free user field.

signed int RENDER_PARAMS::BackColor

The background color behind the rendered image. Note that in Thin rendering modes the background will always be black since we supply 8-bit grayscale output. Also note that due to implementation details valid values are 0-254 for each component at this time. Therefore, pure white (255,255,255) is not achievable.

Referenced by CombineWith().

signed int RENDER_PARAMS::Brightness

Phong brightness coefficient. Only applicable for RT_PARALLEL and RT_PERSPECTIVE rendering modes. Values from [0..255] will map to coefficients of [0..1] in the lighting calculation.

See also
Phong Lighting Model

Referenced by CombineWith().

signed int RENDER_PARAMS::cbSize

Total size of the structure.

ENUM_COLOR_MODEL RENDER_PARAMS::ColorModel

Deprecated. Will be ignored.

Referenced by CombineWith().

CROP_BOX_PARAMS RENDER_PARAMS::CropBox
Deprecated:
This is not currently in use. Use CutPlanes to apply a cropping box.

Referenced by CombineWith().

CUT_PLANE_PARAMS RENDER_PARAMS::CutPlanes[MAX_CUTPLANES]

Currently, you may set each of these 16 cut planes to perform planar segmentation of your volume.

Note: Two additional cutplanes are implicitly provided by the projection plane itself and the slab thickness.

Applies to: RT_PARALLEL and all RT_THICK_* modes.

Referenced by CombineWith().

ENUM_CUT_PLANE_MODE RENDER_PARAMS::CutPlanesMode

This parameter is basically ignored because the only cut plane mode supported is CUT_PLANE_MODE_STANDARD (0).

Referenced by CombineWith().

signed int RENDER_PARAMS::DesiredFPS

Hint for the desired FPS setting from the rendering. 0 is a special value that disables the automatic quality/performance balancing sub-system. You will want a DesiredFPS of 0 if you wish to get a valid frame rate benchmark from the engine.

Otherwise, DesiredFPS will dictate what the minimum acceptable frame rate will be for the engine. After each frame is rendered, the engine will assess the time taken to render. If it appears the frame rate will be lower than acceptable, then the quality of interactive rendering will be reduced to bring the frame rate up. There is a lower threshold on how far the quality will degrade, so it is possible to get a lower frame rate than DesiredFPS is asking for. Similarly, if the machine is so fast that the highest quality level is achieved, then the frame rate may be higher than DesiredFPS.

Note
This parameter applies to interactive renders ONLY. Final renders are always at the top render quality.
See also
Performance Considerations

Referenced by CombineWith().

ENUM_RENDER_FLAGS RENDER_PARAMS::Flags

Set of flags that specify rendering options

Referenced by CombineWith().

ENUM_RENDER_FLAGS RENDER_PARAMS::FlagsMask

Set of flags that specify which bits of RENDER_PARAMS::Flags are valid.

Referenced by CombineWith().

unsigned int RENDER_PARAMS::FrontSlabPolygonTransparency

Sets the transparency of polygon objects in front of the projection plane. If 0, objects in front of the projection plane are fully visible. If 255, objects in front of the projection plane are not visible at all. Values in between will be represented by intermediate levels of transparency.

Referenced by CombineWith().

signed int RENDER_PARAMS::GradInsenSlab

This is the distance from any cut plane (including the front of the slab) in volume units in which the renderer will not do the lighting calculation. This includes the cut planes defined by the slab created between the projection plane position and said position + SlabThickness. This field is only valid for parallel rendering. Note that you can also affect the lighting calculation by toggling lighting for a COLORED_POINT on the transfer function or setting the render flag RF_USE_GRADIENTS to false. Acceptable values are [0, 4096].

IMPORTANT: The depth is calculated as a distance from the eye location in the view direction. This means that the depth is dependent upon the view direction. Therefore, all cut planes other than the front of the slab will have their lighting depth move based upon your viewing angle in relation to the cut plane. The exception to this is when GradInsenSlab is set to 1. This special case will turn off lighting for the surface of the cut plane and will not have this view direction dependent behavior. As a result, 0,1, and 4096 are the recommended values to use for this field.

See also
ENUM_RENDER_FLAGS::RF_USE_GRADIENTS, COLORED_POINT

Referenced by CombineWith().

ENUM_LIGHT_MODEL RENDER_PARAMS::LightModel
Deprecated:
Perspective rendering always uses LIGHT_MODEL_HEADLIGHT and parallel always uses LIGHT_MODEL_BEAM. Setting this field does nothing to affect that.

Referenced by CombineWith().

LIGHT_DEFINITION RENDER_PARAMS::LightParams

Definition of the light parameters

Referenced by CombineWith().

ENUM_RENDER_PARAMS_MASK RENDER_PARAMS::Mask

Set of flags that specify which members of this structure contain data to be set or which members are being requested. The documentation for ENUM_RENDER_PARAMS_MASK will have more detailed information on the bit representation of the mask.

Requesting or setting a RENDER_PARAMS structures with no bits turned on in the Mask variable and in the FlagsMask variable is allowed, but completely redundant.

Referenced by CombineWith().

signed int RENDER_PARAMS::MinQualityBias

Sets the minimum quality threshold for the DesiredFPS field. Valid values are [256,768]. 256 is the default and is the highest minimum quality allowed. 768 is the lowest minimum quality allowed.

Referenced by CombineWith().

signed int RENDER_PARAMS::NumRenderingThreads

Specifies the average number of threads to use when rendering. Valid values are 4, 16, 64 and 256 as described below:

  • 4 - Optimal for 1 core machines
  • 16 - Optimal for 2 core machines
  • 64 - Optimal for 4 core machines
  • 256 - Optimal for 8 or more core machines

Referenced by CombineWith().

ENUM_RENDER_QUALITY RENDER_PARAMS::Quality

Quality level. This value defines the overall level of quality for the final rendered image. The progressive rendering stage 0 is influenced by the DesiredFPS field, but both progressive and final rendering are affected by quality. ENUM_RENDER_QUALITY::RENDER_QUALITY_BETTER is a good level to use if your machine has 8 cores. Less cores might necessitate lower quality settings.

Note
Thin rendering modes do not use this value. They are always at the highest quality level.
See also
Performance Considerations

Referenced by CombineWith().

signed int RENDER_PARAMS::RaycastingPrecision

Higher gradient sensitivity will cause more precise rendering of semi-transparent regions. Note that the differences in output images from this parameter are extremely subtle and will likely not be noticeable to the end user. For that reason, leaving this parameter alone is usually the best practice.

See also
Phong Lighting Model, Performance Considerations

Referenced by CombineWith().

unsigned int RENDER_PARAMS::RearSlabPolygonTransparency

Sets the transparency of polygon objects in back of the clip plane SlabThickness volume units from the projection plane. If 0, objects in this area are fully visible. If 255, objects in this area are not visible at all. Values in between will be represented by intermediate levels of transparency.

Note
Unlike the front slab transparency, this is implemented internally by manually cutting all polygons that cross the projection plane into two polygons and applying the appropriate transparency. As a result, all vertices will be transformed with every movement of the slab and this function is not free. Therefore, it is advised to use this function sparingly if very high polygon counts are to be used.

Referenced by CombineWith().

signed int RENDER_PARAMS::Reflection

Phong reflection coefficient. Only applicable for RT_PARALLEL and RT_PERSPECTIVE rendering modes. Values from [0..255] will map to coefficients of [0..1] in the lighting calculation.

See also
Phong Lighting Model

Referenced by CombineWith().

SIZE RENDER_PARAMS::RenderImageSize

Size of the rendering image matrix. Renering image size affects the speed and quality of the output image. Large image sizes provide more detail, while smaller image sizes increase rendering speed.

The width and height must be multiples of 16 and the current maximum render image size is 4096x4096.

Referenced by CombineWith().

signed int RENDER_PARAMS::RenderRangeMax

Window maximum value. Applicable for Thin and Thick MIP/MPR modes. If RF_DONT_NORMALIZE_TF is set, this is in the range specified by the actual volume data. Otherwise, the minimum scalar value is mapped to 0 and the maximum scalar value is mapped to 65535. All other values are interpolated using these anchor points. Note that values outside of the data range are acceptable.

Referenced by CombineWith().

signed int RENDER_PARAMS::RenderRangeMin

Window minimum value. Applicable for Thin and Thick MIP/MPR modes. If RF_DONT_NORMALIZE_TF is set, this is in the range specified by the actual volume data. Otherwise, the minimum scalar value is mapped to 0 and the maximum scalar value is mapped to 65535. All other values are interpolated using these anchor points. Note that values outside of the data range are acceptable.

Referenced by CombineWith().

RENDER_RANGE_PARAMS RENDER_PARAMS::RenderRanges[MAX_RENDER_RANGES_PARAMS]

These ranges specify the transfer function for parallel and perspective rendering. There can be MAX_RENDER_RANGES_PARAMS of these ranges and they represent a segment of control points that specify color and opacity for that segment. All values outside of a render range are completely invisible. A render range can be quickly turned off by setting its RENDER_RANGE_PARAMS::Status to RENDER_RANGE_STATUS_DISABLED.

This field is not used by rendering modes other than RT_PARALLEL and RT_PERSPECTIVE.

Referenced by CombineWith().

signed int RENDER_PARAMS::RenderSamples

Reserved for future use.

Referenced by CombineWith().

ENUM_RENDER_TYPE RENDER_PARAMS::RenderType

Specify the current rendering type.

See also
ENUM_RENDER_TYPE for more details.

Referenced by CombineWith().

signed int RENDER_PARAMS::Reserved

Reserved for future use

signed int RENDER_PARAMS::Shininess

Phong shininess coefficient. Only applicable for RT_PARALLEL and RT_PERSPECTIVE rendering modes. Values from [0..255] will map to coefficients of [0..1] in the lighting calculation.

See also
Phong Lighting Model

Referenced by CombineWith().

float RENDER_PARAMS::SlabThickness

When rendering in MIP modes or in RT_PARALLEL with RF_USE_SLAB_PAR defined, this describes the distance from the projection plane in volume units where we should stop our rays from continuing. A slab thickness of 0 is an infinitely think slab and in MIP/MPR rendering the voxels are sampled directly in a thin slice. The maximum recommended value for RT_THIN_* rendering modes is 50. Otherwise, the maximum acceptable value is 4096.

Referenced by CombineWith().

ENUM_STEREO_MODE RENDER_PARAMS::StereoMode

Allows you to put the engine into stereo viewing mode. Note that stereo viewing is not supported for thin rendering modes. Also, when stereo is enabled in parallel rendering, you will not be able to cut through the volume with the projection plane (or SlabThickness).

Referenced by CombineWith().

double RENDER_PARAMS::StereoSeparation

Specify 0.0 for an automatic separation calculated based upon the average depth of the scene. Otherwise, a number in the range (0,1] should be specified.

Referenced by CombineWith().

MATRIX44D RENDER_PARAMS::Transform

The transform used for rendering includes X,Y,Z orientation vectors and an offset from the origin. All information is relative to the volume coordinate system specified in VOLUME_DATA_PARAMS::Dimension, VOLUME_DATA_PARAMS::Orientation and VOLUME_DATA_PARAMS::Spacing.

  • X - Defined as the direction from the left of the screen to the right of the screen.
  • Y - Defined as the direction from the top of the screen to the bottom of the screen.
  • Z - Defined as the view direction. In other words, a vector pointing "into" the screen.
  • Offset - The location of the center of the screen in the volume. In perspective rendering, this is the eye location in the volume.

The logical layout of the Transform structure is as follows:

$ \left| \begin{array}{cc} Orientation & Offset \\ 0 & 1 \\ \end{array} \right| = $
$ \left| \begin{array}{cccc} X_{vector} & Y_{vector} & Z_{vector} & Offset \\ 0 & 0 & 0 & 1 \\ \end{array} \right| = $
$ \left| \begin{array}{cccc} m11 & m12 & m13 & \\ m21 & m22 & m23 & Offset \\ m31 & m32 & m33 & \\ 0 & 0 & 0 & 1 \\ \end{array} \right| = $
$ \left| \begin{array}{cccc} m11 & m12 & m13 & m14 \\ m21 & m22 & m23 & m24 \\ m31 & m32 & m33 & m34 \\ m41 & m42 & m43 & m44 \\ \end{array} \right| $
For best results, the vectors of the transform should be normalized and orthogonal to each other.

In all but perspective rendering, the scaling of the rendering is specified separately through the RENDER_PARAMS::Zoom field.
In perspective, the RENDER_PARAMS::ViewAngle field becomes relevant.

The identity matrix will place the camera at the location 0,0,0 viewing axially.

@note It should be noted that OpenGL API uses the inverse form of the above matrix. A
general matrix inverse procedure can be used to interconnect the two APIs. Since
the above matrix is normalized and orthogonal great simplifications can be applied
to the inverse procedure (e.x. When offset vector is zero, the inverse of the matrix
is equal to its transpose).

Referenced by CombineWith().

float RENDER_PARAMS::ViewAngle

The field of view for perspective rendering. Should be in the range 6-150.

Referenced by CombineWith().

float RENDER_PARAMS::Zoom

Zoom is defined as the number of pixels per voxel in the rendered image. For example, if the Zoom is set to 2, that means that every voxel is 2 pixels in size. The voxel size in this definition is the size in volume units specified in VOLUME_DATA_PARAMS::Spacing x field. Note that the RT_PERSPECTIVE rendering mode ignores this value. The maximum acceptable value for Zoom is 700.0.

Referenced by CombineWith().