Based on @patriciogv's work from
https://thebookofshaders.com/13/