Skip to content

JaggerYu928/SofaUnity-Renderer

 
 

Repository files navigation

SOFAUnity-Renderer

Description

This repository is a Unity3D package allowing to render a SOFA simulation scene inside Unity3D. All SOFA VisualModel components present in the loaded simulation will be rendered inside Unity3D engine as GameObject with a MeshFilter. Thus, it is possible to apply Unity3D Materials to each visual model and also to combine Unity3D assets with the SOFA simulation.

Important: This version allows only to change the Gravity and the TimeStep of the SOFA simulation and only the VisualModel are mapped into Unity3D.
A full integration of SOFA components with a two-way communication can be requested here:
https://infinytech3d.com/sapapi-unity3d/

Compatibility:

  • Unity version > 2020.3.x (Tested with LTS: 2020.3.17 and 2021.3.19)
  • SOFA version > 22.12 with SofaPhysicsAPI activated (Tested with SOFA releases 22.12 and 23.06)
  • Only tested on Windows for now

Installation guide

  1. Install Unity engine version > 2020.3.x
  2. (optionnal) Create a new project

Installation from asset:

  1. Download the unity asset provided in the release page: Here for the SofaUnity-Renderer_v22.12_Win64 and here for the SofaUnity-Renderer_v23.06_Win64
  2. Load the unity asset inside Unity3D Editor, use Assets -> Import Package -> Custom Package and load the corresponding package SofaUnity-Renderer_vXX.XX_Win64.unitypackage

Installation from source:

  1. Clone this repository inside your unity project: git clone git@github.com:InfinyTech3D/SofaUnity-Renderer.git /myUnityProject/Assets/SofaUnity
  2. Download the SOFA release v22.12 or v23.06, either using the installer or the zip file
  3. Copy the SOFA .dll from the folder /SOFA_vXX.XX.00_Win64\bin\ inside: /myUnityProject/Assets/SofaUnity/Plugins/Native/x64 (for windows) | /myUnityProject/Assets/SofaUnity/Plugins/Native/x86_64 (for linux)

Usage

As soon as the SofaUnity-Renderer.unitypackage is loaded inside your Unity project, you will have access to a top menu panel called SofaUnity.

This pannel allows to load a SOFA scene in only 2 steps:

  1. Click on SofaContext to add a GameObject into your unity scene graph with a SofaContext component. This component correspond to the SOFA world 3D frame and provides a simple API to load a SOFA scene, change the Time Stepping and the Gravity.

  1. Click on the button Load SOFA Scene (.scn) file to load a SOFA scene. This will create a GameObject with a Unity MeshFilter for each SOFA VisualModel

SOFA simulation will be performed as soon as Unity is playing.

Examples

Three examples corresponding to SOFA Demo folder are provided inside the package: They are available in the folder /Scenes/Demos/

Here are a some results of the integration:

Tutorials

Here is a set of Youtube tutorials. Whether you're just starting out or an experienced developer, our step-by-step guides offer valuable insights into leveraging SofaUnity-Renderer.

License

This Unity asset is under GPL license.
Other license formats can be provided for commercial use. For more information check InfinyTech3D license page.

About

SOFA-Renderer asset for Unity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%