{"id":19416828,"url":"https://github.com/davidalgis/interopunitycuda","last_synced_at":"2026-02-26T16:12:16.288Z","repository":{"id":150670452,"uuid":"540425530","full_name":"davidAlgis/InteropUnityCUDA","owner":"davidAlgis","description":"Demonstrate interoperability between Unity Engine and CUDA","archived":false,"fork":false,"pushed_at":"2024-08-01T17:11:32.000Z","size":4829,"stargazers_count":33,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-18T11:59:31.605Z","etag":null,"topics":["cpp","cuda","dx11","gpu","gpu-acceleration","native-plugin","opengl","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidAlgis.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-23T12:17:58.000Z","updated_at":"2024-08-18T11:59:31.606Z","dependencies_parsed_at":"2024-02-05T11:01:45.958Z","dependency_job_id":"7faa3d13-4370-4ca0-bf20-614c849817e5","html_url":"https://github.com/davidAlgis/InteropUnityCUDA","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidAlgis%2FInteropUnityCUDA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidAlgis%2FInteropUnityCUDA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidAlgis%2FInteropUnityCUDA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidAlgis%2FInteropUnityCUDA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidAlgis","download_url":"https://codeload.github.com/davidAlgis/InteropUnityCUDA/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223954823,"owners_count":17231189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cuda","dx11","gpu","gpu-acceleration","native-plugin","opengl","unity","unity3d"],"created_at":"2024-11-10T13:05:45.558Z","updated_at":"2026-02-26T16:12:11.232Z","avatar_url":"https://github.com/davidAlgis.png","language":"C++","readme":"# Interoperability Between Unity Engine and CUDA\n\nThis repository demonstrates and gives tools for interoperability between the Unity Engine and CUDA. Specifically, it showcases how to create and render graphical objects (e.g., textures) in Unity and edit them directly through CUDA kernels. This approach bypasses compute shaders, leveraging the full capabilities of CUDA. For more details about this project you can read our article [**_InteropUnityCUDA: A Tool for Interoperability Between Unity and CUDA_**](https://doi.org/10.1002/spe.3414).\n\n\n## Plugins\n\nThe `Plugin` folder contains the C++ libraries used for interoperability. These libraries can be regenerated using CMake. Assuming you are at the root of the `interopUnityCUDA` repository, execute the following commands:\n\n```bash\ncd ./Plugin\nmkdir build\ncmake -B build\n```\n\nTo compile the libraries:\n\n```bash\ncmake --build build --config Release\ncmake --build build --config Debug\n```\n\nTo use the library in your Unity project, copy the contents of the `Debug` and `Release` folders to your Unity project.\n\nThe C++ project consists of three libraries:\n\n### 1. Utilities\n\nThis library includes a singleton logger to simplify debugging between Unity and the native plugin. It also contains Unity's native plugin API, which is used by the other libraries.\n\n### 2. PluginInteropUnityCUDA\n\nThis library provides the classes that handle interoperability between Unity, the graphics API, and CUDA. Additionally, it includes functions to register and invoke new `Action` objects.\n\nAn `Action` is a base class from which you can inherit to override specific functions. These functions are executed on the render thread, which is a necessary condition for making interoperability work.\n\n### 3. SampleBasic\n\nThis library contains two basic examples of actions:\n- **ActionSampleTexture**: Registers a Unity **texture** with CUDA and writes some color data to it.\n- **ActionSampleTextureArray**: Registers a Unity **texture array** with CUDA and writes color data to each texture slice.\n- **ActionSampleVertexBuffer**: Registers a Unity **vertex buffer of `float4`** with CUDA and modifies its values.\n\n## InteropUnityCUDA Unity Project\n\nThe `InteropUnityCUDA` folder contains the Unity project, which includes scripts for handling actions and invoking them on the render thread. Additionally, there is a script for displaying log information in Unity, using the logger from the Utilities library (see above).\n\nThe project includes a single scene demonstrating the three basic actions described earlier.\n\n## Generate and Add the InteropUnityCUDA Package to Your Project\n\n[See the dedicated documentation here.](Plugin/Documentation/GenerateUnityPackage.md)\n\n## Create Your Own Action\n\n[See the dedicated documentation here.](Plugin/Documentation/CreateAction.md)\n\n## Platform Availability\n\nThis project has been tested with Unity 2021.1 and CUDA 12.2. It currently supports only OpenGL and DirectX11 graphics APIs. The plugin is designed for Windows but can also be compiled for Linux.\n\n### Limitations\n\n- For DirectX11, textures work only with the `Texture2D` type, not with `RenderTexture` ([see issue #2](https://github.com/davidAlgis/InteropUnityCUDA/issues/2)).\n- Buffers cannot be written by both Unity **and** CUDA without remapping/unmapping the buffer after each write operation in CUDA ([see issue #12](https://github.com/davidAlgis/InteropUnityCUDA/issues/12)).\n\n## Meta\n\nThis repository was developed as part of David Algis' thesis in collaboration with XLIM and Studio Nyx.\n\nIf you find this project useful, please consider citing our associated publication:\n\n**Algis, D., Bramas, B., Darles, E., \u0026 Aveneau, L. (2025). InteropUnityCUDA: A Tool for Interoperability Between Unity and CUDA. _Software: Practice and Experience._** [https://doi.org/10.1002/spe.3414](https://doi.org/10.1002/spe.3414)\n\n```bibtex\n@article{algis2025interopunitycuda,\n  author = {Algis, David and Bramas, Berenger and Darles, Emmanuelle and Aveneau, Lilian},\n  title = {InteropUnityCUDA: A Tool for Interoperability Between Unity and CUDA},\n  journal = {Software: Practice and Experience},\n  year = {2025},\n  doi = {10.1002/spe.3414},\n  url = {https://onlinelibrary.wiley.com/doi/10.1002/spe.3414}\n}","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidalgis%2Finteropunitycuda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidalgis%2Finteropunitycuda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidalgis%2Finteropunitycuda/lists"}