Keenan Crane Profile picture
May 16, 2022 47 tweets 18 min read Read on X
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] Image
Our #SIGGRAPH2022 paper takes a major step toward this vision by building a bridge between PDEs & volume rendering: cs.dartmouth.edu/wjarosz/public…

Joint work with
@daseybdarioseyb.com
@rohansawhney1rohansawhney.io
@wkjaroszcs.dartmouth.edu/wjarosz/

[2/n] Image
Here's one fun example: heat radiating off of infinitely many aperiodically-arranged black body emitters, each with super-detailed geometry, and super-detailed material coefficients.

From this view alone, the *boundary* meshes have ~600M vertices. Try doing that with FEM! [3/n] Image
To get the same level of detail with FEM—even for a tiny piece of the scene—we need about 8.5 million tets & 2.5 hours of meshing time.

With Monte Carlo we get rapid feedback, even if geometry or materials change (above it's even implemented in a GLSL fragment shader!)

[4/n] Image
At this moment the experts in the crowd will ask, "what about boundary element methods?" and "have you heard of meshless FEM?"

The short story is: these methods must still do (very!) tough, expensive, & error-prone node placement, global solves, etc. (See paper for more.) [5/n] Image
Our journey with Monte Carlo began a few years ago, when we realized that rendering techniques from computer graphics could be used to turbo charge Muller's little known "walk on spheres" algorithm for solving PDEs. You can read all about it here:



[6/n]
Our latest paper makes the connection between rendering & simulation even stronger, by linking tools from volume rendering to ideas in stochastic calculus.

We can hence apply techniques for heterogeneous media (clouds, smoke, …) to PDEs with spatially-varying coefficients [7/n] Image
Spatially-varying coefficients are essential for capturing the rich material properties of real-world phenomena.

Want to understand the thermal or acoustic performance of a building? Even a basic wall isn't a homogenous slab—it has many layers of different density, etc. [8/n] Image
And that's just the tip of the iceberg—PDEs with spatially-varying coefficients are everywhere in science & engineering! From antenna design, to biomolecular simulation, to understanding groundwater pollution to… you name it

How can we simulate systems of this complexity? [9/n] Image
A major challenge in any PDE solver is "spatial discretization": whether you use finite differences or FEM or BEM or… whatever, you have to break up space into little pieces in order to simulate it. This process is expensive & error prone—especially for complex systems! [10/n] Image
Apart from just the massive cost of discretization/meshing, it causes two major headaches for solving PDEs:

1. important geometric features get destroyed, and
2. you get aliasing in the functions describing your problem (boundary conditions, PDE coefficients, etc.).

[11/n] Image
Because spatial discretization is such a pain in the @#$%, folks in photorealistic rendering moved away from meshing many years ago—and toward Monte Carlo methods which only need pointwise access to geometry (via ray-scene intersection queries).

So, what about PDEs? [12/n]
Here there's a little-known algorithm called "walk on spheres (WoS)," which avoids the problem of spatial discretization altogether.

Much like rendering, all it needs to know is the closest boundary point x' for any given point x. Details here:

[13/n]
Now, to be candid: WoS is *way* behind mature technology like finite element methods (FEM) in terms of the kinds of problems it can handle (…so far!)

Especially in graphics we've seen amaaaaazing PDE solvers that handle wild, complex, multi-physics scenarios—like pizza! [14/n]
But the WoS idea—and its promise to free us from the bonds of spatial discretization—is so alluring that we have taken up the mission of expanding WoS to broader & broader classes of PDEs.

So, let's talk about how we can extend WoS to variable-coefficient PDEs. [15/n]
This story is really a tale of three kinds of equations:

* partial differential equations (PDE)
* integral equations (IE)
* stochastic differential equations (SDE)

Our paper (Sections 2 & 4) provides a sort of "playbook" of how to convert between these different forms.

[16/n] Image
In precise terms, our goal is to develop a WoS method that solves 2nd order linear elliptic equations with spatially-varying diffusion, drift, and absorption coefficients.

Let's unpack this jargon term by term. [17/n] Image
First: PDEs describe phenomena by relating rates of change. E.g., the 1D heat equation says the change in temperature over time is proportional to its 2nd derivative in space: ∂u/∂t = ∂² u/∂x².

To get the temperature itself, we have to solve for u—usually numerically! [18/n]
"2nd order" means there are at most two derivatives in space; "linear" means derivatives are combined in a linear way (e.g., not squared or multiplied together). "Elliptic" roughly means the solution at each point sort of looks like a (weighted) average of nearby values [19/n].
Seeing some examples is helpful.

First, a Laplace equation Δu = 0 describes the steady-state temperature if heat is fixed to some function g on the boundary.

(Here the Laplacian Δ is just the sum of all 2nd partial derivatives: Δu = ∂²u/∂x² + ∂²u/∂y².)

[20/n] Image
Adding a source term f yields a Poisson equation Δu = f, where f describes a "background temperature." Imagine heat being pumped into the domain at a rate f(x) for each point x of the domain.

[21/n] Image
We can control the rate of heat diffusion by replacing the Laplacian Δu, which can be written as ∇⋅∇u, with the operator ∇⋅(α∇ u), where the α(x) is a scalar function.

Physically, α(x) might describe, say, the thickness of a material, or varying material composition
[22/n] Image
Adding a drift term ω⋅∇ u to a Poisson equation indicates that heat is being pushed along some vector field ω(x) — imagine a flowing river, which mixes hot water into cold water until it reaches a steady state.

[23/n] Image
Finally, an absorption (or "screening") term σ(x)u acts like a background medium that absorbs heat—think about a heat sink, or a cold engine block. The function σ(x) describes the strength of absorption at each point x.

[24/n] Image
There are lots of other terms you could add to a PDE, but these already get you pretty far. And importantly, these are terms we'll be able to easily convert into integral & stochastic representations—and ultimately into Monte Carlo algorithms for PDEs! Let's see how…
[25/n]
Whereas a PDE described a function via derivatives, an integral equation uses, well, integrals!

A good example is deconvolution: given a blurry image f and a blur kernel K, can I solve

f(p)=∫ K(p,q) φ(q) dq

for the original image φ? [26/n] Image
The solutions to basic PDEs can also be expressed via integral equations (IE). E.g., the solution to a Laplace equation is given by the so-called "mean value principle"

u(p)=∫_B(p) u(q) dq / |B(p)|

"The solution at p equals the average value over any ball B(p) around p" [27/n] Image
Unlike deconvolution, the IE for a Laplace equation is *recursive*: unknown values u(x) depend on unknown values u(y)!

Sounds like a conundrum, but this is *exactly* how modern rendering works: solve the recursive rendering equation by recursively estimating illumination. [28/n] Image
As with PDEs, we can keep adding terms to our IE to capture additional behavior (absorption, drift, ...).

For instance, there's a nice integral representation for a screened Poisson equation Δu−σu=−f, as long as absorption σ is constant in space! (See paper for details) [29/n] Image
Finally, we can describe the same phenomena using stochastic differential equations (SDE). For us, the stochastic picture is super important because it lets us deal with spatially-varying coefficients. We can then formulate an IE that can be estimated much as in rendering! [30/n] Image
An *ordinary* differential equation (ODE) describes the location X of a particle in terms of its derivatives in time. For instance, the ODE

dXₜ = ω(Xₜ) dt

says that the particle's velocity is given by some vector field ω—like a tiny speck of dust blowing in the wind.

[31/n]
A *stochastic* DE describes random motions—a key example is a Brownian motion Wₜ, where changes in position follow a Gaussian distribution, and are independent of past events.

Brownian motion describes everything from jiggling molecules to fluctuations in stock prices. [32/n]
Adding Brownian motion to our earlier ODE gives a more general *diffusion process*

dXₜ = ω(Xₜ) dt + dWₜ,

which we can think of as either a deterministic particle "with noise"—or as a random walk "with drift." Maybe something like dust blowing in hot, turbulent wind. [33/n]
We can also modulate the "strength of jiggling" via a function α(x), yielding the SDE

dXₜ = √α(Xₜ) dWₜ

As α increases, things sort of "heat up," and particles jiggle faster. [34/n]
Finally, we can think about a random walker that has some chance of getting absorbed in a background medium, like ink getting soaked up in a sponge.

We'll use σ(x) for the strength of absorption—which doesn't appear in the SDE itself, but will be incorporated in a moment. [35/n]
As you might have guessed, it's no coincidence that we use the same symbols α, σ, ω for both our PDE and our SDE!

These perspectives are linked by the infamous Feynman-Kac formula, which gives the solution to our main PDE as an expectation over many random walks.

[36/n] Image
A special case of Feynman-Kac that helps illustrate the idea is Kakutani's principle, which says the solution to a Laplace equation is the average value "seen" by a Brownian random walker when it first hits the boundary. See this thread for more:
[37/n]
Most important for us: unlike classic (deterministic) integral equations, Feynman-Kac handles spatially-varying coefficients!

We can hence use it to build a *new* recursive-but-deterministic IE, which in turn leads to Monte Carlo methods for variable-coefficient PDEs. 🥵
[38/n]
To do so, we apply a "cascading" sequence of transformations to our original PDE to move all spatial variation to a (recursive!) to the right-hand side. This final PDE looks like a *constant*-coefficient screened Poisson equation, but with a (recursive!) source term. [39/n] Image
From the FEM perspective, it feels like we haven't done anything useful: we just shuffled all the hard stuff to the other side of the "=" sign. So what?

Yet from the Monte Carlo perspective we now have a way forward: recursively estimate the integral, a la path tracing!

[40/n]
In fact, the relationship between PDEs and rendering is more than skin deep: the Feynman-Kac formula and the volumetric rendering equation (VRE) have an extremely similar form—which means we can adapt techniques from volume rendering to efficiently solve our PDE! [41/n] Image
This is really the moment of beauty, where PDEs suddenly benefit from decades of rendering research.

The paper describes how to apply delta tracking, next-flight estimation, and weight windows to get better estimators for PDEs. But *so* much more could be done here! [42/n] Image
Finally, you probably want to hear about applications.

Though our main goal here is to develop core knowledge, there are some cool things we can immediately do.

One is to simply solve physical PDEs with complex geometry, coefficients, etc., as in the "teaser" above. [43/n] Image
A graphics example is to generalize so-called "diffusion curves" to variable coefficients, giving more control over, e.g., how sharp or fuzzy details look.

(With constant-coefficient solvers, all the background details just get blurred out of existence!) [44/n] Image
Another nice point of view is that variable coefficients on a flat domain can actually be used to model constant coefficients on a curved domain! This way, we can solve PDEs with extremely intricate boundary data on smooth surfaces—without any meshing/tessellation at all. [45/n] Image
A Monte Carlo method also makes it easy to integrate PDE solvers with physically-based renderers. For instance, we can get a way more accurate diffusion approximation of heterogeneous subsurface scattering—without painfully hooking up to a FEM/grid-based solver. [46/n] Image
I've said way too much already, but the TL;DR is: grid-free Monte Carlo is a young and wicked cool way to solve PDEs, with deep-but-unexplored connections to rendering. It also still lacks some very basic features—like Neumann boundary conditions!

So, come help us explore! [n/n]

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Keenan Crane

Keenan Crane Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @keenanisalive

Feb 17, 2023
[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! 🧵
[2/n] To be clear, this 🧵 isn't about finding a better packing—or even finding it faster. Wizards like @KangarooPhysics surely have better tricks up their sleeves 🪄

Instead, it's about an awesome *tool* for quickly whipping up constraint-based graphics: penrose.cs.cmu.edu
[3/n] The "17 squares" problem provides a great demonstration of how Penrose works.

In fact, if you want to use this thread as a mini-tutorial, you can try it out at penrose.cs.cmu.edu/try/
Read 23 tweets
Aug 2, 2022
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.
Let's start with a real classic: a chrome and glass ball over a checkerboard, from Turner Whitted's 1980 paper, "An Improved Illumination Model for Shaded Display": cs.drexel.edu/~david/Classes…

Pretty good job on reflection/refraction! Was hard to get the colors I wanted. [2/n]
Two more classics for the price of one: the Stanford Bunny in a Cornell Box.

Bunny: faculty.cc.gatech.edu/~turk/bunny/bu…
Box: graphics.cornell.edu/online/box/his…

A+ for realism, but I'm still having trouble to get the colors to go where I want them. [3/n]
Read 16 tweets
Dec 12, 2021
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
People have made some great drawings of this transformation over the years (sometimes using a loop rather than an infinite pole—which is equivalent), but it can still be hard to interpolate between individual drawings in your head.

(...does a movie make it any clearer?!) 2/n
What's also fun about the motion in the movie above is that it was created without* human input: instead, the computer tries to nudge the shape around so that every point is as far as possible from itself. You can read all about it in this thread:
3/n
Read 6 tweets
Dec 12, 2021
For the @CarnegieMellon computer graphics take-home final, students have to implement a basic molecular dynamics (MD) simulator.

MD is a basic tool in computational chemistry, drug discovery, and understanding diseases like COVID-19.

Give it a try here!
github.com/CMU-Graphics/m…
Disclaimer: this is a simplified exercise for a final exam and should not be used for serious scientific work! It omits important forces and uses nonphysical constants.

Visualization is provided via the excellent #Polyscope library by CMU alumn @nmwsharp: polyscope.run
Bonus question: can you identify the molecule? :-)
Read 5 tweets
Dec 9, 2021
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
For millennia people have been drawn to the question: what are the "nicest" possible shapes that exist?

This is really a basic question about nature: these shapes exist outside space and time; the same shapes can be discovered by civilizations anywhere in the universe. 2/n
"Nicest" could mean the most symmetric—for instance, the ancient Greeks discovered there were five so-called Platonic solids where every face and every vertex looks the same: the tetrahedron, cube, octahedron, dodecahedron, and icosahedron. 3/n
Read 13 tweets
Dec 8, 2021
Suppose you have a pair of handcuffs linked together. Can you pull them apart without unlocking or breaking them, or letting them pass through themselves? With real handcuffs, definitely not! But if they're made of stretchy rubber, it turns out to be possible—as shown here. 1/9
This motion provides a surprising example of what is known in mathematics as an "ambient isotopy" of two surfaces: a continuous motion where the surface is not ripped, cut, pinched, or allowed to pass through itself. 2/9
A more classic example is the "unknot problem": given a loop of string, can it be untangled into a circle without cutting? Even this simple question turns out to be very hard to answer in general. And only gets harder when you start thinking about surfaces rather than curves. 3/9
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(