Hacker News new | past | comments | ask | show | jobs | submit login
Manim – 3Blue1Brown's animation engine for explanatory math videos (github.com)
669 points by amingilani 30 days ago | hide | past | web | favorite | 80 comments

I’ve recently moved back into academia. Inspired by 3b1b and horrified by the awful state of the (PowerPoint) notes that were given to the students of the modules I now coordinate, I’ve taken to rewriting them using Jupyter and copious amounts of Blender animations.

I don’t see myself using these tools as I know blender very well and I’ve got a workflow. Equations can be exported from LaTeXit as SVG and imported into blender for manipulation and animation. The new eevee real time renderer in 2.8 makes rendering high quality graphics really fast. Then, when appropriate, I try to recreate the concept in simple Python and animate it so the students can play with it.

Checkout mathbox. Mathbox is pure and simply genius. https://github.com/unconed/mathbox

Yes please!

I have a passion of explaining concepts to younger humans. Combining programming, animation, and teaching: this kinda hits home.

I learned blender out of a necessity to explain concepts to older executive humans (and blender is awesome!).

During my undergrad we learned Matlab in year one and subsequent modules in core subjects like solid mechanics, fluid mechanics etc ignored anything to do with code. This was mainly because (as I learned later) the lecturers frequently couldn’t code themselves.

This was frustrating because coding is essential to engineering and efficient problem solving. Fast forward to today and I see the same problems. Students are terrified of coding. It’s complicated enough to have to learn all this new maths but also all this computer science stuff?!

So the notebooks often deal with fundamental stuff that don’t really need need code but then the code can be super simple and intuitive and hopefully inviting.

Sounds awesome, can you show off some examples?

I will once I have a few complete sections. I plan on putting them on GitHub so you can run them via Google Colab.

The topic is introductory fluid mechanics BTW.

Hey, I’d love to help out with that. I’ve been making my own attempt at writing literate code in fluid dynamics and I’d love any examples of it in the wild.

In short, don’t mind a repo with half finished code :) send me a message at @grokkingStuff

I’ll be in touch!

Would you mind explaining how you work with SVGs in blender? Genuinely interested, as I've been using blender for years, but have not had much success manipulating 2d graphics in there. I'm hoping your workflow can expand my knowledge! Thanks!

First you need to install pdf2svg for LaTeXit to export SVG.

Now, once you’re in blender if you import SVG art it’ll typically come in at a very small scale and each object will be separate, but it’ll also be selected. I usually scale it up shift select the first character of my equation and then ctrl j to join it.

Then it’ll just be a regular curve object in blender. You can add modifiers like solidify, bevel objects, convert to mesh etc.

There’s also a 2D/3D toggle in the curve properties.

That's great info! Thank you :)

Let me know if you need more info. 2.8 brings s lot of grease pencil and 2D curve changes that are very powerful.

Happy blendering.

Just recently I've been fiddling around with Blender in the hopes of creating some scientific animations with it. I've gotten the hang of the basics, but I'm struggling a bit with moving beyond toy examples.

Would you mind sharing your workflow? It might help me to have a mental model of the full process of a typical animation.

What type of stuff? I could record a video of a specific example for you.

If you have the time, I'd appreciate that a lot! I'm an EE with a focus in electromagnetics, so I'd be most interested in animating time-varying vector fields, and also wave phenomena.

I saw in one of your other comments that you plan to put some of your other work on GitHub at some point. I'll make sure to check that out too.

Here are two quick and dirty videos. Apologies for the mumbling and the fan noise.



There's a lot more you can do with Python scripting and addons. You can plot math functions as surfaces etc. There are probably a lot of possibilities with procedural textures and displacement maps.

Thanks a bunch, those were helpful. You're clearly pretty fluent with Blender, how long ago did you start learning? Were there any resources you found helpful, especially for scientific applications? Most tutorials I've found are aimed more at artists, video game/movie animators, etc.

I've been looking into the Python API and the animation nodes addon too, both seem pretty powerful.

About six years now. I remember initially using some official tutorials that weren’t great. These new ones are much better:


