DEV Community

Cover image for I need a mathematician, Iridescence effect canvas?
Adam Crockett 🌀
Adam Crockett 🌀

Posted on

I need a mathematician, Iridescence effect canvas?

This is the effect I most want to produce on canvas in 2D or glsl contexts. Does anyone know the algorithm to do this? Its like oil on water and so on, note that it's vibrant and rough which is kind of what I'm after, is it perlin noise that I should investigate? I'd also like it to animate really slowly at the speed of crude oil.

Top comments (8)

Collapse
 
andrasnyarai profile image
Andras Nyarai

reactive diffusion

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Jackpot! For interested parties here is a link to the ever reliable Wikipedia. Link to wiki

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

A side note, thank you Andras this was a very clever and kind suggestion.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Here, I found this fantastic tutorial of the concept, seems to be a variation on the game of life.

karlsims.com/rd.html

Collapse
 
andrasnyarai profile image
Andras Nyarai

also the coding train on youtube

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Yeah I found that and the paper he references is in the comments, thank you so much.

Collapse
 
curtisfenner profile image
Curtis Fenner

Specifically on the optics (and how to simulate it in a computer) of iridescence, Alan Zucconi has an excellent blog series:

alanzucconi.com/2017/07/15/cd-rom-...

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

So that covers the colour. As well, thanks Curtis!