Fragment shaders
[VolumeViz Shader API]

VolumeViz VolumeViz GLSL fragment shaders API. More...

Files

file  vvizClipping_frag.h

Functions

VVIZ_DATATYPE VVizCombineData (in vec3 dataCoord)
vec4 VVizComputeFragmentColor (in VVizDataSetId dataset, in vec3 rayDir, inout VVizVoxelInfo voxelInfoFront, in VVizVoxelInfo voxelInfoBack, in int mask)
vec3 VVizComputeCoordinates (const vec3 dataCoord)
vec4 VVizOverOperator (vec4 underCol, vec4 overCol)
float VVizGetLuminance (VVIZ_DATATYPE data)
vec3 VVizGetNearestCoord (in VVizVoxelInfo voxelInfo)
vec3 VVizComputePreintegratedGradient (vec3 tcoord0, vec3 tcoord1)
vec3 VVizComputeNormal (vec3 view, vec3 grad)
vec3 VVizComputeNormal (vec3 tcoordVirt)
vec4 VVizComputeIsoMaterial (VVizDataSetId tex, in VVizVoxelInfo voxelInfoFront, in VVizVoxelInfo voxelInfoBack, int maskId)
vec4 VVizComputePreIntegrated (VVIZ_DATATYPE sf, VVIZ_DATATYPE sb)
vec4 VVizComputeVolumeRendering (VVIZ_DATATYPE sf)
vec4 VVizComputeVolumeRenderingLighting (in vec4 col, in vec3 normal, in float gradLength)
vec4 VVizComputePreintegratedLighting (in vec4 col, in vec3 normal, in float gradLength)
vec3 VVizComputeViewVec ()
VVIZ_DATATYPE VVizGetData (in VVizDataSetId dataset, in vec3 dataCoord)
VVIZ_DATATYPE VVizGetRawData (in VVizDataSetId dataset, in vec3 dataCoord)
int VVizGetMask (in vec3 tcoord)
void VVizOutputColor (vec4 color)
vec4 VVizTransferFunction (in VVIZ_DATATYPE voxelValue, in int Id)
vec4 VVizTransferFunction (in VVIZ_DATATYPE frontVoxelValue, in VVIZ_DATATYPE backVoxelValue, in int Id)

Detailed Description

VolumeViz VolumeViz GLSL fragment shaders API.


Function Documentation

VVIZ_DATATYPE VVizCombineData ( in vec3  dataCoord  ) 

SoVolumeShader::DATA_COMBINE_FUNCTION function.

Applications can replace this method to customize the SoVolumeShader::DATA_COMBINE_FUNCTION shader stage.

Parameters:
dataCoord Uniform data coordinate in volume space.
Returns:
voxel data value.
vec3 VVizComputeCoordinates ( const vec3  dataCoord  ) 

Compute new coordinates from input coordinates.


This method is used to support rectilinear coordinates or custom projection. It computes voxel coordinates and must be used instead of gl_TexCoord[0].xyz. If not used, texture coordinates may not be clamped, scaled, etc... as necessary in order to have correct rendering.

The parameter usually is gl_TexCoord[0].xyz (in slicing mode only). The returned coordinate is in general directly passed to VVizCombineData method.

Parameters:
dataCoord Coordinates of point, in normalized dataset space.
Returns:
Projected coord if requested, returns dataCoord by default.
vec4 VVizComputeFragmentColor ( in VVizDataSetId  dataset,
in vec3  rayDir,
inout VVizVoxelInfo  voxelInfoFront,
in VVizVoxelInfo  voxelInfoBack,
in int  mask 
)

SoVolumeShader::FRAGMENT_COMPUTE_COLOR function.

Applications can replace this method to customize the SoVolumeShader::FRAGMENT_COMPUTE_COLOR shader stage.
Note: This version of the method is only used by the SoVolumeRender node.

Parameters:
dataset Dataset id
rayDir ray Direction in volume space.
voxelInfoFront Voxel info of front slice.
voxelInfoBack Voxel info of back slice
mask Current mask Id
vec4 VVizComputeIsoMaterial ( VVizDataSetId  tex,
in VVizVoxelInfo  voxelInfoFront,
in VVizVoxelInfo  voxelInfoBack,
int  maskId 
)

Returns the color of the lighted pixel belonging to the isosurface.

sf and sb are usually the volume data which have the texture coordinate gl_TexCoord[0] and gl_TexCoord[1] computed by VVizComputeFrontSliceTexCoord and VVizComputeBackSliceTexCoord. If there is no isosurface between sf and sb, a transparent pixel will be returned. Lighting is computed with the first directional light found in the scene graph.
Because it needs a special texture, this function can only be used with SoVolumeIsosurface.

vec3 VVizComputeNormal ( vec3  tcoordVirt  ) 

Compute normal in surface of 2D shapes (slices, volumeGeometry, volumeSkin, hzighfield) at given coordinates.

Normal is returned in eye space. If bump mapping is currently enabled, the normal corresponding to bump effect will be returned.

