{"id":15942153,"url":"https://github.com/discretetom/hyperdesktopduplication","last_synced_at":"2025-03-25T08:31:14.597Z","repository":{"id":167872308,"uuid":"637114162","full_name":"DiscreteTom/HyperDesktopDuplication","owner":"DiscreteTom","description":"Desktop Duplication API implementation for Unity with shared memory and gRPC.","archived":false,"fork":false,"pushed_at":"2023-06-11T03:00:57.000Z","size":26897,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T22:53:20.651Z","etag":null,"topics":["desktop-duplication-api","grpc","rust","rusty-duplication","shared-memory","shremdup","unity","unity3d","windows"],"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/DiscreteTom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-05-06T14:51:48.000Z","updated_at":"2024-10-17T01:20:53.000Z","dependencies_parsed_at":"2023-07-05T03:02:10.356Z","dependency_job_id":null,"html_url":"https://github.com/DiscreteTom/HyperDesktopDuplication","commit_stats":null,"previous_names":["discretetom/hyperdesktopduplication"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2FHyperDesktopDuplication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2FHyperDesktopDuplication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2FHyperDesktopDuplication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2FHyperDesktopDuplication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiscreteTom","download_url":"https://codeload.github.com/DiscreteTom/HyperDesktopDuplication/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245426210,"owners_count":20613303,"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":["desktop-duplication-api","grpc","rust","rusty-duplication","shared-memory","shremdup","unity","unity3d","windows"],"created_at":"2024-10-07T07:40:27.964Z","updated_at":"2025-03-25T08:31:14.589Z","avatar_url":"https://github.com/DiscreteTom.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HyperDesktopDuplication\n\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/DiscreteTom/HyperDesktopDuplication?style=flat-square)\n![Platform support](https://img.shields.io/badge/platform-windows-blue?style=flat-square)\n![Built for Unity3D](https://img.shields.io/badge/Built%20for-Unity3D-lightgrey?style=flat-square)\n![license](https://img.shields.io/github/license/DiscreteTom/HyperDesktopDuplication?style=flat-square)\n\nHyperDesktopDuplication is an Unity asset to use the realtime screen capture as `Texture2D` using Windows Desktop Duplication API, shared memory, gRPC and Rust.\n\n## Why this Project?\n\nThis project is based on [uDesktopDuplication](https://github.com/hecomi/uDesktopDuplication), which is a great project to capture screen to Unity3D. However, it is not working with a standalone/discrete GPU. See https://github.com/hecomi/uDesktopDuplication/issues/30.\n\n## Usage\n\nFirst, start a [shremdup](https://github.com/DiscreteTom/shremdup) (v0.1.7+) server with administrator privilege (to use shared memory across processes).\n\nThen, enable `Allow 'unsafe' Code` in the Player Settings, and copy all `Assets` in this repo into your Unity project.\n\nFinally, add the `HDD_Manager` prefab to your scene, and write a driver script. Here is an example:\n\n```cs\nusing HyperDesktopDuplication;\nusing UnityEngine;\n\npublic class Example : MonoBehaviour {\n  const float scale = 100;\n\n  async void Start() {\n    // assume we have an HDD_Manager component on the same GameObject\n    var manager = this.GetComponent\u003cHDD_Manager\u003e();\n    // refresh monitor infos\n    await manager.Refresh();\n\n    // get the center position of the primary monitor\n    var primaryCenter = Vector3.zero;\n    for (int i = 0; i \u003c manager.Monitors.Count; ++i) {\n      var info = manager.Monitors[i];\n      if (info.IsPrimary) {\n        primaryCenter = new Vector3((info.Right - info.Left) / 2 + info.Left, (info.Top - info.Bottom) / 2 + info.Bottom, 0) / scale;\n        break;\n      }\n    }\n\n    // create all monitors\n    for (int i = 0; i \u003c manager.Monitors.Count; ++i) {\n      var info = manager.Monitors[i];\n      // HDD_Manager will use the HDD_Monitor prefab\n      var obj = manager.CreateMonitor(i);\n      obj.transform.localScale = new Vector3(1 / scale, 1 / scale, 1);\n      // place the monitor according to the system settings\n      obj.transform.localPosition = new Vector3((info.Right - info.Left) / 2 + info.Left, (info.Top - info.Bottom) / 2 + info.Bottom, 0) / scale - primaryCenter;\n\n      // if you want to destroy a monitor, you can do this:\n      // await obj.GetComponent\u003cHDD_Monitor\u003e().DestroyMonitor();\n      // or just:\n      // Destroy(obj);\n    }\n\n    // on destroy, HDD_Manager will destroy all monitors and close the gRPC channel\n  }\n}\n```\n\n## Adopted Optimizations\n\n- Invisible screens won't be updated.\n- Update the desktop image and the mouse cursor image separately to reduce the texture update frequency.\n\n## [CHANGELOG](https://github.com/DiscreteTom/HyperDesktopDuplication/blob/main/CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscretetom%2Fhyperdesktopduplication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscretetom%2Fhyperdesktopduplication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscretetom%2Fhyperdesktopduplication/lists"}