comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Multiple surface colors in the Z buffer?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Multiple surface colors in the Z buffer? [message #29243] Fri, 08 February 2002 10:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Matrox Framegrabber interface
Next Topic: Re: Shared memory and IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:42:48 PDT 2025

Total time taken to generate the page: 0.48674 seconds