8
$\begingroup$

For an upcoming project I need to simulate ultrasound test effect in Blender. Does anyone have any good ideas on how to get into creating this effect? I was trying some stuff, but it all looks bad.

Image for reference: enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Haha, I spent ages implementing this at a company in the past. Unfortunately it'll all be under NDA $\endgroup$
    – sdfgeoff
    Nov 26, 2021 at 10:26
  • $\begingroup$ Video clip for those interested: youtube.com/watch?v=5HJZc2qXzEo This was done in the Blender Game Engine (hah, remember that!) with lots of magic being done by shader wizard Martinsh $\endgroup$
    – sdfgeoff
    Nov 26, 2021 at 10:34
  • 1
    $\begingroup$ One thing I will say is that ultrasound is very similar to light. The ultrasonic transducer "emits" ultrasound, pockets of air absorb/reflect the ultrasound and cast shadows, areas of hard material (eg bone) transmit and lens the ultrasound. So any implementation of an ultrasound "material" risks implementing a full 2d-renderer inside a shader $\endgroup$
    – sdfgeoff
    Nov 26, 2021 at 10:53

2 Answers 2

11
$\begingroup$

From my limited knowledge ultrasound based imaging basically creates a "section" of the subject at a defined depth, controlled by the power output set by the operator.

You can achieve a similar effect by using a shader that adjusts transparency based on some depth parameter. Results wont be the best, but it will be quick and dirty approximation. Some post processing or additional "roughing" may be required to produce a grainier output similar to a real ultrasound.

enter image description here

For this to work properly it will require a relatively detailed model with many "depth layers", that is a dense, almost volumetric, representation of several layers of tissue surfaces found inside an organism, like organs, muscles, bone, blood vessels, among others; that properly illustrates the shader effect. The quality of the result will partially depend on the density of the model.

In the illustrated example several discrete objects are used so there's a need to convert Object texture coordinates into World space, with a Texture Transform Node so all objects share the same continuous texture coordinate space mapping, regardless or scale or position in the scene. If you use a single object this step is unnecessary.

After that feed your coordinates into a linear Gradient texture and run it through a black and white Color Ramp node, feeding it to the Transparency socket of your shader.

enter image description here

You can feed another black and white Color Ramp with reversed colors (in relation to the transparency one) run through the same Gradient texture to the emission and diffuse color of the same shader.

Adjust the depth of the ultrasound by modifying the texture coordinates fed to the Gradient texture. If using EEVEE, make sure to change the Blending Mode under the material transparency options to either Alpha Blend or Alpha Hashed.

enter image description here

$\endgroup$
2
  • 5
    $\begingroup$ I'm loving this approach, it produces such aesthetic results! I'm struggling to make mine more economical. I know in my bones I can chuck half my nodes away before posting :) $\endgroup$
    – Robin Betts
    Nov 25, 2021 at 20:00
  • $\begingroup$ Thanks, I also experimented with a radial gradient which looked great, despite not being a "realistic" approach $\endgroup$ Nov 25, 2021 at 20:44
6
$\begingroup$

The first part of this one is a shameless rip-off from LateAsUsual 's way of making noise anisotropic, following the contours of a gradient.

A 'Scanning Plane' is prepared with this Geometry Nodes group, to encode the proximity of collection of target objects in a vertex-color channel..

enter image description here

... similarly to this answer, which generates ripples. Below, we can see the scanning-plane passing through the target objects, and the resulting vertex-color. On the right, the final result of the shader.

enter image description here

The shader combines a manipulation of this encoding of proximity, with an arc-of-circle scan region.

enter image description here

(Above)

  • The cluster labelled Distance Gradient genertates the mask on the left
  • The cluster labelled Contour Noise generates the image in the middle..
  • They are multiplied to give the image on the right

(Below)

  • Arc Polar coordinates sets up the coordinates for another Noise texture, and a mask to cut a sector out of the plane. Those are multiplied to make a mask for the contoured image:

enter image description here

As you can see... too many nodes.. (I'm sure the node:quality ratio could be improved :D )

enter image description here

The scan-noise can be driven by #frame, to jitter it:

enter image description here

(Blender 3.0b)

$\endgroup$
4
  • $\begingroup$ Ah I was checking back regularly to see what you came up with and wasn't disappointed. That turned out into quite a complex noodle, but the results are great. $\endgroup$ Nov 29, 2021 at 12:57
  • $\begingroup$ Love the "proximity mask" approach, that looks insanely useful for a lot of other stuff. Does it update in real time in the viewport, or does it require "offline rendering" to fully work? $\endgroup$ Nov 29, 2021 at 12:59
  • $\begingroup$ @Duarte tell the truth, I like yours better. This one smells of too much work :) It doesn't 'kick' in that fresh kind of way yours does. $\endgroup$
    – Robin Betts
    Nov 29, 2021 at 15:13
  • 1
    $\begingroup$ Hehe it is quite shader, but totally worth the work. Still wrapping my head around all the details. Damn that "Contour Noise" sounds incredibly versatile $\endgroup$ Nov 29, 2021 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .