Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kbinani/colormap-shaders
A collection of shaders to draw color maps.
https://github.com/kbinani/colormap-shaders
chart colormap cplusplus glsl gnuplot matlab metal opengl shader
Last synced: about 2 hours ago
JSON representation
A collection of shaders to draw color maps.
- Host: GitHub
- URL: https://github.com/kbinani/colormap-shaders
- Owner: kbinani
- License: mit
- Created: 2015-05-17T16:11:50.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-07-31T04:34:18.000Z (over 1 year ago)
- Last Synced: 2025-02-11T12:17:08.343Z (7 days ago)
- Topics: chart, colormap, cplusplus, glsl, gnuplot, matlab, metal, opengl, shader
- Language: C++
- Homepage:
- Size: 500 KB
- Stars: 439
- Watchers: 16
- Forks: 48
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# colormap-shaders
A collection of shaders to draw color map like this:
.
# 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++
```c++
#include
#includeint main()
{
using namespace colormap;// Print RGB table of MATLAB::Jet colormap.
MATLAB::Jet jet;
std::cout << "category: " << jet.getCategory() << std::endl;
std::cout << "title: " << jet.getTitle() << std::endl;
int const size = 256;
for (int i = 0; i < size; ++i) {
float const x = i / (float)size;
Color c = jet.getColor(x);
std::cout << x << "\t" << c.r << "\t" << c.g << "\t" << c.b << std::endl;
}// Dump category and title of all colormaps.
for (std::shared_ptr const& c : ColormapList::getAll()) {
std::cout << c->getCategory() << " : " << c->getTitle() << 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 | |
|IDL\_Blue-White\_Linear | |
|IDL\_Green\-Red\-Blue\-White | |
|IDL\_Red\_Temperature | |
|IDL\_Blue-Green-Red-Yellow | |
|IDL\_Standard\_Gamma-II | |
|IDL\_Prism | |
|IDL\_Red-Purple | |
|IDL\_Green-White\_Linear | |
|IDL\_Green-White\_Exponential||
|IDL\_Green-Pink | |
|IDL\_Blue-Red | |
|IDL\_16\_Level | |
|IDL\_Rainbow | |
|IDL\_Steps | |
|IDL\_Stern\_Special | |
|IDL\_Haze | |
|IDL\_Blue\-Pastel\-Red | |
|IDL\_Pastels | |
|IDL\_Hue\_Sat\_Lightness\_1 | |
|IDL\_Hue\_Sat\_Lightness\_2 | |
|IDL\_Hue\_Sat\_Value\_1 | |
|IDL\_Hue\_Sat\_Value\_2 | |
|IDL\_Purple\-Red\+Stripes | |
|IDL\_Beach | |
|IDL\_Mac\_Style | |
|IDL\_Eos\_A | |
|IDL\_Eos\_B | |
|IDL\_Hardcandy | |
|IDL\_Nature | |
|IDL\_Ocean | |
|IDL\_Peppermint | |
|IDL\_Plasma | |
|IDL\_Blue-Red\_2 | |
|IDL\_Rainbow\_2 | |
|IDL\_Blue\_Waves | |
|IDL\_Volcano | |
|IDL\_Waves | |
|IDL\_Rainbow\_18 | |
|IDL\_Rainbow\+White | |
|IDL\_Rainbow\+Black | |
|IDL\_CB\-Accent | |
|IDL\_CB\-Dark2 | |
|IDL\_CB\-Paired | |
|IDL\_CB\-Pastel1 | |
|IDL\_CB\-Pastel2 | |
|IDL\_CB\-Set1 | |
|IDL\_CB\-Set2 | |
|IDL\_CB\-Set3 | |
|IDL\_CB\-Blues | |
|IDL\_CB\-BuGn | |
|IDL\_CB\-BuPu | |
|IDL\_CB\-GnBu | |
|IDL\_CB\-Greens | |
|IDL\_CB\-Greys | |
|IDL\_CB\-Oranges | |
|IDL\_CB\-OrRd | |
|IDL\_CB\-PuBu | |
|IDL\_CB\-PuBuGn | |
|IDL\_CB\-PuRdn | |
|IDL\_CB\-Purples | |
|IDL\_CB\-RdPu | |
|IDL\_CB\-Reds | |
|IDL\_CB\-YIGn | |
|IDL\_CB\-YIGnBu | |
|IDL\_CB\-YIOrBr | |
|IDL\_CB\-BrBG | |
|IDL\_CB\-PiYG | |
|IDL\_CB\-PRGn | |
|IDL\_CB\-PuOr | |
|IDL\_CB\-RdBu | |
|IDL\_CB\-RdGy | |
|IDL\_CB\-RdYiBu | |
|IDL\_CB\-RdYiGn | |
|IDL\_CB\-Spectral | |## 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 | |## kbinani
|name |sample |
|-----------------|--------------------------------|
|kbinani\_altitude||# license
The MIT License. See 'LICENSE' file for detail.