Timm Weitkamp (weitkamp@esrf.fr) writes:
> I have a segmented volumetric dataset, and am displaying its segments
> in a single 3D image, rendering each segment surface with SHADE_VOLUME
> and then POLYSHADE, plotting to the Z buffer to get hidden parts
> removed.
>
> This works fine except that all the surfaces are displayed in the same
> color. However, I would like to display every segment in a different
> color (yet continue to have IDL do the shading and hidden-surface
> removal). Does anybody know if this can be achieved and how, or where
> I can find material on this problem?
You will have to load different colors in different portions
of the color table, then set the shading parameters to use
just those colors (SET_SHADING) you want to render in.
Here is an example from my book that renders two surfaces,
one in red shades and one in blue shades. You can probably
have as many different color schemes as you have surfaces,
within the constraints of 256 colors.
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
************************************************************ *****
PRO TwoSurf
; Create the data.
peak = Shift(Dist(20, 16), 10, 8)
peak = Exp( - (peak / 5) ^ 2)
saddle = Shift(peak, 6, 0) + Shift(peak, -6, 0) / 2B
; Load program colors.
colors = !D.Table_Size/2
LoadCT, 1, NColors=colors
LoadCT, 3, NColors=colors, Bottom=colors-1
; Open a window and display first data set.
Window, 1, XSize=300, YSize=300
Device, Decomposed = 0
Set_Shading, Values=[0,colors-1]
Shade_Surf, peak, ZRange=[0.0, 1.2]
; Open a window and display second data set.
Window, 2, XSize=300, YSize=300
Set_Shading, Values=[colors, 2*colors-1]
Shade_Surf, saddle, ZRange=[0.0, 1.2]
; Go into Z-buffer.
thisDevice = !D.Name
Set_Plot, 'Z', /Copy
; Configure Z device.
Device, Set_Colors=2*colors, Set_Resolution=[300,300]
; Load objects in Z-buffer.
Set_Shading, Values=[0,colors-1]
Shade_Surf, peak, ZRange=[0.0, 1.2]
Set_Shading, Values=[colors, 2*colors-1]
Shade_Surf, saddle, ZRange=[0.0, 1.2], /NoErase
; Take a snap-shot of Z-buffer display plane.
picture = TVRD()
; Display the results.
Set_Plot, thisDevice
Window, 3, XSize=300, YSize=300
TV, picture
END
|