POV-Ray : Newsgroups : povray.advanced-users : Making color legend : Re: Making color legend Server Time
8 Jul 2024 18:55:42 EDT (-0400)
  Re: Making color legend  
From: Tim Attwood
Date: 22 May 2007 05:01:08
Message: <4652b154$1@news.povray.org>
> I want to make a color legend for following my application.
> My application is, I make a cube with different color faces, which colors
> correspond to the force acting on them.

Is this intended to be an animation?
Is the data generated by some other program?
For now I'll assume you want a still, and the
data is generated inside pov.

> This color set up shows x,y,z direction forces.
>
> texture{pigment{rgb <  2 ,  2 , 2 > }}

Color in pov normally varies from 0 to 1.
POV has the ability to use splines to interpolate between
vectors, and color is just another vector.
Example...

#declare CMap = spline {
   linear_spline
   0.0, <0,0,1> //blue
   0.33,<0,1,0> //green
   0.66,<1,1,0> //yellow
   1.0, <1,0,0> //red
};

Which can then be used as your pigment.
pigment { color CMap(Xforce) }

> Now my problem I should put a color legend which shows the color and force
> relation.

It sounds like you want a gradient pigment, and some text labels.

Example...
union {
 box {<0,0,0>,<1,0.2,0.001>
   pigment {
      gradient x
      color_map {
         [0 Blue]
         [0.33 Green]
         [0.66 Yellow]
         [1 Red]
      }
      translate <-0.001,0,0>
   }
   scale <1.5,1,1>
 }
 text {
    ttf "timrom.ttf" "0" 0.05, 0
    pigment { White}
    scale 0.2
    translate <0.04,0.04,-0.01>
 }
 text {
    ttf "timrom.ttf" "1" 0.05, 0
    pigment { White}
    scale 0.2
    translate <1.4,0.04,-0.01>
 }
 translate <0.2,-1,-0.1>
}

> Is it possible make automatically in POV-ray?
Pov doesn't have a built in legend function, you'll
need to reposition your legend object if you move the
camera.

> If not how can I do the above job? Please help me........
However, with a little math it's possible to
place an object to look like it is in the same spot
in relation to the camera.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.