I wrote a litte program that shows the artefacts. I creates a volume, cuts
of a cube, and renders a short sequence. The artefacts are clearly
recognizable on the cutting surfaces.
;; volume_artefact: show volume rendering artefacts on cutting
;; surfaces inside a volume
FUNCTION CREATE_SIMPLE_VOLUME
;; create a simple volume containing one big red object and two small
cubes
voldims = [180L,150L,130L]
voldims = [80L,75L,70L]
vol = OBJ_NEW('IDLgrVolume')
voldata = fltarr(voldims)
;; fill the volume with values: highest values along the z-axis,
;; values cylindrically decreasing with distance to the z-axis
r1 = voldims[0] / 2 & r2 = voldims[1] / 2
FOR i=0,(voldims[0]-1) DO FOR $
j=0,(voldims[1]-1) DO volData[i,j,*] = (i-r1)^2 + (j-r2)^2
voldata = 255 -BYTSCL(voldata)
;; cut the left top front cube out off the volume
volData[0:(voldims[0]/2.),(voldims[1]/2.):voldims[1]-1,(vold ims[2]/2):voldims[2]-1]
= 0
;; highlight front bottom right and left bottom back cube a little bit
volData[(voldims[0]/2.+
5):(voldims[0]-1),0:(voldims[1]/2.-1),(voldims[2]/2):voldims [2]-1] = 155
volData[0:(voldims[0]/2.),0:(voldims[1]/2.-1),0:(voldims[2]/ 2)-2] = 155
vol->SETPROPERTY, data0=volData,ZBUFFER=1,ZERO_OPACITY_SKIP=1, $
INTERPOLATE=1,OPACITY_TABLE0=(INDGEN(256) / 1)
;; center volume at 0,0,0 and fit it into a unit cube
cc_facs = voldims / float(max(voldims))
cc = fltarr(2,3)
cc[0,*] = -0.5 * cc_facs
cc[1,*] = 1.0 / voldims*cc_facs
vol->SETPROPERTY, XCOORD_CONV=cc[*,0], YCOORD_CONV=cc[*,1],
ZCOORD_CONV=cc[*,2]
RETURN, vol
END ;; of: CREATE_SIMPLE_VOLUME
PRO VOLUME_ARTEFACT
;; create a simple volume
vol = CREATE_SIMPLE_VOLUME()
;; create the view for the volume
volView = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[-1,-1,2,2], $
ZCLIP=[2.0, -2.0], COLOR=[150,150,255])
volModel = OBJ_NEW('IDLgrModel')
volModel->ADD, vol
volModel->SCALE,1.5,1.5,1.5
volView->ADD, volModel
;; create the render window
winSize = 200L
volWin = OBJ_NEW('IDLgrWindow', TITLE="volume transparency",RETAIN=2,
DIMENSIONS=[winSize,winSize]*2)
volWin->DRAW, volView
volModel->ROTATE,[0,1,0],20
volModel->ROTATE,[1,0,0],30
volWin->DRAW, volView
;; litte animation with rotating volume
IF 1 THEN BEGIN
print, "will rotate around y-axis"
FOR i=0,20 DO BEGIN
print, "step: ",i
volModel->ROTATE,[0,1,0],1
volWin->DRAW, volView
END
print, "will rotate around y-axis"
volModel->ROTATE,[0,1,0],-15
volModel->ROTATE,[1,0,0],-10
FOR i=0,20 DO BEGIN
print, "step: ",i
volModel->ROTATE,[1,0,0],1
volWin->DRAW, volView
END
ENDIF
END
|