├── Install ├── Install.bat ├── InstallCustomName.bat ├── InstallMultipleDevices.bat ├── Uninstall.bat ├── UnityCaptureFilter32bit.dll └── UnityCaptureFilter64bit.dll ├── README.md ├── README.png ├── Source ├── .gitignore ├── IUnityGraphics.h ├── IUnityInterface.h ├── Tool_RegisterOneInBuild.bat ├── Tool_UnregisterAllInBuild.bat ├── UnityCapture.sln ├── UnityCaptureFilter.cpp ├── UnityCaptureFilter.def ├── UnityCaptureFilter.sln ├── UnityCaptureFilter.vcxproj ├── UnityCapturePlugin.cpp ├── UnityCapturePlugin.sln ├── UnityCapturePlugin.vcxproj ├── shared.inl ├── streams.cpp └── streams.h └── UnityCaptureSample ├── .gitignore ├── Assets ├── CaptureTexture.cs ├── CaptureTexture.cs.meta ├── CubesSwayBeeps.cs ├── CubesSwayBeeps.cs.meta ├── MultiCam.cs ├── MultiCam.cs.meta ├── UnityCapture.meta ├── UnityCapture │ ├── Plugins.meta │ ├── Plugins │ │ ├── x86.meta │ │ ├── x86 │ │ │ ├── UnityCapturePlugin.dll │ │ │ └── UnityCapturePlugin.dll.meta │ │ ├── x86_64.meta │ │ └── x86_64 │ │ │ ├── UnityCapturePlugin.dll │ │ │ └── UnityCapturePlugin.dll.meta │ ├── UnityCapture.cs │ └── UnityCapture.cs.meta ├── UnityCaptureExample.unity ├── UnityCaptureExample.unity.meta ├── UnityCaptureMultiCam.unity ├── UnityCaptureMultiCam.unity.meta ├── UnityCaptureTextureExample.unity └── UnityCaptureTextureExample.unity.meta └── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset /Install/Install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: BatchGotAdmin 4 | :------------------------------------- 5 | REM --> Check for permissions 6 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 7 | 8 | REM --> If error flag set, we do not have admin. 9 | if '%errorlevel%' NEQ '0' ( 10 | echo Requesting administrative privileges... 11 | goto UACPrompt 12 | ) else ( goto gotAdmin ) 13 | 14 | :UACPrompt 15 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 16 | set params = %*:"="" 17 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 18 | 19 | "%temp%\getadmin.vbs" 20 | del "%temp%\getadmin.vbs" 21 | exit /B 22 | 23 | :gotAdmin 24 | pushd "%CD%" 25 | CD /D "%~dp0" 26 | regsvr32 "UnityCaptureFilter32bit.dll" 27 | regsvr32 "UnityCaptureFilter64bit.dll" 28 | :-------------------------------------- 29 | -------------------------------------------------------------------------------- /Install/InstallCustomName.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: BatchGotAdmin 4 | :------------------------------------- 5 | REM --> Check for permissions 6 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 7 | 8 | REM --> If error flag set, we do not have admin. 9 | if '%errorlevel%' NEQ '0' ( 10 | echo Requesting administrative privileges... 11 | goto UACPrompt 12 | ) else ( goto gotAdmin ) 13 | 14 | :UACPrompt 15 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 16 | set params = %*:"="" 17 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 18 | 19 | "%temp%\getadmin.vbs" 20 | del "%temp%\getadmin.vbs" 21 | exit /B 22 | 23 | :gotAdmin 24 | pushd "%CD%" 25 | CD /D "%~dp0" 26 | set /P "UCCAPNAME=Enter a custom filter name to register as (default is 'Unity Video Capture'): " 27 | echo Installing capture device named '%UCCAPNAME%' ... 28 | regsvr32 "UnityCaptureFilter32bit.dll" "/i:UnityCaptureName=%UCCAPNAME%" 29 | regsvr32 "UnityCaptureFilter64bit.dll" "/i:UnityCaptureName=%UCCAPNAME%" 30 | echo "Done" 31 | :-------------------------------------- 32 | -------------------------------------------------------------------------------- /Install/InstallMultipleDevices.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: BatchGotAdmin 4 | :------------------------------------- 5 | REM --> Check for permissions 6 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 7 | 8 | REM --> If error flag set, we do not have admin. 9 | if '%errorlevel%' NEQ '0' ( 10 | echo Requesting administrative privileges... 11 | goto UACPrompt 12 | ) else ( goto gotAdmin ) 13 | 14 | :UACPrompt 15 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 16 | set params = %*:"="" 17 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 18 | 19 | "%temp%\getadmin.vbs" 20 | del "%temp%\getadmin.vbs" 21 | exit /B 22 | 23 | :gotAdmin 24 | pushd "%CD%" 25 | CD /D "%~dp0" 26 | set /P "UCNUMCAP=Enter number of capture devices you want to register: " 27 | echo "Installing %UCNUMCAP% capture devices ..." 28 | regsvr32 "UnityCaptureFilter32bit.dll" "/i:UnityCaptureDevices=%UCNUMCAP%" 29 | regsvr32 "UnityCaptureFilter64bit.dll" "/i:UnityCaptureDevices=%UCNUMCAP%" 30 | echo "Done" 31 | :-------------------------------------- 32 | -------------------------------------------------------------------------------- /Install/Uninstall.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: BatchGotAdmin 4 | :------------------------------------- 5 | REM --> Check for permissions 6 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 7 | 8 | REM --> If error flag set, we do not have admin. 9 | if '%errorlevel%' NEQ '0' ( 10 | echo Requesting administrative privileges... 11 | goto UACPrompt 12 | ) else ( goto gotAdmin ) 13 | 14 | :UACPrompt 15 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 16 | set params = %*:"="" 17 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 18 | 19 | "%temp%\getadmin.vbs" 20 | del "%temp%\getadmin.vbs" 21 | exit /B 22 | 23 | :gotAdmin 24 | pushd "%CD%" 25 | CD /D "%~dp0" 26 | regsvr32 /u "UnityCaptureFilter32bit.dll" 27 | regsvr32 /u "UnityCaptureFilter64bit.dll" 28 | :-------------------------------------- 29 | -------------------------------------------------------------------------------- /Install/UnityCaptureFilter32bit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DenchiSoft/UnityCapture/a218037f79e4b419def35cb88822b2c67f610a69/Install/UnityCaptureFilter32bit.dll -------------------------------------------------------------------------------- /Install/UnityCaptureFilter64bit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DenchiSoft/UnityCapture/a218037f79e4b419def35cb88822b2c67f610a69/Install/UnityCaptureFilter64bit.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity Capture 2 | 3 | ![Unity Capture and OBS](https://raw.githubusercontent.com/schellingb/UnityCapture/master/README.png) 4 | 5 | ## Overview 6 | 7 | Unity Capture is a Windows DirectShow Filter that allows you to stream a rendered camera directly to another application. 8 | In more simple terms, it essentially makes Unity simulate a web cam device on Windows that shows a rendered camera. 9 | 10 | This project is based on [UnityCam by Yamen Saraiji](//github.com/mrayy/UnityCam) with added features and big performance 11 | improvements. It supports lag-free 1080p at 60 FPS on moderate PCs and can handle 4K resolutions on a faster PC. 12 | It also supports capturing multiple cameras and alpha channel (transparency) in receiving applications that 13 | support it (like [OBS](https://obsproject.com/)). 14 | 15 | 16 | ## Installation 17 | 18 | First download this project from GitHub with the [`Download ZIP`](../../archive/master.zip) button or by cloning the repository. 19 | 20 | To register the DirectShow Filter to be available in Windows programs, run the `Install.bat` inside the `Install` directory. 21 | Make sure the files in the install directory are placed where you want them to be. 22 | If you want to move or delete the files, run `Uninstall.bat` first. 23 | 24 | If you have problems registering or unregistering, right click on the Install.bat and choose "Run as Administrator". 25 | 26 | The script `Install.bat` registers just a single capture device usable for capturing a single Unity camera. If you want to 27 | capture multiple cameras simultaneously you can instead run the `InstallMultipleDevices.bat` script which prompts for a 28 | number of capture devices you wish to register. 29 | 30 | 31 | ## Test in Unity 32 | 33 | Open the included UnityCaptureSample project in Unity, load the scene 'UnityCaptureExample' and hit play. 34 | Then run a receiving application (like [OBS](https://obsproject.com/), any program with web cam support 35 | or a [WebRTC website](https://webrtc.github.io/samples/src/content/getusermedia/resolution/)) and request 36 | video from the "Unity Video Capture" device. 37 | 38 | You should see the rendering output from Unity displayed in your target application. 39 | 40 | If you see a message about matching rendering and display resolutions, use the resolution settings on 41 | the 'Game' tab in Unity to set a fixed resolution to match the capture output. 42 | 43 | 44 | ## Setup in your Unity project 45 | 46 | Just copy the [UnityCapture asset directory from the included sample project](UnityCaptureSample/Assets/UnityCapture) 47 | into your own project and then add the 'Unity Capture' behavior to your camera at the bottom. 48 | 49 | You can also enable this behavior on a secondary camera that is not your main game camera by setting a target texture 50 | with your desired capture output resolution. 51 | 52 | If you want to capture multiple cameras simultaneously you can refer to the 'UnityCaptureMultiCam' scene 53 | and the 'MultiCam' script used by it. 54 | 55 | If you want to capture a custom texture (generated texture, a video, another webcam feed or a static image) you 56 | can refer to the 'UnityCaptureTextureExample' scene and the 'CaptureTexture' script used by it. 57 | 58 | ### Settings 59 | 60 | There are a few settings for the 'Unity Capture' behavior. 61 | 62 | - 'Capture Device': Set the capture device filter number (only relevant when multiple capture devices were [installed](#installation)) 63 | - 'Timeout': Sets how many milliseconds to wait for a new frame until sending is considered to be stopped 64 | If rendering every frame this can be very low. Default is 1000 to allow stalls due to loading, etc. 65 | When set to 0 the image will stay up even when Unity is ended (until the receiving application also ends). 66 | - 'Resize Mode': It is suggested to leave this disabled and just let your capture target application handle the display 67 | sizing/resizing because this setting can introduce frame skipping. So far only a very basic linear resize is supported. 68 | - 'Mirror Mode': This setting should also be handled by your target application if possible and needed, but it is available. 69 | - 'Double Buffering': See [performance caveats](#performance-caveats) below 70 | - 'Enable V Sync': Overwrite the state of the application v-sync setting on component start 71 | - 'Target Frame Rate': Overwrite the application target fps setting on component start 72 | - 'Hide Warnings': Disable output of warning messages (but not errors) 73 | 74 | ### Possible errors/warnings 75 | 76 | - Warning: "Capture device did skip a frame read, capture frame rate will not match render frame rate." 77 | Output when a frame rendered by Unity was never displayed in the target capture application due 78 | to performance problems or target application being slow. 79 | - Warning: "Capture device is inactive" 80 | If the target capture application has not been started yet. 81 | - Error: "Unsupported graphics device (only D3D11 supported)" 82 | When Unity uses a rendering back-end other than Direct 3D 11. 83 | - Error: "Render resolution is too large to send to capture device" 84 | When trying to send data with a resolution higher than the maximum supported 3840 x 2160 85 | - Error: "Render texture format is unsupported" 86 | When the rendered data/color format would require additional conversation. 87 | - Error: "Error while reading texture image data" 88 | Generic error when the plugin is unable to access the rendered image pixel data. 89 | 90 | 91 | ## Output Device Configuration 92 | 93 | In your receiving application mainly two settings are of relevance. 94 | Depending on the application, the settings might be named different or not available at all in which case it will fall back to a default. 95 | - Resolution: Set this to match the rendering resolution in Unity. Depending on your target application you may be able 96 | to request a custom resolution. For instance in OBS you can input 512x512 into the resolution settings textbox. 97 | For custom resolutions, make sure width is specified in increments of 4. 98 | - Video Format: Set this to ARGB if you want to capture the alpha channel (transparency). 99 | Other settings like FPS, color space or buffering are irrelevant as the output from Unity controls these parameters. 100 | 101 | There are four additional settings in the configuration panel offered by the capture device. Some applications like OBS allow you to access 102 | these settings with a 'Configure Video' button, other applications like web browsers might not. 103 | 104 | These settings control what will be displayed in the output in case of an error: 105 | - 'Resolution mismatch': When resizing in the Unity behavior is disabled and the capture output and the rendering resolutions don't match. 106 | - 'Unity never started': When rendering in Unity with a 'Unity Capture' behavior has never started sending video data. 107 | - 'Unity sending stopped': When video data stops being received (i.e. Unity game stopped or crashed). 108 | 109 | There are four modes that can be set for the settings above: 110 | - 'Fill Black': Show just black. 111 | - 'Blue/Pink Pattern': A pattern that is blue and pink. 112 | - 'Green/Yellow Pattern': A pattern that is green and yellow. 113 | - 'Green Key (RGB #00FE00)': Fills the output with a specific color (red and blue at 0, green at 254). 114 | This can be used for instance in OBS with the 'Color Key' video filter to show a layer behind the video capture. 115 | You can use this if you want to show a 'Please stand by...' image layer when Unity is stopped. 116 | 117 | The settings 'Fill Black' and 'Green Key' are shown as completely transparent when capturing with alpha channel. 118 | 119 | For the two colored patterns an additional text message will be displayed detailing the error. 120 | 121 | The setting 'Display FPS' shows the capture frame rate (frames per second) on the capture device output. 122 | 123 | 124 | ## Performance caveats 125 | 126 | There are two main improvements to capture stream frame rate. 127 | 128 | One is to disable the camera setting 'Allow HDR' which causes the camera output texture format 129 | to be in a favorable format (8-bit integer per color per pixel). If your shaders and post-processing 130 | allow it, it's recommended to leave HDR off. 131 | 132 | The other is the setting 'DoubleBuffering' in the UnityCapture component. 133 | Double buffering causes 1 frame of additional latency but improves the image data throughput. 134 | You can check the Unity profiler for how much it impacts performance in your project. 135 | 136 | Otherwise it is recommended to leave scaling and mirroring disabled in the UnityCapture component. 137 | 138 | 139 | ## Todo 140 | 141 | - Saving of the output device configuration 142 | - Bilinear filtered resizing 143 | 144 | 145 | ## License 146 | 147 | Unity Capture is divided into two parts that are separately licensed. 148 | The filter 'UnityCaptureFilter' is available under the [MIT license](https://choosealicense.com/licenses/mit/). 149 | The Unity plugin 'UnityCapturePlugin' is available under the [zlib license](https://choosealicense.com/licenses/zlib/) (so attribution in your Unity project is optional). 150 | -------------------------------------------------------------------------------- /README.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DenchiSoft/UnityCapture/a218037f79e4b419def35cb88822b2c67f610a69/README.png -------------------------------------------------------------------------------- /Source/.gitignore: -------------------------------------------------------------------------------- 1 | .vs/* 2 | Build/* 3 | *.suo 4 | *.user 5 | *.sdf 6 | *.opensdf 7 | *.db 8 | -------------------------------------------------------------------------------- /Source/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | kUnityGfxRendererOpenGL = 0, // Legacy OpenGL 7 | kUnityGfxRendererD3D9 = 1, // Direct3D 9 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererXenon = 6, // Xbox 360 12 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 13 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.x 14 | kUnityGfxRendererGXM = 12, // PlayStation Vita 15 | kUnityGfxRendererPS4 = 13, // PlayStation 4 16 | kUnityGfxRendererXboxOne = 14, // Xbox One 17 | kUnityGfxRendererMetal = 16, // iOS Metal 18 | kUnityGfxRendererOpenGLCore = 17, // OpenGL core 19 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 20 | } UnityGfxRenderer; 21 | 22 | typedef enum UnityGfxDeviceEventType 23 | { 24 | kUnityGfxDeviceEventInitialize = 0, 25 | kUnityGfxDeviceEventShutdown = 1, 26 | kUnityGfxDeviceEventBeforeReset = 2, 27 | kUnityGfxDeviceEventAfterReset = 3, 28 | } UnityGfxDeviceEventType; 29 | 30 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 31 | 32 | // Should only be used on the rendering thread unless noted otherwise. 33 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 34 | { 35 | UnityGfxRenderer (UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 36 | 37 | // This callback will be called when graphics device is created, destroyed, reset, etc. 38 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 39 | // when the graphics device is already created. 40 | void (UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 41 | void (UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 42 | }; 43 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL,0x8C5AD4926EB17B11ULL,IUnityGraphics) 44 | 45 | 46 | 47 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 48 | // Provide them with an address to a function of this signature. 49 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 50 | -------------------------------------------------------------------------------- /Source/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | 21 | 22 | // Unity Interface GUID 23 | // Ensures cross plugin uniqueness. 24 | // 25 | // Template specialization is used to produce a means of looking up a GUID from it's payload type at compile time. 26 | // The net result should compile down to passing around the GUID. 27 | // 28 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any payload definition outside of all namespaces. 29 | // The payload structure and the registration GUID are all that is required to expose the interface to other systems. 30 | struct UnityInterfaceGUID 31 | { 32 | #ifdef __cplusplus 33 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 34 | : m_GUIDHigh(high) 35 | , m_GUIDLow(low) 36 | { 37 | } 38 | 39 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 40 | { 41 | m_GUIDHigh = other.m_GUIDHigh; 42 | m_GUIDLow = other.m_GUIDLow; 43 | } 44 | 45 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 46 | { 47 | m_GUIDHigh = other.m_GUIDHigh; 48 | m_GUIDLow = other.m_GUIDLow; 49 | return *this; 50 | } 51 | 52 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 53 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 54 | #endif 55 | unsigned long long m_GUIDHigh; 56 | unsigned long long m_GUIDLow; 57 | }; 58 | #ifdef __cplusplus 59 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 60 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 61 | inline bool operator< (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 62 | inline bool operator> (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 63 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator< (left,right); } 64 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator> (left,right); } 65 | #else 66 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 67 | #endif 68 | 69 | 70 | 71 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 72 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterface(UNITY_GET_INTERFACE_GUID(TYPE)); 73 | 74 | #ifdef __cplusplus 75 | #define UNITY_DECLARE_INTERFACE(NAME) \ 76 | struct NAME : IUnityInterface 77 | 78 | template \ 79 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); \ 80 | 81 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 82 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 83 | template<> \ 84 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 85 | { \ 86 | return UNITY_GET_INTERFACE_GUID(TYPE); \ 87 | } 88 | #else 89 | #define UNITY_DECLARE_INTERFACE(NAME) \ 90 | typedef struct NAME NAME; \ 91 | struct NAME 92 | 93 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 94 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 95 | #endif 96 | 97 | 98 | 99 | #ifdef __cplusplus 100 | struct IUnityInterface 101 | { 102 | }; 103 | #else 104 | typedef void IUnityInterface; 105 | #endif 106 | 107 | 108 | 109 | typedef struct IUnityInterfaces 110 | { 111 | // Returns an interface matching the guid. 112 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 113 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 114 | 115 | // Registers a new interface. 116 | void (UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface* ptr); 117 | 118 | #ifdef __cplusplus 119 | // Helper for GetInterface. 120 | template 121 | INTERFACE* Get() 122 | { 123 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 124 | } 125 | 126 | // Helper for RegisterInterface. 127 | template 128 | void Register(IUnityInterface* ptr) 129 | { 130 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 131 | } 132 | #endif 133 | } IUnityInterfaces; 134 | 135 | 136 | 137 | #ifdef __cplusplus 138 | extern "C" { 139 | #endif 140 | 141 | // If exported by a plugin, this function will be called when the plugin is loaded. 142 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 143 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 144 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | -------------------------------------------------------------------------------- /Source/Tool_RegisterOneInBuild.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: BatchGotAdmin 4 | :------------------------------------- 5 | REM --> Check for permissions 6 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 7 | 8 | REM --> If error flag set, we do not have admin. 9 | if '%errorlevel%' NEQ '0' ( 10 | echo Requesting administrative privileges... 11 | goto UACPrompt 12 | ) else ( goto gotAdmin ) 13 | 14 | :UACPrompt 15 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 16 | set params = %*:"="" 17 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 18 | 19 | "%temp%\getadmin.vbs" 20 | del "%temp%\getadmin.vbs" 21 | exit /B 22 | 23 | :gotAdmin 24 | pushd "%CD%" 25 | CD /D "%~dp0\Build" 26 | 27 | ECHO Select the configuration and platform variation you want to register 28 | CLS 29 | ECHO 1. Debug - 64 bit 30 | ECHO 2. Release - 64 bit 31 | ECHO 3. Debug - 32 bit 32 | ECHO 4. Release - 64 bit 33 | ECHO. 34 | 35 | CHOICE /C 1234 /M "Enter your choice:" 36 | 37 | :: Note - list ERRORLEVELS in decreasing order 38 | IF ERRORLEVEL 4 GOTO Release32bit 39 | IF ERRORLEVEL 3 GOTO Debug32bit 40 | IF ERRORLEVEL 2 GOTO Releae64bit 41 | IF ERRORLEVEL 1 GOTO Debug64bit 42 | 43 | :Debug64bit 44 | regsvr32 "Debug-UnityCaptureFilter64bit\UnityCaptureFilter64bit.dll" 45 | GOTO End 46 | 47 | :Releae64bit 48 | regsvr32 "Release-UnityCaptureFilter64bit\UnityCaptureFilter64bit.dll" 49 | GOTO End 50 | 51 | :Debug32bit 52 | regsvr32 "Debug-UnityCaptureFilter32bit\UnityCaptureFilter32bit.dll" 53 | GOTO End 54 | 55 | :Release32bit 56 | regsvr32 "Release-UnityCaptureFilter32bit\UnityCaptureFilter32bit.dll" 57 | GOTO End 58 | :-------------------------------------- 59 | -------------------------------------------------------------------------------- /Source/Tool_UnregisterAllInBuild.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: BatchGotAdmin 4 | :------------------------------------- 5 | REM --> Check for permissions 6 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 7 | 8 | REM --> If error flag set, we do not have admin. 9 | if '%errorlevel%' NEQ '0' ( 10 | echo Requesting administrative privileges... 11 | goto UACPrompt 12 | ) else ( goto gotAdmin ) 13 | 14 | :UACPrompt 15 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 16 | set params = %*:"="" 17 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 18 | 19 | "%temp%\getadmin.vbs" 20 | del "%temp%\getadmin.vbs" 21 | exit /B 22 | 23 | :gotAdmin 24 | pushd "%CD%" 25 | CD /D "%~dp0\Build" 26 | regsvr32 /u "Debug-UnityCaptureFilter32bit\UnityCaptureFilter32bit.dll" 27 | regsvr32 /u "Debug-UnityCaptureFilter64bit\UnityCaptureFilter64bit.dll" 28 | regsvr32 /u "Release-UnityCaptureFilter32bit\UnityCaptureFilter32bit.dll" 29 | regsvr32 /u "Release-UnityCaptureFilter64bit\UnityCaptureFilter64bit.dll" 30 | :-------------------------------------- 31 | -------------------------------------------------------------------------------- /Source/UnityCapture.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnityCaptureFilter", "UnityCaptureFilter.vcxproj", "{3D0A9889-9EC1-4012-9382-4FE1EB610D28}" 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnityCapturePlugin", "UnityCapturePlugin.vcxproj", "{727D3AC5-27B5-4288-A475-7A471ECD71B8}" 8 | EndProject 9 | Global 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|Win32 = Debug|Win32 12 | Debug|x64 = Debug|x64 13 | Release|Win32 = Release|Win32 14 | Release|x64 = Release|x64 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|Win32.Build.0 = Debug|Win32 19 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|x64.ActiveCfg = Debug|x64 20 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|x64.Build.0 = Debug|x64 21 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|Win32.ActiveCfg = Release|Win32 22 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|Win32.Build.0 = Release|Win32 23 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|x64.ActiveCfg = Release|x64 24 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|x64.Build.0 = Release|x64 25 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|Win32.ActiveCfg = Debug|Win32 26 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|Win32.Build.0 = Debug|Win32 27 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|x64.ActiveCfg = Debug|x64 28 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|x64.Build.0 = Debug|x64 29 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|Win32.ActiveCfg = Release|Win32 30 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|Win32.Build.0 = Release|Win32 31 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|x64.ActiveCfg = Release|x64 32 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|x64.Build.0 = Release|x64 33 | EndGlobalSection 34 | GlobalSection(SolutionProperties) = preSolution 35 | HideSolutionNode = FALSE 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /Source/UnityCaptureFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Unity Capture 3 | Copyright (c) 2018 Bernhard Schelling 4 | 5 | Based on UnityCam 6 | https://github.com/mrayy/UnityCam 7 | Copyright (c) 2016 MHD Yamen Saraiji 8 | 9 | The MIT License (MIT) 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | SOFTWARE. 28 | */ 29 | 30 | #include "shared.inl" 31 | #include "streams.h" 32 | #include 33 | #include 34 | #include 35 | 36 | #define CaptureSourceName L"Unity Video Capture" 37 | 38 | //Use separate GUIDs for 64bit and 32bit so both can be installed at the same time 39 | #ifdef _WIN64 40 | DEFINE_GUID(CLSID_UnityCaptureService, 0x5c2cd55c, 0x92ad, 0x4999, 0x86, 0x66, 0x91, 0x2b, 0xd3, 0xe7, 0x00, 0x10); 41 | DEFINE_GUID(CLSID_UnityCaptureProperties, 0x5c2cd55c, 0x92ad, 0x4999, 0x86, 0x66, 0x91, 0x2b, 0xd3, 0xe7, 0x00, 0x11); 42 | #else 43 | DEFINE_GUID(CLSID_UnityCaptureService, 0x5c2cd55c, 0x92ad, 0x4999, 0x86, 0x66, 0x91, 0x2b, 0xd3, 0xe7, 0x00, 0x20); 44 | DEFINE_GUID(CLSID_UnityCaptureProperties, 0x5c2cd55c, 0x92ad, 0x4999, 0x86, 0x66, 0x91, 0x2b, 0xd3, 0xe7, 0x00, 0x21); 45 | #endif 46 | 47 | //List of resolutions offered by this filter 48 | //If you add a higher resolution, make sure to update MAX_SHARED_IMAGE_SIZE 49 | static struct { int width, height; } _media[] = 50 | { 51 | { 1920, 1080 }, //16:9 52 | { 1280, 720 }, //16:9 53 | { 960, 540 }, //16:9 54 | { 640, 360 }, //16:9 55 | { 480, 270 }, //16:9 56 | { 256, 144 }, //16:9 57 | { 2560, 1440 }, //16:9 58 | { 3840, 2160 }, //16:9 59 | { 1440, 1080 }, //4:3 60 | { 960, 720 }, //4:3 61 | { 640, 480 }, //4:3 62 | { 480, 360 }, //4:3 63 | { 320, 240 }, //4:3 64 | { 192, 144 }, //4:3 65 | { 1920, 1440 }, //4:3 66 | { 2880, 2160 }, //4:3 67 | { 1920, 1200 }, //16:10 68 | { 1280, 800 }, //16:10 69 | { 2880, 1800 }, //16:10 70 | { 2560, 1600 }, //16:10 71 | { 1680, 1050 }, //16:10 72 | { 1440, 900 }, //16:10 73 | { 0, 0 }, //This slot is used for custom resolutions if requested by the target application 74 | }; 75 | 76 | //Error draw modes (what to display on screen in case of errors/warnings) 77 | enum EErrorDrawCase { EDC_ResolutionMismatch, EDC_UnityNeverStarted, EDC_UnitySendingStopped, _EDC_MAX }; 78 | enum EErrorDrawMode { EDM_GREENKEY, EDM_BLUEPINK, EDM_GREENYELLOW, EDM_BLACK }; 79 | static EErrorDrawMode ErrorDrawModes[_EDC_MAX] = { EDM_BLUEPINK, EDM_GREENYELLOW, EDM_GREENKEY }; 80 | static wchar_t* ErrorDrawModeNames[] = { L"Green Key (RGB #00FE00)", L"Blue/Pink Pattern", L"Green/Yellow Pattern", L"Fill Black" }; 81 | static bool OutputFrameRate = false; 82 | 83 | #ifdef _DEBUG 84 | void DebugLog(const char *format, ...) 85 | { 86 | char stackbuf[1024]; 87 | stackbuf[0] = '\0'; 88 | va_list ap; va_start(ap, format); vsnprintf_s(stackbuf, 1024, 1024, format, ap); va_end(ap); 89 | stackbuf[1023] = '\0'; 90 | OutputDebugStringA(stackbuf); 91 | } 92 | #else 93 | #define DebugLog(...) ((void)0) 94 | #endif 95 | 96 | //Interface definition for ICamSource used by CCaptureSource 97 | DEFINE_GUID(IID_ICamSource, 0xdd20e647, 0xf3e5, 0x4156, 0xb3, 0x7b, 0x54, 0x6f, 0xcf, 0x88, 0xec, 0x50); 98 | DECLARE_INTERFACE_(ICamSource, IUnknown) { }; 99 | 100 | class CCaptureStream : CSourceStream, IKsPropertySet, IAMStreamConfig, IAMStreamControl, IAMPushSource 101 | { 102 | public: 103 | CCaptureStream(CSource* pOwner, HRESULT* phr, int CapNum) : CSourceStream("Stream", phr, pOwner, L"Output") 104 | { 105 | m_llFrame = m_llFrameMissCount = 0; 106 | m_prevStartTime = 0; 107 | m_avgTimePerFrame = 10000000 / 30; 108 | m_pReceiver = new SharedImageMemory(CapNum); 109 | m_iUnscaledBufSize = 0; 110 | m_pUnscaledBuf = NULL; 111 | m_RGBA16Table = NULL; 112 | GetMediaType(0, &m_mt); 113 | } 114 | 115 | virtual ~CCaptureStream() 116 | { 117 | delete m_pReceiver; 118 | if (m_pUnscaledBuf) free(m_pUnscaledBuf); 119 | if (m_RGBA16Table) free(m_RGBA16Table); 120 | } 121 | 122 | private: 123 | HRESULT FillBuffer(IMediaSample *pSamp) override 124 | { 125 | HRESULT hr; 126 | BYTE* pBuf; 127 | VIDEOINFO *pvi = (VIDEOINFO*)m_mt.Format(); 128 | REFERENCE_TIME startTime = m_prevStartTime, endTime = startTime + m_avgTimePerFrame; 129 | LONGLONG mtStart = m_llFrame, mtEnd = mtStart + 1; 130 | m_prevStartTime = endTime; 131 | m_llFrame = mtEnd; 132 | UCASSERT(pSamp->GetSize() == pvi->bmiHeader.biSizeImage); 133 | UCASSERT(DIBSIZE(pvi->bmiHeader) == pvi->bmiHeader.biSizeImage); 134 | 135 | if (FAILED(hr = pSamp->GetPointer(&pBuf))) return hr; 136 | if (FAILED(hr = pSamp->SetActualDataLength(pvi->bmiHeader.biSizeImage))) return hr; 137 | if (FAILED(hr = pSamp->SetTime(&startTime, &endTime))) return hr; 138 | if (FAILED(hr = pSamp->SetMediaTime(&mtStart, &mtEnd))) return hr; 139 | 140 | ProcessState State = { pBuf, pvi->bmiHeader.biWidth, pvi->bmiHeader.biHeight, pvi->bmiHeader.biBitCount / 8, this }; 141 | switch (m_pReceiver->Receive((SharedImageMemory::ReceiveCallbackFunc)ProcessImage, &State)) 142 | { 143 | case SharedImageMemory::RECEIVERES_CAPTUREINACTIVE:{ 144 | //Show color pattern indicating that Unity is not sending frame data yet 145 | char DisplayString[128], *DisplayStrings[] = { DisplayString }; 146 | int DisplayStringLens[] = { sprintf_s(DisplayString, sizeof(DisplayString), "Unity has not started sending image data (Capture Device #%d)", 1+m_pReceiver->GetCapNum()) }; 147 | FillErrorPattern(ErrorDrawModes[EDC_UnityNeverStarted], &State, 1, DisplayStrings, DisplayStringLens, m_llFrame); 148 | Sleep((DWORD)(m_avgTimePerFrame / 10000 - 1)); //just wait a bit until capturing next frame 149 | break;} 150 | 151 | case SharedImageMemory::RECEIVERES_NEWFRAME: 152 | if (m_llFrameMissCount) m_llFrameMissCount = 0; 153 | break; 154 | 155 | case SharedImageMemory::RECEIVERES_OLDFRAME:{ 156 | if (++m_llFrameMissCount < m_llFrameMissMax) break; 157 | //Show color pattern when received more than X frames without new image (probably Unity stopped sending data) 158 | char DisplayString[] = "Unity has stopped sending image data", *DisplayStrings[] = { DisplayString }; 159 | int DisplayStringLens[] = { sizeof(DisplayString) - 1 }; 160 | FillErrorPattern(ErrorDrawModes[EDC_UnitySendingStopped], &State, 1, DisplayStrings, DisplayStringLens, m_llFrame); 161 | break;} 162 | } 163 | if (OutputFrameRate) RenderFPSDisplay(&State); 164 | return S_OK; 165 | } 166 | 167 | struct ProcessJob 168 | { 169 | enum EType { JOB_NONE, JOB_RGBA8toBGR8, JOB_RGBA8toBGRA8, JOB_RGBA16toBGR8, JOB_RGBA16toBGRA8, JOB_BGR_RESIZE_LINEAR, JOB_BGRA_RESIZE_LINEAR, JOB_BGR_MIRROR_HORIZONTAL, JOB_BGRA_MIRROR_HORIZONTAL } Type; 170 | const void *BufIn; void *BufOut; 171 | size_t Width, RowStart, RowEnd, RGBAInStride, ResizeToHeight, ResizeFromWidth, ResizeFromHeight; 172 | const uint8_t* RGBA16Table; 173 | 174 | inline void Execute() 175 | { 176 | UCASSERT(RowEnd >= RowStart); 177 | if (RowStart == RowEnd) return; 178 | if (Type == JOB_RGBA8toBGR8) RGBA8toBGR8(); 179 | else if (Type == JOB_RGBA8toBGRA8) RGBA8toBGRA8(); 180 | else if (Type == JOB_RGBA16toBGR8) RGBA16toBGR8(); 181 | else if (Type == JOB_RGBA16toBGRA8) RGBA16toBGRA8(); 182 | else if (Type == JOB_BGR_RESIZE_LINEAR) BGRResizeLinear(); 183 | else if (Type == JOB_BGRA_RESIZE_LINEAR) BGRAResizeLinear(); 184 | else if (Type == JOB_BGR_MIRROR_HORIZONTAL) BGRMirrorHorizontal(); 185 | else if (Type == JOB_BGRA_MIRROR_HORIZONTAL) BGRAMirrorHorizontal(); 186 | } 187 | 188 | void RGBA8toBGR8() 189 | { 190 | const uint32_t *src = (const uint32_t*)BufIn + (RowStart * RGBAInStride); 191 | uint8_t *dst = (uint8_t*)BufOut + (RowStart * Width * 3), *dstEnd = (uint8_t*)BufOut + (RowEnd * Width * 3); 192 | if (RGBAInStride != Width) 193 | { 194 | //Handle a case where the texture pitch does have a gap on the right side 195 | const uint32_t *srcLastRow = (const uint32_t*)BufIn + ((RowEnd - 1) * RGBAInStride); 196 | for (size_t srcStride = RGBAInStride, iMax = Width; src != srcLastRow; src += srcStride) 197 | for (size_t i = 0; i != iMax; i++, dst += 3) 198 | *(uint32_t*)dst = _byteswap_ulong(src[i]) >> 8; 199 | for (size_t i = 0, iMax = Width - 1; i != iMax; i++, dst += 3, src++) 200 | *(uint32_t*)dst = _byteswap_ulong(*src) >> 8; 201 | } 202 | else 203 | { 204 | //The fastest (implemented) path to convert from RGBA to BGR 205 | const uint32_t *srcEnd8 = src + (((RowEnd-RowStart)*Width-1)&~7), *srcEnd1 = src + ((RowEnd-RowStart)*Width-1); 206 | for (; src != srcEnd8; dst += 24, src += 8) 207 | { 208 | *(uint32_t*)(dst ) = _byteswap_ulong(src[0]) >> 8; 209 | *(uint32_t*)(dst + 3) = _byteswap_ulong(src[1]) >> 8; 210 | *(uint32_t*)(dst + 6) = _byteswap_ulong(src[2]) >> 8; 211 | *(uint32_t*)(dst + 9) = _byteswap_ulong(src[3]) >> 8; 212 | *(uint32_t*)(dst + 12) = _byteswap_ulong(src[4]) >> 8; 213 | *(uint32_t*)(dst + 15) = _byteswap_ulong(src[5]) >> 8; 214 | *(uint32_t*)(dst + 18) = _byteswap_ulong(src[6]) >> 8; 215 | *(uint32_t*)(dst + 21) = _byteswap_ulong(src[7]) >> 8; 216 | } 217 | for (; src != srcEnd1; dst += 3, src++) 218 | *(uint32_t*)(dst) = _byteswap_ulong(*src) >> 8; 219 | } 220 | uint32_t FinalPixel = _byteswap_ulong(*src) >> 8; 221 | memcpy(dst, &FinalPixel, 3); 222 | } 223 | 224 | void RGBA8toBGRA8() 225 | { 226 | #define RGBATOBGRA(x) ((x&0xFF00FF00)|((x&0x00FF0000)>>16)|((x&0x000000FF)<<16)) 227 | const uint32_t *src = (const uint32_t*)BufIn + (RowStart * RGBAInStride); 228 | uint32_t *dst = (uint32_t*)BufOut + (RowStart * Width), *dstEnd = (uint32_t*)BufOut + (RowEnd * Width); 229 | if (RGBAInStride != Width) 230 | { 231 | //Handle a case where the texture pitch does have a gap on the right side 232 | const uint32_t *srcEnd = (const uint32_t*)BufIn + ((RowEnd) * RGBAInStride); 233 | for (size_t srcStride = RGBAInStride, iMax = Width; src != srcEnd; src += srcStride) 234 | for (size_t i = 0; i != iMax; i++, dst++) 235 | *dst = RGBATOBGRA(src[i]); 236 | } 237 | else 238 | { 239 | //The fastest (implemented) path to convert from RGBA to BGR 240 | const uint32_t *srcEnd8 = src + (((RowEnd-RowStart)*Width)&~7), *srcEnd1 = src + ((RowEnd-RowStart)*Width); 241 | for (; src != srcEnd8; dst += 8, src += 8) 242 | { 243 | dst[0] = RGBATOBGRA(src[0]); 244 | dst[1] = RGBATOBGRA(src[1]); 245 | dst[2] = RGBATOBGRA(src[2]); 246 | dst[3] = RGBATOBGRA(src[3]); 247 | dst[4] = RGBATOBGRA(src[4]); 248 | dst[5] = RGBATOBGRA(src[5]); 249 | dst[6] = RGBATOBGRA(src[6]); 250 | dst[7] = RGBATOBGRA(src[7]); 251 | } 252 | for (; src != srcEnd1; dst++, src++) 253 | *dst = RGBATOBGRA(*src); 254 | } 255 | #undef RGBATOBGRA 256 | } 257 | 258 | void RGBA16toBGR8() 259 | { 260 | //16 bit color downscaling (HDR (16 bit floats) to BGR) 261 | const uint8_t* ttbl = RGBA16Table; 262 | #define RGBAF16toBGRU8(psrc) ((ttbl[((uint16_t*)(psrc))[0]]<<16) | (ttbl[((uint16_t*)(psrc))[1]]<<8) | ttbl[((uint16_t*)(psrc))[2]]) 263 | const uint64_t *src = (const uint64_t*)BufIn + (RowStart * RGBAInStride); 264 | uint8_t *dst = (uint8_t*)BufOut + (RowStart * Width * 3), *dstEnd = (uint8_t*)BufOut + (RowEnd * Width * 3); 265 | if (RGBAInStride != Width) 266 | { 267 | //Handle a case where the texture pitch does have a gap on the right side 268 | const uint64_t *srcLastRow = (const uint64_t*)BufIn + ((RowEnd - 1) * RGBAInStride); 269 | for (size_t srcStride = RGBAInStride, iMax = Width; src != srcLastRow; src += srcStride) 270 | for (size_t i = 0; i != iMax; i++, dst += 3) 271 | *(uint32_t*)dst = RGBAF16toBGRU8(src + i); 272 | for (size_t i = 0, iMax = Width - 1; i != iMax; i++, dst += 3, src++) 273 | *(uint32_t*)dst = RGBAF16toBGRU8(src); 274 | } 275 | else 276 | { 277 | //The fastest (implemented) path to convert from RGBA to BGR 278 | const uint64_t *srcEnd8 = src + (((RowEnd-RowStart)*Width-1)&~7), *srcEnd1 = src + ((RowEnd-RowStart)*Width-1); 279 | for (; src != srcEnd8; dst += 24, src += 8) 280 | { 281 | *(uint32_t*)(dst ) = RGBAF16toBGRU8(src ); 282 | *(uint32_t*)(dst + 3) = RGBAF16toBGRU8(src + 1); 283 | *(uint32_t*)(dst + 6) = RGBAF16toBGRU8(src + 2); 284 | *(uint32_t*)(dst + 9) = RGBAF16toBGRU8(src + 3); 285 | *(uint32_t*)(dst + 12) = RGBAF16toBGRU8(src + 4); 286 | *(uint32_t*)(dst + 15) = RGBAF16toBGRU8(src + 5); 287 | *(uint32_t*)(dst + 18) = RGBAF16toBGRU8(src + 6); 288 | *(uint32_t*)(dst + 21) = RGBAF16toBGRU8(src + 7); 289 | } 290 | for (; src != srcEnd1; dst += 3, src++) 291 | *(uint32_t*)(dst) = RGBAF16toBGRU8(src); 292 | } 293 | //For the final pixel we can't use 4 byte uint32_t copy so we call memcpy 294 | uint32_t FinalPixel = RGBAF16toBGRU8(src); 295 | memcpy(dst, &FinalPixel, 3); 296 | #undef RGBAF16toBGRU8 297 | } 298 | 299 | void RGBA16toBGRA8() 300 | { 301 | //16 bit color downscaling (HDR (16 bit floats) to BGRA) 302 | const uint8_t* ttbl = RGBA16Table; 303 | #define RGBAF16toBGRAU8(psrc) ((ttbl[((uint16_t*)(psrc))[3]]<<24) | (ttbl[((uint16_t*)(psrc))[0]]<<16) | (ttbl[((uint16_t*)(psrc))[1]]<<8) | ttbl[((uint16_t*)(psrc))[2]]) 304 | const uint64_t *src = (const uint64_t*)BufIn + (RowStart * RGBAInStride); 305 | uint32_t *dst = (uint32_t*)BufOut + (RowStart * Width), *dstEnd = (uint32_t*)BufOut + (RowEnd * Width); 306 | if (RGBAInStride != Width) 307 | { 308 | //Handle a case where the texture pitch does have a gap on the right side 309 | const uint64_t *srcEnd = (const uint64_t*)BufIn + (RowEnd * RGBAInStride); 310 | for (size_t srcStride = RGBAInStride, iMax = Width; src != srcEnd; src += srcStride) 311 | for (size_t i = 0; i != iMax; i++, dst++) 312 | *dst = RGBAF16toBGRAU8(src + i); 313 | } 314 | else 315 | { 316 | //The fastest (implemented) path to convert from RGBA to BGR 317 | const uint64_t *srcEnd8 = src + (((RowEnd-RowStart)*Width-1)&~7), *srcEnd1 = src + ((RowEnd-RowStart)*Width-1); 318 | for (; src != srcEnd8; dst += 8, src += 8) 319 | { 320 | dst[0] = RGBAF16toBGRAU8(src ); 321 | dst[1] = RGBAF16toBGRAU8(src + 1); 322 | dst[2] = RGBAF16toBGRAU8(src + 2); 323 | dst[3] = RGBAF16toBGRAU8(src + 3); 324 | dst[4] = RGBAF16toBGRAU8(src + 4); 325 | dst[5] = RGBAF16toBGRAU8(src + 5); 326 | dst[6] = RGBAF16toBGRAU8(src + 6); 327 | dst[7] = RGBAF16toBGRAU8(src + 7); 328 | } 329 | for (; src != srcEnd1; dst++, src++) 330 | *dst = RGBAF16toBGRAU8(src); 331 | } 332 | #undef RGBAF16toBGRAU8 333 | } 334 | 335 | void BGRResizeLinear() 336 | { 337 | const size_t w = Width, h = ResizeToHeight, ResizeFromPitch = ResizeFromWidth * 3; 338 | const double aw = (double)w, ah = (double)h; 339 | const double scale = max(ResizeFromWidth / aw, ResizeFromHeight / ah); 340 | const double ax = (aw - (ResizeFromWidth / scale)) / 2.0; 341 | const double ay = (ah - (ResizeFromHeight / scale)) / 2.0; 342 | const uint8_t *src = (const uint8_t*)BufIn, BlackPixel[3] = {0, 0, 0}; 343 | uint8_t *dst = (uint8_t*)BufOut + (RowStart * Width * 3); 344 | for (size_t y = RowStart, yEnd = RowEnd, isMaxW = ResizeFromWidth, isOffsetMax = ResizeFromHeight * ResizeFromPitch; y != yEnd; y++) 345 | for (size_t x = 0; x != w; x++, dst += 3) 346 | { 347 | const size_t isx = (size_t)((x-ax)*scale), isy = (size_t)((y-ay)*scale); 348 | const size_t isOffset = (isx > isMaxW ? isOffsetMax : isy * ResizeFromPitch + isx * 3); 349 | memcpy(dst, (isOffset >= isOffsetMax ? BlackPixel : src + isOffset), 3); 350 | } 351 | } 352 | 353 | void BGRAResizeLinear() 354 | { 355 | const size_t w = Width, h = ResizeToHeight, fromw = ResizeFromWidth; 356 | const double aw = (double)w, ah = (double)h; 357 | const double scale = max(ResizeFromWidth / aw, ResizeFromHeight / ah); 358 | const double ax = (aw - (ResizeFromWidth / scale)) / 2.0; 359 | const double ay = (ah - (ResizeFromHeight / scale)) / 2.0; 360 | const uint32_t *src = (const uint32_t*)BufIn; 361 | uint32_t *dst = (uint32_t*)BufOut + (RowStart * Width); 362 | for (size_t y = RowStart, yEnd = RowEnd, isMaxW = ResizeFromWidth, isOffsetMax = ResizeFromHeight * fromw; y != yEnd; y++) 363 | for (size_t x = 0; x != w; x++, dst++) 364 | { 365 | const size_t isx = (size_t)((x-ax)*scale), isy = (size_t)((y-ay)*scale); 366 | const size_t isOffset = (isx > isMaxW ? isOffsetMax : isy * fromw + isx); 367 | *dst = (isOffset >= isOffsetMax ? 0 : src[isOffset]); 368 | } 369 | UCASSERT(dst == (uint32_t*)BufOut + (RowEnd * Width)); 370 | } 371 | 372 | void BGRMirrorHorizontal() 373 | { 374 | uint8_t *dst = (uint8_t*)BufOut + (RowStart * Width * 3), *dstEnd = (uint8_t*)BufOut + (RowEnd * Width * 3); 375 | for (size_t dstPitch = Width * 3; dst != dstEnd; dst += dstPitch) 376 | for (uint8_t tmp[3], *dstA = dst, *dstB = dst + dstPitch - 3; dstA < dstB; dstA += 3, dstB -= 3) 377 | memcpy(tmp, dstA, 3), memcpy(dstA, dstB, 3), memcpy(dstB, tmp, 3); 378 | } 379 | 380 | void BGRAMirrorHorizontal() 381 | { 382 | uint32_t *dst = (uint32_t*)BufOut + (RowStart * Width), *dstEnd = (uint32_t*)BufOut + (RowEnd * Width); 383 | for (size_t w = Width; dst != dstEnd; dst += w) 384 | for (uint32_t tmp, *dstA = dst, *dstB = dst + w - 1; dstA < dstB; dstA++, dstB--) 385 | tmp = *dstA, *dstA = *dstB, *dstB = tmp; 386 | } 387 | }; 388 | 389 | struct ProcessWorkers 390 | { 391 | ProcessWorkers() : WorkersRunning(WORKERCOUNT) 392 | { 393 | for (size_t i = 0; i != WORKERCOUNT; i++) Threads[i].Start((sThread::FUNC_t)&ProcessThread, (void*)this); 394 | } 395 | 396 | ~ProcessWorkers() 397 | { 398 | WorkersRunning = 0; 399 | for (size_t i = 0; i != WORKERCOUNT; i++) NewJobSemaphore.Post(); //wake up all threads 400 | } 401 | 402 | void StartNewJob(ProcessJob NewJob) 403 | { 404 | //Notify threads of new work to do 405 | WorkingJobCount = 0; 406 | size_t Num = NewJob.RowEnd; 407 | for (size_t i = 0; i != WORKERCOUNT; i++) 408 | { 409 | NewJob.RowStart = Num * (i ) / (WORKERCOUNT + 1); 410 | NewJob.RowEnd = Num * (i+1) / (WORKERCOUNT + 1); 411 | Jobs[i] = NewJob; 412 | NewJobSemaphore.Post(); 413 | } 414 | 415 | //Do work in the main thread as well 416 | NewJob.RowStart = NewJob.RowEnd; 417 | NewJob.RowEnd = Num; 418 | NewJob.Execute(); 419 | 420 | //Wait for threads to finish working 421 | for (size_t i = 0; i != WORKERCOUNT;) 422 | if (JobDoneSemaphore.WaitForPost()) 423 | i++; 424 | } 425 | 426 | private: 427 | //Wrapper objects for Windows concurrency objects (thread, mutex, semaphore) 428 | struct sThread { typedef DWORD (WINAPI *FUNC_t)(LPVOID); sThread() : h(0) {} sThread(FUNC_t f, void* p = NULL) : h(0) { Start(f, p); } void Start(FUNC_t f, void* p = NULL) { if (h) this->~sThread(); h = CreateThread(0,0,f,p,0,0); } ~sThread() { if (h) { WaitForSingleObject(h, INFINITE); CloseHandle(h); } } private:HANDLE h;sThread(const sThread&);sThread& operator=(const sThread&);}; 429 | struct sMutex { sMutex() : h(CreateMutexA(0,0,0)) {} ~sMutex() { CloseHandle(h); } __inline void Lock() { WaitForSingleObject(h,INFINITE); } __inline void Unlock() { ReleaseMutex(h); } private:HANDLE h;sMutex(const sMutex&);sMutex& operator=(const sMutex&);}; 430 | struct sSemaphore { sSemaphore() : h(CreateSemaphoreA(0,0,32768,0)) {} ~sSemaphore() { CloseHandle(h); } __inline void Post() { ReleaseSemaphore(h, 1, 0); } __inline bool WaitForPost() { return WaitForSingleObject(h,100) == WAIT_OBJECT_0; } private:HANDLE h;sSemaphore(const sSemaphore&);sSemaphore& operator=(const sSemaphore&);}; 431 | 432 | enum { WORKERCOUNT = 3 }; 433 | sMutex JobsMutex; 434 | sThread Threads[WORKERCOUNT]; 435 | ProcessJob Jobs[WORKERCOUNT]; 436 | sSemaphore NewJobSemaphore, JobDoneSemaphore; 437 | size_t WorkingJobCount, WorkersRunning; 438 | 439 | static void ProcessThread(ProcessWorkers* mw) 440 | { 441 | while (mw->WorkersRunning) 442 | { 443 | if (mw->NewJobSemaphore.WaitForPost() && mw->WorkersRunning) 444 | { 445 | mw->JobsMutex.Lock(); 446 | size_t MyJob = mw->WorkingJobCount++; 447 | mw->JobsMutex.Unlock(); 448 | mw->Jobs[MyJob].Execute(); 449 | mw->JobDoneSemaphore.Post(); 450 | } 451 | } 452 | } 453 | }; 454 | 455 | struct ProcessState 456 | { 457 | uint8_t* Buf; 458 | int BufWidth, BufHeight, BufBPP; 459 | CCaptureStream* Owner; 460 | }; 461 | 462 | static void ProcessImage(int InWidth, int InHeight, int InStride, SharedImageMemory::EFormat Format, SharedImageMemory::EResizeMode ResizeMode, SharedImageMemory::EMirrorMode MirrorMode, int Timeout, uint8_t* InBuf, ProcessState* State) 463 | { 464 | //Set maximum number of missed frames allowed until we show sending as having stopped 465 | State->Owner->m_llFrameMissMax = (Timeout + SharedImageMemory::RECEIVE_MAX_WAIT - 1) / SharedImageMemory::RECEIVE_MAX_WAIT; 466 | 467 | const bool NeedResize = (InWidth != State->BufWidth || InHeight != State->BufHeight); 468 | if (NeedResize && ResizeMode == SharedImageMemory::RESIZEMODE_DISABLED) 469 | { 470 | //Show color pattern indicating that the requested resolution does not match the resolution provided by Unity 471 | char DisplayString1[128], DisplayString2[128], DisplayString3[128]; 472 | char* DisplayStrings[] = { DisplayString1, DisplayString2, DisplayString3 }; 473 | int DisplayStringLens[] = { 474 | sprintf_s(DisplayString1, sizeof(DisplayString1), "Capture output resolution is %d x %d", State->BufWidth, State->BufHeight), 475 | sprintf_s(DisplayString2, sizeof(DisplayString2), "Unity render resolution is %d x %d", InWidth, InHeight), 476 | sprintf_s(DisplayString3, sizeof(DisplayString3), "please set these to match"), 477 | }; 478 | FillErrorPattern(ErrorDrawModes[EDC_ResolutionMismatch], State, 3, DisplayStrings, DisplayStringLens); 479 | return; 480 | } 481 | 482 | if (NeedResize) 483 | { 484 | //Prepare buffer for image scaling 485 | DWORD UnscaledBufSize = (InWidth * InHeight * State->BufBPP); 486 | if (State->Owner->m_iUnscaledBufSize != UnscaledBufSize) 487 | { 488 | if (State->Owner->m_pUnscaledBuf) free(State->Owner->m_pUnscaledBuf); 489 | State->Owner->m_pUnscaledBuf = (uint8_t*)malloc(UnscaledBufSize); 490 | State->Owner->m_iUnscaledBufSize = UnscaledBufSize; 491 | } 492 | } 493 | 494 | if (Format != SharedImageMemory::FORMAT_UINT8 && (!State->Owner->m_RGBA16Table || State->Owner->m_RGBA16TableFormat != Format)) 495 | { 496 | //Build a 64k table that maps 16 bit float values (either linear SRGB or gamma RGB) to 8 bit color values 497 | const bool SRGB = (Format == SharedImageMemory::FORMAT_FP16_LINEAR); 498 | uint8_t* RGBA16Table = State->Owner->m_RGBA16Table; 499 | if (!RGBA16Table) RGBA16Table = State->Owner->m_RGBA16Table = (uint8_t*)malloc(0xFFFF+1); 500 | for(int i = 0; i <= 0xFFFF; i++) 501 | { 502 | float f; 503 | (i & 0x8000 ? f = 0 : (*(uint32_t*)&f = (i << 13) + 0x38000000)); 504 | if (SRGB) f = (f <= 0.0031308f ? (f * 12.92f) : (powf(f, 1.0f / 2.4f) * 1.055f - 0.055f)); 505 | RGBA16Table[i] = (f < 1.0f ? (uint8_t)(f * 255.9999f) : 255); 506 | } 507 | State->Owner->m_RGBA16TableFormat = Format; 508 | } 509 | 510 | //Multi-threaded conversion of RGBA source to 8-bit BGR format while also eliminating possible row gaps (when stride != width) 511 | ProcessJob Job; 512 | if (State->BufBPP == 4) Job.Type = (Format == SharedImageMemory::FORMAT_UINT8 ? ProcessJob::JOB_RGBA8toBGRA8 : ProcessJob::JOB_RGBA16toBGRA8); 513 | else Job.Type = (Format == SharedImageMemory::FORMAT_UINT8 ? ProcessJob::JOB_RGBA8toBGR8 : ProcessJob::JOB_RGBA16toBGR8 ); 514 | Job.BufIn = InBuf, Job.BufOut = (NeedResize ? State->Owner->m_pUnscaledBuf : State->Buf); 515 | Job.Width = InWidth, Job.RowStart = 0, Job.RowEnd = InHeight, Job.RGBAInStride = InStride; 516 | Job.RGBA16Table = State->Owner->m_RGBA16Table; 517 | State->Owner->m_ProcessWorkers.StartNewJob(Job); 518 | 519 | if (NeedResize) 520 | { 521 | //Multi-threaded image scaling 522 | Job.Type = (State->BufBPP == 4 ? ProcessJob::JOB_BGRA_RESIZE_LINEAR : ProcessJob::JOB_BGR_RESIZE_LINEAR); 523 | Job.BufIn = State->Owner->m_pUnscaledBuf, Job.BufOut = State->Buf; 524 | Job.Width = State->BufWidth, Job.RowStart = 0, Job.RowEnd = State->BufHeight; 525 | Job.ResizeToHeight = State->BufHeight, Job.ResizeFromWidth = InWidth, Job.ResizeFromHeight = InHeight; 526 | State->Owner->m_ProcessWorkers.StartNewJob(Job); 527 | } 528 | 529 | if (MirrorMode == SharedImageMemory::MIRRORMODE_HORIZONTALLY) 530 | { 531 | //Multi-threaded horizontal image flipping 532 | Job.Type = (State->BufBPP == 4 ? ProcessJob::JOB_BGRA_MIRROR_HORIZONTAL : ProcessJob::JOB_BGR_MIRROR_HORIZONTAL); 533 | Job.BufOut = State->Buf; 534 | Job.Width = State->BufWidth, Job.RowStart = 0, Job.RowEnd = State->BufHeight; 535 | State->Owner->m_ProcessWorkers.StartNewJob(Job); 536 | } 537 | } 538 | 539 | static void FillErrorPattern(EErrorDrawMode edm, ProcessState* State, int LineCount = 0, char** LineStrings = NULL, int* LineLengths = NULL, LONGLONG FrameNumber = -1) 540 | { 541 | if (FrameNumber >= 0 && FrameNumber < 5) edm = EDM_BLACK; //show errors as just black during the first 5 frames (when starting) 542 | BYTE *p = State->Buf, *pEnd = State->Buf + (State->BufWidth * State->BufHeight * State->BufBPP), SkipCount = State->BufBPP - 3; 543 | switch (edm) 544 | { 545 | case EDM_GREENKEY: while (p != pEnd) { *(p++) = 0x00; *(p++) = 0xFE; *(p++) = 0x00; p += SkipCount; } break; //Filled with 0x00FE00 (BGR colors) 546 | case EDM_GREENYELLOW: while (p != pEnd) { *(p++) = 0x00; *(p++) = 0xFF; *(p++) = (size_t)p%0xFF; p += SkipCount; } break; //Green/yellow color pattern (BGR colors) 547 | case EDM_BLUEPINK: while (p != pEnd) { *(p++) = 0xFF; *(p++) = 0x00; *(p++) = (size_t)p%0xFF; p += SkipCount; } break; //Blue/pink color pattern (BGR colors) 548 | case EDM_BLACK: ZeroMemory(State->Buf, (State->BufWidth * State->BufHeight * State->BufBPP)); break; //Filled with black 549 | } 550 | 551 | if (LineCount && edm != EDM_BLACK && edm != EDM_GREENKEY && State->BufHeight >= LineCount * 20) 552 | { 553 | void* pTextBuf; 554 | HDC TextDC = CreateCompatibleDC(0); 555 | BITMAPINFO TextBMI = { sizeof(BITMAPINFOHEADER), State->BufWidth, LineCount * 20, 1, 8 * State->BufBPP, 0, LineCount * 20 * State->BufWidth * State->BufBPP }; 556 | TextBMI.bmiHeader.biHeight = LineCount * 20; 557 | HBITMAP TextHBitmap = CreateDIBSection(TextDC, &TextBMI, DIB_RGB_COLORS, &pTextBuf, NULL, 0); 558 | SelectObject(TextDC, TextHBitmap); 559 | SetBkMode(TextDC, TRANSPARENT); 560 | SetTextColor(TextDC, RGB(255, 0, 0)); 561 | for (int i = 0; i < LineCount; i++) TextOutA(TextDC, 10, i * 20, LineStrings[i], LineLengths[i]); 562 | memcpy(State->Buf + ((State->BufHeight - TextBMI.bmiHeader.biHeight) / 2) * State->BufWidth * State->BufBPP, pTextBuf, TextBMI.bmiHeader.biHeight * State->BufWidth * State->BufBPP); 563 | DeleteObject(TextHBitmap); 564 | DeleteDC(TextDC); 565 | } 566 | if (State->BufBPP == 4) 567 | { 568 | BYTE FillAlpha = (edm == EDM_GREENKEY ? 0x0 : (edm == EDM_BLACK ? 0x0 : 0xA0)); 569 | for (p = State->Buf; p != pEnd; p += 4) p[3] = FillAlpha; 570 | } 571 | } 572 | 573 | static void RenderFPSDisplay(ProcessState* State) 574 | { 575 | static LONGLONG MyFPS = 0, MyLastFPSTime = GetTickCount64(), MyLastFPS = 0; 576 | for (MyFPS++; GetTickCount64() - MyLastFPSTime > 1000; MyFPS = 0, MyLastFPSTime += 1000) { MyLastFPS = MyFPS; } 577 | char DisplayString[128]; 578 | int DisplayStringLen = sprintf_s(DisplayString, sizeof(DisplayString), "%d FPS", MyLastFPS); 579 | 580 | void* pTextBuf; 581 | HDC TextDC = CreateCompatibleDC(0); 582 | BITMAPINFO TextBMI = { sizeof(BITMAPINFOHEADER), State->BufWidth, 20, 1, 8 * State->BufBPP, 0, 20 * State->BufWidth * State->BufBPP }; 583 | HBITMAP TextHBitmap = CreateDIBSection(TextDC, &TextBMI, DIB_RGB_COLORS, &pTextBuf, NULL, 0); 584 | SelectObject(TextDC, TextHBitmap); 585 | SetBkMode(TextDC, TRANSPARENT); 586 | SetTextColor(TextDC, RGB(0, 255, 0)); 587 | TextOutA(TextDC, 10, 0, DisplayString, DisplayStringLen); 588 | if (State->BufBPP == 4) for (BYTE *p = (BYTE*)pTextBuf, *pEnd = p + 20 * State->BufWidth * 4; p != pEnd; p += 4) p[3] = 0xFF; 589 | memcpy(State->Buf, pTextBuf, TextBMI.bmiHeader.biHeight * State->BufWidth * State->BufBPP); 590 | DeleteObject(TextHBitmap); 591 | DeleteDC(TextDC); 592 | } 593 | 594 | //IUnknown 595 | STDMETHODIMP QueryInterface(REFIID riid, void **ppv) override 596 | { 597 | if (ppv == NULL) return E_POINTER; 598 | else if (riid == _uuidof(IAMStreamConfig)) { *ppv = (IAMStreamConfig*)this; AddRef(); return S_OK; } 599 | else if (riid == _uuidof(IKsPropertySet)) { *ppv = (IKsPropertySet*)this; AddRef(); return S_OK; } 600 | return CSourceStream::QueryInterface(riid, ppv); 601 | } 602 | 603 | STDMETHODIMP_(ULONG) AddRef() override { return GetOwner()->AddRef(); } 604 | STDMETHODIMP_(ULONG) Release() override { return GetOwner()->Release(); } 605 | 606 | STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv) override 607 | { 608 | if (ppv == NULL) return E_POINTER; 609 | else if (riid == IID_IKsPropertySet) { *ppv = (IKsPropertySet*)this; AddRef(); return S_OK; } 610 | else if (riid == IID_IQualityControl) { *ppv = (IQualityControl*)this; AddRef(); return S_OK; } 611 | else if (riid == IID_IAMStreamConfig) { *ppv = (IAMStreamConfig*)this; AddRef(); return S_OK; } 612 | return CSourceStream::NonDelegatingQueryInterface(riid, ppv); 613 | } 614 | 615 | STDMETHODIMP QuerySupported(REFGUID rguidPropSet, ULONG ulId, PULONG pulTypeSupport) override 616 | { 617 | if (rguidPropSet != AMPROPSETID_Pin) return E_PROP_SET_UNSUPPORTED; 618 | if (ulId != AMPROPERTY_PIN_CATEGORY) return E_PROP_ID_UNSUPPORTED; 619 | if (pulTypeSupport) *pulTypeSupport = KSPROPERTY_SUPPORT_GET; // We support getting this property, but not setting it. 620 | return S_OK; 621 | 622 | //if(rguidPropSet == AMPROPSETID_Pin && ulId == AMPROPERTY_PIN_CATEGORY) { *pulTypeSupport = KSPROPERTY_SUPPORT_GET; return S_OK; } 623 | //return E_NOTIMPL; 624 | } 625 | 626 | STDMETHODIMP Get(REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, LPVOID pPropertyData, ULONG ulDataLength, PULONG pulBytesReturned) override 627 | { 628 | if (rguidPropSet != AMPROPSETID_Pin) return E_PROP_SET_UNSUPPORTED; 629 | if (ulId != AMPROPERTY_PIN_CATEGORY) return E_PROP_ID_UNSUPPORTED; 630 | if (pPropertyData == NULL && pulBytesReturned == NULL) return E_POINTER; 631 | 632 | if (pulBytesReturned) *pulBytesReturned = sizeof(GUID); 633 | if (pPropertyData == NULL) return S_OK; // Caller just wants to know the size. 634 | if (ulDataLength < sizeof(GUID)) return E_UNEXPECTED; // The buffer is too small. 635 | 636 | *(GUID *)pPropertyData = PIN_CATEGORY_CAPTURE; 637 | return S_OK; 638 | 639 | //if(rguidPropSet == AMPROPSETID_Pin && ulId == AMPROPERTY_PIN_CATEGORY) 640 | //{ 641 | // if (pPropertyData == NULL) return E_POINTER; 642 | // if (ulDataLength != sizeof(GUID)) return E_INVALIDARG; 643 | // memcpy(pPropertyData, &PIN_CATEGORY_CAPTURE, sizeof(GUID)); 644 | // *pulBytesReturned = sizeof(GUID); 645 | // return S_OK; 646 | //} 647 | //return E_NOTIMPL; 648 | } 649 | 650 | STDMETHODIMP Set(REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, LPVOID pPropertyData, ULONG ulDataLength) override { return E_NOTIMPL; } 651 | STDMETHODIMP Notify(IBaseFilter *pSelf, Quality q) override { return S_OK; } 652 | STDMETHODIMP SetSink(IQualityControl *piqc) override { return S_OK; } 653 | 654 | HRESULT DecideBufferSize(IMemAllocator * pAlloc, ALLOCATOR_PROPERTIES * pRequest) override 655 | { 656 | if (pAlloc == NULL || pRequest == NULL) DebugLog("[DecideBufferSize] E_POINTER\n"); 657 | if (pAlloc == NULL || pRequest == NULL) return E_POINTER; 658 | CAutoLock cAutoLock(m_pFilter->pStateLock()); 659 | HRESULT hr = NOERROR; 660 | VIDEOINFO *pvi = (VIDEOINFO*)m_mt.Format(); 661 | pRequest->cBuffers = 1; 662 | 663 | DebugLog("[DecideBufferSize] Request Size: %d - Have Size: %d\n", (int)pvi->bmiHeader.biSizeImage, (int)pRequest->cbBuffer); 664 | if (pvi->bmiHeader.biSizeImage > (DWORD)pRequest->cbBuffer) 665 | pRequest->cbBuffer = pvi->bmiHeader.biSizeImage; 666 | 667 | ALLOCATOR_PROPERTIES actual; 668 | hr = pAlloc->SetProperties(pRequest, &actual); 669 | if (FAILED(hr)) DebugLog("[DecideBufferSize] E_SOMETHING\n"); 670 | if (FAILED(hr)) return hr; 671 | 672 | DebugLog("[DecideBufferSize] Request Size: %d - Actual Size: %d\n", (int)pvi->bmiHeader.biSizeImage, (int)actual.cbBuffer); 673 | return (actual.cbBuffer < pRequest->cbBuffer ? E_FAIL : S_OK); 674 | } 675 | 676 | STDMETHODIMP SetFormat(AM_MEDIA_TYPE *pmt) override 677 | { 678 | if (pmt == NULL) DebugLog("[SetFormat] E_POINTER\n"); 679 | if (pmt == NULL) return E_POINTER; 680 | 681 | VIDEOINFO* pvi = (VIDEOINFO*)pmt->pbFormat; 682 | if (pvi == NULL) DebugLog("[SetFormat] E_UNEXPECTED (pvi is null)\n"); 683 | if (pvi == NULL) return E_UNEXPECTED; 684 | 685 | bool HasStrideBytes = (DIBSIZE(pvi->bmiHeader) != pvi->bmiHeader.biWidth * pvi->bmiHeader.biHeight * pvi->bmiHeader.biBitCount / 8); 686 | if (HasStrideBytes) DebugLog("[SetFormat] E_FAIL (has stride bytes)\n"); 687 | if (HasStrideBytes) return E_FAIL; 688 | 689 | DebugLog("[SetFormat] WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d - SIZE: %d - SIZE CALC: %d\n", (int)pvi->bmiHeader.biWidth, (int)pvi->bmiHeader.biHeight, (int)pvi->bmiHeader.biBitCount, (int)pvi->AvgTimePerFrame, 690 | (int)pvi->bmiHeader.biSizeImage, (int)DIBSIZE(pvi->bmiHeader)); 691 | m_avgTimePerFrame = pvi->AvgTimePerFrame; 692 | m_mt = *pmt; 693 | ((VIDEOINFO*)m_mt.pbFormat)->bmiHeader.biSizeImage = DIBSIZE(((VIDEOINFO*)m_mt.pbFormat)->bmiHeader); 694 | return S_OK; 695 | } 696 | 697 | STDMETHODIMP GetFormat(AM_MEDIA_TYPE **ppmt) override 698 | { 699 | if (ppmt == NULL) DebugLog("[GetFormat] E_POINTER\n"); 700 | if (ppmt == NULL) return E_POINTER; 701 | DebugLog("[GetFormat] RETURNING WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d - SIZEIMAGE: %d - SIZECALC: %d\n", (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biWidth, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biHeight, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biBitCount, (int)((VIDEOINFO*)m_mt.Format())->AvgTimePerFrame, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biSizeImage, (int)DIBSIZE(((VIDEOINFO*)m_mt.Format())->bmiHeader)); 702 | *ppmt = CreateMediaType(&m_mt); 703 | return S_OK; 704 | } 705 | 706 | STDMETHODIMP GetNumberOfCapabilities(int *piCount, int *piSize) override 707 | { 708 | if (piCount == NULL || piSize == NULL) DebugLog("[GetNumberOfCapabilities] E_POINTER\n"); 709 | if (piCount == NULL || piSize == NULL) return E_POINTER; 710 | *piCount = (sizeof(_media)/sizeof(_media[0])*2); //RGB and RGBA variations 711 | *piSize = sizeof(VIDEO_STREAM_CONFIG_CAPS); 712 | DebugLog("[GetNumberOfCapabilities] Returning Count: %d - Size: %d\n", *piCount, *piSize); 713 | return S_OK; 714 | } 715 | 716 | STDMETHODIMP GetStreamCaps(int iIndex, AM_MEDIA_TYPE **ppmt, BYTE *pSCC) override 717 | { 718 | if (ppmt == NULL || pSCC == NULL) DebugLog("[GetStreamCaps] E_POINTER\n"); 719 | if (ppmt == NULL || pSCC == NULL) return E_POINTER; 720 | 721 | CMediaType mt; 722 | HRESULT hr = GetMediaType(iIndex, &mt); 723 | if (FAILED(hr)) return hr; 724 | VIDEOINFO *pvi = (VIDEOINFO*)mt.Format(); 725 | 726 | *ppmt = CreateMediaType(&mt); 727 | 728 | VIDEO_STREAM_CONFIG_CAPS* pCaps = (VIDEO_STREAM_CONFIG_CAPS*)pSCC; 729 | ZeroMemory(pCaps, sizeof(VIDEO_STREAM_CONFIG_CAPS)); 730 | 731 | pCaps->guid = FORMAT_VideoInfo; 732 | pCaps->VideoStandard = 0; 733 | pCaps->CropAlignX = 1; 734 | pCaps->CropAlignY = 1; 735 | pCaps->OutputGranularityX = 1; 736 | pCaps->OutputGranularityY = 1; 737 | pCaps->StretchTapsX = 2; 738 | pCaps->StretchTapsY = 2; 739 | pCaps->ShrinkTapsX = 2; 740 | pCaps->ShrinkTapsY = 2; 741 | pCaps->InputSize.cx = pvi->bmiHeader.biWidth; 742 | pCaps->InputSize.cy = pvi->bmiHeader.biHeight; 743 | pCaps->MinCroppingSize.cx = 1; 744 | pCaps->MinCroppingSize.cy = 1; 745 | pCaps->MaxCroppingSize.cx = pvi->bmiHeader.biWidth; 746 | pCaps->MaxCroppingSize.cy = pvi->bmiHeader.biHeight; 747 | pCaps->CropGranularityX = 1; 748 | pCaps->CropGranularityY = 1; 749 | pCaps->MinOutputSize.cx = 4; 750 | pCaps->MinOutputSize.cy = 4; 751 | pCaps->MaxOutputSize.cx = pvi->bmiHeader.biWidth; 752 | pCaps->MaxOutputSize.cy = pvi->bmiHeader.biHeight; 753 | pCaps->MinFrameInterval = 10000000 / 120; 754 | pCaps->MaxFrameInterval = 10000000 / 30; 755 | pCaps->MinBitsPerSecond = pCaps->MinOutputSize.cx * pCaps->MinOutputSize.cy * pvi->bmiHeader.biBitCount * 30; 756 | pCaps->MaxBitsPerSecond = pCaps->MaxOutputSize.cx * pCaps->MaxOutputSize.cy * pvi->bmiHeader.biBitCount * 120; 757 | DebugLog("[GetStreamCaps] Index: %d - MINWIDTH: %d - MINHEIGHT: %d - MAXWIDTH: %d - MAXHEIGHT: %d - BITS: %d - TPS: %d - SIZEIMAGE: %d - SIZECALC: %d\n", iIndex, (int)pCaps->MinOutputSize.cx, (int)pCaps->MinOutputSize.cy, (int)pCaps->MaxOutputSize.cx, (int)pCaps->MaxOutputSize.cy, (int)pvi->bmiHeader.biBitCount, (int)pvi->AvgTimePerFrame, (int)pvi->bmiHeader.biSizeImage, (int)DIBSIZE(pvi->bmiHeader)); 758 | return S_OK; 759 | } 760 | 761 | HRESULT SetMediaType(const CMediaType *pmt) override 762 | { 763 | VIDEOINFOHEADER* pvi = (VIDEOINFOHEADER*)(pmt->Format()); 764 | DebugLog("[SetMediaType] [ASKD] WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d - SIZEIMAGE: %d - SIZECALC: %d\n", (int)pvi->bmiHeader.biWidth, (int)pvi->bmiHeader.biHeight, (int)pvi->bmiHeader.biBitCount, (int)pvi->AvgTimePerFrame, (int)pvi->bmiHeader.biSizeImage, (int)DIBSIZE(pvi->bmiHeader)); 765 | DebugLog("[SetMediaType] [HAVE] WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d - SIZEIMAGE: %d - SIZECALC: %d\n", (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biWidth, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biHeight, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biBitCount, (int)((VIDEOINFO*)m_mt.Format())->AvgTimePerFrame, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biSizeImage, (int)DIBSIZE(((VIDEOINFO*)m_mt.Format())->bmiHeader)); 766 | HRESULT hr = CSourceStream::SetMediaType(pmt); 767 | return hr; 768 | } 769 | 770 | HRESULT CheckMediaType(const CMediaType *pMediaType) override 771 | { 772 | CAutoLock lock(m_pFilter->pStateLock()); 773 | VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *)(pMediaType->Format()); 774 | if (!pvi) DebugLog("[CheckMediaType] WANT VIDEO INFO NULL\n"); 775 | else DebugLog("[CheckMediaType] [WANT] WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d - SIZEIMAGE: %d - SIZECALC: %d - CBFORMAT: %d\n", (int)pvi->bmiHeader.biWidth, (int)pvi->bmiHeader.biHeight, (int)pvi->bmiHeader.biBitCount, (int)pvi->AvgTimePerFrame, (int)pvi->bmiHeader.biSizeImage, (int)DIBSIZE(pvi->bmiHeader), (int)pMediaType->cbFormat); 776 | DebugLog("[CheckMediaType] [HAVE] WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d - SIZEIMAGE: %d - SIZECALC: %d - CBFORMAT: %d\n", (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biWidth, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biHeight, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biBitCount, (int)((VIDEOINFO*)m_mt.Format())->AvgTimePerFrame, (int)((VIDEOINFO*)m_mt.Format())->bmiHeader.biSizeImage, (int)DIBSIZE(((VIDEOINFO*)m_mt.Format())->bmiHeader), (int)m_mt.cbFormat); 777 | DebugLog("[CheckMediaType] [RETURNING] %s\n", (*pMediaType != m_mt ? "E_INVALIDARG" : "S_OK")); 778 | return (*pMediaType != m_mt ? E_INVALIDARG : S_OK); 779 | } 780 | 781 | HRESULT GetMediaType(int iPos, CMediaType *pMediaType) override 782 | { 783 | CheckPointer(pMediaType, E_POINTER); 784 | if (iPos < 0) return E_INVALIDARG; 785 | if (iPos >= (sizeof(_media)/sizeof(_media[0])*2)) return VFW_S_NO_MORE_ITEMS; 786 | CAutoLock cAutoLock(m_pFilter->pStateLock()); 787 | 788 | int iMedia = iPos%(sizeof(_media)/sizeof(_media[0])); 789 | UCASSERT(_media[iMedia].width * _media[iMedia].height * 4 * sizeof(short) <= MAX_SHARED_IMAGE_SIZE); 790 | VIDEOINFO *pvi = (VIDEOINFO *)pMediaType->AllocFormatBuffer(sizeof(VIDEOINFO)); 791 | ZeroMemory(pvi, sizeof(VIDEOINFO)); 792 | pvi->AvgTimePerFrame = m_avgTimePerFrame; 793 | BITMAPINFOHEADER *pBmi = &(pvi->bmiHeader); 794 | pBmi->biSize = sizeof(BITMAPINFOHEADER); 795 | pBmi->biWidth = (_media[iMedia].width ? _media[iMedia].width : ((VIDEOINFO*)m_mt.pbFormat)->bmiHeader.biWidth ); 796 | pBmi->biHeight = (_media[iMedia].height ? _media[iMedia].height : ((VIDEOINFO*)m_mt.pbFormat)->bmiHeader.biHeight); 797 | pBmi->biPlanes = 1; 798 | pBmi->biBitCount = (iPos >= (sizeof(_media)/sizeof(_media[0])) ? 32 : 24); 799 | pBmi->biCompression = BI_RGB; 800 | pvi->bmiHeader.biSizeImage = DIBSIZE(pvi->bmiHeader); 801 | 802 | //DebugLog("[GetMediaType] iPos: %d - WIDTH: %d - HEIGHT: %d - BITS: %d - TPS: %d\n", iPos, (int)pvi->bmiHeader.biWidth, (int)pvi->bmiHeader.biHeight, (int)pvi->bmiHeader.biBitCount, (int)pvi->AvgTimePerFrame); 803 | 804 | pMediaType->SetType(&MEDIATYPE_Video); 805 | pMediaType->SetFormatType(&FORMAT_VideoInfo); 806 | pMediaType->SetSubtype(&(pBmi->biBitCount == 32 ? MEDIASUBTYPE_ARGB32 : MEDIASUBTYPE_RGB24)); 807 | pMediaType->SetSampleSize(pvi->bmiHeader.biSizeImage); 808 | pMediaType->SetTemporalCompression(FALSE); 809 | return S_OK; 810 | } 811 | 812 | HRESULT OnThreadStartPlay() override 813 | { 814 | DebugLog("[OnThreadStartPlay] OnThreadStartPlay\n"); 815 | m_llFrame = m_llFrameMissCount = 0; 816 | m_llFrameMissMax = 5; 817 | return CSourceStream::OnThreadStartPlay(); 818 | } 819 | 820 | CMediaType m_mt; 821 | LONGLONG m_llFrame, m_llFrameMissCount, m_llFrameMissMax; 822 | REFERENCE_TIME m_prevStartTime; 823 | REFERENCE_TIME m_avgTimePerFrame; 824 | SharedImageMemory* m_pReceiver; 825 | ProcessWorkers m_ProcessWorkers; 826 | DWORD m_iUnscaledBufSize; 827 | uint8_t *m_pUnscaledBuf, *m_RGBA16Table; 828 | SharedImageMemory::EFormat m_RGBA16TableFormat; 829 | 830 | //IAMStreamControl 831 | HRESULT STDMETHODCALLTYPE StartAt(const REFERENCE_TIME *ptStart, DWORD dwCookie) override { return NOERROR; } 832 | HRESULT STDMETHODCALLTYPE StopAt(const REFERENCE_TIME *ptStop, BOOL bSendExtra, DWORD dwCookie) override { return NOERROR; } 833 | HRESULT STDMETHODCALLTYPE GetInfo(AM_STREAM_INFO *pInfo) override { return NOERROR; } 834 | 835 | // IAMPushSource 836 | HRESULT STDMETHODCALLTYPE GetLatency(REFERENCE_TIME *prtLatency) override { return NOERROR; } 837 | HRESULT STDMETHODCALLTYPE GetPushSourceFlags(ULONG *pFlags) override { *pFlags = AM_PUSHSOURCECAPS_INTERNAL_RM; return NOERROR; } 838 | HRESULT STDMETHODCALLTYPE SetPushSourceFlags(ULONG Flags) override { return E_NOTIMPL; } 839 | HRESULT STDMETHODCALLTYPE SetStreamOffset(REFERENCE_TIME rtOffset) override { return NOERROR; } 840 | HRESULT STDMETHODCALLTYPE GetStreamOffset(REFERENCE_TIME *prtOffset) override { *prtOffset = 0; return NOERROR; } 841 | HRESULT STDMETHODCALLTYPE GetMaxStreamOffset(REFERENCE_TIME *prtMaxOffset) override { *prtMaxOffset = 0; return NOERROR; } 842 | HRESULT STDMETHODCALLTYPE SetMaxStreamOffset(REFERENCE_TIME rtMaxOffset) override { return NOERROR; } 843 | }; 844 | 845 | class CCaptureProperties : public CBasePropertyPage 846 | { 847 | public: 848 | static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr) 849 | { 850 | CUnknown *punk = new CCaptureProperties(lpunk, phr); 851 | *phr = (punk ? S_OK : E_OUTOFMEMORY); 852 | return punk; 853 | } 854 | 855 | private: 856 | CCaptureProperties(LPUNKNOWN lpunk, HRESULT *phr) : CBasePropertyPage("", lpunk, -1, -1) { } 857 | 858 | STDMETHODIMP Activate(HWND hwndParent, LPCRECT prect, BOOL fModal) 859 | { 860 | struct MyData 861 | { 862 | #pragma pack(4) 863 | DLGTEMPLATE Header; 864 | #pragma pack(2) 865 | WORD NoMenu, StdClass; wchar_t Title[1]; // 0 - no menu | 0 - standard dialog class | No title 866 | #pragma pack(4) 867 | struct Item 868 | { 869 | #pragma pack(4) 870 | DLGITEMTEMPLATE Header; 871 | #pragma pack(2) 872 | WORD FFFF, ClassID; wchar_t Text[2]; WORD NoData; 873 | #pragma pack(4) 874 | } Items[8]; 875 | #pragma pack(4) 876 | } md = { 877 | { WS_CHILD | WS_VISIBLE | DS_CENTER, NULL, sizeof(md.Items)/sizeof(MyData::Item) }, 0, 0, L"", { 878 | { { WS_VISIBLE | WS_CHILD | SS_LEFT, NULL , 5, 18, 80, 10, 1000 }, 0xFFFF, 0x0082, L"-" }, //Label 879 | { { WS_VISIBLE | WS_CHILD | WS_TABSTOP | CBS_DROPDOWNLIST, NULL , 90, 17, 150, 100, 1001 }, 0xFFFF, 0x0085, L"-" }, //Combo Box 880 | { { WS_VISIBLE | WS_CHILD | SS_LEFT, NULL , 5, 36, 80, 10, 1002 }, 0xFFFF, 0x0082, L"-" }, //Label 881 | { { WS_VISIBLE | WS_CHILD | WS_TABSTOP | CBS_DROPDOWNLIST, NULL , 90, 35, 150, 100, 1003 }, 0xFFFF, 0x0085, L"-" }, //Combo Box 882 | { { WS_VISIBLE | WS_CHILD | SS_LEFT, NULL , 5, 54, 80, 10, 1004 }, 0xFFFF, 0x0082, L"-" }, //Label 883 | { { WS_VISIBLE | WS_CHILD | WS_TABSTOP | CBS_DROPDOWNLIST, NULL , 90, 53, 150, 100, 1005 }, 0xFFFF, 0x0085, L"-" }, //Combo Box 884 | { { WS_VISIBLE | WS_CHILD | SS_LEFT, NULL , 5, 72, 80, 10, 1006 }, 0xFFFF, 0x0082, L"-" }, //Label 885 | { { WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_CHECKBOX, NULL , 90, 71, 150, 10, 1007 }, 0xFFFF, 0x0080, L"-" }, //Check Box 886 | }}; 887 | 888 | HWND hwnd = CreateDialogIndirectParamW(NULL, &md.Header, hwndParent, &MyDialogProc, (LPARAM)this); 889 | SetDlgItemTextW(hwnd, 1000, L"Resolution mismatch:"); 890 | SetDlgItemTextW(hwnd, 1002, L"Unity never started:"); 891 | SetDlgItemTextW(hwnd, 1004, L"Unity sending stopped:"); 892 | SetDlgItemTextW(hwnd, 1006, L"Display FPS:"); 893 | SetDlgItemTextW(hwnd, 1007, L"Show capture frame rate"); 894 | for (int i = 0; i < 3; i++) 895 | { 896 | HWND hWndComboBox = GetDlgItem(hwnd, 1001 + i*2); 897 | for (int j = 0; j < sizeof(ErrorDrawModeNames)/sizeof(ErrorDrawModeNames[0]); j++) 898 | SendMessageW(hWndComboBox, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)ErrorDrawModeNames[j]); 899 | SendMessageA(hWndComboBox, CB_SETCURSEL, (WPARAM)ErrorDrawModes[i], (LPARAM)0); 900 | } 901 | SendMessage(GetDlgItem(hwnd, 1007), BM_SETCHECK, (OutputFrameRate ? BST_CHECKED : BST_UNCHECKED), 0); 902 | 903 | SetWindowPos(hwnd, NULL, prect->left, prect->top, prect->right-prect->left, prect->bottom-prect->top, 0); //show in tab page 904 | return S_OK; 905 | } 906 | 907 | static INT_PTR CALLBACK MyDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 908 | { 909 | if (uMsg == WM_INITDIALOG) return TRUE; 910 | if (uMsg == WM_COMMAND) 911 | { 912 | //DebugLog("[DIALOG] WM_COMMAND - ItemID: %d - SubCommand: %d - Value: %d\n", (int)LOWORD(wParam), (int)HIWORD(wParam), (int)lParam); 913 | int ItemID = LOWORD(wParam), SubCommand = HIWORD(wParam); 914 | HWND hWndItem = GetDlgItem(hwnd, ItemID); 915 | int SelectionIndex = (int)SendMessageA(hWndItem, CB_GETCURSEL, 0, 0); 916 | if (ItemID == 1001 && SubCommand == 1) ErrorDrawModes[EDC_ResolutionMismatch] = (EErrorDrawMode)SelectionIndex; 917 | if (ItemID == 1003 && SubCommand == 1) ErrorDrawModes[EDC_UnityNeverStarted] = (EErrorDrawMode)SelectionIndex; 918 | if (ItemID == 1005 && SubCommand == 1) ErrorDrawModes[EDC_UnitySendingStopped] = (EErrorDrawMode)SelectionIndex; 919 | if (ItemID == 1007) SendMessage(hWndItem, BM_SETCHECK, ((OutputFrameRate ^= 1) ? BST_CHECKED : BST_UNCHECKED), 0); 920 | return TRUE; 921 | } 922 | return FALSE; 923 | } 924 | 925 | STDMETHODIMP GetPageInfo(__out LPPROPPAGEINFO pPageInfo) 926 | { 927 | pPageInfo->pszTitle = (WCHAR*)CoTaskMemAlloc(sizeof(CaptureSourceName)); 928 | memcpy(pPageInfo->pszTitle, CaptureSourceName, sizeof(CaptureSourceName)); 929 | pPageInfo->size.cx = 490; 930 | pPageInfo->size.cy = 200; 931 | pPageInfo->pszDocString = NULL; 932 | pPageInfo->pszHelpFile = NULL; 933 | pPageInfo->dwHelpContext= 0; 934 | return NOERROR; 935 | } 936 | }; 937 | 938 | class CCaptureSource : CSource, IQualityControl, ICamSource, ISpecifyPropertyPages 939 | { 940 | public: 941 | static CUnknown * CreateInstance(LPUNKNOWN lpunk, HRESULT *phr, int32_t CapNum) 942 | { 943 | UCASSERT(phr); 944 | *phr = S_OK; 945 | 946 | CCaptureSource *pSource = new CCaptureSource(lpunk, phr); 947 | if (FAILED(*phr) || !pSource) 948 | { 949 | if (!pSource) *phr = E_OUTOFMEMORY; 950 | delete pSource; 951 | return NULL; 952 | } 953 | 954 | CCaptureStream* pStream = new CCaptureStream(pSource, phr, CapNum); 955 | if (FAILED(*phr) || !pStream) 956 | { 957 | if (!pStream) *phr = E_OUTOFMEMORY; 958 | delete pStream; 959 | delete pSource; 960 | return NULL; 961 | } 962 | 963 | return pSource; 964 | } 965 | 966 | private: 967 | DECLARE_IUNKNOWN; 968 | 969 | CCaptureSource(LPUNKNOWN lpunk, HRESULT* phr) : CSource("Source", lpunk, CLSID_UnityCaptureService, phr) { } 970 | 971 | //CSource 972 | STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv) override 973 | { 974 | if (ppv == NULL) return E_POINTER; 975 | if (riid == IID_IQualityControl ) { *ppv = (IQualityControl*)this; AddRef(); return S_OK; } 976 | else if (riid == IID_ICamSource ) { *ppv = (ICamSource*)this; AddRef(); return S_OK; } 977 | else if (riid == IID_ISpecifyPropertyPages) { *ppv = (ISpecifyPropertyPages*)this; AddRef(); return S_OK; } // 978 | return CSource::NonDelegatingQueryInterface(riid, ppv); 979 | } 980 | 981 | //IQualityControl 982 | STDMETHODIMP Notify(IBaseFilter *pSelf, Quality q) override { return S_OK; } 983 | STDMETHODIMP SetSink(IQualityControl *piqc) override { return S_OK; } 984 | 985 | //ISpecifyPropertyPages 986 | STDMETHODIMP GetPages(CAUUID * pPages) override 987 | { 988 | CheckPointer(pPages,E_POINTER); 989 | pPages->cElems = 1; 990 | pPages->pElems = (GUID *) CoTaskMemAlloc(sizeof(GUID)); 991 | if (pPages->pElems == NULL) return E_OUTOFMEMORY; 992 | *(pPages->pElems) = CLSID_UnityCaptureProperties; 993 | return NOERROR; 994 | } 995 | }; 996 | 997 | static const AMOVIESETUP_MEDIATYPE sudMediaTypesCaptureSourceOut = { &MEDIATYPE_Video, &MEDIASUBTYPE_NULL }; 998 | static const AMOVIESETUP_PIN sudCaptureSourceOut = { 999 | L"Output", // Pin string name 1000 | FALSE, // Is it rendered 1001 | TRUE, // Is it an output 1002 | FALSE, // Can we have none 1003 | FALSE, // Can we have many 1004 | &CLSID_NULL, // Connects to filter 1005 | NULL, // Connects to pin 1006 | 1, // Number of types 1007 | &sudMediaTypesCaptureSourceOut // Pin Media types 1008 | }; 1009 | 1010 | struct WStringHolder { wchar_t str[256]; }; 1011 | __inline static WStringHolder GetCaptureSourceNameNum(const wchar_t* pCaptureSourceName, int i) 1012 | { 1013 | WStringHolder res; 1014 | StringCchPrintfW(res.str, sizeof(res.str)/sizeof(*res.str), (i == 0 ? L"%s" : L"%s #%d"), pCaptureSourceName, i + 1); 1015 | return res; 1016 | } 1017 | 1018 | __inline static GUID GetCLSIDUnityCaptureServiceNum(int i) 1019 | { 1020 | GUID NumCLSID = CLSID_UnityCaptureService; 1021 | if (i != 0) NumCLSID.Data4[7] += 1 + i; 1022 | return NumCLSID; 1023 | } 1024 | 1025 | extern "C" int CustomGetFactoryType(const IID &rClsID) 1026 | { 1027 | if (IsEqualCLSID(rClsID, CLSID_UnityCaptureProperties)) return 1; 1028 | if (memcmp(&rClsID, &CLSID_UnityCaptureService, sizeof(GUID) - 1)) return 0; 1029 | unsigned char LastByteOffset = (rClsID.Data4[7] - CLSID_UnityCaptureService.Data4[7]); 1030 | return 2 + (LastByteOffset == 0 ? 0 : LastByteOffset - 1); 1031 | } 1032 | 1033 | CUnknown *CustomCreateInstance(int FactoryType, LPUNKNOWN pUnkOuter, HRESULT* hr) 1034 | { 1035 | if (FactoryType == 1) return CCaptureProperties::CreateInstance(pUnkOuter, hr); 1036 | if (FactoryType >= 2) return CCaptureSource::CreateInstance(pUnkOuter, hr, FactoryType - 2); 1037 | return NULL; 1038 | } 1039 | 1040 | // Stack Overflow - "Fake" DirectShow video capture device 1041 | // http://stackoverflow.com/questions/1376734/fake-directshow-video-capture-device 1042 | STDAPI AMovieSetupRegisterServer(CLSID clsServer, LPCWSTR szDescription, LPCWSTR szFileName, LPCWSTR szThreadingModel = L"Both", LPCWSTR szServerType = L"InprocServer32"); 1043 | STDAPI AMovieSetupUnregisterServer(CLSID clsServer); 1044 | static HRESULT RegisterFilters(BOOL bRegister) 1045 | { 1046 | UCASSERT(g_hInst != 0); 1047 | WCHAR achFileName[MAX_PATH]; 1048 | if (!GetModuleFileNameW(g_hInst, achFileName, sizeof(achFileName))) return AmHresultFromWin32(GetLastError()); 1049 | HRESULT hr = CoInitialize(0); 1050 | 1051 | int MaxCapNum = (bRegister ? 1 : SharedImageMemory::MAX_CAPNUM); 1052 | const wchar_t* pCaptureSourceName = CaptureSourceName; 1053 | if (SUCCEEDED(hr) && bRegister) 1054 | { 1055 | char* CapNumParam = strstr(GetCommandLineA(), "/i:UnityCaptureDevices="); 1056 | if (CapNumParam) MaxCapNum = atoi(CapNumParam + sizeof("/i:UnityCaptureDevices=") - 1); 1057 | 1058 | const wchar_t* CapNameParam = wcsstr(GetCommandLineW(), L"/i:UnityCaptureName="); 1059 | if (CapNameParam) 1060 | { 1061 | //Parse custom filter names from /i:UnityCaptureName=NAME or "/i:UnityCaptureName=NAME NAME" or /i:UnityCaptureName="NAME NAME" 1062 | const wchar_t* CapNameStart = CapNameParam + sizeof("/i:UnityCaptureName=") - 1; 1063 | if (CapNameStart[0] == L'"') CapNameStart++; 1064 | const wchar_t* CapNameEnd = wcsstr(CapNameStart, (CapNameParam[-1] == L'"' || CapNameStart[-1] == L'"' ? L"\"" : L" ")); 1065 | if (!CapNameEnd) CapNameEnd = CapNameStart + wcslen(CapNameStart); 1066 | size_t CapNameLen = CapNameEnd - CapNameStart; 1067 | if (CapNameLen > 0 && CapNameLen < 200) 1068 | { 1069 | //Allocate memory to hold the name string (this is never freed until regsvr32 ends, which is soon after this function anyway) 1070 | wchar_t* CustomCaptureSourceName = (wchar_t*)malloc(sizeof(wchar_t) * (CapNameLen + 1)); 1071 | memcpy(CustomCaptureSourceName, CapNameStart, sizeof(wchar_t) * CapNameLen); 1072 | CustomCaptureSourceName[CapNameLen] = L'\0'; 1073 | pCaptureSourceName = CustomCaptureSourceName; 1074 | } 1075 | } 1076 | 1077 | if (MaxCapNum < 1) MaxCapNum = 1; 1078 | if (MaxCapNum > SharedImageMemory::MAX_CAPNUM) MaxCapNum = SharedImageMemory::MAX_CAPNUM; 1079 | 1080 | for (int i = 0; SUCCEEDED(hr) && i != MaxCapNum; i++) 1081 | hr = AMovieSetupRegisterServer(GetCLSIDUnityCaptureServiceNum(i), GetCaptureSourceNameNum(pCaptureSourceName, i).str, achFileName, L"Both", L"InprocServer32"); 1082 | if (SUCCEEDED(hr)) hr = AMovieSetupRegisterServer(CLSID_UnityCaptureProperties, CaptureSourceName L" Configuration", achFileName, L"Both", L"InprocServer32"); 1083 | if (FAILED(hr)) MessageBoxA(0, "AMovieSetupRegisterServer failed", "RegisterFilters setup", NULL); 1084 | } 1085 | 1086 | if (SUCCEEDED(hr)) 1087 | { 1088 | IFilterMapper2 *fm = NULL; 1089 | hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&fm); 1090 | 1091 | if (SUCCEEDED(hr)) 1092 | { 1093 | if (bRegister) 1094 | { 1095 | REGFILTER2 rf2; 1096 | rf2.dwVersion = 1; 1097 | rf2.dwMerit = MERIT_DO_NOT_USE; 1098 | rf2.cPins = 1; 1099 | rf2.rgPins = &sudCaptureSourceOut; 1100 | for (int i = 0; SUCCEEDED(hr) && i != MaxCapNum; i++) 1101 | { 1102 | hr = fm->RegisterFilter(GetCLSIDUnityCaptureServiceNum(i), GetCaptureSourceNameNum(pCaptureSourceName, i).str, 0, &CLSID_VideoInputDeviceCategory, NULL, &rf2); 1103 | 1104 | //This is needed for Unity and Skype to access the virtual camera 1105 | //Thanks to: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/cd2b9d2d-b961-442d-8946-fdc038fed530/where-to-specify-device-id-in-the-filter?forum=windowsdirectshowdevelopment 1106 | LPOLESTR CLSID_Category_Str, CLSID_Filter_Str; WCHAR strKey[256]; HKEY hKey; 1107 | StringFromCLSID(CLSID_VideoInputDeviceCategory, &CLSID_Category_Str); 1108 | StringFromCLSID(GetCLSIDUnityCaptureServiceNum(i), &CLSID_Filter_Str); 1109 | StringCchPrintfW(strKey, 256, L"SOFTWARE\\Classes\\CLSID\\%s\\Instance\\%s", CLSID_Category_Str, CLSID_Filter_Str); 1110 | RegOpenKeyExW(HKEY_LOCAL_MACHINE, strKey, 0, KEY_ALL_ACCESS, &hKey); 1111 | RegSetValueExA(hKey, "DevicePath", 0, REG_SZ, (LPBYTE)"foo:bar", (DWORD)sizeof("foo:bar")); 1112 | RegCloseKey(hKey); 1113 | } 1114 | if (FAILED(hr)) MessageBoxA(0, "Service RegisterFilter of IFilterMapper2 failed", "RegisterFilters setup", NULL); 1115 | } 1116 | else 1117 | { 1118 | for (int i = 0; SUCCEEDED(hr) && i != MaxCapNum; i++) 1119 | hr = fm->UnregisterFilter(&CLSID_VideoInputDeviceCategory, 0, GetCLSIDUnityCaptureServiceNum(i)); 1120 | if (FAILED(hr)) MessageBoxA(0, "Service UnregisterFilter of IFilterMapper2 failed", "RegisterFilters setup", NULL); 1121 | } 1122 | } 1123 | 1124 | if (fm) fm->Release(); 1125 | } 1126 | 1127 | if (SUCCEEDED(hr) && !bRegister) 1128 | { 1129 | for (int i = 0; SUCCEEDED(hr) && i != MaxCapNum; i++) 1130 | hr = AMovieSetupUnregisterServer(GetCLSIDUnityCaptureServiceNum(i)); 1131 | if (SUCCEEDED(hr)) hr = AMovieSetupUnregisterServer(CLSID_UnityCaptureProperties); 1132 | if (FAILED(hr)) MessageBoxA(0, "AMovieSetupUnregisterServer failed", "RegisterFilters setup", NULL); 1133 | } 1134 | 1135 | CoFreeUnusedLibraries(); 1136 | CoUninitialize(); 1137 | return hr; 1138 | } 1139 | 1140 | STDAPI DllRegisterServer() 1141 | { 1142 | return RegisterFilters(TRUE); 1143 | } 1144 | 1145 | STDAPI DllInstall(BOOL bInstall, PCWSTR pszCmdLine) 1146 | { 1147 | return S_OK; 1148 | } 1149 | 1150 | STDAPI DllUnregisterServer() 1151 | { 1152 | return RegisterFilters(FALSE); 1153 | } 1154 | 1155 | extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID); 1156 | BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) 1157 | { 1158 | return DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call, lpReserved); 1159 | } 1160 | -------------------------------------------------------------------------------- /Source/UnityCaptureFilter.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllMain PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | DllCanUnloadNow PRIVATE 7 | DllInstall PRIVATE 8 | -------------------------------------------------------------------------------- /Source/UnityCaptureFilter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnityCaptureFilter", "UnityCaptureFilter.vcxproj", "{3D0A9889-9EC1-4012-9382-4FE1EB610D28}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|Win32.Build.0 = Debug|Win32 18 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|x64.ActiveCfg = Debug|x64 19 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Debug|x64.Build.0 = Debug|x64 20 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|Win32.ActiveCfg = Release|Win32 21 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|Win32.Build.0 = Release|Win32 22 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|x64.ActiveCfg = Release|x64 23 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Source/UnityCaptureFilter.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | UnityCaptureFilter 23 | UnityCaptureFilter 24 | {3D0A9889-9EC1-4012-9382-4FE1EB610D28} 25 | 26 | 27 | 28 | DynamicLibrary 29 | v110_xp 30 | v120_xp 31 | v140 32 | v141 33 | false 34 | MultiByte 35 | true 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | UnityCaptureFilter64bit 44 | UnityCaptureFilter32bit 45 | Build\$(Configuration)-$(TargetName)\ 46 | $(OutDir) 47 | false 48 | true 49 | false 50 | $(ProgramW6432)\OBSStudio\bin\x64\obs64.exe 51 | $(ProgramW6432)\OBSStudio\bin\x64 52 | WindowsLocalDebugger 53 | 54 | 55 | 56 | false 57 | Level3 58 | true 59 | false 60 | false 61 | 62 | 63 | Win32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 64 | Disabled 65 | EnableFastChecks 66 | MultiThreadedDebug 67 | 68 | 69 | Win32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 70 | Full 71 | true 72 | MultiThreaded 73 | true 74 | true 75 | true 76 | Speed 77 | true 78 | AnySuitable 79 | false 80 | /Gw %(AdditionalOptions) 81 | 82 | 83 | true 84 | true 85 | Windows 86 | false 87 | $(ProjectName).def 88 | 89 | 90 | true 91 | true 92 | UseLinkTimeCodeGeneration 93 | true 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /Source/UnityCapturePlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Unity Capture 3 | Copyright (c) 2018 Bernhard Schelling 4 | 5 | Based on UnityCam 6 | https://github.com/mrayy/UnityCam 7 | Copyright (c) 2016 MHD Yamen Saraiji 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any damages 11 | arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any purpose, 14 | including commercial applications, and to alter it and redistribute it 15 | freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you must not 18 | claim that you wrote the original software. If you use this software 19 | in a product, an acknowledgment in the product documentation would be 20 | appreciated but is not required. 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 3. This notice may not be removed or altered from any source distribution. 24 | */ 25 | 26 | #include "shared.inl" 27 | #include 28 | #include 29 | #include "IUnityGraphics.h" 30 | 31 | enum 32 | { 33 | RET_SUCCESS = 0, 34 | RET_WARNING_FRAMESKIP = 1, 35 | RET_WARNING_CAPTUREINACTIVE = 2, 36 | RET_ERROR_UNSUPPORTEDGRAPHICSDEVICE = 100, 37 | RET_ERROR_PARAMETER = 101, 38 | RET_ERROR_TOOLARGERESOLUTION = 102, 39 | RET_ERROR_TEXTUREFORMAT = 103, 40 | RET_ERROR_READTEXTURE = 104, 41 | }; 42 | 43 | #include 44 | 45 | static int g_GraphicsDeviceType = -1; 46 | static ID3D11Device* g_D3D11GraphicsDevice = 0; 47 | 48 | struct UnityCaptureInstance 49 | { 50 | SharedImageMemory* Sender; 51 | int Width, Height; 52 | DXGI_FORMAT Format; 53 | bool UseDoubleBuffering, AlternativeBuffer; 54 | ID3D11Texture2D* Textures[2]; 55 | }; 56 | 57 | extern "C" __declspec(dllexport) UnityCaptureInstance* CaptureCreateInstance(int CapNum) 58 | { 59 | UnityCaptureInstance* c = new UnityCaptureInstance(); 60 | memset(c, 0, sizeof(UnityCaptureInstance)); 61 | c->Sender = new SharedImageMemory(CapNum); 62 | return c; 63 | } 64 | 65 | extern "C" __declspec(dllexport) void CaptureDeleteInstance(UnityCaptureInstance* c) 66 | { 67 | if (!c) return; 68 | delete c->Sender; 69 | if (c->Textures[0]) c->Textures[0]->Release(); 70 | if (c->Textures[1]) c->Textures[1]->Release(); 71 | delete c; 72 | } 73 | 74 | extern "C" __declspec(dllexport) int CaptureSendTexture(UnityCaptureInstance* c, void* TextureNativePtr, int Timeout, bool UseDoubleBuffering, SharedImageMemory::EResizeMode ResizeMode, SharedImageMemory::EMirrorMode MirrorMode, bool IsLinearColorSpace) 75 | { 76 | if (!c || !TextureNativePtr) return RET_ERROR_PARAMETER; 77 | if (g_GraphicsDeviceType != kUnityGfxRendererD3D11) return RET_ERROR_UNSUPPORTEDGRAPHICSDEVICE; 78 | if (!c->Sender->SendIsReady()) return RET_WARNING_CAPTUREINACTIVE; 79 | 80 | //Get the active D3D11 context 81 | ID3D11DeviceContext* ctx = NULL; 82 | g_D3D11GraphicsDevice->GetImmediateContext(&ctx); 83 | if (!ctx) return RET_ERROR_UNSUPPORTEDGRAPHICSDEVICE; 84 | 85 | //Read the size and format info from the render texture 86 | ID3D11Texture2D* d3dtex = (ID3D11Texture2D*)TextureNativePtr; 87 | D3D11_TEXTURE2D_DESC desc = {0}; 88 | d3dtex->GetDesc(&desc); 89 | if (!desc.Width || !desc.Height) return RET_ERROR_READTEXTURE; 90 | 91 | if (c->Width != desc.Width || c->Height != desc.Height || c->Format != desc.Format || c->UseDoubleBuffering != UseDoubleBuffering) 92 | { 93 | //Allocate a Texture2D resource which holds the texture with CPU memory access 94 | D3D11_TEXTURE2D_DESC textureDesc; 95 | ZeroMemory(&textureDesc, sizeof(textureDesc)); 96 | textureDesc.Width = desc.Width; 97 | textureDesc.Height = desc.Height; 98 | textureDesc.MipLevels = desc.MipLevels; 99 | textureDesc.ArraySize = 1; 100 | textureDesc.Format = desc.Format; 101 | textureDesc.SampleDesc.Count = 1; 102 | textureDesc.SampleDesc.Quality = 0; 103 | textureDesc.Usage = D3D11_USAGE_STAGING; 104 | textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 105 | textureDesc.MiscFlags = 0; 106 | if (c->Textures[0]) c->Textures[0]->Release(); 107 | g_D3D11GraphicsDevice->CreateTexture2D(&textureDesc, NULL, &c->Textures[0]); 108 | if (c->Textures[1]) c->Textures[1]->Release(); 109 | if (UseDoubleBuffering) g_D3D11GraphicsDevice->CreateTexture2D(&textureDesc, NULL, &c->Textures[1]); 110 | else c->Textures[1] = NULL; 111 | c->Width = desc.Width; 112 | c->Height = desc.Height; 113 | c->Format = desc.Format; 114 | c->UseDoubleBuffering = UseDoubleBuffering; 115 | } 116 | 117 | //Handle double buffer 118 | if (c->UseDoubleBuffering) c->AlternativeBuffer ^= 1; 119 | ID3D11Texture2D* WriteTexture = c->Textures[c->UseDoubleBuffering && c->AlternativeBuffer ? 1 : 0]; 120 | ID3D11Texture2D* ReadTexture = c->Textures[c->UseDoubleBuffering && !c->AlternativeBuffer ? 1 : 0]; 121 | 122 | //Check texture format 123 | SharedImageMemory::EFormat Format; 124 | if (desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM || desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB || desc.Format == DXGI_FORMAT_R8G8B8A8_UINT || desc.Format == DXGI_FORMAT_R8G8B8A8_TYPELESS) Format = SharedImageMemory::FORMAT_UINT8; 125 | else if (desc.Format == DXGI_FORMAT_R16G16B16A16_FLOAT || desc.Format == DXGI_FORMAT_R16G16B16A16_TYPELESS) Format = (IsLinearColorSpace ? SharedImageMemory::FORMAT_FP16_LINEAR : SharedImageMemory::FORMAT_FP16_GAMMA); 126 | else return RET_ERROR_TEXTUREFORMAT; 127 | 128 | //Copy render texture to texture with CPU access and map the image data to RAM 129 | ctx->CopyResource(WriteTexture, d3dtex); 130 | D3D11_MAPPED_SUBRESOURCE mapResource; 131 | if (FAILED(ctx->Map(ReadTexture, 0, D3D11_MAP_READ, 0, &mapResource))) return RET_ERROR_READTEXTURE; 132 | 133 | //Push the captured data to the direct show filter 134 | SharedImageMemory::ESendResult res = c->Sender->Send(desc.Width, desc.Height, mapResource.RowPitch / (Format == SharedImageMemory::FORMAT_UINT8 ? 4 : 8), mapResource.RowPitch * desc.Height, Format, ResizeMode, MirrorMode, Timeout, (const unsigned char*)mapResource.pData); 135 | 136 | ctx->Unmap(ReadTexture, 0); 137 | 138 | switch (res) 139 | { 140 | case SharedImageMemory::SENDRES_TOOLARGE: return RET_ERROR_TOOLARGERESOLUTION; 141 | case SharedImageMemory::SENDRES_WARN_FRAMESKIP: return RET_WARNING_FRAMESKIP; 142 | } 143 | return RET_SUCCESS; 144 | } 145 | 146 | // If exported by a plugin, this function will be called when graphics device is created, destroyed, and before and after it is reset (ie, resolution changed). 147 | extern "C" void UNITY_INTERFACE_EXPORT UnitySetGraphicsDevice(void* device, int deviceType, int eventType) 148 | { 149 | if (eventType == kUnityGfxDeviceEventInitialize || eventType == kUnityGfxDeviceEventAfterReset) 150 | { 151 | g_GraphicsDeviceType = deviceType; 152 | if (deviceType == kUnityGfxRendererD3D11) g_D3D11GraphicsDevice = (ID3D11Device*)device; 153 | } 154 | else g_GraphicsDeviceType = -1; 155 | } 156 | -------------------------------------------------------------------------------- /Source/UnityCapturePlugin.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnityCapturePlugin", "UnityCapturePlugin.vcxproj", "{727D3AC5-27B5-4288-A475-7A471ECD71B8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|Win32.Build.0 = Debug|Win32 18 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|x64.ActiveCfg = Debug|x64 19 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Debug|x64.Build.0 = Debug|x64 20 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|Win32.ActiveCfg = Release|Win32 21 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|Win32.Build.0 = Release|Win32 22 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|x64.ActiveCfg = Release|x64 23 | {727D3AC5-27B5-4288-A475-7A471ECD71B8}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Source/UnityCapturePlugin.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | UnityCapturePlugin 23 | UnityCapturePlugin 24 | {727D3AC5-27B5-4288-A475-7A471ECD71B8} 25 | 26 | 27 | 28 | DynamicLibrary 29 | v110_xp 30 | v120_xp 31 | v140 32 | v141 33 | false 34 | MultiByte 35 | true 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | Build\$(Configuration)-$(TargetName)64bit\ 44 | Build\$(Configuration)-$(TargetName)32bit\ 45 | $(OutDir) 46 | false 47 | true 48 | false 49 | $(ProgramW6432)\Unity\Editor\Unity.exe 50 | -projectPath "$(ProjectDir)..\UnityCaptureSample" 51 | WindowsLocalDebugger 52 | 53 | 54 | 55 | false 56 | Level3 57 | true 58 | false 59 | false 60 | 61 | 62 | Win32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 63 | Disabled 64 | EnableFastChecks 65 | MultiThreadedDebugDLL 66 | 67 | 68 | Win32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 69 | Full 70 | true 71 | MultiThreaded 72 | true 73 | true 74 | true 75 | Speed 76 | true 77 | AnySuitable 78 | false 79 | StreamingSIMDExtensions2 80 | /Gw %(AdditionalOptions) 81 | 82 | 83 | true 84 | true 85 | Windows 86 | false 87 | opengl32.lib;%(AdditionalDependencies) 88 | 89 | 90 | true 91 | true 92 | UseLinkTimeCodeGeneration 93 | true 94 | false 95 | 96 | 97 | 98 | SETLOCAL 99 | SET TARGET_PLUGIN_DIR=x86 100 | IF NOT "$(PlatformShortName)" == "x86" SET TARGET_PLUGIN_DIR=x86_64 101 | echo Copying output $(OutDir)$(TargetName) DLL and PDB to "$(SolutionDir)..\UnityCaptureSample\Assets\UnityCapture\Plugins\%TARGET_PLUGIN_DIR%\" 102 | mkdir "$(SolutionDir)..\UnityCaptureSample\Assets\UnityCapture\Plugins\%TARGET_PLUGIN_DIR%" 2>nul 103 | copy /Y "$(SolutionDir)$(OutDir)$(TargetName).dll" "$(SolutionDir)..\UnityCaptureSample\Assets\UnityCapture\Plugins\%TARGET_PLUGIN_DIR%\" 104 | copy /Y "$(SolutionDir)$(OutDir)$(TargetName).pdb" "$(SolutionDir)..\UnityCaptureSample\Assets\UnityCapture\Plugins\%TARGET_PLUGIN_DIR%\" 105 | ENDLOCAL 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Source/shared.inl: -------------------------------------------------------------------------------- 1 | /* 2 | Unity Capture 3 | Copyright (c) 2018 Bernhard Schelling 4 | 5 | Based on UnityCam 6 | https://github.com/mrayy/UnityCam 7 | Copyright (c) 2016 MHD Yamen Saraiji 8 | */ 9 | 10 | #define _HAS_EXCEPTIONS 0 11 | #define WIN32_LEAN_AND_MEAN 12 | #include 13 | #include 14 | #include 15 | 16 | #define MAX_SHARED_IMAGE_SIZE (3840 * 2160 * 4 * sizeof(short)) //4K (RGBA max 16bit per pixel) 17 | 18 | #if _DEBUG 19 | #define UCASSERT(cond) ((cond) ? ((void)0) : *(volatile int*)0 = 0xbad|(OutputDebugStringA("[FAILED ASSERT] " #cond "\n"),1)) 20 | #else 21 | #define UCASSERT(cond) ((void)0) 22 | #endif 23 | 24 | struct SharedImageMemory 25 | { 26 | SharedImageMemory(int32_t CapNum) 27 | { 28 | memset(this, 0, sizeof(*this)); 29 | m_CapNum = CapNum; 30 | } 31 | 32 | ~SharedImageMemory() 33 | { 34 | if (m_hMutex) CloseHandle(m_hMutex); 35 | if (m_hWantFrameEvent) CloseHandle(m_hWantFrameEvent); 36 | if (m_hSentFrameEvent) CloseHandle(m_hSentFrameEvent); 37 | if (m_hSharedFile) CloseHandle(m_hSharedFile); 38 | } 39 | 40 | int32_t GetCapNum() { return m_CapNum; } 41 | enum { MAX_CAPNUM = ('z' - '0') }; //see Open() for why this number 42 | enum { RECEIVE_MAX_WAIT = 200 }; //How many milliseconds to wait for new frame 43 | enum EFormat { FORMAT_UINT8, FORMAT_FP16_GAMMA, FORMAT_FP16_LINEAR }; 44 | enum EResizeMode { RESIZEMODE_DISABLED = 0, RESIZEMODE_LINEAR = 1 }; 45 | enum EMirrorMode { MIRRORMODE_DISABLED = 0, MIRRORMODE_HORIZONTALLY = 1 }; 46 | enum EReceiveResult { RECEIVERES_CAPTUREINACTIVE, RECEIVERES_NEWFRAME, RECEIVERES_OLDFRAME }; 47 | 48 | typedef void (*ReceiveCallbackFunc)(int width, int height, int stride, EFormat format, EResizeMode resizemode, EMirrorMode mirrormode, int timeout, uint8_t* buffer, void* callback_data); 49 | 50 | EReceiveResult Receive(ReceiveCallbackFunc callback, void* callback_data) 51 | { 52 | if (!Open(true) || !m_pSharedBuf->width) return RECEIVERES_CAPTUREINACTIVE; 53 | 54 | SetEvent(m_hWantFrameEvent); 55 | bool IsNewFrame = (WaitForSingleObject(m_hSentFrameEvent, RECEIVE_MAX_WAIT) == WAIT_OBJECT_0); 56 | 57 | WaitForSingleObject(m_hMutex, INFINITE); //lock mutex 58 | callback(m_pSharedBuf->width, m_pSharedBuf->height, m_pSharedBuf->stride, (EFormat)m_pSharedBuf->format, (EResizeMode)m_pSharedBuf->resizemode, (EMirrorMode)m_pSharedBuf->mirrormode, m_pSharedBuf->timeout, m_pSharedBuf->data, callback_data); 59 | ReleaseMutex(m_hMutex); //unlock mutex 60 | 61 | return (IsNewFrame ? RECEIVERES_NEWFRAME : RECEIVERES_OLDFRAME); 62 | } 63 | 64 | bool SendIsReady() 65 | { 66 | return Open(false); 67 | } 68 | 69 | enum ESendResult { SENDRES_TOOLARGE, SENDRES_WARN_FRAMESKIP, SENDRES_OK }; 70 | ESendResult Send(int width, int height, int stride, DWORD DataSize, EFormat format, EResizeMode resizemode, EMirrorMode mirrormode, int timeout, const uint8_t* buffer) 71 | { 72 | UCASSERT(buffer); 73 | UCASSERT(m_pSharedBuf); 74 | if (m_pSharedBuf->maxSize < DataSize) return SENDRES_TOOLARGE; 75 | 76 | WaitForSingleObject(m_hMutex, INFINITE); //lock mutex 77 | m_pSharedBuf->width = width; 78 | m_pSharedBuf->height = height; 79 | m_pSharedBuf->stride = stride; 80 | m_pSharedBuf->format = format; 81 | m_pSharedBuf->resizemode = resizemode; 82 | m_pSharedBuf->mirrormode = mirrormode; 83 | m_pSharedBuf->timeout = timeout; 84 | memcpy(m_pSharedBuf->data, buffer, DataSize); 85 | ReleaseMutex(m_hMutex); //unlock mutex 86 | 87 | SetEvent(m_hSentFrameEvent); 88 | bool DidSkipFrame = (WaitForSingleObject(m_hWantFrameEvent, 0) != WAIT_OBJECT_0); 89 | 90 | return (DidSkipFrame ? SENDRES_WARN_FRAMESKIP : SENDRES_OK); 91 | } 92 | 93 | private: 94 | bool Open(bool ForReceiving) 95 | { 96 | if (m_pSharedBuf) return true; //already open 97 | 98 | UCASSERT(m_CapNum <= MAX_CAPNUM); 99 | if (m_CapNum > MAX_CAPNUM) m_CapNum = MAX_CAPNUM; 100 | char CSCapNumChar = (m_CapNum ? '0' + m_CapNum : '\0'); //use NULL terminator for CapNum 0 to be compatible with old filter DLLs before multi cap 101 | char CS_NAME_MUTEX [] = "UnityCapture_Mutx0"; CS_NAME_MUTEX [sizeof(CS_NAME_MUTEX ) - 2] = CSCapNumChar; 102 | char CS_NAME_EVENT_WANT [] = "UnityCapture_Want0"; CS_NAME_EVENT_WANT [sizeof(CS_NAME_EVENT_WANT ) - 2] = CSCapNumChar; 103 | char CS_NAME_EVENT_SENT [] = "UnityCapture_Sent0"; CS_NAME_EVENT_SENT [sizeof(CS_NAME_EVENT_SENT ) - 2] = CSCapNumChar; 104 | char CS_NAME_SHARED_DATA[] = "UnityCapture_Data0"; CS_NAME_SHARED_DATA[sizeof(CS_NAME_SHARED_DATA) - 2] = CSCapNumChar; 105 | 106 | if (!m_hMutex) 107 | { 108 | if (ForReceiving) m_hMutex = CreateMutexA(NULL, FALSE, CS_NAME_MUTEX); 109 | else m_hMutex = OpenMutexA(SYNCHRONIZE, FALSE, CS_NAME_MUTEX); 110 | if (!m_hMutex) return false; 111 | } 112 | 113 | WaitForSingleObject(m_hMutex, INFINITE); //lock mutex 114 | struct UnlockAtReturn { ~UnlockAtReturn() { ReleaseMutex(m); }; HANDLE m; } cs = { m_hMutex }; 115 | 116 | if (!m_hWantFrameEvent) 117 | { 118 | if (ForReceiving) m_hWantFrameEvent = OpenEventA(EVENT_MODIFY_STATE, FALSE, CS_NAME_EVENT_WANT); 119 | else m_hWantFrameEvent = CreateEventA(NULL, FALSE, FALSE, CS_NAME_EVENT_WANT); 120 | if (!m_hWantFrameEvent) return false; 121 | } 122 | 123 | if (!m_hSentFrameEvent) 124 | { 125 | if (ForReceiving) m_hSentFrameEvent = CreateEventA(NULL, FALSE, FALSE, CS_NAME_EVENT_SENT); 126 | else m_hSentFrameEvent = OpenEventA(EVENT_MODIFY_STATE, FALSE, CS_NAME_EVENT_SENT); 127 | if (!m_hSentFrameEvent) return false; 128 | } 129 | 130 | if (!m_hSharedFile) 131 | { 132 | if (ForReceiving) m_hSharedFile = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, NULL, sizeof(SharedMemHeader) + MAX_SHARED_IMAGE_SIZE, CS_NAME_SHARED_DATA); 133 | else m_hSharedFile = OpenFileMappingA(FILE_MAP_WRITE, FALSE, CS_NAME_SHARED_DATA); 134 | if (!m_hSharedFile) return false; 135 | } 136 | 137 | m_pSharedBuf = (SharedMemHeader*)MapViewOfFile(m_hSharedFile, FILE_MAP_WRITE, 0, 0, 0); 138 | if (!m_pSharedBuf) return false; 139 | 140 | if (ForReceiving && m_pSharedBuf->maxSize != MAX_SHARED_IMAGE_SIZE) 141 | m_pSharedBuf->maxSize = MAX_SHARED_IMAGE_SIZE; 142 | 143 | return true; 144 | } 145 | 146 | struct SharedMemHeader 147 | { 148 | DWORD maxSize; 149 | int width; 150 | int height; 151 | int stride; 152 | int format; 153 | int resizemode; 154 | int mirrormode; 155 | int timeout; 156 | uint8_t data[1]; 157 | }; 158 | 159 | int32_t m_CapNum; 160 | HANDLE m_hMutex; 161 | HANDLE m_hWantFrameEvent; 162 | HANDLE m_hSentFrameEvent; 163 | HANDLE m_hSharedFile; 164 | SharedMemHeader* m_pSharedBuf; 165 | }; 166 | -------------------------------------------------------------------------------- /UnityCaptureSample/.gitignore: -------------------------------------------------------------------------------- 1 | Library/* 2 | Temp/* 3 | Packages/* 4 | UnityPackageManager/* 5 | obj/* 6 | .vscode/* 7 | 8 | *.csproj 9 | *.sln 10 | *.suo 11 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/CaptureTexture.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This sample code is for demonstrating and testing the functionality 3 | of Unity Capture, and is placed in the public domain. 4 | 5 | This code generates a scrolling color texture simply for the purposes of demonstration. 6 | Other uses may include sending a video, another webcam feed or a static image to the output. 7 | */ 8 | 9 | using UnityEngine; 10 | 11 | public class CaptureTexture : MonoBehaviour 12 | { 13 | public int width = 320; 14 | public int height = 240; 15 | public MeshRenderer outputRenderer; 16 | Texture2D activeTex; 17 | UnityCapture.Interface captureInterface; 18 | int y = 0; 19 | Color color = Color.red; 20 | 21 | void Start() 22 | { 23 | // Create texture and capture interface 24 | activeTex = new Texture2D(width, height, TextureFormat.ARGB32, false); 25 | captureInterface = new UnityCapture.Interface(UnityCapture.ECaptureDevice.CaptureDevice1); 26 | 27 | if (outputRenderer != null) outputRenderer.material.mainTexture = activeTex; 28 | } 29 | 30 | void OnDestroy() 31 | { 32 | //Cleanup capture interface 33 | captureInterface.Close(); 34 | } 35 | 36 | void Update() 37 | { 38 | // Draw next line on texture 39 | for (int x = 0; x < width; x++) 40 | { 41 | activeTex.SetPixel(x, y, color); 42 | } 43 | 44 | y += 1; 45 | if (y > height) 46 | { 47 | y = 0; 48 | color = new Color(color.g, color.b, color.r); 49 | } 50 | 51 | activeTex.Apply(); 52 | 53 | // Update the capture texture 54 | UnityCapture.ECaptureSendResult result = captureInterface.SendTexture(activeTex); 55 | if (result != UnityCapture.ECaptureSendResult.SUCCESS) 56 | Debug.Log("SendTexture failed: " + result); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/CaptureTexture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8e68187542b37846b4a604d28bd90e1 3 | timeCreated: 1536559205 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/CubesSwayBeeps.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This sample code is for demonstrating and testing the functionality 3 | of Unity Capture, and is placed in the public domain. 4 | */ 5 | 6 | using UnityEngine; 7 | 8 | public class CubesSwayBeeps : MonoBehaviour 9 | { 10 | public float RotationAmount = 6f, RotationSpeedX = 2.5f, RotationSpeedY = 1.75f; 11 | public int CubeCount = 10; 12 | public Material CubeMaterial = null; 13 | public bool EnableSyncBeeps = true; 14 | public float BeepDuration = 1/60f*3; 15 | public Color[] PerFrameBackgroundColors = new Color[] { Color.gray }; 16 | 17 | Camera CameraComp; 18 | Transform[] CubeTransforms; 19 | Vector3[] CubeSpeeds; 20 | ulong AudioPosition; 21 | float AudioStartTime; 22 | 23 | void Start() 24 | { 25 | CameraComp = GetComponent(); 26 | 27 | int TotalCubeCount = CubeCount*CubeCount*CubeCount; 28 | CubeTransforms = new Transform[TotalCubeCount]; 29 | CubeSpeeds = new Vector3[TotalCubeCount]; 30 | GameObject CubeHolder = new GameObject("CubeHolder"); 31 | for (int i = 0; i < TotalCubeCount; i++) 32 | { 33 | int x = (i / (CubeCount * CubeCount)), y = ((i / CubeCount) % CubeCount), z = (i % CubeCount); 34 | GameObject o = GameObject.CreatePrimitive(PrimitiveType.Cube); 35 | o.transform.parent = CubeHolder.transform; 36 | o.transform.position = new Vector3(5 * (x - CubeCount / 2), 5 * (y - CubeCount / 2), 5 * (z - CubeCount / 2)); 37 | if (CubeMaterial != null) o.GetComponent().material = CubeMaterial; 38 | CubeTransforms[i] = o.transform; 39 | CubeSpeeds[i] = Random.insideUnitSphere * 50; 40 | } 41 | 42 | if (EnableSyncBeeps) 43 | { 44 | AudioClip myClip = AudioClip.Create("AudioBeeps", 44100/60, 1, 44100, true, OnAudioRead); 45 | AudioSource aud = gameObject.AddComponent(); 46 | aud.clip = myClip; 47 | aud.loop = true; 48 | AudioPosition = 0; 49 | AudioStartTime = Time.realtimeSinceStartup; 50 | aud.Play(); 51 | } 52 | } 53 | 54 | void OnAudioRead(float[] data) 55 | { 56 | const float SineSpeed = 440f * Mathf.PI * 2f / 44100f; //440hz beeps 57 | for (int count = 0; count < data.Length; AudioPosition++, count++) 58 | { 59 | bool SoundDoBeep = ((AudioPosition % 44100) < (44100*BeepDuration)); //beep for 1 second 60 | data[count] = Mathf.Sign(Mathf.Sin(SineSpeed * AudioPosition)) * (SoundDoBeep ? 1f : 0f); 61 | } 62 | } 63 | 64 | void Update() 65 | { 66 | transform.localRotation = Quaternion.Euler(new Vector3(Mathf.Cos(Time.time * RotationSpeedX), Mathf.Sin(Time.time * RotationSpeedY)) * RotationAmount); 67 | 68 | for (int i = 0; i < CubeTransforms.Length; i++) 69 | { 70 | CubeTransforms[i].rotation = Quaternion.Euler(CubeSpeeds[i] * Time.time); 71 | } 72 | 73 | CameraComp.backgroundColor = PerFrameBackgroundColors[Time.frameCount % PerFrameBackgroundColors.Length]; 74 | 75 | if (EnableSyncBeeps) 76 | { 77 | bool SoundDoBeep = (((Time.realtimeSinceStartup - AudioStartTime) % 1.0f) < BeepDuration); 78 | if (SoundDoBeep) CameraComp.backgroundColor = Color.red; 79 | } 80 | } 81 | 82 | void OnGUI() 83 | { 84 | GUI.Box(new Rect(20, 20, 250, 25), "Drawing in OnGUI is not captured"); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/CubesSwayBeeps.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70cec3f0490dff14fbf273abb6a3a72d 3 | timeCreated: 1461153401 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/MultiCam.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This sample code is for demonstrating and testing the functionality 3 | of Unity Capture, and is placed in the public domain. 4 | */ 5 | 6 | using UnityEngine; 7 | 8 | public class MultiCam : MonoBehaviour 9 | { 10 | public int CaptureResolutionWidth = 1920, CaptureResolutionHeight = 1080; 11 | public Camera CaptureCamera1, CaptureCamera2; 12 | 13 | void Awake() 14 | { 15 | Camera RenderToScreenCamera = gameObject.GetComponent(); 16 | if (RenderToScreenCamera == null) gameObject.AddComponent(); 17 | RenderToScreenCamera.clearFlags = CameraClearFlags.Nothing; 18 | RenderToScreenCamera.cullingMask = 0; 19 | RenderToScreenCamera.depth = 100; 20 | RenderToScreenCamera.useOcclusionCulling = false; 21 | RenderToScreenCamera.allowHDR = false; 22 | RenderToScreenCamera.allowMSAA = false; 23 | RenderToScreenCamera.allowDynamicResolution = false; 24 | RenderToScreenCamera.stereoTargetEye = StereoTargetEyeMask.None; 25 | CaptureCamera1.targetTexture = new RenderTexture(CaptureResolutionWidth, CaptureResolutionHeight, 24); 26 | CaptureCamera2.targetTexture = new RenderTexture(CaptureResolutionWidth, CaptureResolutionHeight, 24); 27 | } 28 | 29 | void OnPostRender() 30 | { 31 | float w = Screen.width, whalf = w/2, h = Screen.height; 32 | GL.PushMatrix(); 33 | GL.LoadPixelMatrix(); 34 | Graphics.DrawTexture(new Rect( 0, h, whalf, -h), CaptureCamera1.targetTexture); 35 | Graphics.DrawTexture(new Rect(whalf, h, whalf, -h), CaptureCamera2.targetTexture); 36 | GL.PopMatrix(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/MultiCam.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7196fa938037bb46be5bc12531f7f10 3 | timeCreated: 1530683132 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64daacfb1be37bb4085e1ff8a9b4cceb 3 | folderAsset: yes 4 | timeCreated: 1519955760 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f452a138547dbb34b9edfa5d6695c929 3 | folderAsset: yes 4 | timeCreated: 1519955869 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cd051131b4a37240be23bed28adaa6a 3 | folderAsset: yes 4 | timeCreated: 1519954762 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins/x86/UnityCapturePlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DenchiSoft/UnityCapture/a218037f79e4b419def35cb88822b2c67f610a69/UnityCaptureSample/Assets/UnityCapture/Plugins/x86/UnityCapturePlugin.dll -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins/x86/UnityCapturePlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27f4f8798f88ca0459e783408e6846a1 3 | timeCreated: 1519954762 4 | licenseType: Free 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | '': OSXIntel 15 | second: 16 | enabled: 1 17 | settings: 18 | CPU: AnyCPU 19 | - first: 20 | '': OSXIntel64 21 | second: 22 | enabled: 0 23 | settings: 24 | CPU: None 25 | - first: 26 | Any: 27 | second: 28 | enabled: 1 29 | settings: {} 30 | - first: 31 | Editor: Editor 32 | second: 33 | enabled: 0 34 | settings: 35 | CPU: x86 36 | DefaultValueInitialized: true 37 | - first: 38 | Facebook: Win 39 | second: 40 | enabled: 1 41 | settings: 42 | CPU: AnyCPU 43 | - first: 44 | Facebook: Win64 45 | second: 46 | enabled: 0 47 | settings: 48 | CPU: None 49 | - first: 50 | Standalone: Linux 51 | second: 52 | enabled: 1 53 | settings: 54 | CPU: x86 55 | - first: 56 | Standalone: Linux64 57 | second: 58 | enabled: 0 59 | settings: 60 | CPU: None 61 | - first: 62 | Standalone: LinuxUniversal 63 | second: 64 | enabled: 1 65 | settings: 66 | CPU: x86 67 | - first: 68 | Standalone: OSXUniversal 69 | second: 70 | enabled: 0 71 | settings: 72 | CPU: x86 73 | - first: 74 | Standalone: Win 75 | second: 76 | enabled: 1 77 | settings: 78 | CPU: AnyCPU 79 | - first: 80 | Standalone: Win64 81 | second: 82 | enabled: 0 83 | settings: 84 | CPU: None 85 | userData: 86 | assetBundleName: 87 | assetBundleVariant: 88 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2dd877191f53794b810d198e4f4ac67 3 | folderAsset: yes 4 | timeCreated: 1460524653 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins/x86_64/UnityCapturePlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DenchiSoft/UnityCapture/a218037f79e4b419def35cb88822b2c67f610a69/UnityCaptureSample/Assets/UnityCapture/Plugins/x86_64/UnityCapturePlugin.dll -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/Plugins/x86_64/UnityCapturePlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec414908dccab334fb32e19ccf8879bd 3 | timeCreated: 1519867776 4 | licenseType: Free 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | '': OSXIntel 15 | second: 16 | enabled: 0 17 | settings: 18 | CPU: None 19 | - first: 20 | '': OSXIntel64 21 | second: 22 | enabled: 1 23 | settings: 24 | CPU: AnyCPU 25 | - first: 26 | Any: 27 | second: 28 | enabled: 1 29 | settings: {} 30 | - first: 31 | Editor: Editor 32 | second: 33 | enabled: 0 34 | settings: 35 | CPU: x86_64 36 | DefaultValueInitialized: true 37 | - first: 38 | Facebook: Win 39 | second: 40 | enabled: 0 41 | settings: 42 | CPU: None 43 | - first: 44 | Facebook: Win64 45 | second: 46 | enabled: 1 47 | settings: 48 | CPU: AnyCPU 49 | - first: 50 | Standalone: Linux 51 | second: 52 | enabled: 0 53 | settings: 54 | CPU: None 55 | - first: 56 | Standalone: Linux64 57 | second: 58 | enabled: 1 59 | settings: 60 | CPU: x86_64 61 | - first: 62 | Standalone: LinuxUniversal 63 | second: 64 | enabled: 1 65 | settings: 66 | CPU: x86_64 67 | - first: 68 | Standalone: OSXUniversal 69 | second: 70 | enabled: 0 71 | settings: 72 | CPU: x86_64 73 | - first: 74 | Standalone: Win 75 | second: 76 | enabled: 0 77 | settings: 78 | CPU: None 79 | - first: 80 | Standalone: Win64 81 | second: 82 | enabled: 1 83 | settings: 84 | CPU: AnyCPU 85 | userData: 86 | assetBundleName: 87 | assetBundleVariant: 88 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/UnityCapture.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Unity Capture 3 | Copyright (c) 2018 Bernhard Schelling 4 | 5 | Feature contributors: 6 | Brandon J Matthews (low-level interface for custom texture capture) 7 | 8 | Based on UnityCam 9 | https://github.com/mrayy/UnityCam 10 | Copyright (c) 2016 MHD Yamen Saraiji 11 | 12 | This software is provided 'as-is', without any express or implied 13 | warranty. In no event will the authors be held liable for any damages 14 | arising from the use of this software. 15 | 16 | Permission is granted to anyone to use this software for any purpose, 17 | including commercial applications, and to alter it and redistribute it 18 | freely, subject to the following restrictions: 19 | 20 | 1. The origin of this software must not be misrepresented; you must not 21 | claim that you wrote the original software. If you use this software 22 | in a product, an acknowledgment in the product documentation would be 23 | appreciated but is not required. 24 | 2. Altered source versions must be plainly marked as such, and must not be 25 | misrepresented as being the original software. 26 | 3. This notice may not be removed or altered from any source distribution. 27 | */ 28 | 29 | using UnityEngine; 30 | 31 | [RequireComponent(typeof(Camera))] 32 | public class UnityCapture : MonoBehaviour 33 | { 34 | public enum ECaptureDevice { CaptureDevice1 = 0, CaptureDevice2 = 1, CaptureDevice3 = 2, CaptureDevice4 = 3, CaptureDevice5 = 4, CaptureDevice6 = 5, CaptureDevice7 = 6, CaptureDevice8 = 7, CaptureDevice9 = 8, CaptureDevice10 = 9 } 35 | public enum EResizeMode { Disabled = 0, LinearResize = 1 } 36 | public enum EMirrorMode { Disabled = 0, MirrorHorizontally = 1 } 37 | public enum ECaptureSendResult { SUCCESS = 0, WARNING_FRAMESKIP = 1, WARNING_CAPTUREINACTIVE = 2, ERROR_UNSUPPORTEDGRAPHICSDEVICE = 100, ERROR_PARAMETER = 101, ERROR_TOOLARGERESOLUTION = 102, ERROR_TEXTUREFORMAT = 103, ERROR_READTEXTURE = 104, ERROR_INVALIDCAPTUREINSTANCEPTR = 200 }; 38 | 39 | [SerializeField] [Tooltip("Capture device index")] public ECaptureDevice CaptureDevice = ECaptureDevice.CaptureDevice1; 40 | [SerializeField] [Tooltip("Scale image if Unity and capture resolution don't match (can introduce frame dropping, not recommended)")] public EResizeMode ResizeMode = EResizeMode.Disabled; 41 | [SerializeField] [Tooltip("How many milliseconds to wait for a new frame until sending is considered to be stopped")] public int Timeout = 1000; 42 | [SerializeField] [Tooltip("Mirror captured output image")] public EMirrorMode MirrorMode = EMirrorMode.Disabled; 43 | [SerializeField] [Tooltip("Introduce a frame of latency in favor of frame rate")] public bool DoubleBuffering = false; 44 | [SerializeField] [Tooltip("Check to enable VSync during capturing")] public bool EnableVSync = false; 45 | [SerializeField] [Tooltip("Set the desired render target frame rate")] public int TargetFrameRate = 60; 46 | [SerializeField] [Tooltip("Check to disable output of warnings")] public bool HideWarnings = false; 47 | 48 | Interface CaptureInterface; 49 | 50 | void Awake() 51 | { 52 | QualitySettings.vSyncCount = (EnableVSync ? 1 : 0); 53 | Application.targetFrameRate = TargetFrameRate; 54 | 55 | if (Application.runInBackground == false) 56 | { 57 | Debug.LogWarning("Application.runInBackground switched to enabled for capture streaming"); 58 | Application.runInBackground = true; 59 | } 60 | } 61 | 62 | void Start() 63 | { 64 | CaptureInterface = new Interface(CaptureDevice); 65 | } 66 | 67 | void OnDestroy() 68 | { 69 | CaptureInterface.Close(); 70 | } 71 | 72 | void OnRenderImage(RenderTexture source, RenderTexture destination) 73 | { 74 | Graphics.Blit(source, destination); 75 | switch (CaptureInterface.SendTexture(source, Timeout, DoubleBuffering, ResizeMode, MirrorMode)) 76 | { 77 | case ECaptureSendResult.SUCCESS: break; 78 | case ECaptureSendResult.WARNING_FRAMESKIP: if (!HideWarnings) Debug.LogWarning("[UnityCapture] Capture device did skip a frame read, capture frame rate will not match render frame rate."); break; 79 | case ECaptureSendResult.WARNING_CAPTUREINACTIVE: if (!HideWarnings) Debug.LogWarning("[UnityCapture] Capture device is inactive"); break; 80 | case ECaptureSendResult.ERROR_UNSUPPORTEDGRAPHICSDEVICE: Debug.LogError("[UnityCapture] Unsupported graphics device (only D3D11 supported)"); break; 81 | case ECaptureSendResult.ERROR_PARAMETER: Debug.LogError("[UnityCapture] Input parameter error"); break; 82 | case ECaptureSendResult.ERROR_TOOLARGERESOLUTION: Debug.LogError("[UnityCapture] Render resolution is too large to send to capture device"); break; 83 | case ECaptureSendResult.ERROR_TEXTUREFORMAT: Debug.LogError("[UnityCapture] Render texture format is unsupported (only basic non-HDR (ARGB32) and HDR (FP16/ARGB Half) formats are supported)"); break; 84 | case ECaptureSendResult.ERROR_READTEXTURE: Debug.LogError("[UnityCapture] Error while reading texture image data"); break; 85 | case ECaptureSendResult.ERROR_INVALIDCAPTUREINSTANCEPTR: Debug.LogError("[UnityCapture] Invalid Capture Instance Pointer"); break; 86 | } 87 | } 88 | 89 | public class Interface 90 | { 91 | [System.Runtime.InteropServices.DllImport("UnityCapturePlugin")] extern static System.IntPtr CaptureCreateInstance(int CapNum); 92 | [System.Runtime.InteropServices.DllImport("UnityCapturePlugin")] extern static void CaptureDeleteInstance(System.IntPtr instance); 93 | [System.Runtime.InteropServices.DllImport("UnityCapturePlugin")] extern static ECaptureSendResult CaptureSendTexture(System.IntPtr instance, System.IntPtr nativetexture, int Timeout, bool UseDoubleBuffering, EResizeMode ResizeMode, EMirrorMode MirrorMode, bool IsLinearColorSpace); 94 | System.IntPtr CaptureInstance; 95 | 96 | public Interface(ECaptureDevice CaptureDevice) 97 | { 98 | CaptureInstance = CaptureCreateInstance((int)CaptureDevice); 99 | } 100 | 101 | ~Interface() 102 | { 103 | Close(); 104 | } 105 | 106 | public void Close() 107 | { 108 | if (CaptureInstance != System.IntPtr.Zero) CaptureDeleteInstance(CaptureInstance); 109 | CaptureInstance = System.IntPtr.Zero; 110 | } 111 | 112 | public ECaptureSendResult SendTexture(Texture Source, int Timeout = 1000, bool DoubleBuffering = false, EResizeMode ResizeMode = EResizeMode.Disabled, EMirrorMode MirrorMode = EMirrorMode.Disabled) 113 | { 114 | if (CaptureInstance == System.IntPtr.Zero) return ECaptureSendResult.ERROR_INVALIDCAPTUREINSTANCEPTR; 115 | return CaptureSendTexture(CaptureInstance, Source.GetNativeTexturePtr(), Timeout, DoubleBuffering, ResizeMode, MirrorMode, QualitySettings.activeColorSpace == ColorSpace.Linear); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCapture/UnityCapture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f1106d3744ef824496276c8274506b2 3 | timeCreated: 1463481058 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCaptureExample.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 0 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 1024 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 1 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 0 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 0 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &1126630849 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 1126630855} 124 | - component: {fileID: 1126630854} 125 | - component: {fileID: 1126630853} 126 | - component: {fileID: 1126630851} 127 | - component: {fileID: 1126630852} 128 | - component: {fileID: 1126630850} 129 | m_Layer: 0 130 | m_Name: Camera 131 | m_TagString: Untagged 132 | m_Icon: {fileID: 0} 133 | m_NavMeshLayer: 0 134 | m_StaticEditorFlags: 0 135 | m_IsActive: 1 136 | --- !u!114 &1126630850 137 | MonoBehaviour: 138 | m_ObjectHideFlags: 0 139 | m_PrefabParentObject: {fileID: 0} 140 | m_PrefabInternal: {fileID: 0} 141 | m_GameObject: {fileID: 1126630849} 142 | m_Enabled: 1 143 | m_EditorHideFlags: 0 144 | m_Script: {fileID: 11500000, guid: 5f1106d3744ef824496276c8274506b2, type: 3} 145 | m_Name: 146 | m_EditorClassIdentifier: 147 | ResizeMode: 0 148 | MirrorMode: 0 149 | --- !u!81 &1126630851 150 | AudioListener: 151 | m_ObjectHideFlags: 0 152 | m_PrefabParentObject: {fileID: 0} 153 | m_PrefabInternal: {fileID: 0} 154 | m_GameObject: {fileID: 1126630849} 155 | m_Enabled: 1 156 | --- !u!114 &1126630852 157 | MonoBehaviour: 158 | m_ObjectHideFlags: 0 159 | m_PrefabParentObject: {fileID: 0} 160 | m_PrefabInternal: {fileID: 0} 161 | m_GameObject: {fileID: 1126630849} 162 | m_Enabled: 1 163 | m_EditorHideFlags: 0 164 | m_Script: {fileID: 11500000, guid: 70cec3f0490dff14fbf273abb6a3a72d, type: 3} 165 | m_Name: 166 | m_EditorClassIdentifier: 167 | CubeMaterial: {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 168 | EnableSyncBeeps: false 169 | --- !u!124 &1126630853 170 | Behaviour: 171 | m_ObjectHideFlags: 0 172 | m_PrefabParentObject: {fileID: 0} 173 | m_PrefabInternal: {fileID: 0} 174 | m_GameObject: {fileID: 1126630849} 175 | m_Enabled: 1 176 | --- !u!20 &1126630854 177 | Camera: 178 | m_ObjectHideFlags: 0 179 | m_PrefabParentObject: {fileID: 0} 180 | m_PrefabInternal: {fileID: 0} 181 | m_GameObject: {fileID: 1126630849} 182 | m_Enabled: 1 183 | serializedVersion: 2 184 | m_ClearFlags: 2 185 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 186 | m_NormalizedViewPortRect: 187 | serializedVersion: 2 188 | x: 0 189 | y: 0 190 | width: 1 191 | height: 1 192 | near clip plane: 0.3 193 | far clip plane: 1000 194 | field of view: 60 195 | orthographic: 0 196 | orthographic size: 5 197 | m_Depth: 0 198 | m_CullingMask: 199 | serializedVersion: 2 200 | m_Bits: 4294967295 201 | m_RenderingPath: -1 202 | m_TargetTexture: {fileID: 0} 203 | m_TargetDisplay: 0 204 | m_TargetEye: 3 205 | m_HDR: 0 206 | m_AllowMSAA: 1 207 | m_AllowDynamicResolution: 0 208 | m_ForceIntoRT: 0 209 | m_OcclusionCulling: 1 210 | m_StereoConvergence: 10 211 | m_StereoSeparation: 0.022 212 | --- !u!4 &1126630855 213 | Transform: 214 | m_ObjectHideFlags: 0 215 | m_PrefabParentObject: {fileID: 0} 216 | m_PrefabInternal: {fileID: 0} 217 | m_GameObject: {fileID: 1126630849} 218 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 219 | m_LocalPosition: {x: -6.91, y: -2.4, z: 0} 220 | m_LocalScale: {x: 1, y: 1, z: 1} 221 | m_Children: [] 222 | m_Father: {fileID: 0} 223 | m_RootOrder: 1 224 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 225 | --- !u!1 &1251162945 226 | GameObject: 227 | m_ObjectHideFlags: 0 228 | m_PrefabParentObject: {fileID: 0} 229 | m_PrefabInternal: {fileID: 0} 230 | serializedVersion: 5 231 | m_Component: 232 | - component: {fileID: 1251162947} 233 | - component: {fileID: 1251162946} 234 | m_Layer: 0 235 | m_Name: Directional Light 236 | m_TagString: Untagged 237 | m_Icon: {fileID: 0} 238 | m_NavMeshLayer: 0 239 | m_StaticEditorFlags: 0 240 | m_IsActive: 1 241 | --- !u!108 &1251162946 242 | Light: 243 | m_ObjectHideFlags: 0 244 | m_PrefabParentObject: {fileID: 0} 245 | m_PrefabInternal: {fileID: 0} 246 | m_GameObject: {fileID: 1251162945} 247 | m_Enabled: 1 248 | serializedVersion: 8 249 | m_Type: 1 250 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 251 | m_Intensity: 1 252 | m_Range: 10 253 | m_SpotAngle: 30 254 | m_CookieSize: 10 255 | m_Shadows: 256 | m_Type: 2 257 | m_Resolution: -1 258 | m_CustomResolution: -1 259 | m_Strength: 1 260 | m_Bias: 0.05 261 | m_NormalBias: 0.4 262 | m_NearPlane: 0.2 263 | m_Cookie: {fileID: 0} 264 | m_DrawHalo: 0 265 | m_Flare: {fileID: 0} 266 | m_RenderMode: 0 267 | m_CullingMask: 268 | serializedVersion: 2 269 | m_Bits: 4294967295 270 | m_Lightmapping: 4 271 | m_AreaSize: {x: 1, y: 1} 272 | m_BounceIntensity: 1 273 | m_ColorTemperature: 6570 274 | m_UseColorTemperature: 0 275 | m_ShadowRadius: 0 276 | m_ShadowAngle: 0 277 | --- !u!4 &1251162947 278 | Transform: 279 | m_ObjectHideFlags: 0 280 | m_PrefabParentObject: {fileID: 0} 281 | m_PrefabInternal: {fileID: 0} 282 | m_GameObject: {fileID: 1251162945} 283 | m_LocalRotation: {x: 0.40821797, y: -0.23456974, z: 0.10938168, w: 0.8754261} 284 | m_LocalPosition: {x: 0, y: 3, z: 0} 285 | m_LocalScale: {x: 1, y: 1, z: 1} 286 | m_Children: [] 287 | m_Father: {fileID: 0} 288 | m_RootOrder: 0 289 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 290 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCaptureExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91da01314302a514aa3176f8a4ad8536 3 | timeCreated: 1463485542 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCaptureMultiCam.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &592828463 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 592828467} 124 | - component: {fileID: 592828466} 125 | - component: {fileID: 592828465} 126 | - component: {fileID: 592828464} 127 | m_Layer: 0 128 | m_Name: Sphere 129 | m_TagString: Untagged 130 | m_Icon: {fileID: 0} 131 | m_NavMeshLayer: 0 132 | m_StaticEditorFlags: 0 133 | m_IsActive: 1 134 | --- !u!23 &592828464 135 | MeshRenderer: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | m_GameObject: {fileID: 592828463} 140 | m_Enabled: 1 141 | m_CastShadows: 1 142 | m_ReceiveShadows: 1 143 | m_DynamicOccludee: 1 144 | m_MotionVectors: 1 145 | m_LightProbeUsage: 1 146 | m_ReflectionProbeUsage: 1 147 | m_Materials: 148 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 149 | m_StaticBatchInfo: 150 | firstSubMesh: 0 151 | subMeshCount: 0 152 | m_StaticBatchRoot: {fileID: 0} 153 | m_ProbeAnchor: {fileID: 0} 154 | m_LightProbeVolumeOverride: {fileID: 0} 155 | m_ScaleInLightmap: 1 156 | m_PreserveUVs: 1 157 | m_IgnoreNormalsForChartDetection: 0 158 | m_ImportantGI: 0 159 | m_StitchLightmapSeams: 0 160 | m_SelectedEditorRenderState: 3 161 | m_MinimumChartSize: 4 162 | m_AutoUVMaxDistance: 0.5 163 | m_AutoUVMaxAngle: 89 164 | m_LightmapParameters: {fileID: 0} 165 | m_SortingLayerID: 0 166 | m_SortingLayer: 0 167 | m_SortingOrder: 0 168 | --- !u!135 &592828465 169 | SphereCollider: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 592828463} 174 | m_Material: {fileID: 0} 175 | m_IsTrigger: 0 176 | m_Enabled: 1 177 | serializedVersion: 2 178 | m_Radius: 0.5 179 | m_Center: {x: 0, y: 0, z: 0} 180 | --- !u!33 &592828466 181 | MeshFilter: 182 | m_ObjectHideFlags: 0 183 | m_PrefabParentObject: {fileID: 0} 184 | m_PrefabInternal: {fileID: 0} 185 | m_GameObject: {fileID: 592828463} 186 | m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} 187 | --- !u!4 &592828467 188 | Transform: 189 | m_ObjectHideFlags: 0 190 | m_PrefabParentObject: {fileID: 0} 191 | m_PrefabInternal: {fileID: 0} 192 | m_GameObject: {fileID: 592828463} 193 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 194 | m_LocalPosition: {x: 0.6, y: 0, z: 0} 195 | m_LocalScale: {x: 1, y: 1, z: 1} 196 | m_Children: [] 197 | m_Father: {fileID: 0} 198 | m_RootOrder: 6 199 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 200 | --- !u!1 &658370335 201 | GameObject: 202 | m_ObjectHideFlags: 0 203 | m_PrefabParentObject: {fileID: 0} 204 | m_PrefabInternal: {fileID: 0} 205 | serializedVersion: 5 206 | m_Component: 207 | - component: {fileID: 658370339} 208 | - component: {fileID: 658370338} 209 | - component: {fileID: 658370336} 210 | - component: {fileID: 658370337} 211 | m_Layer: 0 212 | m_Name: DisplayCamera 213 | m_TagString: MainCamera 214 | m_Icon: {fileID: 0} 215 | m_NavMeshLayer: 0 216 | m_StaticEditorFlags: 0 217 | m_IsActive: 1 218 | --- !u!81 &658370336 219 | AudioListener: 220 | m_ObjectHideFlags: 0 221 | m_PrefabParentObject: {fileID: 0} 222 | m_PrefabInternal: {fileID: 0} 223 | m_GameObject: {fileID: 658370335} 224 | m_Enabled: 1 225 | --- !u!114 &658370337 226 | MonoBehaviour: 227 | m_ObjectHideFlags: 0 228 | m_PrefabParentObject: {fileID: 0} 229 | m_PrefabInternal: {fileID: 0} 230 | m_GameObject: {fileID: 658370335} 231 | m_Enabled: 1 232 | m_EditorHideFlags: 0 233 | m_Script: {fileID: 11500000, guid: f7196fa938037bb46be5bc12531f7f10, type: 3} 234 | m_Name: 235 | m_EditorClassIdentifier: 236 | CaptureResolutionWidth: 1920 237 | CaptureResolutionHeight: 1080 238 | CaptureCamera1: {fileID: 1989115845} 239 | CaptureCamera2: {fileID: 1198875011} 240 | --- !u!20 &658370338 241 | Camera: 242 | m_ObjectHideFlags: 0 243 | m_PrefabParentObject: {fileID: 0} 244 | m_PrefabInternal: {fileID: 0} 245 | m_GameObject: {fileID: 658370335} 246 | m_Enabled: 1 247 | serializedVersion: 2 248 | m_ClearFlags: 1 249 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 250 | m_NormalizedViewPortRect: 251 | serializedVersion: 2 252 | x: 0 253 | y: 0 254 | width: 1 255 | height: 1 256 | near clip plane: 0.3 257 | far clip plane: 1000 258 | field of view: 60 259 | orthographic: 0 260 | orthographic size: 5 261 | m_Depth: 0 262 | m_CullingMask: 263 | serializedVersion: 2 264 | m_Bits: 4294967295 265 | m_RenderingPath: -1 266 | m_TargetTexture: {fileID: 0} 267 | m_TargetDisplay: 0 268 | m_TargetEye: 3 269 | m_HDR: 1 270 | m_AllowMSAA: 1 271 | m_AllowDynamicResolution: 0 272 | m_ForceIntoRT: 0 273 | m_OcclusionCulling: 1 274 | m_StereoConvergence: 10 275 | m_StereoSeparation: 0.022 276 | --- !u!4 &658370339 277 | Transform: 278 | m_ObjectHideFlags: 0 279 | m_PrefabParentObject: {fileID: 0} 280 | m_PrefabInternal: {fileID: 0} 281 | m_GameObject: {fileID: 658370335} 282 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 283 | m_LocalPosition: {x: 0, y: 0, z: 0} 284 | m_LocalScale: {x: 1, y: 1, z: 1} 285 | m_Children: [] 286 | m_Father: {fileID: 0} 287 | m_RootOrder: 1 288 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 289 | --- !u!1 &1095384612 290 | GameObject: 291 | m_ObjectHideFlags: 0 292 | m_PrefabParentObject: {fileID: 0} 293 | m_PrefabInternal: {fileID: 0} 294 | serializedVersion: 5 295 | m_Component: 296 | - component: {fileID: 1095384614} 297 | - component: {fileID: 1095384613} 298 | m_Layer: 0 299 | m_Name: Directional Light 300 | m_TagString: Untagged 301 | m_Icon: {fileID: 0} 302 | m_NavMeshLayer: 0 303 | m_StaticEditorFlags: 0 304 | m_IsActive: 1 305 | --- !u!108 &1095384613 306 | Light: 307 | m_ObjectHideFlags: 0 308 | m_PrefabParentObject: {fileID: 0} 309 | m_PrefabInternal: {fileID: 0} 310 | m_GameObject: {fileID: 1095384612} 311 | m_Enabled: 1 312 | serializedVersion: 8 313 | m_Type: 1 314 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 315 | m_Intensity: 1 316 | m_Range: 10 317 | m_SpotAngle: 30 318 | m_CookieSize: 10 319 | m_Shadows: 320 | m_Type: 2 321 | m_Resolution: -1 322 | m_CustomResolution: -1 323 | m_Strength: 1 324 | m_Bias: 0.05 325 | m_NormalBias: 0.4 326 | m_NearPlane: 0.2 327 | m_Cookie: {fileID: 0} 328 | m_DrawHalo: 0 329 | m_Flare: {fileID: 0} 330 | m_RenderMode: 0 331 | m_CullingMask: 332 | serializedVersion: 2 333 | m_Bits: 4294967295 334 | m_Lightmapping: 4 335 | m_AreaSize: {x: 1, y: 1} 336 | m_BounceIntensity: 1 337 | m_ColorTemperature: 6570 338 | m_UseColorTemperature: 0 339 | m_ShadowRadius: 0 340 | m_ShadowAngle: 0 341 | --- !u!4 &1095384614 342 | Transform: 343 | m_ObjectHideFlags: 0 344 | m_PrefabParentObject: {fileID: 0} 345 | m_PrefabInternal: {fileID: 0} 346 | m_GameObject: {fileID: 1095384612} 347 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 348 | m_LocalPosition: {x: 0, y: 3, z: 0} 349 | m_LocalScale: {x: 1, y: 1, z: 1} 350 | m_Children: [] 351 | m_Father: {fileID: 0} 352 | m_RootOrder: 0 353 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 354 | --- !u!1 &1198875009 355 | GameObject: 356 | m_ObjectHideFlags: 0 357 | m_PrefabParentObject: {fileID: 0} 358 | m_PrefabInternal: {fileID: 0} 359 | serializedVersion: 5 360 | m_Component: 361 | - component: {fileID: 1198875012} 362 | - component: {fileID: 1198875011} 363 | - component: {fileID: 1198875010} 364 | m_Layer: 0 365 | m_Name: CaptureCamera2 366 | m_TagString: Untagged 367 | m_Icon: {fileID: 0} 368 | m_NavMeshLayer: 0 369 | m_StaticEditorFlags: 0 370 | m_IsActive: 1 371 | --- !u!114 &1198875010 372 | MonoBehaviour: 373 | m_ObjectHideFlags: 0 374 | m_PrefabParentObject: {fileID: 0} 375 | m_PrefabInternal: {fileID: 0} 376 | m_GameObject: {fileID: 1198875009} 377 | m_Enabled: 1 378 | m_EditorHideFlags: 0 379 | m_Script: {fileID: 11500000, guid: 5f1106d3744ef824496276c8274506b2, type: 3} 380 | m_Name: 381 | m_EditorClassIdentifier: 382 | CaptureDevice: 1 383 | ResizeMode: 0 384 | MirrorMode: 0 385 | DoubleBuffering: 0 386 | EnableVSync: 0 387 | TargetFrameRate: 60 388 | HideWarnings: 0 389 | --- !u!20 &1198875011 390 | Camera: 391 | m_ObjectHideFlags: 0 392 | m_PrefabParentObject: {fileID: 0} 393 | m_PrefabInternal: {fileID: 0} 394 | m_GameObject: {fileID: 1198875009} 395 | m_Enabled: 1 396 | serializedVersion: 2 397 | m_ClearFlags: 1 398 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 399 | m_NormalizedViewPortRect: 400 | serializedVersion: 2 401 | x: 0 402 | y: 0 403 | width: 1 404 | height: 1 405 | near clip plane: 0.3 406 | far clip plane: 1000 407 | field of view: 15 408 | orthographic: 0 409 | orthographic size: 5 410 | m_Depth: 0 411 | m_CullingMask: 412 | serializedVersion: 2 413 | m_Bits: 4294967295 414 | m_RenderingPath: -1 415 | m_TargetTexture: {fileID: 0} 416 | m_TargetDisplay: 0 417 | m_TargetEye: 3 418 | m_HDR: 1 419 | m_AllowMSAA: 1 420 | m_AllowDynamicResolution: 0 421 | m_ForceIntoRT: 0 422 | m_OcclusionCulling: 1 423 | m_StereoConvergence: 10 424 | m_StereoSeparation: 0.022 425 | --- !u!4 &1198875012 426 | Transform: 427 | m_ObjectHideFlags: 0 428 | m_PrefabParentObject: {fileID: 0} 429 | m_PrefabInternal: {fileID: 0} 430 | m_GameObject: {fileID: 1198875009} 431 | m_LocalRotation: {x: 0.3050128, y: -0.26139337, z: 0.087460995, w: 0.91158724} 432 | m_LocalPosition: {x: 4.5, y: 7, z: -7} 433 | m_LocalScale: {x: 1, y: 1, z: 1} 434 | m_Children: [] 435 | m_Father: {fileID: 0} 436 | m_RootOrder: 3 437 | m_LocalEulerAnglesHint: {x: 37, y: -32, z: 0} 438 | --- !u!1 &1785607102 439 | GameObject: 440 | m_ObjectHideFlags: 0 441 | m_PrefabParentObject: {fileID: 0} 442 | m_PrefabInternal: {fileID: 0} 443 | serializedVersion: 5 444 | m_Component: 445 | - component: {fileID: 1785607106} 446 | - component: {fileID: 1785607105} 447 | - component: {fileID: 1785607104} 448 | - component: {fileID: 1785607103} 449 | m_Layer: 0 450 | m_Name: Cylinder 451 | m_TagString: Untagged 452 | m_Icon: {fileID: 0} 453 | m_NavMeshLayer: 0 454 | m_StaticEditorFlags: 0 455 | m_IsActive: 1 456 | --- !u!23 &1785607103 457 | MeshRenderer: 458 | m_ObjectHideFlags: 0 459 | m_PrefabParentObject: {fileID: 0} 460 | m_PrefabInternal: {fileID: 0} 461 | m_GameObject: {fileID: 1785607102} 462 | m_Enabled: 1 463 | m_CastShadows: 1 464 | m_ReceiveShadows: 1 465 | m_DynamicOccludee: 1 466 | m_MotionVectors: 1 467 | m_LightProbeUsage: 1 468 | m_ReflectionProbeUsage: 1 469 | m_Materials: 470 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 471 | m_StaticBatchInfo: 472 | firstSubMesh: 0 473 | subMeshCount: 0 474 | m_StaticBatchRoot: {fileID: 0} 475 | m_ProbeAnchor: {fileID: 0} 476 | m_LightProbeVolumeOverride: {fileID: 0} 477 | m_ScaleInLightmap: 1 478 | m_PreserveUVs: 1 479 | m_IgnoreNormalsForChartDetection: 0 480 | m_ImportantGI: 0 481 | m_StitchLightmapSeams: 0 482 | m_SelectedEditorRenderState: 3 483 | m_MinimumChartSize: 4 484 | m_AutoUVMaxDistance: 0.5 485 | m_AutoUVMaxAngle: 89 486 | m_LightmapParameters: {fileID: 0} 487 | m_SortingLayerID: 0 488 | m_SortingLayer: 0 489 | m_SortingOrder: 0 490 | --- !u!136 &1785607104 491 | CapsuleCollider: 492 | m_ObjectHideFlags: 0 493 | m_PrefabParentObject: {fileID: 0} 494 | m_PrefabInternal: {fileID: 0} 495 | m_GameObject: {fileID: 1785607102} 496 | m_Material: {fileID: 0} 497 | m_IsTrigger: 0 498 | m_Enabled: 1 499 | m_Radius: 0.5 500 | m_Height: 2 501 | m_Direction: 1 502 | m_Center: {x: 0, y: 0, z: 0} 503 | --- !u!33 &1785607105 504 | MeshFilter: 505 | m_ObjectHideFlags: 0 506 | m_PrefabParentObject: {fileID: 0} 507 | m_PrefabInternal: {fileID: 0} 508 | m_GameObject: {fileID: 1785607102} 509 | m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} 510 | --- !u!4 &1785607106 511 | Transform: 512 | m_ObjectHideFlags: 0 513 | m_PrefabParentObject: {fileID: 0} 514 | m_PrefabInternal: {fileID: 0} 515 | m_GameObject: {fileID: 1785607102} 516 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 517 | m_LocalPosition: {x: 0.01999998, y: 0, z: 1.7} 518 | m_LocalScale: {x: 1, y: 1, z: 1} 519 | m_Children: [] 520 | m_Father: {fileID: 0} 521 | m_RootOrder: 5 522 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 523 | --- !u!1 &1989115843 524 | GameObject: 525 | m_ObjectHideFlags: 0 526 | m_PrefabParentObject: {fileID: 0} 527 | m_PrefabInternal: {fileID: 0} 528 | serializedVersion: 5 529 | m_Component: 530 | - component: {fileID: 1989115846} 531 | - component: {fileID: 1989115845} 532 | - component: {fileID: 1989115844} 533 | m_Layer: 0 534 | m_Name: CaptureCamera1 535 | m_TagString: Untagged 536 | m_Icon: {fileID: 0} 537 | m_NavMeshLayer: 0 538 | m_StaticEditorFlags: 0 539 | m_IsActive: 1 540 | --- !u!114 &1989115844 541 | MonoBehaviour: 542 | m_ObjectHideFlags: 0 543 | m_PrefabParentObject: {fileID: 0} 544 | m_PrefabInternal: {fileID: 0} 545 | m_GameObject: {fileID: 1989115843} 546 | m_Enabled: 1 547 | m_EditorHideFlags: 0 548 | m_Script: {fileID: 11500000, guid: 5f1106d3744ef824496276c8274506b2, type: 3} 549 | m_Name: 550 | m_EditorClassIdentifier: 551 | CaptureDevice: 0 552 | ResizeMode: 0 553 | MirrorMode: 0 554 | DoubleBuffering: 0 555 | EnableVSync: 0 556 | TargetFrameRate: 60 557 | HideWarnings: 0 558 | --- !u!20 &1989115845 559 | Camera: 560 | m_ObjectHideFlags: 0 561 | m_PrefabParentObject: {fileID: 0} 562 | m_PrefabInternal: {fileID: 0} 563 | m_GameObject: {fileID: 1989115843} 564 | m_Enabled: 1 565 | serializedVersion: 2 566 | m_ClearFlags: 1 567 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 568 | m_NormalizedViewPortRect: 569 | serializedVersion: 2 570 | x: 0 571 | y: 0 572 | width: 1 573 | height: 1 574 | near clip plane: 0.3 575 | far clip plane: 1000 576 | field of view: 60 577 | orthographic: 0 578 | orthographic size: 5 579 | m_Depth: 0 580 | m_CullingMask: 581 | serializedVersion: 2 582 | m_Bits: 4294967295 583 | m_RenderingPath: -1 584 | m_TargetTexture: {fileID: 0} 585 | m_TargetDisplay: 0 586 | m_TargetEye: 3 587 | m_HDR: 1 588 | m_AllowMSAA: 1 589 | m_AllowDynamicResolution: 0 590 | m_ForceIntoRT: 0 591 | m_OcclusionCulling: 1 592 | m_StereoConvergence: 10 593 | m_StereoSeparation: 0.022 594 | --- !u!4 &1989115846 595 | Transform: 596 | m_ObjectHideFlags: 0 597 | m_PrefabParentObject: {fileID: 0} 598 | m_PrefabInternal: {fileID: 0} 599 | m_GameObject: {fileID: 1989115843} 600 | m_LocalRotation: {x: 0.12378104, y: 0.31459007, z: -0.041416556, w: 0.94021064} 601 | m_LocalPosition: {x: -2.6, y: 1, z: -3} 602 | m_LocalScale: {x: 1, y: 1, z: 1} 603 | m_Children: [] 604 | m_Father: {fileID: 0} 605 | m_RootOrder: 2 606 | m_LocalEulerAnglesHint: {x: 15, y: 37, z: 0} 607 | --- !u!1 &2109363506 608 | GameObject: 609 | m_ObjectHideFlags: 0 610 | m_PrefabParentObject: {fileID: 0} 611 | m_PrefabInternal: {fileID: 0} 612 | serializedVersion: 5 613 | m_Component: 614 | - component: {fileID: 2109363510} 615 | - component: {fileID: 2109363509} 616 | - component: {fileID: 2109363508} 617 | - component: {fileID: 2109363507} 618 | m_Layer: 0 619 | m_Name: Cube 620 | m_TagString: Untagged 621 | m_Icon: {fileID: 0} 622 | m_NavMeshLayer: 0 623 | m_StaticEditorFlags: 0 624 | m_IsActive: 1 625 | --- !u!23 &2109363507 626 | MeshRenderer: 627 | m_ObjectHideFlags: 0 628 | m_PrefabParentObject: {fileID: 0} 629 | m_PrefabInternal: {fileID: 0} 630 | m_GameObject: {fileID: 2109363506} 631 | m_Enabled: 1 632 | m_CastShadows: 1 633 | m_ReceiveShadows: 1 634 | m_DynamicOccludee: 1 635 | m_MotionVectors: 1 636 | m_LightProbeUsage: 1 637 | m_ReflectionProbeUsage: 1 638 | m_Materials: 639 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 640 | m_StaticBatchInfo: 641 | firstSubMesh: 0 642 | subMeshCount: 0 643 | m_StaticBatchRoot: {fileID: 0} 644 | m_ProbeAnchor: {fileID: 0} 645 | m_LightProbeVolumeOverride: {fileID: 0} 646 | m_ScaleInLightmap: 1 647 | m_PreserveUVs: 1 648 | m_IgnoreNormalsForChartDetection: 0 649 | m_ImportantGI: 0 650 | m_StitchLightmapSeams: 0 651 | m_SelectedEditorRenderState: 3 652 | m_MinimumChartSize: 4 653 | m_AutoUVMaxDistance: 0.5 654 | m_AutoUVMaxAngle: 89 655 | m_LightmapParameters: {fileID: 0} 656 | m_SortingLayerID: 0 657 | m_SortingLayer: 0 658 | m_SortingOrder: 0 659 | --- !u!65 &2109363508 660 | BoxCollider: 661 | m_ObjectHideFlags: 0 662 | m_PrefabParentObject: {fileID: 0} 663 | m_PrefabInternal: {fileID: 0} 664 | m_GameObject: {fileID: 2109363506} 665 | m_Material: {fileID: 0} 666 | m_IsTrigger: 0 667 | m_Enabled: 1 668 | serializedVersion: 2 669 | m_Size: {x: 1, y: 1, z: 1} 670 | m_Center: {x: 0, y: 0, z: 0} 671 | --- !u!33 &2109363509 672 | MeshFilter: 673 | m_ObjectHideFlags: 0 674 | m_PrefabParentObject: {fileID: 0} 675 | m_PrefabInternal: {fileID: 0} 676 | m_GameObject: {fileID: 2109363506} 677 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 678 | --- !u!4 &2109363510 679 | Transform: 680 | m_ObjectHideFlags: 0 681 | m_PrefabParentObject: {fileID: 0} 682 | m_PrefabInternal: {fileID: 0} 683 | m_GameObject: {fileID: 2109363506} 684 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 685 | m_LocalPosition: {x: -0.6, y: 0, z: 0} 686 | m_LocalScale: {x: 1, y: 1, z: 1} 687 | m_Children: [] 688 | m_Father: {fileID: 0} 689 | m_RootOrder: 4 690 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 691 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCaptureMultiCam.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11a64de95dd5931409a8adddd311a26d 3 | timeCreated: 1530682853 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCaptureTextureExample.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 0 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 1024 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 1 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 0 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 0 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &922515556 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 922515559} 124 | - component: {fileID: 922515557} 125 | m_Layer: 0 126 | m_Name: Capturer 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!114 &922515557 133 | MonoBehaviour: 134 | m_ObjectHideFlags: 0 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 922515556} 138 | m_Enabled: 1 139 | m_EditorHideFlags: 0 140 | m_Script: {fileID: 11500000, guid: c8e68187542b37846b4a604d28bd90e1, type: 3} 141 | m_Name: 142 | m_EditorClassIdentifier: 143 | width: 320 144 | height: 240 145 | outputRenderer: {fileID: 1893059143} 146 | --- !u!4 &922515559 147 | Transform: 148 | m_ObjectHideFlags: 0 149 | m_PrefabParentObject: {fileID: 0} 150 | m_PrefabInternal: {fileID: 0} 151 | m_GameObject: {fileID: 922515556} 152 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 153 | m_LocalPosition: {x: -6.91, y: -2.4, z: 0} 154 | m_LocalScale: {x: 1, y: 1, z: 1} 155 | m_Children: [] 156 | m_Father: {fileID: 0} 157 | m_RootOrder: 2 158 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 159 | --- !u!1 &1251162945 160 | GameObject: 161 | m_ObjectHideFlags: 0 162 | m_PrefabParentObject: {fileID: 0} 163 | m_PrefabInternal: {fileID: 0} 164 | serializedVersion: 5 165 | m_Component: 166 | - component: {fileID: 1251162947} 167 | - component: {fileID: 1251162946} 168 | m_Layer: 0 169 | m_Name: Directional Light 170 | m_TagString: Untagged 171 | m_Icon: {fileID: 0} 172 | m_NavMeshLayer: 0 173 | m_StaticEditorFlags: 0 174 | m_IsActive: 1 175 | --- !u!108 &1251162946 176 | Light: 177 | m_ObjectHideFlags: 0 178 | m_PrefabParentObject: {fileID: 0} 179 | m_PrefabInternal: {fileID: 0} 180 | m_GameObject: {fileID: 1251162945} 181 | m_Enabled: 1 182 | serializedVersion: 8 183 | m_Type: 1 184 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 185 | m_Intensity: 1 186 | m_Range: 10 187 | m_SpotAngle: 30 188 | m_CookieSize: 10 189 | m_Shadows: 190 | m_Type: 2 191 | m_Resolution: -1 192 | m_CustomResolution: -1 193 | m_Strength: 1 194 | m_Bias: 0.05 195 | m_NormalBias: 0.4 196 | m_NearPlane: 0.2 197 | m_Cookie: {fileID: 0} 198 | m_DrawHalo: 0 199 | m_Flare: {fileID: 0} 200 | m_RenderMode: 0 201 | m_CullingMask: 202 | serializedVersion: 2 203 | m_Bits: 4294967295 204 | m_Lightmapping: 4 205 | m_AreaSize: {x: 1, y: 1} 206 | m_BounceIntensity: 1 207 | m_ColorTemperature: 6570 208 | m_UseColorTemperature: 0 209 | m_ShadowRadius: 0 210 | m_ShadowAngle: 0 211 | --- !u!4 &1251162947 212 | Transform: 213 | m_ObjectHideFlags: 0 214 | m_PrefabParentObject: {fileID: 0} 215 | m_PrefabInternal: {fileID: 0} 216 | m_GameObject: {fileID: 1251162945} 217 | m_LocalRotation: {x: 0.40821797, y: -0.23456974, z: 0.10938168, w: 0.8754261} 218 | m_LocalPosition: {x: 0, y: 3, z: 0} 219 | m_LocalScale: {x: 1, y: 1, z: 1} 220 | m_Children: [] 221 | m_Father: {fileID: 0} 222 | m_RootOrder: 0 223 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 224 | --- !u!1 &1776439397 225 | GameObject: 226 | m_ObjectHideFlags: 0 227 | m_PrefabParentObject: {fileID: 0} 228 | m_PrefabInternal: {fileID: 0} 229 | serializedVersion: 5 230 | m_Component: 231 | - component: {fileID: 1776439401} 232 | - component: {fileID: 1776439400} 233 | - component: {fileID: 1776439399} 234 | - component: {fileID: 1776439398} 235 | m_Layer: 0 236 | m_Name: Camera 237 | m_TagString: Untagged 238 | m_Icon: {fileID: 0} 239 | m_NavMeshLayer: 0 240 | m_StaticEditorFlags: 0 241 | m_IsActive: 1 242 | --- !u!81 &1776439398 243 | AudioListener: 244 | m_ObjectHideFlags: 0 245 | m_PrefabParentObject: {fileID: 0} 246 | m_PrefabInternal: {fileID: 0} 247 | m_GameObject: {fileID: 1776439397} 248 | m_Enabled: 1 249 | --- !u!124 &1776439399 250 | Behaviour: 251 | m_ObjectHideFlags: 0 252 | m_PrefabParentObject: {fileID: 0} 253 | m_PrefabInternal: {fileID: 0} 254 | m_GameObject: {fileID: 1776439397} 255 | m_Enabled: 1 256 | --- !u!20 &1776439400 257 | Camera: 258 | m_ObjectHideFlags: 0 259 | m_PrefabParentObject: {fileID: 0} 260 | m_PrefabInternal: {fileID: 0} 261 | m_GameObject: {fileID: 1776439397} 262 | m_Enabled: 1 263 | serializedVersion: 2 264 | m_ClearFlags: 1 265 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 266 | m_NormalizedViewPortRect: 267 | serializedVersion: 2 268 | x: 0 269 | y: 0 270 | width: 1 271 | height: 1 272 | near clip plane: 0.3 273 | far clip plane: 1000 274 | field of view: 60 275 | orthographic: 0 276 | orthographic size: 5 277 | m_Depth: 0 278 | m_CullingMask: 279 | serializedVersion: 2 280 | m_Bits: 4294967295 281 | m_RenderingPath: -1 282 | m_TargetTexture: {fileID: 0} 283 | m_TargetDisplay: 0 284 | m_TargetEye: 3 285 | m_HDR: 1 286 | m_AllowMSAA: 1 287 | m_AllowDynamicResolution: 0 288 | m_ForceIntoRT: 0 289 | m_OcclusionCulling: 1 290 | m_StereoConvergence: 10 291 | m_StereoSeparation: 0.022 292 | --- !u!4 &1776439401 293 | Transform: 294 | m_ObjectHideFlags: 0 295 | m_PrefabParentObject: {fileID: 0} 296 | m_PrefabInternal: {fileID: 0} 297 | m_GameObject: {fileID: 1776439397} 298 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 299 | m_LocalPosition: {x: -6.91, y: -2.4, z: 0} 300 | m_LocalScale: {x: 1, y: 1, z: 1} 301 | m_Children: [] 302 | m_Father: {fileID: 0} 303 | m_RootOrder: 1 304 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 305 | --- !u!1 &1893059142 306 | GameObject: 307 | m_ObjectHideFlags: 0 308 | m_PrefabParentObject: {fileID: 0} 309 | m_PrefabInternal: {fileID: 0} 310 | serializedVersion: 5 311 | m_Component: 312 | - component: {fileID: 1893059146} 313 | - component: {fileID: 1893059145} 314 | - component: {fileID: 1893059144} 315 | - component: {fileID: 1893059143} 316 | m_Layer: 0 317 | m_Name: Quad 318 | m_TagString: Untagged 319 | m_Icon: {fileID: 0} 320 | m_NavMeshLayer: 0 321 | m_StaticEditorFlags: 0 322 | m_IsActive: 1 323 | --- !u!23 &1893059143 324 | MeshRenderer: 325 | m_ObjectHideFlags: 0 326 | m_PrefabParentObject: {fileID: 0} 327 | m_PrefabInternal: {fileID: 0} 328 | m_GameObject: {fileID: 1893059142} 329 | m_Enabled: 1 330 | m_CastShadows: 1 331 | m_ReceiveShadows: 1 332 | m_DynamicOccludee: 1 333 | m_MotionVectors: 1 334 | m_LightProbeUsage: 1 335 | m_ReflectionProbeUsage: 1 336 | m_Materials: 337 | - {fileID: 2100000, guid: 07c56e3f5854b144bb9eca95eacc0425, type: 2} 338 | m_StaticBatchInfo: 339 | firstSubMesh: 0 340 | subMeshCount: 0 341 | m_StaticBatchRoot: {fileID: 0} 342 | m_ProbeAnchor: {fileID: 0} 343 | m_LightProbeVolumeOverride: {fileID: 0} 344 | m_ScaleInLightmap: 1 345 | m_PreserveUVs: 1 346 | m_IgnoreNormalsForChartDetection: 0 347 | m_ImportantGI: 0 348 | m_StitchLightmapSeams: 0 349 | m_SelectedEditorRenderState: 3 350 | m_MinimumChartSize: 4 351 | m_AutoUVMaxDistance: 0.5 352 | m_AutoUVMaxAngle: 89 353 | m_LightmapParameters: {fileID: 0} 354 | m_SortingLayerID: 0 355 | m_SortingLayer: 0 356 | m_SortingOrder: 0 357 | --- !u!64 &1893059144 358 | MeshCollider: 359 | m_ObjectHideFlags: 0 360 | m_PrefabParentObject: {fileID: 0} 361 | m_PrefabInternal: {fileID: 0} 362 | m_GameObject: {fileID: 1893059142} 363 | m_Material: {fileID: 0} 364 | m_IsTrigger: 0 365 | m_Enabled: 1 366 | serializedVersion: 3 367 | m_Convex: 0 368 | m_CookingOptions: 14 369 | m_SkinWidth: 0.01 370 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} 371 | --- !u!33 &1893059145 372 | MeshFilter: 373 | m_ObjectHideFlags: 0 374 | m_PrefabParentObject: {fileID: 0} 375 | m_PrefabInternal: {fileID: 0} 376 | m_GameObject: {fileID: 1893059142} 377 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} 378 | --- !u!4 &1893059146 379 | Transform: 380 | m_ObjectHideFlags: 0 381 | m_PrefabParentObject: {fileID: 0} 382 | m_PrefabInternal: {fileID: 0} 383 | m_GameObject: {fileID: 1893059142} 384 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 385 | m_LocalPosition: {x: -6.91, y: -2.4, z: 1.41} 386 | m_LocalScale: {x: 1, y: 1, z: 1} 387 | m_Children: [] 388 | m_Father: {fileID: 0} 389 | m_RootOrder: 3 390 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 391 | -------------------------------------------------------------------------------- /UnityCaptureSample/Assets/UnityCaptureTextureExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e5521c3918e4e94e896eb15f27dcde5 3 | timeCreated: 1536023064 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/UnityCam/Example/CubesScene.unity 10 | guid: 91da01314302a514aa3176f8a4ad8536 11 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 14 7 | productGUID: 25ebdaf9f91a03340a849d4e2b2c5542 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | defaultScreenOrientation: 4 11 | targetDevice: 2 12 | useOnDemandResources: 0 13 | accelerometerFrequency: 60 14 | companyName: DefaultCompany 15 | productName: UnityCaptureSample 16 | defaultCursor: {fileID: 0} 17 | cursorHotspot: {x: 0, y: 0} 18 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 19 | m_ShowUnitySplashScreen: 1 20 | m_ShowUnitySplashLogo: 1 21 | m_SplashScreenOverlayOpacity: 1 22 | m_SplashScreenAnimation: 1 23 | m_SplashScreenLogoStyle: 1 24 | m_SplashScreenDrawMode: 0 25 | m_SplashScreenBackgroundAnimationZoom: 1 26 | m_SplashScreenLogoAnimationZoom: 1 27 | m_SplashScreenBackgroundLandscapeAspect: 1 28 | m_SplashScreenBackgroundPortraitAspect: 1 29 | m_SplashScreenBackgroundLandscapeUvs: 30 | serializedVersion: 2 31 | x: 0 32 | y: 0 33 | width: 1 34 | height: 1 35 | m_SplashScreenBackgroundPortraitUvs: 36 | serializedVersion: 2 37 | x: 0 38 | y: 0 39 | width: 1 40 | height: 1 41 | m_SplashScreenLogos: [] 42 | m_VirtualRealitySplashScreen: {fileID: 0} 43 | m_HolographicTrackingLossScreen: {fileID: 0} 44 | defaultScreenWidth: 1024 45 | defaultScreenHeight: 768 46 | defaultScreenWidthWeb: 960 47 | defaultScreenHeightWeb: 600 48 | m_StereoRenderingPath: 0 49 | m_ActiveColorSpace: 0 50 | m_MTRendering: 1 51 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 52 | iosShowActivityIndicatorOnLoading: -1 53 | androidShowActivityIndicatorOnLoading: -1 54 | tizenShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidBlitType: 0 67 | defaultIsFullScreen: 1 68 | defaultIsNativeResolution: 1 69 | macRetinaSupport: 1 70 | runInBackground: 1 71 | captureSingleScreen: 0 72 | muteOtherAudioSources: 0 73 | Prepare IOS For Recording: 0 74 | Force IOS Speakers When Recording: 0 75 | deferSystemGesturesMode: 0 76 | hideHomeButton: 0 77 | submitAnalytics: 1 78 | usePlayerLog: 1 79 | bakeCollisionMeshes: 0 80 | forceSingleInstance: 0 81 | resizableWindow: 0 82 | useMacAppStoreValidation: 0 83 | macAppStoreCategory: public.app-category.games 84 | gpuSkinning: 0 85 | graphicsJobs: 0 86 | xboxPIXTextureCapture: 0 87 | xboxEnableAvatar: 0 88 | xboxEnableKinect: 0 89 | xboxEnableKinectAutoTracking: 0 90 | xboxEnableFitness: 0 91 | visibleInBackground: 1 92 | allowFullscreenSwitch: 1 93 | graphicsJobMode: 0 94 | macFullscreenMode: 2 95 | d3d11FullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | n3dsDisableStereoscopicView: 0 102 | n3dsEnableSharedListOpt: 1 103 | n3dsEnableVSync: 0 104 | xboxOneResolution: 0 105 | xboxOneSResolution: 0 106 | xboxOneXResolution: 3 107 | xboxOneMonoLoggingLevel: 0 108 | xboxOneLoggingLevel: 1 109 | xboxOneDisableEsram: 0 110 | xboxOnePresentImmediateThreshold: 0 111 | videoMemoryForVertexBuffers: 0 112 | psp2PowerMode: 0 113 | psp2AcquireBGM: 1 114 | wiiUTVResolution: 0 115 | wiiUGamePadMSAA: 1 116 | wiiUSupportsNunchuk: 0 117 | wiiUSupportsClassicController: 0 118 | wiiUSupportsBalanceBoard: 0 119 | wiiUSupportsMotionPlus: 0 120 | wiiUSupportsProController: 0 121 | wiiUAllowScreenCapture: 1 122 | wiiUControllerCount: 0 123 | m_SupportedAspectRatios: 124 | 4:3: 1 125 | 5:4: 1 126 | 16:10: 1 127 | 16:9: 1 128 | Others: 1 129 | bundleVersion: 1.0 130 | preloadedAssets: [] 131 | metroInputSource: 0 132 | wsaTransparentSwapchain: 0 133 | m_HolographicPauseOnTrackingLoss: 1 134 | xboxOneDisableKinectGpuReservation: 0 135 | xboxOneEnable7thCore: 0 136 | vrSettings: 137 | cardboard: 138 | depthFormat: 0 139 | enableTransitionView: 0 140 | daydream: 141 | depthFormat: 0 142 | useSustainedPerformanceMode: 0 143 | enableVideoLayer: 0 144 | useProtectedVideoMemory: 0 145 | minimumSupportedHeadTracking: 0 146 | maximumSupportedHeadTracking: 1 147 | hololens: 148 | depthFormat: 1 149 | depthBufferSharingEnabled: 0 150 | oculus: 151 | sharedDepthBuffer: 0 152 | dashSupport: 0 153 | protectGraphicsMemory: 0 154 | useHDRDisplay: 0 155 | m_ColorGamuts: 00000000 156 | targetPixelDensity: 30 157 | resolutionScalingMode: 0 158 | androidSupportedAspectRatio: 1 159 | androidMaxAspectRatio: 2.1 160 | applicationIdentifier: {} 161 | buildNumber: {} 162 | AndroidBundleVersionCode: 1 163 | AndroidMinSdkVersion: 16 164 | AndroidTargetSdkVersion: 0 165 | AndroidPreferredInstallLocation: 1 166 | aotOptions: 167 | stripEngineCode: 1 168 | iPhoneStrippingLevel: 0 169 | iPhoneScriptCallOptimization: 0 170 | ForceInternetPermission: 0 171 | ForceSDCardPermission: 0 172 | CreateWallpaper: 0 173 | APKExpansionFiles: 0 174 | keepLoadedShadersAlive: 0 175 | StripUnusedMeshComponents: 0 176 | VertexChannelCompressionMask: 177 | serializedVersion: 2 178 | m_Bits: 238 179 | iPhoneSdkVersion: 988 180 | iOSTargetOSVersionString: 7.0 181 | tvOSSdkVersion: 0 182 | tvOSRequireExtendedGameController: 0 183 | tvOSTargetOSVersionString: 9.0 184 | uIPrerenderedIcon: 0 185 | uIRequiresPersistentWiFi: 0 186 | uIRequiresFullScreen: 1 187 | uIStatusBarHidden: 1 188 | uIExitOnSuspend: 0 189 | uIStatusBarStyle: 0 190 | iPhoneSplashScreen: {fileID: 0} 191 | iPhoneHighResSplashScreen: {fileID: 0} 192 | iPhoneTallHighResSplashScreen: {fileID: 0} 193 | iPhone47inSplashScreen: {fileID: 0} 194 | iPhone55inPortraitSplashScreen: {fileID: 0} 195 | iPhone55inLandscapeSplashScreen: {fileID: 0} 196 | iPhone58inPortraitSplashScreen: {fileID: 0} 197 | iPhone58inLandscapeSplashScreen: {fileID: 0} 198 | iPadPortraitSplashScreen: {fileID: 0} 199 | iPadHighResPortraitSplashScreen: {fileID: 0} 200 | iPadLandscapeSplashScreen: {fileID: 0} 201 | iPadHighResLandscapeSplashScreen: {fileID: 0} 202 | appleTVSplashScreen: {fileID: 0} 203 | appleTVSplashScreen2x: {fileID: 0} 204 | tvOSSmallIconLayers: [] 205 | tvOSSmallIconLayers2x: [] 206 | tvOSLargeIconLayers: [] 207 | tvOSTopShelfImageLayers: [] 208 | tvOSTopShelfImageLayers2x: [] 209 | tvOSTopShelfImageWideLayers: [] 210 | tvOSTopShelfImageWideLayers2x: [] 211 | iOSLaunchScreenType: 0 212 | iOSLaunchScreenPortrait: {fileID: 0} 213 | iOSLaunchScreenLandscape: {fileID: 0} 214 | iOSLaunchScreenBackgroundColor: 215 | serializedVersion: 2 216 | rgba: 0 217 | iOSLaunchScreenFillPct: 100 218 | iOSLaunchScreenSize: 100 219 | iOSLaunchScreenCustomXibPath: 220 | iOSLaunchScreeniPadType: 0 221 | iOSLaunchScreeniPadImage: {fileID: 0} 222 | iOSLaunchScreeniPadBackgroundColor: 223 | serializedVersion: 2 224 | rgba: 0 225 | iOSLaunchScreeniPadFillPct: 100 226 | iOSLaunchScreeniPadSize: 100 227 | iOSLaunchScreeniPadCustomXibPath: 228 | iOSUseLaunchScreenStoryboard: 0 229 | iOSLaunchScreenCustomStoryboardPath: 230 | iOSDeviceRequirements: [] 231 | iOSURLSchemes: [] 232 | iOSBackgroundModes: 0 233 | iOSMetalForceHardShadows: 0 234 | metalEditorSupport: 1 235 | metalAPIValidation: 1 236 | iOSRenderExtraFrameOnPause: 0 237 | appleDeveloperTeamID: 238 | iOSManualSigningProvisioningProfileID: 239 | tvOSManualSigningProvisioningProfileID: 240 | appleEnableAutomaticSigning: 0 241 | clonedFromGUID: 00000000000000000000000000000000 242 | AndroidTargetDevice: 0 243 | AndroidSplashScreenScale: 0 244 | androidSplashScreen: {fileID: 0} 245 | AndroidKeystoreName: 246 | AndroidKeyaliasName: 247 | AndroidTVCompatibility: 1 248 | AndroidIsGame: 1 249 | AndroidEnableTango: 0 250 | androidEnableBanner: 1 251 | androidUseLowAccuracyLocation: 0 252 | m_AndroidBanners: 253 | - width: 320 254 | height: 180 255 | banner: {fileID: 0} 256 | androidGamepadSupportLevel: 0 257 | resolutionDialogBanner: {fileID: 0} 258 | m_BuildTargetIcons: [] 259 | m_BuildTargetBatching: [] 260 | m_BuildTargetGraphicsAPIs: [] 261 | m_BuildTargetVRSettings: [] 262 | m_BuildTargetEnableVuforiaSettings: [] 263 | openGLRequireES31: 0 264 | openGLRequireES31AEP: 0 265 | m_TemplateCustomTags: {} 266 | mobileMTRendering: 267 | iPhone: 1 268 | tvOS: 1 269 | m_BuildTargetGroupLightmapEncodingQuality: [] 270 | wiiUTitleID: 0005000011000000 271 | wiiUGroupID: 00010000 272 | wiiUCommonSaveSize: 4096 273 | wiiUAccountSaveSize: 2048 274 | wiiUOlvAccessKey: 0 275 | wiiUTinCode: 0 276 | wiiUJoinGameId: 0 277 | wiiUJoinGameModeMask: 0000000000000000 278 | wiiUCommonBossSize: 0 279 | wiiUAccountBossSize: 0 280 | wiiUAddOnUniqueIDs: [] 281 | wiiUMainThreadStackSize: 3072 282 | wiiULoaderThreadStackSize: 1024 283 | wiiUSystemHeapSize: 128 284 | wiiUTVStartupScreen: {fileID: 0} 285 | wiiUGamePadStartupScreen: {fileID: 0} 286 | wiiUDrcBufferDisabled: 0 287 | wiiUProfilerLibPath: 288 | playModeTestRunnerEnabled: 0 289 | actionOnDotNetUnhandledException: 1 290 | enableInternalProfiler: 0 291 | logObjCUncaughtExceptions: 1 292 | enableCrashReportAPI: 0 293 | cameraUsageDescription: 294 | locationUsageDescription: 295 | microphoneUsageDescription: 296 | switchNetLibKey: 297 | switchSocketMemoryPoolSize: 6144 298 | switchSocketAllocatorPoolSize: 128 299 | switchSocketConcurrencyLimit: 14 300 | switchScreenResolutionBehavior: 2 301 | switchUseCPUProfiler: 0 302 | switchApplicationID: 0x01004b9000490000 303 | switchNSODependencies: 304 | switchTitleNames_0: 305 | switchTitleNames_1: 306 | switchTitleNames_2: 307 | switchTitleNames_3: 308 | switchTitleNames_4: 309 | switchTitleNames_5: 310 | switchTitleNames_6: 311 | switchTitleNames_7: 312 | switchTitleNames_8: 313 | switchTitleNames_9: 314 | switchTitleNames_10: 315 | switchTitleNames_11: 316 | switchTitleNames_12: 317 | switchTitleNames_13: 318 | switchTitleNames_14: 319 | switchPublisherNames_0: 320 | switchPublisherNames_1: 321 | switchPublisherNames_2: 322 | switchPublisherNames_3: 323 | switchPublisherNames_4: 324 | switchPublisherNames_5: 325 | switchPublisherNames_6: 326 | switchPublisherNames_7: 327 | switchPublisherNames_8: 328 | switchPublisherNames_9: 329 | switchPublisherNames_10: 330 | switchPublisherNames_11: 331 | switchPublisherNames_12: 332 | switchPublisherNames_13: 333 | switchPublisherNames_14: 334 | switchIcons_0: {fileID: 0} 335 | switchIcons_1: {fileID: 0} 336 | switchIcons_2: {fileID: 0} 337 | switchIcons_3: {fileID: 0} 338 | switchIcons_4: {fileID: 0} 339 | switchIcons_5: {fileID: 0} 340 | switchIcons_6: {fileID: 0} 341 | switchIcons_7: {fileID: 0} 342 | switchIcons_8: {fileID: 0} 343 | switchIcons_9: {fileID: 0} 344 | switchIcons_10: {fileID: 0} 345 | switchIcons_11: {fileID: 0} 346 | switchIcons_12: {fileID: 0} 347 | switchIcons_13: {fileID: 0} 348 | switchIcons_14: {fileID: 0} 349 | switchSmallIcons_0: {fileID: 0} 350 | switchSmallIcons_1: {fileID: 0} 351 | switchSmallIcons_2: {fileID: 0} 352 | switchSmallIcons_3: {fileID: 0} 353 | switchSmallIcons_4: {fileID: 0} 354 | switchSmallIcons_5: {fileID: 0} 355 | switchSmallIcons_6: {fileID: 0} 356 | switchSmallIcons_7: {fileID: 0} 357 | switchSmallIcons_8: {fileID: 0} 358 | switchSmallIcons_9: {fileID: 0} 359 | switchSmallIcons_10: {fileID: 0} 360 | switchSmallIcons_11: {fileID: 0} 361 | switchSmallIcons_12: {fileID: 0} 362 | switchSmallIcons_13: {fileID: 0} 363 | switchSmallIcons_14: {fileID: 0} 364 | switchManualHTML: 365 | switchAccessibleURLs: 366 | switchLegalInformation: 367 | switchMainThreadStackSize: 1048576 368 | switchPresenceGroupId: 369 | switchLogoHandling: 0 370 | switchReleaseVersion: 0 371 | switchDisplayVersion: 1.0.0 372 | switchStartupUserAccount: 0 373 | switchTouchScreenUsage: 0 374 | switchSupportedLanguagesMask: 0 375 | switchLogoType: 0 376 | switchApplicationErrorCodeCategory: 377 | switchUserAccountSaveDataSize: 0 378 | switchUserAccountSaveDataJournalSize: 0 379 | switchApplicationAttribute: 0 380 | switchCardSpecSize: -1 381 | switchCardSpecClock: -1 382 | switchRatingsMask: 0 383 | switchRatingsInt_0: 0 384 | switchRatingsInt_1: 0 385 | switchRatingsInt_2: 0 386 | switchRatingsInt_3: 0 387 | switchRatingsInt_4: 0 388 | switchRatingsInt_5: 0 389 | switchRatingsInt_6: 0 390 | switchRatingsInt_7: 0 391 | switchRatingsInt_8: 0 392 | switchRatingsInt_9: 0 393 | switchRatingsInt_10: 0 394 | switchRatingsInt_11: 0 395 | switchLocalCommunicationIds_0: 396 | switchLocalCommunicationIds_1: 397 | switchLocalCommunicationIds_2: 398 | switchLocalCommunicationIds_3: 399 | switchLocalCommunicationIds_4: 400 | switchLocalCommunicationIds_5: 401 | switchLocalCommunicationIds_6: 402 | switchLocalCommunicationIds_7: 403 | switchParentalControl: 0 404 | switchAllowsScreenshot: 1 405 | switchAllowsVideoCapturing: 1 406 | switchAllowsRuntimeAddOnContentInstall: 0 407 | switchDataLossConfirmation: 0 408 | switchSupportedNpadStyles: 3 409 | switchSocketConfigEnabled: 0 410 | switchTcpInitialSendBufferSize: 32 411 | switchTcpInitialReceiveBufferSize: 64 412 | switchTcpAutoSendBufferSizeMax: 256 413 | switchTcpAutoReceiveBufferSizeMax: 256 414 | switchUdpSendBufferSize: 9 415 | switchUdpReceiveBufferSize: 42 416 | switchSocketBufferEfficiency: 4 417 | switchSocketInitializeEnabled: 1 418 | switchNetworkInterfaceManagerInitializeEnabled: 1 419 | switchPlayerConnectionEnabled: 1 420 | ps4NPAgeRating: 12 421 | ps4NPTitleSecret: 422 | ps4NPTrophyPackPath: 423 | ps4ParentalLevel: 11 424 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 425 | ps4Category: 0 426 | ps4MasterVersion: 01.00 427 | ps4AppVersion: 01.00 428 | ps4AppType: 0 429 | ps4ParamSfxPath: 430 | ps4VideoOutPixelFormat: 0 431 | ps4VideoOutInitialWidth: 1920 432 | ps4VideoOutBaseModeInitialWidth: 1920 433 | ps4VideoOutReprojectionRate: 60 434 | ps4PronunciationXMLPath: 435 | ps4PronunciationSIGPath: 436 | ps4BackgroundImagePath: 437 | ps4StartupImagePath: 438 | ps4StartupImagesFolder: 439 | ps4IconImagesFolder: 440 | ps4SaveDataImagePath: 441 | ps4SdkOverride: 442 | ps4BGMPath: 443 | ps4ShareFilePath: 444 | ps4ShareOverlayImagePath: 445 | ps4PrivacyGuardImagePath: 446 | ps4NPtitleDatPath: 447 | ps4RemotePlayKeyAssignment: -1 448 | ps4RemotePlayKeyMappingDir: 449 | ps4PlayTogetherPlayerCount: 0 450 | ps4EnterButtonAssignment: 1 451 | ps4ApplicationParam1: 0 452 | ps4ApplicationParam2: 0 453 | ps4ApplicationParam3: 0 454 | ps4ApplicationParam4: 0 455 | ps4DownloadDataSize: 0 456 | ps4GarlicHeapSize: 2048 457 | ps4ProGarlicHeapSize: 2560 458 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 459 | ps4pnSessions: 1 460 | ps4pnPresence: 1 461 | ps4pnFriends: 1 462 | ps4pnGameCustomData: 1 463 | playerPrefsSupport: 0 464 | restrictedAudioUsageRights: 0 465 | ps4UseResolutionFallback: 0 466 | ps4ReprojectionSupport: 0 467 | ps4UseAudio3dBackend: 0 468 | ps4SocialScreenEnabled: 0 469 | ps4ScriptOptimizationLevel: 0 470 | ps4Audio3dVirtualSpeakerCount: 14 471 | ps4attribCpuUsage: 0 472 | ps4PatchPkgPath: 473 | ps4PatchLatestPkgPath: 474 | ps4PatchChangeinfoPath: 475 | ps4PatchDayOne: 0 476 | ps4attribUserManagement: 0 477 | ps4attribMoveSupport: 0 478 | ps4attrib3DSupport: 0 479 | ps4attribShareSupport: 0 480 | ps4attribExclusiveVR: 0 481 | ps4disableAutoHideSplash: 0 482 | ps4videoRecordingFeaturesUsed: 0 483 | ps4contentSearchFeaturesUsed: 0 484 | ps4attribEyeToEyeDistanceSettingVR: 0 485 | ps4IncludedModules: [] 486 | monoEnv: 487 | psp2Splashimage: {fileID: 0} 488 | psp2NPTrophyPackPath: 489 | psp2NPSupportGBMorGJP: 0 490 | psp2NPAgeRating: 12 491 | psp2NPTitleDatPath: 492 | psp2NPCommsID: 493 | psp2NPCommunicationsID: 494 | psp2NPCommsPassphrase: 495 | psp2NPCommsSig: 496 | psp2ParamSfxPath: 497 | psp2ManualPath: 498 | psp2LiveAreaGatePath: 499 | psp2LiveAreaBackroundPath: 500 | psp2LiveAreaPath: 501 | psp2LiveAreaTrialPath: 502 | psp2PatchChangeInfoPath: 503 | psp2PatchOriginalPackage: 504 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 505 | psp2KeystoneFile: 506 | psp2MemoryExpansionMode: 0 507 | psp2DRMType: 0 508 | psp2StorageType: 0 509 | psp2MediaCapacity: 0 510 | psp2DLCConfigPath: 511 | psp2ThumbnailPath: 512 | psp2BackgroundPath: 513 | psp2SoundPath: 514 | psp2TrophyCommId: 515 | psp2TrophyPackagePath: 516 | psp2PackagedResourcesPath: 517 | psp2SaveDataQuota: 10240 518 | psp2ParentalLevel: 1 519 | psp2ShortTitle: Not Set 520 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 521 | psp2Category: 0 522 | psp2MasterVersion: 01.00 523 | psp2AppVersion: 01.00 524 | psp2TVBootMode: 0 525 | psp2EnterButtonAssignment: 2 526 | psp2TVDisableEmu: 0 527 | psp2AllowTwitterDialog: 1 528 | psp2Upgradable: 0 529 | psp2HealthWarning: 0 530 | psp2UseLibLocation: 0 531 | psp2InfoBarOnStartup: 0 532 | psp2InfoBarColor: 0 533 | psp2ScriptOptimizationLevel: 0 534 | psmSplashimage: {fileID: 0} 535 | splashScreenBackgroundSourceLandscape: {fileID: 0} 536 | splashScreenBackgroundSourcePortrait: {fileID: 0} 537 | spritePackerPolicy: 538 | webGLMemorySize: 256 539 | webGLExceptionSupport: 1 540 | webGLNameFilesAsHashes: 0 541 | webGLDataCaching: 0 542 | webGLDebugSymbols: 0 543 | webGLEmscriptenArgs: 544 | webGLModulesDirectory: 545 | webGLTemplate: APPLICATION:Default 546 | webGLAnalyzeBuildSize: 0 547 | webGLUseEmbeddedResources: 0 548 | webGLUseWasm: 0 549 | webGLCompressionFormat: 1 550 | scriptingDefineSymbols: {} 551 | platformArchitecture: {} 552 | scriptingBackend: {} 553 | incrementalIl2cppBuild: {} 554 | additionalIl2CppArgs: 555 | scriptingRuntimeVersion: 0 556 | apiCompatibilityLevelPerPlatform: {} 557 | m_RenderingPath: 1 558 | m_MobileRenderingPath: 1 559 | metroPackageName: UnityCaptureSample 560 | metroPackageVersion: 561 | metroCertificatePath: 562 | metroCertificatePassword: 563 | metroCertificateSubject: 564 | metroCertificateIssuer: 565 | metroCertificateNotAfter: 0000000000000000 566 | metroApplicationDescription: UnityCaptureSample 567 | wsaImages: {} 568 | metroTileShortName: 569 | metroCommandLineArgsFile: 570 | metroTileShowName: 0 571 | metroMediumTileShowName: 0 572 | metroLargeTileShowName: 0 573 | metroWideTileShowName: 0 574 | metroDefaultTileSize: 1 575 | metroTileForegroundText: 2 576 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 577 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 578 | a: 1} 579 | metroSplashScreenUseBackgroundColor: 0 580 | platformCapabilities: {} 581 | metroFTAName: 582 | metroFTAFileTypes: [] 583 | metroProtocolName: 584 | metroCompilationOverrides: 1 585 | tizenProductDescription: 586 | tizenProductURL: 587 | tizenSigningProfileName: 588 | tizenGPSPermissions: 0 589 | tizenMicrophonePermissions: 0 590 | tizenDeploymentTarget: 591 | tizenDeploymentTargetType: -1 592 | tizenMinOSVersion: 1 593 | n3dsUseExtSaveData: 0 594 | n3dsCompressStaticMem: 1 595 | n3dsExtSaveDataNumber: 0x12345 596 | n3dsStackSize: 131072 597 | n3dsTargetPlatform: 2 598 | n3dsRegion: 7 599 | n3dsMediaSize: 0 600 | n3dsLogoStyle: 3 601 | n3dsTitle: GameName 602 | n3dsProductCode: 603 | n3dsApplicationId: 0xFF3FF 604 | XboxOneProductId: 605 | XboxOneUpdateKey: 606 | XboxOneSandboxId: 607 | XboxOneContentId: 608 | XboxOneTitleId: 609 | XboxOneSCId: 610 | XboxOneGameOsOverridePath: 611 | XboxOnePackagingOverridePath: 612 | XboxOneAppManifestOverridePath: 613 | XboxOnePackageEncryption: 0 614 | XboxOnePackageUpdateGranularity: 2 615 | XboxOneDescription: 616 | XboxOneLanguage: 617 | - enus 618 | XboxOneCapability: [] 619 | XboxOneGameRating: {} 620 | XboxOneIsContentPackage: 0 621 | XboxOneEnableGPUVariability: 0 622 | XboxOneSockets: {} 623 | XboxOneSplashScreen: {fileID: 0} 624 | XboxOneAllowedProductIds: [] 625 | XboxOnePersistentLocalStorageSize: 0 626 | xboxOneScriptCompiler: 0 627 | vrEditorSettings: 628 | daydream: 629 | daydreamIconForeground: {fileID: 0} 630 | daydreamIconBackground: {fileID: 0} 631 | cloudServicesEnabled: {} 632 | facebookSdkVersion: 7.9.4 633 | apiCompatibilityLevel: 2 634 | cloudProjectId: 635 | projectName: 636 | organizationId: 637 | cloudEnabled: 0 638 | enableNativePlatformBackendsForNewInputSystem: 0 639 | disableOldInputManagerSupport: 0 640 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.3.1p1 2 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /UnityCaptureSample/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | --------------------------------------------------------------------------------