The various Andrew Price videos were very helpful and once I had an idea of what feature I needed to use it made searching for tutorials easier.

For specific scientific applications, I can’t say. I’ve used various Adobe tools and CAD packages over the years for making artwork for papers and presentations as well as being inspired by animation from video games, documentaries, 3b1b etc.

One of my initial uses was rendering lambda_2 isosurfaces of turbulent structures from Direct Numerical Simulations.

I’ve used the Python API to script some topology generation for 3D printing which is great. I’ve yet to use animation nodes because for the current series I’m working on I want to give the students blend files of the animations in vanilla 2.8 should they want to explore behind the curtain.

Awesome, thanks again for taking the time to answer all my questions!

Just wanted to also give a shoutout to Eugene Khutoryansky for providing a ton of science and math videos with great 3D visualizations. I'm not sure what 3D system he uses, perhaps someone here does:



This type of project would really benefit from some examples of the media it produces.

You mean such as the entire 3blue1brown YouTube channel that it was created for?

Sure, that would be a great thing to include in the README.

In the tutorial linked in the README, there are many examples with output: https://talkingphysics.wordpress.com/2019/01/08/getting-star...

Thanks! I think a screenshot or link to a youtube video would be helpful in the README for those of us unfamiliar with 3Blue1Brown.

I have no idea why this was downvoted. This is absolutely correct.

Edit: Can someone explain to me why both the answer above this and mine were downvoted? The linked library has zero context on what 3Blue1Brown is, or even that it's a YouTube channel.

Changing the explanation on the library from "Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically." to "Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen on <the 3Blue1Brown YouTube channel>." would — in seven words — instantly improve this README. It would give visitors context, concrete examples, and a resource to dig in more.

If you've downvoted, please explain what drawbacks there are to that.

Talking about downvoting on HN almost always results in your comment being downvoted. I see your account is from 2009, so this HN guideline shouldn't come as a surprise...

> Please don't comment about the voting on comments. It never does any good, and it makes boring reading.


Good point. I should have left it.

In other news, my PR got merged into the README, so hopefully folks in the future won't have the same confusion that prompted this thread.

> If you've downvoted, please explain

Downvoting exists to enhance the signal to noise ratio by discouraging response chains to comments which are not valuable to the discussion. Explaining downvotes is contrary to the purpose of downvotes.

I have not downvoted you, but frankly comments like these. seem superficial given the fact that the project is hosted on github and you could literally spend a similar amount of effort and get a pull request yourself.

As a former math teacher and now software developer, this is super cool. I no longer have a need for it, but if I had time, I'd consider reviving some old lessons. Again, this is really neat.

It would be nice to be able to make it interactive, like slider bars and such. The ti Nspire had some cool apps for that.

Where can I find some examples of the output of this ? The github page doesn't link to an example video or even a screenshot.

Thanks, that looks pretty cool actually.

I clicked on the first one and most of the animation is distracting and superfluous, like bars of a bar graph repeatedly bouncing off each other.

Does that sort of animation really promote learning? How much ornamental dressing is needed to keep visual attention but not distract?

Aren't they meant to be solid masses with particular collision properties? In which case showing how they collide seems to me exactly want you'd want to show.

EDIT - I just watched it with sound. I suspect you didn't and misunderstood the subject matter.

The github readme points to a tutorial here: https://talkingphysics.wordpress.com/2019/01/08/getting-star...

Does it do 3d? Because geometry and algebra on 3d bodies and rotations, quarternions, etc do benefit from good visualizations.

A lot of his series on differential equations and geometry makes use of 3d components, presumably from this engine

Does anybody has a recommendation to animation workflow for algorithms explanation? I've already tried with tikz and inkscape, but I always give up.

Why did he give away his secret sauce?

Edit: yes I know this tool isn’t his secret sauce, I was being facetious. His excellent explanations are his secret sauce. I just wanted to know why he open sourced this after so long of saying it was made for his personal use and wasn’t designed for widespread use.

