VOL_REND Function
Renders volumetric data in a translucent manner.
Usage
result = VOL_REND(volume, imgx, imgy)
Input Parameters
volume—A 3D array containing volumetric data. volume is normally scaled into the range {0 ... 255}.
imgx—The x dimension of the image to return.
imgy—The y dimension of the image to return.
Returned Value
result—An 8-bit image of the volumetric data.
Keywords
Depth_q—A scalar depth queuing factor. The Depth_q keyword values should be between 0.0 and 1.0:
1.0 sets voxels in the back to be just as bright as the voxels in the front.
0.5 causes voxels in the back to be half as bright as those in front.
Opaque—A 3D array (with the same dimensions as volume) containing the translucency values for each voxel. Opaque is normally scaled into the range {0 ... 255}, where 0 is clear and 255 is completely opaque. (Default: 0)
Discussion
If no keywords are used, the final intensity value produced at a given pixel with VOL_REND is the brightest value along the Z dimension of the volume. This default behavior can be enhanced, however, by using the Opaque and Depth_q keywords.
If Opaque is set to 0, the resulting value will be unaffected; if Opaque is set to 255, then values behind that position in the opaque array will be completely blocked.
If Depth_q is set to a value less than 1.0, a bright spot in the back will be dimmed in proportion to the distance it is from the viewpoint. (A bright spot in the front will remain bright.)
Typically, you would first process a volume of data with VOL_PAD and VOL_TRANS, and then render it with VOL_REND.
Examples
This program displays 3D fluid data using two display techniques.
; Specify the size of the volumes.
volx = 17
voly = 17
volz = 59
; Specify the window size.
winx = 512
winy = 512
; Read in the data and pad with zeroes.
flow_axial = FLTARR(volx, voly, volz)
OPENR, 1, !Data_Dir + 'cfd_axial.dat', /Xdr
READU, 1, flow_axial
CLOSE, 1
flow_axial = VOL_PAD(flow_axial, 1)
; Set up the view.
CENTER_VIEW, Xr=[0.0, 18.0], Yr=[0.0, 18.0], $
Zr=[0.0, 60.0], Az=210.0, Ay=120.0, Ax=0.0, Winx=512, $
Winy=512, Zoom=0.85
; Change the direction of the light source for shading.
SET_SHADING, Light=[-1.0, 1.0, 0.5], /Gouraud, /Reject
; Compute the 3D contour surface as a list of polygons.
SHADE_VOLUME, flow_axial, 110, vertex_list, polygon_list, $
/Low
; Set up the viewing window and load the color table.
WINDOW, 1, XSize=winx, YSize=winx, XPos=16, YPos=256, $
Colors=128
LOADCT, 3
; Construct the shaded surface representation of the data as
; a list of polygons and display it.
img1 = POLYSHADE(vertex_list, polygon_list, XSize=winx, $
YSize=winy, /Data, /T3d)
TVSCL, img1
; Create a new window for plotting.
WINDOW, 2, XSize=winx, YSize=winx, XPos=496, YPos=324, $
Colors=128
; Scale the data into the range of bytes 0 - 255.
vol_dim = MAX([volx, voly, volz])
flow_axial = BYTSCL(flow_axial)
; Transform the volume of data into the current view.
vol2 = VOL_TRANS(flow_axial, vol_dim, !P.T)
; Render the data as a translucent image.
img2 = VOL_REND(vol2, winx, winy, Depth_q=0.4)
; Display the image.
TVSCL, img2
For other examples, see the demonstration programs vol_demo2 and vol_demo4 in:
<wavedir>/demo/arl
<wavedir>\demo\arl
Where <wavedir> is the main PV‑WAVE directory.