Sean Dettrick (dettrick@uci.edu) writes:
> Does anyone have a way to make semi-transparent polygon
> objects with IDLgrPolygon?
>
> I would like to use IDL's fancy object graphics, but in my
> attempts so far, alpha blending using a monochrome image only
> makes a polygon object transparent to ITSELF, not to other
> objects. This is pretty useless.
>
> I would like the red cylinder to be semi-transparent, so
> that I can see the black cylinder through it.
I think the problem is the order in which you put
your polygons in the model. I futzed around with
a couple of things that didn't work, then I took
the polygon you call "thisSurface" and added it
to the model *after* the other polygons and Viola!,
just what I wanted!
I'm not sure now exactly what I changed, but here
are the relevant bits, I think.
; Changed the order of the polygons in model
if keyword_set(light) then thisModel->Add, light
if keyword_set(surface2) then thisModel->Add, surface2
if keyword_set(surface3) then thisModel->Add, surface3
if keyword_set(surface4) then thisModel->Add, surface4
thisModel->Add, thisSurface
; Here is how I built the drape for the image object.
alpha = replicate(128,2) # replicate(1,2)
red = replicate(200,2) # replicate(1,2)
green = replicate(20,2) # replicate(1,2)
blue = replicate(20,2) # replicate(1,2)
drape = Bytarr(4, 2, 2)
drape = [[[red]],[[green]],[[blue]],[[alpha]]]
; I made the color of drape image red, so I made the
; polygon color white.
thisSurface = OBJ_NEW('IDLgrPolygon', x, y, z, Style=2, Shading=1, $
polygon=polygon, color=[255,255,255], $
texture_coord= texture_coord,$
texture_map=image )
If you can't get that to work, let me know and I'll send you
the code I have.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|