Because the "secret sauce" isn't a tool to make animations. The secret sauce is being able to explain complex concepts in simple terms, while encouraging curiosity and maintaining math as an approachable topic, for those who may be otherwise intimidated - and additionally coming up with ideas for animations that will help explain those concepts. All the while, maintaining a high level of quality and regularly releasing content, such that you become a "brand".

It's a lot harder to replicate that secret sauce, than it is to replicate some animation engine.

Mathematicians are all experts at symbol manipulation and tend to communicate that way. 3b1b uses geometric analogues that are far more useful than definitions and symbols for learners.

Math teachers are usually stuck using symbols to communicate because not many mathematicians have 3b1b's skill at animating and so can't use the high-bandwidth visual medium like he does. A blackboard can't compete with a 3b1b video; and it isn't just because he thinks clearly, it is because an animation can get more bits of information through in a short period of time and works better with a students short term memory. His custom animation tool is more important than it seems - he can explain more clearly because of a slight-of-hand where he has a much wider communication channel to get his message across.

That being said, the barrier to entry is still high. I suspect any topic he hasn't already covered is going to need specialist knowledge to extend this program.

I like 3b1b's animations, but lets not get ahead of ourselves here.

Mathematicians have been using blackboards and symbols for thousands of years, and its never been a hindrance. While its not as good as video, its more than adequate to explain things and if you still have issues, you can use the many mathematical modeling tools that have existed for years.

Also, many of his topics require in-depth knowledge in the first place and gloss over significant portions of detail because the problems are often specialized. These details are obscured through the many drawings and it gives the viewer a false sense of understanding without actually being able to do the math.

So you're left with a largely conceptual understanding without any syntheses understanding, because, at the end of the day, you have to produce a line by line derivation in order to be considered having understanding.

To expand:

Of all of the math teachers I've had, only one tried to explain things in an understandable way the 3b1b does.

Most math teachers just follow a curriculum and hope repetition drills facts into the students head. 3b1b makes the relationships between systems clear.

In addition, theres proabably not a wide audience for math videos, and this is a good advertisement for his channel. Likely would have been useful when I was in undergrad, but most math terms are gibberish after not using them at all for work.

>why he open sourced this after so long

Did he only do it recently? It was on GitHub already when I watched his video first time.

Yes, it has been on GitHub for some time already

It’s been on github for years.

> after so long of saying it was made for his personal use and wasn’t designed for widespread use.

I'm not sure why you don't trust his explanation? Polishing up personal/internal projects and making them releasable as open source can take a lot of time and effort.

I never said I didn’t trust his explanation. As I recall it seemed like he had no intention of ever making it widely available so was just surprised to see it show up all of the sudden. This is sort of funny, I’m actually a big fan of his work and yet everyone seems to think my question is a knock on him.

The 3b-hive stung you.

Because animations aren't his secret sauce?

Clearly, he is simply a great human.

Because the renderer alone won't help you.

I tried using this once... it wasn't super great.

1. The documentation is sorely lacking.

2. Which makes the inheritance hierarchy (which is already a little unintuitive) really hard to grok.

3. There's this weird home-rolled way of doing default property inheritance that took me a long time to wrap my head around.

In the end, I ended up coding a short interactive thing[1] for my blog using Paper.js. It's a great idea, but could really use some love and maybe a stronger philosophy to guide development. Right now it feels more like a few hacks thrown together.

[1] http://mitchgordon.me/math/2019/03/18/multiplying-complex-nu...

He can't win. People bug him to find out what software he uses. He says he wrote it. People bug him to release it. And then complain it is not properly documented or is unintuitive.

'A few hacks thrown together' seems awfully pejorative. It is a tool he has developed over the years to enable him to produce the high-quality videos he releases.

It's different people making the different complaints.

In general, you can't please all the people all the time.

GP isn't a complaint, but constructive criticism. When we lose the ability to tolerate criticism, we lose the capability of progress.

It's not that constructive though, just seems like a complaint.

How do you differentiate those two things?

To me constructive means there is a suggestion of how to improve.

Don't get me wrong, I love his videos, and I think it's really nice of him to open-source the stuff.

