Need help with colormap-shaders?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

kbinani
292 Stars 29 Forks MIT License 37 Commits 0 Opened issues

Description

A collection of shaders to draw color maps.

Services available

!
?

Need anything else?

Contributors list

colormap-shaders

A collection of shaders to draw color map like this:

rainbow.

usage

Each

*.frag
shader sources provides a
colormap
function, which takes an
float
argument
x
(
x
should be:
0.0 <= x <= 1.0
). The
colormap
function returns a
vec4
value which represents an RGBA color.
vec4 colormap(float x);

void main() { gl_FragColor = colormap(gl_TexCoord[0].x); }

/* include "shaders/rainbow.frag" here, for example. */

special case

gnuplot.frag

This shader emulates

gnuplot
's
rgbformulae
, and the signature of
colormap
is:
vec4 colormap(float x, int red_type, int green_type, int blue_type);

It takes additional 3 arguments, with same meanings to

rgbformulae
's 3 arguments respectively.

usage from c++

#include 
#include 

int main() { using namespace colormap;

// Print RGB table of MATLAB::Jet colormap.
MATLAB::Jet jet;
std::cout &lt;&lt; "category: " &lt;&lt; jet.getCategory() &lt;&lt; std::endl;
std::cout &lt;&lt; "title:    " &lt;&lt; jet.getTitle() &lt;&lt; std::endl;
int const size = 256;
for (int i = 0; i &lt; size; ++i) {
    float const x = i / (float)size;
    Color c = jet.getColor(x);
    std::cout &lt;&lt; x &lt;&lt; "\t" &lt;&lt; c.r &lt;&lt; "\t" &lt;&lt; c.g &lt;&lt; "\t" &lt;&lt; c.b &lt;&lt; std::endl;
}

// Dump category and title of all colormaps.
for (std::shared_ptr<colormap const> const&amp; c : ColormapList::getAll()) {
    std::cout &lt;&lt; c-&gt;getCategory() &lt;&lt; " : " &lt;&lt; c-&gt;getTitle() &lt;&lt; std::endl;
}
return 0;

}

samples

MATLAB

  • http://www.mathworks.com/products/matlab/

|name |sample | |--------------|-----------------------------| |MATLAB_autumn|| |MATLAB_bone | | |MATLAB_cool | | |MATLAB_copper|| |MATLAB_hot | | |MATLAB_hsv | | |MATLAB_jet | | |MATLAB_parula|| |MATLAB_pink | | |MATLAB_spring|| |MATLAB_summer|| |MATLAB_winter||

gnuplot

  • http://www.gnuplot.info/

|name |sample | |-----------------------|--------------------------------| |rgbformulae(7, 5, 15) | | |rgbformulae(3, 11, 6) | | |rgbformulae(23, 28, 3) | | |rgbformulae(21, 22, 23)|| |rgbformulae(30, 31, 32)|| |rgbformulae(33, 13, 10)|| |rgbformulae(34, 35, 36)||

IDL

  • http://www.exelisvis.com/ProductsServices/IDL.aspx

