I made something using yampa! (live watercolour diffusion project) #291
cxrala
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the past few months, alongside my university studies, I've been making a project concerning live painting with yampa for a dissertation.
Here is the code, you can clone it and run it if you want to see it in action.
A demo:
A comment on my journey
The things I enjoyed
Although there was a lot that was difficult (see below), I have to say that using
yampa
was the easiest part of this project. Perhaps that's because the signal function I ultimately ended up using wasn't very complicated (... it was dealing with discrete State-to-State steps), but I think it was an extra plus to work with a framework so well documented. In fact, the goal of this project was to explore FRP, and I ended up having to do a lot of set-up to be able to even begin playing around withyampa
. But it was by far the most enjoyable part of the process. It's really pleasant to see how everything fits together with just a few signal functions. I really want to do more stretching ofyampa
(i.e. learn it fully instead of using just a few functions), so perhaps my immediate next goal would be to see what sort of effects I can add to my program using FRP and minimal modification.Improvements (there are a lot of them)
There's a LOT to improve on. Firstly, this project was essentially my introduction to Haskell -- so I was learning FRP + Haskell on the fly, and some parts of the code felt very "hacked together" due to a lack of knowledge about the language. Retrospectively, there are a lot of improvements that I could have made and almost definitely things that I have missed (for example, I had a memory leak and part of that was because of a lack of proper strictness usage). Secondly, this project was also my introduction to SDL2/OpenGL, which was at first an absolute nightmare to work with (until it wasn't, owing to focusing on working entirely within SDL2 and not interacting directly with OpenGL). Thirdly, the rendering could have been a lot nicer. Admittedly, I could have written nice shaders and used the Kubelka-Munk model, but I had sunk so much time learning how to get it to a bare minimum standard that I wanted to leave it until some other time.
Final comments
Overall, I have definitely learned a significant amount. Before even trying to use
yampa
I had read a few papers on FRP, but retrospectively I don't think I even needed to do that. It may have been possible to figure out how many of the functions worked just by looking at the type signature and the name, which is awesome (and a consistent theme of using Haskell, which is amazing).Although I would probably hesitate to work on a physics-simulation type project again with Haskell, I think it would be an interesting exercise to see how to use FRP in other contexts, and may continue using
yampa
in the future!If you have any comments, criticism or suggestions, please let me know!
Beta Was this translation helpful? Give feedback.
All reactions