All Projects → Erkaman → glsl-cos-palette

Erkaman / glsl-cos-palette

Licence: other
glsl function for making cosine palettes

Programming Languages

javascript
184084 projects - #8 most used programming language
GLSL
2045 projects

Projects that are alternatives of or similar to glsl-cos-palette

Thebookofshaders
Step-by-step guide through the abstract and complex universe of Fragment Shaders.
Stars: ✭ 4,070 (+15553.85%)
Mutual labels:  shaders, glsl, shader
Curtainsjs
curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.
Stars: ✭ 1,039 (+3896.15%)
Mutual labels:  shaders, glsl, shader
ios-spritekit-shader-sandbox
👾 Collection of custom effects for SpriteKit implemented using GLSL/Metal shaders.
Stars: ✭ 63 (+142.31%)
Mutual labels:  shaders, glsl, shader
Glsl Worley
Worley noise implementation for WebGL shaders
Stars: ✭ 66 (+153.85%)
Mutual labels:  shaders, glsl, shader
sparksl-noise
minimum proof of concept about procedural noise generation in SparkAR's shader language (SparkSL).
Stars: ✭ 16 (-38.46%)
Mutual labels:  shaders, glsl, shader
SdfFontDesigner
Offline font tuning/bitmap generation via shaders
Stars: ✭ 56 (+115.38%)
Mutual labels:  procedural-generation, shaders, glsl
Tess Opt
Demonstration of how we can use tessellation shaders to make faster fragment shaders.
Stars: ✭ 13 (-50%)
Mutual labels:  shaders, glsl, shader
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+44892.31%)
Mutual labels:  shaders, glsl, shader
Glsl Godrays
This module implements a volumetric light scattering effect(godrays)
Stars: ✭ 155 (+496.15%)
Mutual labels:  shaders, glsl, shader
Spirv Vm
Virtual machine for executing SPIR-V
Stars: ✭ 173 (+565.38%)
Mutual labels:  shaders, glsl, shader
shaderplace
Real-time collaborative GLSL livecode editor
Stars: ✭ 43 (+65.38%)
Mutual labels:  shaders, glsl, shader
glsl-editor
💾 A simple WebGL shader editor
Stars: ✭ 20 (-23.08%)
Mutual labels:  glsl, shader
webassembly-webgl-shaders
Demo project for using WebGL shaders in WebAssembly
Stars: ✭ 107 (+311.54%)
Mutual labels:  shaders, glsl
ofxShadertoy
Addon for openFrameworks that sets up and loads Shadertoy (http://www.shadertoy.com) shaders
Stars: ✭ 77 (+196.15%)
Mutual labels:  shaders, glsl
FNode
Tool based in nodes to build GLSL shaders without any programming knowledge written in C using OpenGL and GLFW.
Stars: ✭ 81 (+211.54%)
Mutual labels:  shaders, glsl
frag3d.js
WebGL shader tools
Stars: ✭ 58 (+123.08%)
Mutual labels:  glsl, shader
ModularMusicVisualizer
Project in Hiatus, unmaintained, being rewritten privately. Will Open Source when stuff is ready. Project will be Renamed.
Stars: ✭ 81 (+211.54%)
Mutual labels:  shaders, glsl
stc8
#NVJOB STC8 v 3.2 (Custom shader for Unity SpeedTree 8)
Stars: ✭ 17 (-34.62%)
Mutual labels:  shaders, shader
unity-reaction-diffusion
(WIP) ✏️ Test of a Reaction-Diffusion simulated with a compute shader in Unity.
Stars: ✭ 25 (-3.85%)
Mutual labels:  shaders, shader
Messier87
A realtime raytracing blackhole renderer
Stars: ✭ 53 (+103.85%)
Mutual labels:  shaders, glsl

glsl-cos-palette

cosPalette is a simple shader function that is defined as

vec3 cosPalette(  float t,  vec3 a,  vec3 b,  vec3 c, vec3 d ){
    return a + b*cos( 6.28318*(c*t+d) );
}

where a,b,c,d are RGB-colors. This function can be used to make very compact color palettes. A simple editor for making such palettes is provided here.

The function cosPalette(t, a, b, c, d ), which is the palette, will basically assign a color to every value t, which is in the range [0,1]. So if you set t to be the value of some noise function(say, Perlin noise) in range [0,1], you can use this palette to make simple procedural textures. The palette will basically colorize the noise. In the fragment shader, we can easily procedurally generate a texture by doing something like

    float t = noise(vPosition);
    vec3 tex = cosPalette(t, uAColor, uBColor, uCColor, uDColor );

Credit goes to Inigo Quilez for coming up with this technique.

If even more advanced palettes are desired, they can be created using glsl-gradient-palette

Examples

Below are some examples of palettes

cosPalette(t,vec3(0.2,0.7,0.4),vec3(0.6,0.9,0.2),vec3(0.6,0.8,0.7),vec3(0.5,0.1,0.0))

cosPalette(t,vec3(0.2,0.5,0.3),vec3(0.0,0.5,0.7),vec3(1.0,1.0,1.0),vec3(0.0,0.3,0.7))

cosPalette(t,vec3(0.6,0.0,0.0),vec3(1.0,0.0,0.0),vec3(1.0,0.0,0.0),vec3(1.0,0.0,0.0))

cosPalette(t,vec3(1.0,0.4,0.0),vec3(0.4,0.8,0.0),vec3(0.5,0.3,0.9),vec3(0.9,0.6,0.9))

cosPalette(t,vec3(0.4,0.3,0.1),vec3(0.1,0.1,0.1),vec3(0.4,0.4,0.4),vec3(0.0,0.0,0.0))

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].