|name |sample | |-----------------------------|-------------------------------------------| |IDL_Black-White_Linear | | <!-- #0 --> |IDL_Blue-White_Linear | | <!-- #1 --> |IDL_Green-Red-Blue-White | | <!-- #2 --> |IDL_Red_Temperature | | <!-- #3 --> |IDL_Blue-Green-Red-Yellow | | <!-- #4 --> |IDL_Standard_Gamma-II | | <!-- #5 --> |IDL_Prism | | <!-- #6 --> |IDL_Red-Purple | | <!-- #7 --> |IDL_Green-White_Linear | | <!-- #8 --> |IDL_Green-White_Exponential|| <!-- #9 --> |IDL_Green-Pink | | <!-- #10 --> |IDL_Blue-Red | | <!-- #11 --> |IDL_16_Level | | <!-- #12 --> |IDL_Rainbow | | <!-- #13 --> |IDL_Steps | | <!-- #14 --> |IDL_Stern_Special | | <!-- #15 --> |IDL_Haze | | <!-- #16 --> |IDL_Blue-Pastel-Red | | <!-- #17 --> |IDL_Pastels | | <!-- #18 --> |IDL_Hue_Sat_Lightness_1 | | <!-- #19 --> |IDL_Hue_Sat_Lightness_2 | | <!-- #20 --> |IDL_Hue_Sat_Value_1 | | <!-- #21 --> |IDL_Hue_Sat_Value_2 | | <!-- #22 --> |IDL_Purple-Red+Stripes | | <!-- #23 --> |IDL_Beach | | <!-- #24 --> |IDL_Mac_Style | | <!-- #25 --> |IDL_Eos_A | | <!-- #26 --> |IDL_Eos_B | | <!-- #27 --> |IDL_Hardcandy | | <!-- #28 --> |IDL_Nature | | <!-- #29 --> |IDL_Ocean | | <!-- #30 --> |IDL_Peppermint | | <!-- #31 --> |IDL_Plasma | | <!-- #32 --> |IDL_Blue-Red_2 | | <!-- #33 --> |IDL_Rainbow_2 | | <!-- #34 --> |IDL_Blue_Waves | | <!-- #35 --> |IDL_Volcano | | <!-- #36 --> |IDL_Waves | | <!-- #37 --> |IDL_Rainbow_18 | | <!-- #38 --> |IDL_Rainbow+White | | <!-- #39 --> |IDL_Rainbow+Black | | <!-- #40 --> |IDL_CB-Accent | | <!-- #41 --> |IDL_CB-Dark2 | | <!-- #42 --> |IDL_CB-Paired | | <!-- #43 --> |IDL_CB-Pastel1 | | <!-- #44 --> |IDL_CB-Pastel2 | | <!-- #45 --> |IDL_CB-Set1 | | <!-- #46 --> |IDL_CB-Set2 | | <!-- #47 --> |IDL_CB-Set3 | | <!-- #48 --> |IDL_CB-Blues | | <!-- #49 --> |IDL_CB-BuGn | | <!-- #50 --> |IDL_CB-BuPu | | <!-- #51 --> |IDL_CB-GnBu | | <!-- #52 --> |IDL_CB-Greens | | <!-- #53 --> |IDL_CB-Greys | | <!-- #54 --> |IDL_CB-Oranges | | <!-- #55 --> |IDL_CB-OrRd | | <!-- #56 --> |IDL_CB-PuBu | | <!-- #57 --> |IDL_CB-PuBuGn | | <!-- #58 --> |IDL_CB-PuRdn | | <!-- #59 --> |IDL_CB-Purples | | <!-- #60 --> |IDL_CB-RdPu | | <!-- #61 --> |IDL_CB-Reds | | <!-- #62 --> |IDL_CB-YIGn | | <!-- #63 --> |IDL_CB-YIGnBu | | <!-- #64 --> |IDL_CB-YIOrBr | | <!-- #65 --> |IDL_CB-BrBG | | <!-- #66 --> |IDL_CB-PiYG | | <!-- #67 --> |IDL_CB-PRGn | | <!-- #68 --> |IDL_CB-PuOr | | <!-- #69 --> |IDL_CB-RdBu | | <!-- #70 --> |IDL_CB-RdGy | | <!-- #71 --> |IDL_CB-RdYiBu | | <!-- #72 --> |IDL_CB-RdYiGn | | <!-- #73 --> |IDL_CB-Spectral | | <!-- #74 -->

transform

  • http://web.archive.org/web/20000520021207/http://www.fortner.com/docs/product_transform.html

|name |sample | |--------------------------|---------------------------------------| |transform_rainbow | | |transform_apricot | | |transform_carnation | | |transform_ether | | |transform_grayscale_banded | | |transform_hot_metal | | |transform_lava_waves | | |transform_malachite | | |transform_seismic | | |transform_space | | |transform_morning_glory | | |transform_peanut_butter_and_jerry|| |transform_purple_haze | | |transform_rose | | |transform_saturn | | |transform_supernova | |

transform

|name |sample | |-----------------|--------------------------------| |kbinani_altitude||

license

The MIT License. See 'LICENSE' file for detail.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.