2 ms·
Instead of giving us a small number of colors, could this idea be turned into a new colorspace model?
by amelius 4y ago
Instead of giving us a small number of colors, could this idea be turned into a new colorspace model?
- danwills 4y agoYeah I've been using HSV transform in feedback (in glsl shaders) to great effect lately (rotate hue a bit to get rainbow-color cycling) but only the other day I was wondering how the heck to make this rainbow better!? (essentially: more like real diffraction) If it passed through the colors in the article instead of going around the hsv-wheel that would be a huge improvement I reckon! I'll brave the syntax and try to paste my current method: vec3 rgb2hsv(vec3 c) { vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); float d = q.x - min(q.w, q.y); float e = 1.0e-10; return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } I wish I knew more about what this code is really up to, I inherited it from somewhere, can't remember, and I'll admit I haven't tried to understand it yet.