But like some of the other comments have mentioned, it's not a general purpose tool... it's more like he open-sourced his dot files.

You can certainly make a few things work, but it would be nice to see a community of interested individuals come together to flesh out the abstractions, make sure everything is documented and works as advertised. As it is now, the class hierarchy is a little... misshapen. It's not clear what classes are responsible for what functionality, and how everything fits together in a nice, orthogonal way.

People don’t know what they want. Or rather, they conflate what they want with real things that are close to, but not quite exactly, what they had in their mind. They then get frustrated because it doesn’t match what they imagined the whole time... but nobody told them it was!

> Right now it feels more like a few hacks thrown together.

Because that's what it is. It's a tool made over time by him for his videos. The only reason it's out there is because people keep asking to see the code. It was never meant to be a fully documented, easy to use public tool. It's a personal project that was shared for the sake of openness.

That being said, there aren't many tools like it out there, and I'd love to see someone take bits and piece from here, and create a proper tool from the ground up.

what would a proper tool look like? I really want to write such a tool. But I can't formalize the product.

If I were you, I would look into writing equation and graphing calculator plugins for an existing animation tool, such as Blender.

I'm imagining something like a graphing calculator where you can define parameter variables that become interactive sliders, or that can be scripted or controlled by animation curves to produce baked animations.

I've been using Desmos for a year now, it's great! Waiting for the 3D version.

Although you can write your own 3D renderer inside Desmos...

Like the Manipulate command in Mathematica?: https://reference.wolfram.com/language/tutorial/Introduction...

I would start by looking at the current space of math software: TeX and LaTeX, MathJax, R, Wolfram Alpha, GNU Octave, MATLAB, Microsoft Excel, Omnigraffle. Plus decades of bespoke math educational video games (originally distributed on floppy/cd-rom; later online flash games).

Then think about what subdomain of mathematics you want to write software for. (9th grade polynomials, graphing, and algebra? Addition? Times tables?)

I'd also think about who you expect to use the software. (Just you? Teachers? Students?)

My dad used to work in a TV station's meteorology department. He is also a math teacher. He used some of the animation software (running on Irix on SGI O2's at the time, if I remember right) and green screen for weather reports to make math videos for his students, long before YouTube.

I was able to pick up that software and start making animations during a tour I got of the studio. The tools were designed to allow linking objects, paths, and animations in a very intuitive way.

See if you can find a demo of some of those weather animation user interfaces as there is probably good inspiration there.

Do you remember the name of the animation software they used?

“Looking at” R, Matlab and sage alone is easily year worth of work.

Probably like Mathematica crossed with After Effects.

Yet another useless and entitled comment. A tool that is very clearly meant for personal use, and is even advertised as such, did not happen to be a well documented library easy for everyone else to use. What a surprise. To me this repo shouldn't be interpreted as anything more than just a sneak peek at what such a library could look like, and we're lucky he even bothered putting it out there after all the nagging. It's frankly embarrassing seeing it get flooded with entry-level questions expecting full guides on how to get started.

"In the end, I ended up coding" — this is what open source does to your brain, I guess.

Honestly, "useless and entitled" kind of hurt my feelings. The title says it's 3Blue1Brown's "animation engine." I'm just relaying my experience with the thing to let people know that working with it won't be all sunshine and roses, if they want to use it, and that it might be nice to put some effort into it if we really want it to be a community tool.

I think we have similar opinions about what the tool is, and what it's not. I just must have not expressed myself in a very clear way. I did spend about two days hacking on this, just to get a basic POC working. But in the end, I couldn't figure out how to put right angle markers on my vectors. I also submitted an issue about vectors getting smaller when the norm was less than 1.

I'm just saying, the title makes it seem like it's a general purpose tool, but it's not.

Yeah, that's what I felt when I poked around it. But at the same time, I don't think it was meant to be anything more than a few hacks he uses to create his own beautiful content. I expect this is the kind of critique I'd get if someone ever tried to use my dotfiles. They work wonderfully, but just for me.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact