This asset allows to compute the fluoroscopic 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/Fluoroscopy/. Those scene integrate the SOFA X-Ray plugin that can be found here on the SOFA marketplace under proprietary license and Unity controller is used to change the X-Ray source position and direction.

It can be displayed inside Unity (in OpenGL mode only) as a texture and controlled from unity script. For example, it can be mapped with the motion of a virtual C-Arm in VR.

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.



Fluorosopy Scene Configuration

Once the the SOFA scene has been setup using a XRayRenderer and XRayModel 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.

  1. Create a SofaContext in the Unity scene.
  2. Load the SOFA simulation scene with the XRay integration.
  3. Create an empty GameObject and add the component SofaGraphicOGL_ApplyXRay and link the SofaContext. Do not change the Sofa Path, it is used by OpenGL on the SOFA side. (See the XRay_config in the screenshot menu on the right).
  4. Add a Plan GameObject with a Unlit Material. This Material will be used to render the OpenGL XRay texture. It is important to name this GameObject: “Plane_XRay”. This name is used by the SofaGraphicOGL_ApplyXRay script to find the target texture.
XRay config menu
XRay texture menu

In the Unity scene to control the XRay rendering source and orientation, it is possible to set an additional script named “XRayController” to a GameObject. This script need to be linked to the SOFA SurfaceXRayRenderer component. It allows to:

  • Control the source position. By default it is the GameObject position.
  • Set the target position (this will compute the direction).
  • Change the beam power and distance

Usually this script can be combine with a GameObject controller script to be able to move it at Play time.

XRay projector menu



Fluoroscopic demo scenes

XRay Caduceus demo

XRay_Caduceus: Classic SOFA scene of the snake falling around the caduceus with XRay projection. Last image show change of beam power.

XRay Collision Multiple demo

XRay_CollisionMultiple: Classic SOFA scene of multiple collision of deformable bodies. Each body has its own XRayModel with specific parameters.

XRay SPHFluid demo
XRay SPHFluid demo at start
XRay SPHFluid demo at end

XRay_SPHFluid: SPH fluid scene falling inside a bowl with XRay projection. Fluid surface is computed from the particles and used for XRay rendering.



XRay Integration in Unity VR scene

Full demo movie of X-Ray rendering.