-
I have a webgl scene that i would like to apply a rainbow color effect, i can get the effect i want with one color and i can create a gradient colors of two color in shader language.
from https://stackoverflow.com/questions/47376499/creating-a-gradient-color-in-fragment-shader is there a function in fragment shader that allow you to mix more than two colors with a smooth gradient linear? i would love to just use a image but i can't seem to get that to work and want to focus on what i can get to work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You really should figure out how to use a texture like the answer you linked to rather than try to figure out a poor substitute. As the answer points out Canvas 2D and CSS both use a texture for gradients because it's the most flexible and performant solution. Otherwise if you want a non-flexible solution there are examples on shadertoy |
Beta Was this translation helpful? Give feedback.
You really should figure out how to use a texture like the answer you linked to rather than try to figure out a poor substitute. As the answer points out Canvas 2D and CSS both use a texture for gradients because it's the most flexible and performant solution.
Otherwise if you want a non-flexible solution there are examples on shadertoy
https://www.shadertoy.com/view/4ttfRN