This asset allows to compute UltraSound images of 3D models inside SOFA in real time while the simulation is running. The scenes illustrating this asset are located in SofaUnity/Scenes/Demos/Imaging/Ultrasound/. Those scene integrate the SOFA Ultrasound plugin which is a private license under proprietary license. In those examples, Unity controller is used to change the Ultrsound probe position and direction.
It can be displayed inside Unity (in OpenGL mode only) as a texture and controlled from unity script. It is important to note that this plugin is using NVidia Optix. Therefore computer with good RTX graphic cards are requested.
This feature is available in the trial version but for extended academic or commercial use, this feature is subject to an additional license. See the licenses page for more details.
Ultrasound demo scenes
Ultrasound_IRCAD_demo_auto: This is a demo of ultrasound rendering using IRCAD 3D models and pre-computed probe motion.
Ultrasound_IRCAD_demo_manual: This is the same demo of ultrasound rendering using IRCAD 3D models but the probe motion is controlled by Unity.
Ultrasound Scene Configuration
Once the the SOFA scene has been setup using a OptixUSRenderer and USModel for each mesh. The first step is to load the scene in Unity using the SofaContext component like any other scene. Then, several additional steps are needed to properly load the texture from SOFA OpenGL context.
- Create a SofaContext in the Unity scene.
- Load the SOFA simulation scene with the US integration.
- Create an empty GameObject and add the component SofaGraphicOGL_ApplyUS and link the SofaContext. Do not change the Sofa Path, it is used by OpenGL on the SOFA side. (See the US_config in the screenshot menu on the right).
- Add a Plan GameObject with a Unlit Material. This Material will be used to render the OpenGL Ultrasound texture. It is important to name this GameObject: “Plane_US”. This name is used by the SofaGraphicOGL_ApplyUS script to find the target texture.
In the Unity scene to control the Ultrasound probe position and orientation, you need to add the script “SofaUSController” to a GameObject. This script need to be linked to the SOFA MechanicalObject/Mesh relative to the SOFA probe model.
The GameObject position and orientation will be used and sent to SOFA to be mapped on the SOFA rigid object.
Usually this script can be combine with a GameObject controller script to be able to move it at Play time.