Hey 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.
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.
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.
- 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
- 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: