Live data from Hacker News

Programming SDF animations of Rick and Morty

danielchasehooper.com

21–30 of 42 posts

Re: Programming SDF animations of Rick and Morty

#22

What tool is used for embedded code? It’s really nice! I like the folding of non focused snippets

I made the live shader editor myself. It uses CodeMirror to display the code, and a webgl canvas for the preview.

Took some work to support having lots of editors on the page. If you do the naïve thing and create a webgl canvas for every one and instantiate all CodeMirror editors at page load time, the whole page would freeze for several seconds. So I create the editors as they are about to be scrolled into view. I also create only one webgl canvas, and when a preview is paused I cache the preview to an img, and move the canvas to the newly active editor instance.

Re: Programming SDF animations of Rick and Morty

#26
Did the author's development process involve a loop of tweaking fractional values or was some kind of editor used?

It seems like the trial-and-error approach to coming up with the 240 lines with appropriate decimal values may be just a tad time intensive.

Re: Programming SDF animations of Rick and Morty

#27
post #26

Did the author's development process involve a loop of tweaking fractional values or was some kind of editor used? It seems like the trial-and-error approach to coming up with the 240 lines with appropriate decimal values may be just a tad time intensive.

I just used the code editor built into that page. Binary search is fast, even by hand.

Re: Programming SDF animations of Rick and Morty

#28
post #26

Did the author's development process involve a loop of tweaking fractional values or was some kind of editor used? It seems like the trial-and-error approach to coming up with the 240 lines with appropriate decimal values may be just a tad time intensive.

When I have done things like this, I just grab a slider or input and wire it to a uniform. Uniforms are passed into the shader and can be updated without recompiling.

Re: Programming SDF animations of Rick and Morty

#30
post #15

Does anyone know if the portal animation from Balatro is done in the same way?

I think the Balatro background is a shader but the technique and effect it gives are different - this one has a static "ring" that shrinks as it moves inward to the horizon, the Balatro one has a fluid motion to it. The Balatro background reminds me (intentionally, I suspect) of demoscene effects, I love it

>The Balatro background reminds me (intentionally, I suspect) of demoscene effects, I love it

Oh, yes, I love it too!

Post reply on HN