Skip to content

Turn a texture to a vec3 color or create a gradient in shader languge with 10 colors #399

Answered by greggman
lv2lrn4lf asked this question in Q&A
Discussion options

You must be logged in to vote

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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lv2lrn4lf
Comment options

Answer selected by lv2lrn4lf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants