;Hello, try this code, i think it may help.
;s should be the opaque white obj. in the creation
;with idlgrpolygon you can set the color.
;attend the values in "image" for red, green and blue you
;have to set 255
; create 2 simple objects
vol=bytarr(10,10,10)
vol[1:8,1:8,1:8]=1
vol2=bytarr(10,10,10)
vol2[3:5,3:5,3:5]=1
isosurface, vol, 1, v, c
s=obj_new('IDLgrPolygon', v, polygons=c, $
color=[255b,255b,255b],shading=1)
isosurface, vol2, 1, v, c
r=obj_new('IDLgrPolygon', v, polygons=c, $
color=[0b,0b,255b],shading=1)
; create Alphachannel, you can choose from 0-255,
; 0 is completly opaque
image=BYTARR(4,256,256)
image[0,*,*]=REPLICATE(255b,256,256) ; red channel
image[1,*,*]=REPLICATE(255b,256,256) ; green channel
image[2,*,*]=REPLICATE(255b,256,256) ; blue channel
image[3,*,*]=REPLICATE(30,256,256) ; alpha channel
;image[3,*,*]=REPLICATE(200,256,256) ; alpha channel
; change the greyvalues to understand how it works
;image=BYTARR(4,256,256)
;image[0,*,*]=REPLICATE(255b,256,256) ; red channel
;image[1,*,*]=REPLICATE(0b,256,256) ; green channel
;image[2,*,*]=REPLICATE(0b,256,256) ; blue channel
;image[3,*,*]=REPLICATE(30,256,256) ; alpha channel
;
;image=BYTARR(4,256,256)
;image[0,*,*]=REPLICATE(0b,256,256) ; red channel
;image[1,*,*]=REPLICATE(0b,256,256) ; green channel
;image[2,*,*]=REPLICATE(255b,256,256) ; blue channel
;image[3,*,*]=REPLICATE(30,256,256) ; alpha channel
; create imageobj
oimage=OBJ_NEW('IDLgrIMAGE',image, INTERLEAVE=0, BLEND_FUNCTION=[3,4])
; set texture map to obj
s->setproperty,texture_map=oimage
; create model obj
theModel = Obj_New('IDLgrModel')
; add opaque and transparent obj to model
themodel->add,r
themodel->add,s
xobjview,theModel,/block
obj_destroy,themodel
end
;best regards, Robert
|