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.
-
1Haha, I spent ages implementing this at a company in the past. Unfortunately it'll all be under NDA – sdfgeoff Nov 26 '21 at 10:26
-
Video clip for those interested: https://www.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 – sdfgeoff Nov 26 '21 at 10:34
-
1One 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 – sdfgeoff Nov 26 '21 at 10:53
2 Answers
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.
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.
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.
- 59,425
- 39
- 130
- 187
-
5I'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 :) – Robin Betts Nov 25 '21 at 20:00
-
Thanks, I also experimented with a radial gradient which looked great, despite not being a "realistic" approach – Duarte Farrajota Ramos Nov 25 '21 at 20:44
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..
... 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.
The shader combines a manipulation of this encoding of proximity, with an arc-of-circle scan region.
(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:
As you can see... too many nodes.. (I'm sure the node:quality ratio could be improved :D )
The scan-noise can be driven by #frame, to jitter it:
(Blender 3.0b)
- 76,260
- 8
- 77
- 190
-
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. – Duarte Farrajota Ramos Nov 29 '21 at 12:57
-
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? – Duarte Farrajota Ramos Nov 29 '21 at 12:59
-
@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. – Robin Betts Nov 29 '21 at 15:13
-
1Hehe it is quite shader, but totally worth the work. Still wrapping my head around all the details. Damn that "Contour Noise" sounds incredibly versatile – Duarte Farrajota Ramos Nov 29 '21 at 15:42