vec3 VVizComputeNormal ( vec3  view,
vec3  grad 
)

Returns the current normal.

vec4 VVizComputePreIntegrated ( VVIZ_DATATYPE  sf,
VVIZ_DATATYPE  sb 
)

Convert the volume data values (sf, sb) to a color by lookup in the pre-integrated table.

The pre-integrated table is a precomputed table which gives an approximation of the volume rendering integral between two slices.
Because it needs a special texture, this function can only be used with SoVolumeRenderingQuality.

vec3 VVizComputePreintegratedGradient ( vec3  tcoord0,
vec3  tcoord1 
)

Returns the gradient at the center of the two slices.

vec4 VVizComputePreintegratedLighting ( in vec4  col,
in vec3  normal,
in float  gradLength 
)

Add lighting to the color col in the case of pre-integrated rendering.

col is usually the result of VVizComputePreintegrated. The difference with the VVizComputeVolumeRenderingLighting function is that the normal used for lighting is at the middle of the space between the front and the back slice. Lighting is computed with the first directional light found in the scene graph.
Because it needs a special texture, this function can only be used with SoVolumeRenderingQuality.

vec3 VVizComputeViewVec (  ) 

Returns the current viewing vector.

vec4 VVizComputeVolumeRendering ( VVIZ_DATATYPE  sf  ) 

Returns the conversion of the volume data value sf to color by lookup in the colormap.

vec4 VVizComputeVolumeRenderingLighting ( in vec4  col,
in vec3  normal,
in float  gradLength 
)

Add lighting to the color col.

col is usually the result of VVizComputeVolumeRendering.

VVIZ_DATATYPE VVizGetData ( in VVizDataSetId  dataset,
in vec3  dataCoord 
)

SoVolumeShader::GET_DATA_FUNCTION function.

Applications can replace this method to customize the SoVolumeShader::GET_DATA_FUNCTION shader stage.

NOTE: On the GPU, voxel values are always returned as a normalized value in the range 0..1. If the actual voxel value is needed, the shader function must compute that value using the current data range (see SoDataRange). The application must explicitly pass the current data range to the shader function as a uniform parameter.

Parameters:
dataset The dataset to read
dataCoord Uniform data coordinates in volume space.
Returns:
voxel data value.
float VVizGetLuminance ( VVIZ_DATATYPE  data  ) 

Compute the luminance of a voxel value.

Parameters:
data value to convert
Returns:
Luminance of data.
int VVizGetMask ( in vec3  tcoord  ) 

Returns the mask value at the given texture coordinate.

If there is no SoVolumeMask, the returned value is the id of the transfer function on the state.

vec3 VVizGetNearestCoord ( in VVizVoxelInfo  voxelInfo  ) 

Returns virtual coordinates of nearest voxel center, taking in account current voxel resolution.

This can be used to avoid having interpolation issues by taking the true value of voxel.

VVIZ_DATATYPE VVizGetRawData ( in VVizDataSetId  dataset,
in vec3  dataCoord 
)

Default SoVolumeShader::GET_DATA_FUNCTION function.

Method to access dataset, that can be used by VVizGetData custom implementation. It may apply different interpolation (linear, cubix, trilinear, multi-sample12) depending on SoVolumeRenderingQuality and SoVolumeRender nodes setup.

NOTE: On the GPU, voxel values are always returned as a normalized value in the range 0..1. If the actual voxel value is needed, the shader function must compute that value using the current data range (see SoDataRange). The application must explicitly pass the current data range to the shader function as a uniform parameter.

Parameters:
dataset The dataset to read
dataCoord uniform data coordinates in volume space.
Returns:
voxel data value
void VVizOutputColor ( vec4  color  ) 

This function sends the final fragment color to OpenGL.


It should be used instead of directly setting gl_FragColor, in order to allow VolumeViz to do final manipulation of the color.

Should be used at the end of FRAGMENT_MAIN shader only.

Parameters:
color the color to render.
vec4 VVizOverOperator ( vec4  underCol,
vec4  overCol 
)

Blend 2 colors using the over operator, result color is not alpha premultiplied.

Parameters:
underCol First color to blend.
overCol Second color to blend.
Returns:
Blended color.
vec4 VVizTransferFunction ( in VVIZ_DATATYPE  frontVoxelValue,
in VVIZ_DATATYPE  backVoxelValue,
in int  Id 
)

Pre-integrated transfer function.

Parameters:
frontVoxelValue Input voxel data value of the front slice.
backVoxelValue Input voxel data value of the back slice.
Id of the transfer function to use.
Returns:
Color of the value based on the transfer function id
vec4 VVizTransferFunction ( in VVIZ_DATATYPE  voxelValue,
in int  Id 
)

1D transfer function.

Parameters:
voxelValue Input voxel data value
Id of the transfer function to use.
Returns:
Color of the value based on the transfer function id

Open Inventor Toolkit reference manual, generated on 28 Oct 2019
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/