the Twarchive

This is a record of a twitter thread, originally posted in 2019

Thew
@AmazingThew

Been working on a bunch of ultrasound sim research at @LevelExGameDev

Here's a Sort Of Physically Based But Mostly Extremely Not wave propagation sim

Thew
@AmazingThew

Transducer is along top edge of image. Red pixels are energy moving away from the transducer, green is towards

Red is REALLY hard to see because video compression was designed by misanthropes

Thew
@AmazingThew

Sim starts by emitting a pulse (red line), then every frame reads the reflected energy striking the transducer (i.e. samples the green channel along the top row) and appends that energy to the next row in the scan

Thew
@AmazingThew

Every fragment at every step looks at the energy passing through it and determines how much should be reflected and how much should be transmitted, via (extremely simplified, 1D case of) Snell's Law and real-world (ish) values for acoustic impedance

Thew
@AmazingThew

This is nowhere close to enough for a real sim; I'm ignoring attenuation and scatter entirely (which are HUGE components), there's no speckle (bc no scatter), and wave propagation is only handled in 1D (real world's 3D and also, like, devastatingly anisotropic)

Thew
@AmazingThew

It does capture some really interesting physical effects though. You can see how the dense bone in the middle "rings" as energy bounces around inside it, which due to time-of-flight rendering results in weird trails of echoes extending downwards

Thew
@AmazingThew

You can also see how the air/flesh boundary at the bottom is so sharp that it's essentially impermeable, reflecting the entire wave back like a weird distorted mirror

(the real-world behavior is more complex obv but this is why they have to smear silicone goop on patients' skin)

Thew
@AmazingThew

def makes some cool images in any case