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

Home » Public Forums » archive » Re: Another fun question about color in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Another fun question about color in IDL [message #17490] Thu, 21 October 1999 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Todd Bowers (tbowers@nrlssc.navy.mil ) writes:

> Well, I was just getting the hang of all this, then I
> started going to object graphics and now I'm confused
> again. I have some 2D data that I was surface'ing and
> shade_surf'ing with the z axis intensity colored by
> data value. Dandy.
>
> Then I decided to get cute when David Fanning pointed me to his
> xsurface object graphics procedure at
> http://www.dfanning.com/programs/xsurface.pro
> I thought, hmmmm, I'll just make his solid surface option which
> uses yellow by default and switch it to use my color shading
> instead, the equivalent of:
>
> colorData = zData
> shade_surf, zData, xData, yData, Ax=AX, Az=AZ, $
> shades=bytscl(colorData, top=!D.N_Colors-4, NaN=1), $
> XTitle=XTitle, YTitle=YTitle, ZTitle=ZTitle, charsize=charSize
>
> in my direct graphics code.
>
> Well, you can probably guess the rest. I can't get the RGB model
> it defaults to to handle colors the way I've been using them.
> Can anyone give me a nudge (or preferably a hard shove) in the
> right direction??

Yes, elevation shading in object graphics can be a bit
dicey. The trick is to turn shading ON and turn all
your lights OFF. The details can be found in this
article on my web page:

http://www.dfanning.com/tips/elevation_object.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Another fun question about color in IDL [message #17491 is a reply to message #17490] Thu, 21 October 1999 00:00 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Todd Bowers <tbowers@nrlssc.navy.mil> wrote in message
news:7ula30$r0d$1@ra.nrl.navy.mil...
> Well, I was just getting the hang of all this, then I
> started going to object graphics and now I'm confused
> again.

It will pass--shouldn't last more than a year or two.

> ...I have some 2D data that I was surface'ing and
> shade_surf'ing with the z axis intensity colored by
> data value
> ...
> Then I decided to get cute when David Fanning pointed me to his
> xsurface object graphics procedure at
> http://www.dfanning.com/programs/xsurface.pro
> I thought, hmmmm, I'll just make his solid surface option which
> uses yellow by default and switch it to use my color shading
> Well, you can probably guess the rest. I can't get the RGB model
> it defaults to handle colors the way I've been using them. It
> seemed simple enough, scan his code for the surface creation call:
>
> thisSurface = OBJ_NEW('IDLgrSurface', data, x, y, $
> Color=[255,255,0], _Extra=extra)
>
> and tweak it with the SHADE_RANGE keyword which I thought would be
> analagous to the SHADES keyword in shade_surf. No luck.

SHADE_RANGE has an effect only when the destination device uses indexed
colour. Assuming you have an RGB destination device (and I can't see why you
would) you need to use VERT_COLORS. Set it to an [n] or [3,n] byte array
where n is the number of vertices in the surface.

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: Another fun question about color in IDL [message #17493 is a reply to message #17490] Wed, 20 October 1999 00:00 Go to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
I am wondering if using VERT_COLORS in combination with /SHADING will give
the effect you want? You can specify color for each vertex. Here's what Help
says:

VERT_COLORS (Get, Set)
Set this keyword to a vector of colors to be used to draw at each vertex.
Color is interpolated between vertices if SHADING is set to 1 (Gouraud). If
there are more vertices than elements in VERT_COLORS, the elements of
VERT_COLORS are cyclically repeated. By default, the polygons are all drawn
in the single color provided by the COLOR keyword. If this keyword is omitted
or set to a scalar, vertex colors are removed and the surface is drawn in the
color specified by the COLOR keyword.

Good luck,
Pavel

Todd Bowers wrote:

cut - cut

> and tweak it with the SHADE_RANGE keyword which I thought would be
> analagous to the SHADES keyword in shade_surf. No luck. It's only
> a 2 element vector. I'm trying to do something with a palette, but
> I think I'm not grasping the concepts of the obj. graphics model or
> RGB.
>
> Can anyone give me a nudge (or preferably a hard shove) in the
> right direction??
>
> Thanks, as always.
> TB
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: plot axis colors
Next Topic: idl

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

Current Time: Wed Oct 08 17:30:53 PDT 2025

Total time taken to generate the page: 0.00397 seconds