0

I am trying to decide on the color of various points in a 3D coordinate system. The way I want to do it is to decide the RGB Values for a particular 3D Point based on the Z Cordinate value of that point, For the point having maximum Z value to have only Red color and for a point having minimum Z value to have only blue color. But I am not sure how to transition the values for R, G and B in between for all the points.

Thanks

Manal Goyal
  • 29
  • 1
  • 8
  • a color cube? kind of like a 3d color picker? – Vj- Apr 04 '18 at 05:51
  • Something like that, I want it to highlight higher values of z with red color and lower values of z with blue color and to have a nice transition for in between values. – Manal Goyal Apr 04 '18 at 06:16
  • Usually you have such colour gradient (as a scale colour), or just as gradient function (with start and end values (colour), ev. with also intermediate values (like 0)). Tools provide such functionalities. By hand is less flexible (but in you case: either :interpolate with white (in middle), or interpolate the extremes (per channel). This should be enough. For really good you need a designer, and better function (maybe by keeping the same brightness and saturation). – Giacomo Catenazzi Apr 04 '18 at 08:29
  • @GiacomoCatenazzi can you provide some example of implementation of what are you suggesting. – Manal Goyal Apr 04 '18 at 08:58
  • e.g. https://matplotlib.org/users/colormapnorms.html CSS (of HTML) and SVG also implement such colour grading, so various plot libraries support them because their are based or copied such graphical API. Check with your graphical tool, or if you want to control, as I told you: linear interpolation from start to end colour (per channel, so R, G, B separately). – Giacomo Catenazzi Apr 04 '18 at 09:30

1 Answers1

0

RGB color scheme is not very useful for that. Throw a look at HSV.

You have to scale your Z to (0, 360) and set Saturation and Value to 1 and then convert this into RGB

Or if you have something like the matlab jet color map in mind:

Grayscale to Red-Green-Blue (MATLAB Jet) color scale

vlad_tepesch
  • 6,681
  • 1
  • 38
  • 80