You are viewing archived messages.
Go here to search the history.

Ivan Reese 2023-06-19 05:38:01

My overall goal for the year is to —finally— learn how to do real work on the GPU. As a motivating short-term goal, I'm building a visualization of magnetic fields, as VFX for a video about regenerative braking that my company is producing. I'm doing all this (bear with me) inside a new drawing app that I'm developing, which heretofore rendered to SVG, but which I'd like to abstract so that it can render in a more API-agnostic way, as a prelude to making it portable (with an eye to Swift+Metal, perhaps eventually Vision Pro). Then (continue to bear with me) I'll have a nice foundation for continuing some of my visual programming experiments. So no, these screenshots here aren't strictly FoC-relevant. But it is stuff that I'm building as a test case… within a new graphics tech stack that I'm building… with a goal of supporting some new visual programming stuff that I'd like to do.

I won't be posting much stuff here until it becomes more directly FoC relevant, but if you'd like to follow along regardless I'll be posting more regularly on Mastodon.

Lu Wilson 2023-06-19 08:46:18

niiiiiiiiiiiiiice

Jack Rusher 2023-06-19 09:06:42

O, boy, do I have some goodies for you in my talk in September…

Ivan Reese 2023-06-19 17:22:21

You tease!

Chris Maughan 2023-06-20 13:07:19

You might find this video interesting; it has some good stuff on writing GPU shaders:

youtube.com/watch?v=f4s1h2YETNY&list=WL&index=2&t=14s

Ivan Reese 2023-06-20 17:26:35

Chris Maughan — Good summary of the basics, yep! One thing I learned from it — there's a step() function, which is like smoothstep() but, like, not smooth! Who knew :)

Chris Maughan 2023-06-20 18:42:14

I like the way he explains the maths, I hope he will continue the series.

Ivan Reese 2023-06-20 18:57:53

Yep, really familiar with IQ's work, but I appreciate the reference nonetheless. I needed some sdf shapes for this project, and you can bet where I went to grab those formulas :)

Chris Maughan 2023-06-20 19:33:21

He's amazing; I'd like to include some of his SDF math shapes in my own tool, but he is quite specific about that code not being free to use; I should just get around to asking him.

Ivan Reese 2023-06-20 19:35:52

I mean… I don't think he could stake a claim to, say, length(p) - r

Ivan Reese 2023-06-20 19:37:30

Also — "all code snippets you'll find are under the MIT license so you can easily reuse them."

Jack Rusher 2023-06-21 07:34:11

IIRC he had a freakout at one stage because he was worried that people might use his tutorials to learn how to produce work minted as NFTs, which were being vilified as massively environmentally destructive.

Chris Maughan 2023-06-21 10:47:00

Ivan Reese I'm referring to this: shadertoy.com/view/Xds3zN

And specifically:

Copyright Inigo Quilez, 2016 - iquilezles.org

// I am the sole copyright owner of this Work.

// You cannot host, display, distribute or share this Work in any form,

// including physical and digital. You cannot use this Work in any

// commercial or non-commercial product, website or project. You cannot

// sell this Work and you cannot mint an NFTs of it.

// I share this Work for educational purposes, and you can link to it,

// through an URL, proper attribution and unmodified screenshot, as part

// of your educational material. If these conditions are too restrictive

// please contact me and we'll definitely work it out.

To be fair, he does say 'contact me'... The shapes on the that page are what I'm interested in; he has a nice set of construction components.

Chris Maughan 2023-06-21 10:47:24

He may have said 'MIT' elsewhere, but not actually in the code...

Paul Tarvydas 2023-06-19 08:34:56

Aside: Magnetic fields are actually 4D phenomena (x/y/z/t). We use equations to think about fields by reducing fields to 2D so that we may scribble our thoughts down onto clay tablets and papyrus. There is this new medium - called “computers” - that might let us break free of 2D-only expression of 4D phenomena, using, say, 3D (x/y/t) while expressing the 4th D (z) using a trick that humanity invented, called “perspective”. Fields might be more-than-4D phenomena but our brains can only perceive 4 dimensions at this time.

Ivan Reese 2023-06-19 15:43:14

You're absolutely right. That's the whole reason I'm doing these experiments in field visualization. The video we're making is fully 3d rendered, and we were dissatisfied with all the styles of 3d field visualization that we saw out there in the wild. For instance, it's common for videos to use contour lines (in 3d, so splines , but whatever) to show a 2d slice of the field around a solenoid. That works kinda-sorta if you (A) pick the correct angle to slice and (B) use a perfectly ring-shaped solenoid. But for our video, we have a variety of weirdly-shaped coils and permanent magnets moving and interacting in nuanced ways. So we wanted to try to come up with something that would reveal more of the 3d structure of the field.

My experiments are happening in 2d, yes, but that's just because it's easier for me to iterate in 2d than 3d. I'm thinking in 3d as I'm working in 2d.

(Feel free to do an n+1 on all these uses of "2d" and "3d" to include time, if that's your notational preference — I just always take time as a given since I'm effectively always working in time-based media)