Excited to share *two* papers appearing at
#SIGGRAPHAsia2021
, on "Repulsive Curves" and "Repulsive Surfaces."
Tons of graphics algorithms find nice distributions of points by minimizing a "repulsive" energy.
But what if you need to nicely distribute curves or surfaces? (1/14)
Basic fact all graphics coders should know:
To uniformly sample points in a disk, you'd think you could just pick a random radius r ∈ [0,1] and a random angle θ ∈ [0,2π] to generate points r (cos θ, sin θ).
This doesn't work!
…But take the square root of r, and it does! 1/3
Here's another fun question: given two loops around an (infinite) pole, can you remove one loop without breaking it?
Amazingly enough... yes!
This is a surprising example of what's called an "ambient isotopy": a continuous deformation of space taking one shape to another. 1/n
New paper with Chris Yu & Henrik Schumacher:
We model 2D & 3D curves while avoiding self-intersection—a natural requirement in graphics, simulation & visualization.
Our scheme also does an *amazingly* good job of unknotting highly-tangled curves!
[1/n]
Tiny changes to the order in which you update positions x and velocities v can be the difference between your simulation blowing up or dying down.
But for many systems, *symplectic* integrators guarantee energy is preserved forever.
Full lecture here:
Different kinds of random walks ("stochastic processes") can be used to express solutions to many fundamental equations found in science & engineering ("PDEs"). These can in turn be used to develop Monte Carlo solvers.
Here I visually catalog a few of the connections.
#MCMA2023
Has machine learning solved computer graphics?
Let's find out by trying to re-create a bunch of classic graphics images using
#dalle2
! A thread. 🧵 [1/n]
Left: original image
Right: DALL-E 2 image
In each case I tried many times & show the best result. Full query string given.
Just uploaded a video on the Laplacian:
If you've heard of the Laplacian and always wondered what it was, or feel like you don't have great intuition for what it means, take a look—we explore how the Laplacian shows up in geometry, physics, & computation.
Cantor showed that the "integer grid" has the exact same number of points as the "integer line"—even though both have infinitely many points!
The correspondence can be shown using two (& only two!) bijective quadratic functions sending pairs (x,y)∈ℕ₀×ℕ₀ to integers n∈ℕ₀.
[Cantor 1873]: The quadratic function
P: ℕ x ℕ → ℕ
(x,y) ↦ ½( (x+y)² + 3x + y )
is a bijection.
[Fueter–Pólya 1923]: The only quadratic bijections ℕ x ℕ → ℕ are Cantor's P(x,y) and P(y,x).
"Don't just believe that because something is trendy that it's good … I think you get more prestige by doing good science than by doing popular science." —Donald Knuth
Very excited to share
#SIGGRAPH2020
paper w/
@rohansawhney1
on "Monte Carlo Geometry Processing"
We reimagine geometric algorithms without mesh generation or linear solves. Basically "ray tracing for geometry"—and that analogy goes pretty deep (1/n)
What's the nicest way to draw a shape with many "holes"?
We can use the principle of repulsion to explore this question: each point of the shape behaves like a charged particle, trying to repel all others. Surface tension prevents everything from shooting off to infinity. 1/n
If you need the area of a polygon, don't bother triangulating it.
Just add up the cross products of consecutive vertices.
This is the same as to adding up the signed areas of triangles made by the edges with a point p. But the choice of p doesn't matter since overlaps cancel.
Dead-simple way to find the intersection of two line segments:
- Append "1" to each endpoint
- Take three cross products
- Divide by the 3rd coordinate
This works because the 2D lines become 3D planes, & the cross product of the planes' normals gives their line of intersection.
Need the volume of a broken triangle mesh?
Don't bother fixing it.
Just sum over all triangles (𝐚ᵢ, 𝐛ᵢ, 𝐜ᵢ) the dot product of one vertex with the cross product of the other two, and divide by 6.
[Caveat: all normals must point out. Works even for nonconvex shapes!]
This breathtaking imagery is neither generative AI nor computer graphics—but rather real physical liquids under a microscope, exhibiting "reaction-diffusion" behavior.
These clips were created and filmed by artist Kamil Czapiga: (ig: cosmodernism)
Models in engineering & science have *way* more complexity in geometry/materials than what conventional solvers can handle.
But imagine if simulation was like Monte Carlo rendering: just load up a complex model and hit "go"; don't worry about meshing, basis functions, etc. [1/n]
Need the area of a broken polygon?
Don't bother fixing it.
Just sum up the cross product of the two endpoints, and divide by two.
[Here u × v := u₁v₂ − u₂v₁. Works even if the polygon is nonconvex. Caveat: all segments must point counter-clockwise, since u × v = −v × u!]
Advice to a student who was worried about bombing the computer graphics midterm, and wanted to know why they did great at the coding exercises but struggled with the exam.
To paraphrase my PhD advisor: mathematics is like weightlifting for the mind. 🏋️♀️🏋️♂️
Excited to share a new
#SIGGRAPH2021
paper with
@markgillesie81
and Boris Springborn that is a pretty big breakthrough in mesh parameterization:
In short: no matter how awful your mesh is, we compute beautiful high-quality texture coordinates.
(1/n)
For fun (and because I couldn't find any!) I wrote down some closed-form parametric equations for plain-knit yarns and the twisted fibers running around them:
Also includes C code to generate curves, and displacement/alpha maps for making tiled patterns.
If you need to interpolate rotations across space or time, there are much better options than Euler angles.
Here, rotations at the four corners are interpolated via the exp/log map.
Want to know more?
Some exercises:
& solutions:
Really incredible (or embarrassing?) to learn after all these years that there is in fact a perfect, regular tiling of the sphere by hexagons—with no pentagons, heptagons, or irregular vertices:
Do you distinguish between the words "ball" and "sphere?"
When teaching, I encounter two types of students:
1. those who think the distinction is “obvious”
2. those who have never thought about it/had any reason to care
So, to avoid bafflement, I take a moment to define them!
What's really impressive about this paper—apart from the incredible results—is that it doesn't come from an army of Facebook or Google researchers with a warehouse full of machines.
Just two PhD students and their advisor, and 12 hours of training on a single GPU in Erlangen.
Want to compute the volume enclosed by a triangle mesh?
Just sum up, for each triangle ijk, the triple product of its three vertices. Then divide by 6.
This works because the sum of signed tet volumes is the same no matter where you put the 4th vertex p. So just let p = 0.
Suppose you take a "random walk" by repeatedly sampling your next step from some set of possible directions (a square, a circle, a collection of dots…).
Remarkably, very different sets yield nearly identical behavior as we "zoom out" from the walk.
Q: Why?
#MCMA2023
(1/3)
When I was a kid, I fell in love with a program called "Bryce" that made beautiful, infinite worlds using procedural graphics:
Question: Where's the 21st century version of Bryce? Like, a NeRF-GAN world generator. (If it doesn't exist yet, it's coming…)
People love to toss around the word
#manifold
—but what is a manifold, really?
This lecture provides a first glimpse at manifolds, using discrete meshes to side-step formal definitions that show up in many intro textbooks on differential geometry:
#DDG2021
A *geodesic* is often confused with a “shortest path" on a surface, but in general a geodesic can be any path that locally minimizes length—or equivalently, that exhibits no tangential acceleration.
Check out this video for a visual intro to geodesics:
Excited to announce our
#SIGGRAPH2023
paper
"Winding Numbers on Discrete Surfaces,"
with
@nicolefeng_
and
@MarkGillespie64
.
In essence, we address the question: given a jumble of curves on a surface (possibly noisy & broken), which points are "inside" vs. "outside"? [1/n]
TIL I've been computing random number wrong my entire life. To get an integer uniformly at random between 0 and n-1, you *can't* just do
rand() % n
(Though admittedly the bias is extremely small in practice…)
#MCMA2023
Common misconception: Newton's method provides the "ideal" descent direction, and everything else is a cheap approximation.
Couldn't be further from the truth!
Newton is great when you're really close to a minimizer… and is a total heuristic everywhere else.
A powerful idea in math (that nobody teaches you directly…):
If you don't know how to map between two "things," you can often map each of them to the same "canonical thing."
Then you can just go from the 1st thing to the canonical thing, and back to the 2nd thing. [1/n]
A basic strategy for drawing from a random distribution is to first generate uniformly-distributed points, then "warp" these points so they're spread out according to the target distribution.
For example, the Box-Muller transform takes uniform points to normally-distributed ones
As a child, Gauss famously (& probably apocryphally) annoyed his teacher by coming up with a clever workaround for summing the numbers 1 through 100.
Here's a super cool formula & exposition by my friend
@hrldcpr
generalizing Gauss' trick to N dimensions:
Posted a short note giving a simple expression for the "volume" of a mesh with non-planar quads (easily generalized to n-gons):
(Nothing too deep here—just might be useful for folks who would otherwise bang their heads against nasty bilinear patches…)
There are lots of different ways you can express 3D rotations: Euler angles, quaternions, log/exp map…
Check out this awesome interactive webpage by
@SCSatCMU
undergrad Max Slater, which explais what all these different choices mean & how they behave.
Ever wonder how rotation matrices, axis/angle vectors, and quaternions are really related? The exponential and logarithmic maps allow us to translate between representations—and even average rotations.
Learn how, interactively:
Think you know
#ComputerGraphics
pretty well? We just released the past 5 years of midterm & final exams (with solutions!) from
@CarnegieMellon
's intro graphics class (CMU 15-462):
Give it a try!
(Course page here:
@CSDatCMU
)
Translating a 2D shape can be viewed as shearing a cone through that shape in 3D, turning addition (p ⟼ p + u) into matrix multiplication (q ⟼ Aq). This is the perspective of "homogeneous coordinates"—covered in a new lecture on spatial transformations:
This formula—and a general recipe for uniformly sampling from 2-dimensional shapes—can be found in the excellent article,
Jim Arvo
"Stratified Sampling of 2-Manifolds"
SIGGRAPH Course Notes (2001)
3/3
Would it be easier to understand the
#KleinBottle
if we drew a polyhedral surface rather than a smooth one?
Starting outside the box, jump into the J from above. Climb up through the hole in the bottom and you're outside the J—but inside the box.
No real "inside" or "outside."
Hot off the repo: our Monte Carlo solver for physical equations on super complex geometry—like predicting the temperature on this 3.9M element CT scan of a piece of toast, faster than a real toaster!
Check it out! 🔥💻🍞🔥
A reference C++ implementation for the Walk on Stars algorithm with
@baileymmiller1
, Ioannis Gkioulekas and
@keenanisalive
is available now here:
To learn more, check out this talk:
After four years of hard work by our team, I'm really happy to announce Penrose, which is sort of a "TeX for diagrams": type a mathematical expression; get a picture. See the great thread by
@hypotext
below!
(Public release coming later this year…!)
Do you like cool geometry stuff?
In honor of hitting over 1 million views on YouTube, I thought I might let my Twitter followers know that I have a YouTube channel, and it has cool geometry stuff!
Enjoy! 🧊🍩📺👀🧠🤩
Pretty awesome discovery: a single shape that tiles the infinite plane without repetition.
If you're staring straight down at a checkerboard, there's no way to tell where you are: every part looks the same.
But here, the relative arrangement of tiles encodes your location.
In a new paper, David Smith, Joseph Myers, Chaim Goodman-Strauss and I prove that a polykite that we call "the hat" is an aperiodic monotile, AKA an einstein. We finally got down to 1! 4/6
An image is a grid of pixels—but have you ever wondered how computers represent 3D shapes? If so, these lectures from
@CarnegieMellon
will get you started:
Intro to 3D Geometry:
Meshes:
Geometry Processing:
Have been recording lectures on Discrete Differential Geometry for remote teaching. Here for instance is a broad overview of the idea of *curvature* for those who haven't studied it before (or maybe also for those who have!):
#DiscreteDifferentialGeometry
Excited to share our
#SIGGRAPH2023
paper on the grid-free "walk on stars (WoSt)" algorithm:
Grid-free methods can solve fundamental physical equations like Laplace & Poisson without meshing the domain—WoSt extends such methods to Neumann conditions. [1/n]
[1/n] There's been a lot of hubbub lately about the best known packing of 17 unit squares into a larger square, owing to this post:
I realized this can be coded up in < 5 minutes in the browser via
@UsePenrose
, and gave it a try. Pretty darn close! 🧵
[9/n] Even simple 2D graph layout can benefit from repulsive curves. Rather than the usual "edge is a linear spring" model, each edge can bend around to optimize node placement:
Blown away to see this upcoming
#SIGGRAPHAsia
paper on fluid simulation using Monte Carlo:
We had dreamed of someday using Walk on Spheres to solve Navier-Stokes but never thought it would happen this quickly! Congrats
@topher_batty
@DerekRenderling
& co!
What's the best way to pack N circles into a square?
Using less than 20 lines of code in
@UsePenrose
, we can reproduce the best-known solutions ever found:
Try it out for yourself!
Oh but it goes so much further. 😁
- derivative of volume is area
- derivative of area is mean curvature
- derivative of total mean curvature is Gauss curvature
- derivative of total Gauss curvature is zero
Explained here for smooth & discrete surfaces:
I’m a tenured professor and TIL that the formula for the surface area is simply the first derivative of the volume formula, e.g. V(sphere, r) = 4/3 pi r^3 and SA(sphere) = dV(sphere, r)/dr = 4 pi r^2. Obvious in retrospect, but no one ever pointed this out to me.
Check out the latest from
#MCMA2023
:
Monte Carlo integration is super powerful, but can be *slow*
So-called 𝘃𝗮𝗿𝗶𝗮𝗻𝗰𝗲 𝗿𝗲𝗱𝘂𝗰𝘁𝗶𝗼𝗻 techniques give you "more information for your buck," making Monte Carlo thousands of times faster—and useful for real-world problems!
Three integers satisfying a² + b² = c² form a Pythagorean triple, which can be drawn as a right triangle, or a point (a/c, b/c) on the unit circle. Amazing fact: starting with the four Pythagorean triples (±1,0,1), (0,±1,1) all others can be generated via hyperbolic reflections.
Over the years I've made a huge number of mathematical illustrations as vector art for papers, course notes, lecture videos… there's still no great automatic solution, and I do a lot of work "by hand."
Here's an old talk about my process, circa 2015:
Anyone who thinks vectorization of 3D geometry is a solved problem hasn't had to make clear & useful mathematical diagrams (or isn't enough of a perfectionist).
Awesome video by
@monkibase
explaining how to compute geodesic distance directly on point clouds, using the original
#heatmethod
. Also provides a visual tutorial on the point cloud Laplacian, covariance matrices & moving least squares. Full video here:
Remember those mysterious "trigonometric identities" you had to memorize in high school? They were just basic facts about points on a circle. For instance, you can write a dot product of two unit vectors in components, or as the cosine of the angle between them. So you get this:
Using point clouds for machine learning?
@nmwsharp
has released code for our point cloud Laplacian:
It's both sparser (read: faster) and more accurate/reliable than widely-used Laplacians (Belkin, graph Laplacian, …)
Just pip install robust_laplacian
Tired of making the same kind of diagrams over and over by hand (e.g., in PowerPoint)?
The
@UsePenrose
team has been working away on Penrose 3.0, an automated notation-to-diagram tool, finally released today!
Check it out here:
Stupid little matrix algebra manipulation nobody ever bothers to teach you: even if c is a scalar, you sometimes want to write its square as c² = cᵀc.
Why? So that the square of an inner product (𝐲ᵀ𝐱)² = (𝐲ᵀ𝐱)ᵀ(𝐲ᵀ𝐱) becomes a nice quadratic form Q(𝐱) = 𝐱ᵀ(𝐲𝐲ᵀ)𝐱
The dihedral angle between two triangles is easy to mess up—with lots of ugly formulas floating around the internet!
Fortunately, it can be computed via a simple expression involving only:
- the unit vector e along the shared edge
- the unit normals n1/n2 to the left/right of e
For the intro Computer Graphics class at
@CarnegieMellon
, we asked our students for feedback on how to improve the documentation for an assignment on triangle rasterization & supersampling.
One of them created this (!):
[12/n] Finally, here's a weird idea, to find 2D trajectories for vehicles that are as "far as possible from collision," optimize 3D curves in space + time:
The isoperimetric inequality says the squared length L² of a curve is no less than 4π times its area A—these quantities are equal for a circle.
But have you heard of Bonnesen's inequality? The deviation from a circle is bounded by the inner/outer radii r/R:
π²(R-r)² ≤ L²-4πA
Suppose I have a collection of identical, non-overlapping, unit-height rectangular blocks in 2D, each given by a real coordinate x and integer coordinate y.
What is the simplest algorithm to check if these blocks are in static equilibrium?
Honored to have been named the Michael B. Donohue Associate Professor of Computer Science and Robotics, which will provide greater freedom to pursue my dreams and ambitions.
Anyone who thinks vectorization of 3D geometry is a solved problem hasn't had to make clear & useful mathematical diagrams (or isn't enough of a perfectionist).
The law of cosines feels like some obscure formula you had to memorize for a high school trig exam.
But actually it's just a trivial fact about vectors: the squared length |x−y|² expands into the individual squared norms |x|² and |y|², minus twice their inner product <x,y>.
One awesome thing about Monte Carlo integration: you get very predictable convergence to the true solution, across a variety of tough problems.
Our 2nd lecture in
#MCMA2023
gives a (quite visual!) review of probability, culminating in the famous 1/√N Monte Carlo error rate.
After dozens of papers written, many dozens of lectures given, and many dozens of dozens of dollars raised, I am happy to announce that I have been promoted to Associate Professor (without tenure). Just three more years to go...
To compute the smallest angle of rotation θ between two 3D rotation matrices U, V, just take their dot product, subtract 1, divide by 2, and take the arc cosine. ("Dot product" here means multiply corresponding entries, then sum them up.)
(To see why: )
When it comes to mathematics, the best way to deal with feeling like an idiot is to accept that you will always feel like an idiot—no matter who you are, or how far you've come.
(See also: Thurston, "On Proof & Progress in Mathematics" )
Q: How can we solve physical equations on massively complex geometry?
A: Monte Carlo methods!
Check out this talk for a deep-dive into the "walk on spheres" algorithm & recent developments, which I gave last week at the Oberwolfach Mathematics Institute:
In this lecture we talk about integration, culminating with one of the most beautiful theorems in differential geometry—Stokes' theorem—which generalizes the divergence theorem, Green's theorem, fundamental theorem of calculus, and much more!
#DDG2021
Both of these illustrations demonstrate an intersection-free path between the tangled-up curve and the circle.
One uses Reidemeister moves:
The other minimizes tangent-point energy:
Which do you find helpful? Both? (Neither!?)
Something not well-appreciated about finite element methods (FEM) is that if you can't mesh your domain, you simply can't run the solver. Game over.
We've been developing Monte Carlo methods that *always* work, no matter how bad your geometry gets:
In our first lecture in
#MCMA2023
, we give a broad overview of the Monte Carlo method, introduce the integration & sampling problems, and take a brief look at how it helps with applications from image generation to solving PDEs to finance to natural language to generative AI!
Boundary conditions are super important, but are often glossed over—including by me!
After many years, I finally got around to writing up how to derive and implement Dirichlet & Neumann conditions for the discrete Laplacian (§6.7):
(Report bugs below!🪲)
The
@CarnegieMellon
course on Discrete Differential Geometry is back for Spring 2022!
If you want to follow along, all lectures, notes, and coding exercises are online for free at
The welcome video here gives a quick overview:
Think knots are easy to untangle?
As a companion to our recent paper on "Repulsive Curves," we're releasing a dataset of hundreds of *extremely* difficult knots:
In each case, a knotted & canonical embedding is given. Can you recover the right knot? 1/5
New video lecture, on geodesics:
Geodesics generalize the idea of "straight lines" to curved spaces—like the circular arc an airplane takes across the globe. This video gives a crash course on geodesics, using geometric algorithms to help tell the story.
For years I've used these weights to interpolate constant values on edges of a triangle mesh; h are heights.
Does anyone know what they're called, or anything about them?
I say "circuit interpolation" since it (sort of) reminds me of computing resistance in a parallel circuit.
Think you know curves? Despite being only one-dimensional, these creatures have surprisingly rich and beautiful structure.
This lecture is a 1st intro to curves, including the fundamental theorem & Whitney-Graustein + applications to geometry processing!
So badly—but subtly—wrong that I not only distrust
#Galactica
: I don’t trust *any* deep language model to provide reliable answers in situations that matter.
(The danger is that they perfectly imitate an authoritative & trustworthy style.)
🪐 Introducing Galactica. A large language model for science.
Can summarize academic literature, solve math problems, generate Wiki articles, write scientific code, annotate molecules and proteins, and more.
Explore and get weights: