├── UnitySVDComputeShader ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── EditorBuildSettings.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── AudioManager.asset │ ├── TagManager.asset │ ├── EditorSettings.asset │ ├── UnityConnectSettings.asset │ ├── DynamicsManager.asset │ ├── Physics2DSettings.asset │ ├── NavMeshAreas.asset │ ├── GraphicsSettings.asset │ ├── QualitySettings.asset │ ├── InputManager.asset │ └── ProjectSettings.asset ├── UnityPackageManager │ └── manifest.json └── Assets │ ├── GetSVD3D.unity.meta │ ├── Math.cginc.meta │ ├── Common.cginc.meta │ ├── ComputeWithCS.compute.meta │ ├── Common.cginc │ ├── ComputeWithCS.cs.meta │ ├── ComputeWithCS.compute │ ├── ComputeWithCS.cs │ ├── GetSVD3D.unity │ └── Math.cginc ├── README.md └── .gitignore /UnitySVDComputeShader/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.3.0f3 2 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/UnityPackageManager/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/GetSVD3D.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 974ce1556ba4f2b46992ab9e90bc7eb2 3 | timeCreated: 1516950003 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/Math.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09fedf73519ed0046a3102ce7d90af32 3 | timeCreated: 1516950375 4 | licenseType: Pro 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/Common.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c05ddf92a76275048951750126d14a8a 3 | timeCreated: 1516950285 4 | licenseType: Pro 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/ComputeWithCS.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b6e8dbd5c92e204c9f0fd5a9e1e7040 3 | timeCreated: 1516950058 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | externalObjects: {} 7 | currentAPIMask: 4 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/Common.cginc: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_INCLUDED 2 | #define COMMON_INCLUDED 3 | static const float4x4 Identity = 4 | { 5 | { 1, 0, 0, 0 }, 6 | { 0, 1, 0, 0 }, 7 | { 0, 0, 1, 0 }, 8 | { 0, 0, 0, 1 } 9 | }; 10 | 11 | static const float3x3 Identity3x3 = 12 | { 13 | { 1, 0, 0}, 14 | { 0, 1, 0}, 15 | { 0, 0, 1}, 16 | }; 17 | 18 | #endif -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/ComputeWithCS.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a408b917505cf1043bbd261ea41a5c1b 3 | timeCreated: 1516950054 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnitySVDComputeShader 2 | 3 | This is a Unity implementation of [Implicit-shifted Symmetric QR Singular Value Decomposition of 3x3 Matrices](http://www.math.ucla.edu/~fuchuyuan/svd/svd.html) 4 | 5 | As a part of [A material point method for snow simulation](https://www.math.ucla.edu/~jteran/papers/SSCTS13.pdf). 6 | 7 | ### It is a GPU SVD implementation, I use compute shader to get SVD for both 2D and 3D matrix. 8 | it takes about 171 ms GPU time to calculate svd values of 10240 matrices. 9 | and takes about 0.23 ms GPU time to calculate svd values of 256 matrices. 10 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | *.VC.db 21 | 22 | 23 | # Unity3D generated meta files 24 | *.pidb.meta 25 | 26 | # Unity3D Generated File On Crash Reports 27 | sysinfo.txt 28 | 29 | # Builds 30 | *.apk 31 | *.unitypackage 32 | UnityComputeShaderExample/.vs/UnityComputeShaderExample/v15/Browse.VC.db 33 | UnityComputeShaderExample/.vs/UnityComputeShaderExample/v15/Browse.VC.opendb 34 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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: Hidden 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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/ComputeWithCS.compute: -------------------------------------------------------------------------------- 1 | // Each #kernel tells which function to compile; you can have many kernels 2 | #pragma kernel ComputeSVD3D 3 | #pragma enable_d3d11_debug_symbols 4 | 5 | #include "Assets/Common.cginc" 6 | #include "Assets/Math.cginc" 7 | 8 | struct Input 9 | { 10 | float4x4 A; 11 | }; 12 | 13 | struct Output 14 | { 15 | float4x4 U; 16 | float4 D; 17 | float4x4 Vt; 18 | }; 19 | 20 | RWStructuredBuffer _input_buffer; 21 | RWStructuredBuffer _output_buffer; 22 | 23 | [numthreads(8, 8, 1)] 24 | void ComputeSVD3D(uint3 id : SV_DispatchThreadID) 25 | { 26 | bool cal_2d = false; 27 | 28 | if (cal_2d) 29 | { 30 | float2x2 A2 = (float2x2)_input_buffer[id.x].A; 31 | float2x2 U2 = float2x2(0, 0, 0, 0); 32 | float2 D2 = float2(0, 0); 33 | float2x2 V2 = float2x2(0, 0, 0, 0); 34 | GetSVD2D(A2, U2, D2, V2); 35 | 36 | float2x2 Vt = transpose(V2); 37 | 38 | _output_buffer[id.x].U[0] = float4(U2[0].xy, 0,0); 39 | _output_buffer[id.x].U[1] = float4(U2[1].xy, 0,0); 40 | _output_buffer[id.x].U[2] = float4(0, 0, 0, 0); 41 | _output_buffer[id.x].U[3] = float4(0, 0, 0, 0); 42 | 43 | _output_buffer[id.x].D.xy = D2; 44 | 45 | _output_buffer[id.x].Vt[0] = float4(Vt[0].xy, 0,0); 46 | _output_buffer[id.x].Vt[1] = float4(Vt[1].xy, 0,0); 47 | _output_buffer[id.x].Vt[2] = float4(0, 0, 0, 0); 48 | _output_buffer[id.x].Vt[3] = float4(0, 0, 0, 0); 49 | } 50 | else 51 | { 52 | 53 | float3x3 A = (float3x3)_input_buffer[id.x].A; 54 | float3x3 U; 55 | float3 D; 56 | float3x3 V; 57 | 58 | GetSVD3D(A, U, D, V); 59 | 60 | float3x3 Vt = transpose(V); 61 | 62 | _output_buffer[id.x].U[0] = float4(U[0].xyz, 0); 63 | _output_buffer[id.x].U[1] = float4(U[1].xyz, 0); 64 | _output_buffer[id.x].U[2] = float4(U[2].xyz, 0); 65 | _output_buffer[id.x].U[3] = float4(0, 0, 0, 0); 66 | 67 | _output_buffer[id.x].D[0] = D[0]; 68 | _output_buffer[id.x].D[1] = D[1]; 69 | _output_buffer[id.x].D[2] = D[2]; 70 | 71 | _output_buffer[id.x].Vt[0] = float4(Vt[0].xyz, 0); 72 | _output_buffer[id.x].Vt[1] = float4(Vt[1].xyz, 0); 73 | _output_buffer[id.x].Vt[2] = float4(Vt[2].xyz, 0); 74 | _output_buffer[id.x].Vt[3] = float4(0, 0, 0, 0); 75 | } 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/ComputeWithCS.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using UnityEngine; 6 | using UnityEngine.Assertions; 7 | using UnityEngine.Profiling; 8 | 9 | public class ComputeWithCS : MonoBehaviour { 10 | 11 | [SerializeField] private ComputeShader cs; 12 | ComputeBuffer input_buffer_; 13 | Input[] input_data_; 14 | 15 | ComputeBuffer output_buffer_; 16 | Output[] output_data_; 17 | 18 | int kernal_id; 19 | 20 | [SerializeField] int number_of_buffer_ = 10000; 21 | float range = 1000; 22 | 23 | int test_count_ = 0; 24 | int error_count_ = 0; 25 | 26 | float time_total_ = 0; 27 | float time_count_ = 0; 28 | float current_time_ = 0; 29 | 30 | struct Input 31 | { 32 | public Matrix4x4 A; 33 | } 34 | 35 | struct Output 36 | { 37 | public Matrix4x4 U; 38 | public Vector4 D; 39 | public Matrix4x4 Vt; 40 | } 41 | 42 | // Use this for initialization 43 | void Start () { 44 | input_buffer_ = new ComputeBuffer(number_of_buffer_, Marshal.SizeOf(typeof(Input))); 45 | output_buffer_ = new ComputeBuffer(number_of_buffer_, Marshal.SizeOf(typeof(Output))); 46 | 47 | this.input_data_= new Input[number_of_buffer_]; 48 | this.RandomInputAndSetToBuffer(); 49 | 50 | this.output_data_ = new Output[number_of_buffer_]; 51 | 52 | this.kernal_id = cs.FindKernel("ComputeSVD3D"); 53 | 54 | 55 | this.RunCS(); 56 | } 57 | 58 | // Update is called once per frame 59 | private void Update() 60 | { 61 | this.RunCS(); 62 | } 63 | 64 | void RandomInputAndSetToBuffer() 65 | { 66 | test_count_ += this.input_data_.Length; 67 | for (int i = 0; i < this.input_data_.Length; i++) 68 | { 69 | //generator some random matrix 70 | this.input_data_[i].A = new Matrix4x4( 71 | new Vector4(Random.Range(-range, range), Random.Range(-range, range), Random.Range(-range, range), 0), 72 | new Vector4(Random.Range(-range, range), Random.Range(-range, range), Random.Range(-range, range), 0), 73 | new Vector4(Random.Range(-range, range), Random.Range(-range, range), Random.Range(-range, range), 0), 74 | new Vector4(0, 0, 0, 0)); 75 | } 76 | input_buffer_.SetData(input_data_); 77 | } 78 | 79 | void RunCS () 80 | { 81 | time_count_++; 82 | this.RandomInputAndSetToBuffer(); 83 | 84 | if (cs != null) 85 | { 86 | cs.SetBuffer(this.kernal_id, "_input_buffer", input_buffer_); 87 | cs.SetBuffer(this.kernal_id, "_output_buffer", output_buffer_); 88 | 89 | float time = Time.realtimeSinceStartup; 90 | Profiler.BeginSample("SVD3D"); 91 | cs.Dispatch(this.kernal_id, number_of_buffer_/8, number_of_buffer_/8, 1); 92 | Profiler.EndSample(); 93 | 94 | current_time_ = Time.realtimeSinceStartup - time; 95 | time_total_ += current_time_; 96 | 97 | output_buffer_.GetData(output_data_); 98 | 99 | VerifyData(input_data_, output_data_); 100 | } 101 | 102 | } 103 | 104 | void VerifyData(Input[] input, Output[] output) 105 | { 106 | for (int i = 0; i < input.Length; ++i) 107 | { 108 | Matrix4x4 matirx_d = new Matrix4x4( 109 | new Vector4(output[i].D[0], 0, 0, 0), 110 | new Vector4(0, output[i].D[1], 0, 0), 111 | new Vector4(0, 0, output[i].D[2], 0), 112 | new Vector4(0, 0, 0, 0) 113 | ); 114 | 115 | Matrix4x4 delta = output[i].U * matirx_d * output[i].Vt; 116 | delta.SetRow(0, input[i].A.GetRow(0) - delta.GetRow(0)); 117 | delta.SetRow(1, input[i].A.GetRow(1) - delta.GetRow(1)); 118 | delta.SetRow(2, input[i].A.GetRow(2) - delta.GetRow(2)); 119 | delta.SetRow(3, input[i].A.GetRow(3) - delta.GetRow(3)); 120 | 121 | //Debug.LogFormat("Verifying {0} with \n {1}", input[i].A, delta); 122 | 123 | bool checked_value = false; 124 | for (int j = 0; j < 3 && !checked_value; ++j) 125 | { 126 | for (int k = 0; k < 3; ++k) 127 | { 128 | if (Mathf.Abs(delta[j,k]) > 0.0005 * range) 129 | { 130 | Debug.LogWarningFormat("A is \n{4}\n" + 131 | "Retored is \n{5}\n" + 132 | "output is \n" + 133 | "U:\n{0}\n" + 134 | "D:\n{1}\n" + 135 | "Vt:\n{2}\n" + 136 | "Delta is \n{3}\n", output[i].U, matirx_d, output[i].Vt, delta, input[i].A, output[i].U * matirx_d * output[i].Vt); 137 | 138 | checked_value = true; 139 | error_count_++; 140 | break; 141 | } 142 | } 143 | } 144 | 145 | //Assert.IsTrue(input[i].A == output[i].U * matirx_d * output[i].Vt); 146 | } 147 | } 148 | void OnGUI() 149 | { 150 | //GUI.DrawTexture(new Rect(0, 0, 512 , 512), result_); 151 | 152 | string s = System.String.Format("input tested: {0}\nerror ratio {1:P4}\ntime average: {2:F5} ms\nCurrent Time:{3:F5}", 153 | test_count_, (error_count_ * 1.0f / test_count_), time_total_/time_count_ * 1000, current_time_ * 1000f); 154 | GUI.TextArea(new Rect(100, 100, 300, 100), s); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/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 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/GetSVD3D.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 &97355614 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: 97355616} 124 | - component: {fileID: 97355615} 125 | m_Layer: 0 126 | m_Name: Directional Light 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!108 &97355615 133 | Light: 134 | m_ObjectHideFlags: 0 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 97355614} 138 | m_Enabled: 1 139 | serializedVersion: 8 140 | m_Type: 1 141 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 142 | m_Intensity: 1 143 | m_Range: 10 144 | m_SpotAngle: 30 145 | m_CookieSize: 10 146 | m_Shadows: 147 | m_Type: 2 148 | m_Resolution: -1 149 | m_CustomResolution: -1 150 | m_Strength: 1 151 | m_Bias: 0.05 152 | m_NormalBias: 0.4 153 | m_NearPlane: 0.2 154 | m_Cookie: {fileID: 0} 155 | m_DrawHalo: 0 156 | m_Flare: {fileID: 0} 157 | m_RenderMode: 0 158 | m_CullingMask: 159 | serializedVersion: 2 160 | m_Bits: 4294967295 161 | m_Lightmapping: 4 162 | m_AreaSize: {x: 1, y: 1} 163 | m_BounceIntensity: 1 164 | m_ColorTemperature: 6570 165 | m_UseColorTemperature: 0 166 | m_ShadowRadius: 0 167 | m_ShadowAngle: 0 168 | --- !u!4 &97355616 169 | Transform: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 97355614} 174 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 175 | m_LocalPosition: {x: 0, y: 3, z: 0} 176 | m_LocalScale: {x: 1, y: 1, z: 1} 177 | m_Children: [] 178 | m_Father: {fileID: 0} 179 | m_RootOrder: 1 180 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 181 | --- !u!1 &992510980 182 | GameObject: 183 | m_ObjectHideFlags: 0 184 | m_PrefabParentObject: {fileID: 0} 185 | m_PrefabInternal: {fileID: 0} 186 | serializedVersion: 5 187 | m_Component: 188 | - component: {fileID: 992510981} 189 | - component: {fileID: 992510982} 190 | m_Layer: 0 191 | m_Name: GetSVD3D 192 | m_TagString: Untagged 193 | m_Icon: {fileID: 0} 194 | m_NavMeshLayer: 0 195 | m_StaticEditorFlags: 0 196 | m_IsActive: 1 197 | --- !u!4 &992510981 198 | Transform: 199 | m_ObjectHideFlags: 0 200 | m_PrefabParentObject: {fileID: 0} 201 | m_PrefabInternal: {fileID: 0} 202 | m_GameObject: {fileID: 992510980} 203 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 204 | m_LocalPosition: {x: 0, y: 0, z: 0} 205 | m_LocalScale: {x: 1, y: 1, z: 1} 206 | m_Children: [] 207 | m_Father: {fileID: 0} 208 | m_RootOrder: 2 209 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 210 | --- !u!114 &992510982 211 | MonoBehaviour: 212 | m_ObjectHideFlags: 0 213 | m_PrefabParentObject: {fileID: 0} 214 | m_PrefabInternal: {fileID: 0} 215 | m_GameObject: {fileID: 992510980} 216 | m_Enabled: 1 217 | m_EditorHideFlags: 0 218 | m_Script: {fileID: 11500000, guid: a408b917505cf1043bbd261ea41a5c1b, type: 3} 219 | m_Name: 220 | m_EditorClassIdentifier: 221 | cs: {fileID: 7200000, guid: 9b6e8dbd5c92e204c9f0fd5a9e1e7040, type: 3} 222 | number_of_buffer_: 10240 223 | --- !u!1 &1024810173 224 | GameObject: 225 | m_ObjectHideFlags: 0 226 | m_PrefabParentObject: {fileID: 0} 227 | m_PrefabInternal: {fileID: 0} 228 | serializedVersion: 5 229 | m_Component: 230 | - component: {fileID: 1024810177} 231 | - component: {fileID: 1024810176} 232 | - component: {fileID: 1024810175} 233 | - component: {fileID: 1024810174} 234 | m_Layer: 0 235 | m_Name: Main Camera 236 | m_TagString: MainCamera 237 | m_Icon: {fileID: 0} 238 | m_NavMeshLayer: 0 239 | m_StaticEditorFlags: 0 240 | m_IsActive: 1 241 | --- !u!81 &1024810174 242 | AudioListener: 243 | m_ObjectHideFlags: 0 244 | m_PrefabParentObject: {fileID: 0} 245 | m_PrefabInternal: {fileID: 0} 246 | m_GameObject: {fileID: 1024810173} 247 | m_Enabled: 1 248 | --- !u!124 &1024810175 249 | Behaviour: 250 | m_ObjectHideFlags: 0 251 | m_PrefabParentObject: {fileID: 0} 252 | m_PrefabInternal: {fileID: 0} 253 | m_GameObject: {fileID: 1024810173} 254 | m_Enabled: 1 255 | --- !u!20 &1024810176 256 | Camera: 257 | m_ObjectHideFlags: 0 258 | m_PrefabParentObject: {fileID: 0} 259 | m_PrefabInternal: {fileID: 0} 260 | m_GameObject: {fileID: 1024810173} 261 | m_Enabled: 1 262 | serializedVersion: 2 263 | m_ClearFlags: 1 264 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 265 | m_NormalizedViewPortRect: 266 | serializedVersion: 2 267 | x: 0 268 | y: 0 269 | width: 1 270 | height: 1 271 | near clip plane: 0.3 272 | far clip plane: 1000 273 | field of view: 60 274 | orthographic: 0 275 | orthographic size: 5 276 | m_Depth: -1 277 | m_CullingMask: 278 | serializedVersion: 2 279 | m_Bits: 4294967295 280 | m_RenderingPath: -1 281 | m_TargetTexture: {fileID: 0} 282 | m_TargetDisplay: 0 283 | m_TargetEye: 3 284 | m_HDR: 1 285 | m_AllowMSAA: 1 286 | m_AllowDynamicResolution: 0 287 | m_ForceIntoRT: 0 288 | m_OcclusionCulling: 1 289 | m_StereoConvergence: 10 290 | m_StereoSeparation: 0.022 291 | --- !u!4 &1024810177 292 | Transform: 293 | m_ObjectHideFlags: 0 294 | m_PrefabParentObject: {fileID: 0} 295 | m_PrefabInternal: {fileID: 0} 296 | m_GameObject: {fileID: 1024810173} 297 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 298 | m_LocalPosition: {x: 0, y: 1, z: -10} 299 | m_LocalScale: {x: 1, y: 1, z: 1} 300 | m_Children: [] 301 | m_Father: {fileID: 0} 302 | m_RootOrder: 0 303 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 304 | -------------------------------------------------------------------------------- /UnitySVDComputeShader/Assets/Math.cginc: -------------------------------------------------------------------------------- 1 | #ifndef MATH_INCLUDED 2 | #define MATH_INCLUDED 3 | 4 | #define EPSILON 1.19209e-07 5 | 6 | float2x2 G2(float c, float s) 7 | { 8 | return float2x2(c, s, -s, c); 9 | } 10 | 11 | float2 GetGivensConventionalCS(float a, float b) 12 | { 13 | float d = a * a + b * b; 14 | float c = 1; 15 | float s = 0; 16 | if (abs(d) > 0) 17 | { 18 | float t = rsqrt(d); 19 | c = a * t; 20 | s = -b * t; 21 | } 22 | 23 | return float2(c, s); 24 | } 25 | 26 | float2 GetGivensUnConventionalCS(float a, float b) 27 | { 28 | 29 | float d = a * a + b * b; 30 | float c = 0; 31 | float s = 1; 32 | if (abs(d) > 0) 33 | { 34 | float t = rsqrt(d); 35 | s = a * t; 36 | c = b * t; 37 | } 38 | 39 | return float2(c, s); 40 | } 41 | 42 | float3x3 G3_12(float c, float s, bool use_conventional = true) 43 | { 44 | float2 cs = use_conventional ? GetGivensConventionalCS(c, s) : GetGivensUnConventionalCS(c, s); 45 | c = cs.x; 46 | s = cs.y; 47 | return float3x3(c, s, 0, 48 | -s, c, 0, 49 | 0, 0, 1); 50 | } 51 | 52 | float3x3 G3_12_Direct(float c, float s) 53 | { 54 | return float3x3(c, s, 0, 55 | -s, c, 0, 56 | 0, 0, 1); 57 | } 58 | 59 | 60 | float3x3 G3_23(float c, float s, bool use_conventional = true) 61 | { 62 | float2 cs = use_conventional ? GetGivensConventionalCS(c, s) : GetGivensUnConventionalCS(c, s); 63 | c = cs.x; 64 | s = cs.y; 65 | return float3x3(1, 0, 0, 66 | 0, c, s, 67 | 0, -s, c); 68 | } 69 | float3x3 G3_23_Direct(float c, float s) 70 | { 71 | return float3x3(1, 0, 0, 72 | 0, c, s, 73 | 0, -s, c); 74 | } 75 | 76 | 77 | float3x3 G3_13(float c, float s, bool use_conventional = true) 78 | { 79 | float2 cs = use_conventional ? GetGivensConventionalCS(c, s) : GetGivensUnConventionalCS(c, s); 80 | c = cs.x; 81 | s = cs.y; 82 | return float3x3(c, 0, s, 83 | 0, 1, 0, 84 | -s, 0, c); 85 | } 86 | 87 | float3x3 G3_13_Direct(float c, float s) 88 | { 89 | return float3x3(c, 0, s, 90 | 0, 1, 0, 91 | -s, 0, c); 92 | } 93 | 94 | void GetPolarDecomposition2D(in float2x2 A, out float2x2 R, out float2x2 S) 95 | { 96 | R = float2x2(0, 0, 0, 0); 97 | S = float2x2(0, 0, 0, 0); 98 | 99 | float x = A[0][0] + A[1][1]; 100 | float y = A[1][0] - A[0][1]; 101 | 102 | float d = sqrt(x*x + y*y); 103 | 104 | float c = 1; 105 | float s = 0; 106 | 107 | R = G2(c, s); 108 | 109 | if (abs(d) > EPSILON) 110 | { 111 | d = 1.0f / d; 112 | R = G2(x * d, -y * d); 113 | } 114 | 115 | S = mul(transpose(R), A); 116 | } 117 | 118 | 119 | void GetSVD2D(in float2x2 A, out float2x2 U, out float2 D, out float2x2 V) 120 | { 121 | U = float2x2(0, 0, 0, 0); 122 | D = float2(0, 0); 123 | V = float2x2(0, 0, 0, 0); 124 | 125 | float2x2 R = float2x2(0, 0, 0, 0); 126 | float2x2 S = float2x2(0, 0, 0, 0); 127 | 128 | GetPolarDecomposition2D(A, R, S); 129 | 130 | float c = 1; 131 | float s = 0; 132 | 133 | if (abs(S[0][1]) < EPSILON) 134 | { 135 | D[0] = S[0][0]; 136 | D[1] = S[1][1]; 137 | } 138 | else 139 | { 140 | float taw = 0.5f * (S[0][0] - S[1][1]); 141 | float w = sqrt(taw * taw + S[0][1] * S[0][1]); 142 | float t = taw > 0 ? S[0][1] / (taw + w) : S[0][1] / (taw - w); 143 | 144 | c = rsqrt(t*t + 1); 145 | s = -t * c; 146 | 147 | D[0] = c*c *S[0][0] - 2 * c*s*S[0][1] + s*s*S[1][1]; 148 | D[1] = s*s *S[0][0] + 2 * c*s*S[0][1] + c*c*S[1][1]; 149 | 150 | } 151 | 152 | if (D[0] < D[1]) 153 | { 154 | float temp = D[0]; 155 | D[0] = D[1]; 156 | D[1] = temp; 157 | 158 | V = G2(-s, c); 159 | } 160 | else 161 | { 162 | V = G2(c, s); 163 | } 164 | 165 | U = mul(R, V); 166 | } 167 | 168 | void CodeZerochasing(inout float3x3 U, inout float3x3 A, inout float3x3 V) 169 | { 170 | float3x3 G = G3_12(A[0][0], A[1][0]); 171 | A = mul(transpose(G), A); 172 | U = mul(U, G); 173 | //checked 174 | 175 | float c = A[0][1]; 176 | float s = A[0][2]; 177 | if (abs(A[1][0]) > EPSILON) 178 | { 179 | c = A[0][0] * A[0][1] + A[1][0] * A[1][1]; 180 | s = A[0][0] * A[0][2] + A[1][0] * A[1][2]; 181 | } 182 | 183 | G = G3_23(c, s); 184 | A = mul(A, G); 185 | V = mul(V, G); 186 | //checked; 187 | 188 | G = G3_23(A[1][1], A[2][1]); 189 | A = mul(transpose(G), A); 190 | U = mul(U, G); 191 | //checked 192 | } 193 | 194 | void Zerochasing(inout float3x3 U, inout float3x3 A, inout float3x3 V) 195 | { 196 | float3x3 G = G3_23(A[0][1], A[0][2]); 197 | A = mul(A, G); 198 | U = mul(transpose(G), U); 199 | 200 | G = G3_23(A[0][1], A[0][2]); 201 | A = mul(transpose(G), A); 202 | V = mul(transpose(G), V); 203 | 204 | G = G3_23(A[1][1], A[2][1]); 205 | A = mul(transpose(G), A); 206 | U = mul(U, G); 207 | } 208 | 209 | void Bidiagonalize(inout float3x3 U, inout float3x3 A, inout float3x3 V) 210 | { 211 | float3x3 G = G3_23(A[1][0], A[2][0]); 212 | A = mul(transpose(G), A); 213 | U = mul(U, G); 214 | //checked 215 | 216 | CodeZerochasing(U, A, V); 217 | } 218 | 219 | float FrobeniusNorm(float3x3 input) 220 | { 221 | float ret = 0; 222 | for (int i = 0; i < 3; ++i) 223 | { 224 | for (int j = 0; j < 3; ++j) 225 | { 226 | ret += input[i][j] * input[i][j]; 227 | } 228 | } 229 | 230 | return sqrt(ret); 231 | } 232 | 233 | void FlipSign(int index, inout float3x3 mat, inout float3 sigma) 234 | { 235 | mat[0][index] = -mat[0][index]; 236 | mat[1][index] = -mat[1][index]; 237 | mat[2][index] = -mat[2][index]; 238 | sigma[index] = -sigma[index]; 239 | } 240 | 241 | void FlipSignColumn(inout float3x3 mat, int col) 242 | { 243 | mat[0][col] = -mat[0][col]; 244 | mat[1][col] = -mat[1][col]; 245 | mat[2][col] = -mat[2][col]; 246 | } 247 | 248 | inline void Swap(inout float a, inout float b) 249 | { 250 | float temp = a; 251 | a = b; 252 | b = temp; 253 | } 254 | 255 | 256 | inline void Swap(inout float3 a, inout float3 b) 257 | { 258 | float3 temp = a; 259 | a = b; 260 | b = temp; 261 | } 262 | 263 | inline void SwapColumn(inout float3x3 a, int col_a, int col_b) 264 | { 265 | float3 temp = float3(a[0][col_a], a[1][col_a], a[2][col_a]); 266 | a[0][col_a] = a[0][col_b]; 267 | a[1][col_a] = a[1][col_b]; 268 | a[2][col_a] = a[2][col_b]; 269 | 270 | a[0][col_b] = temp[0]; 271 | a[1][col_b] = temp[1]; 272 | a[2][col_b] = temp[2]; 273 | } 274 | 275 | void SortWithTopLeftSub(inout float3x3 U, inout float3 sigma, inout float3x3 V) 276 | { 277 | if (abs(sigma[1]) >= abs(sigma[2])) 278 | { 279 | if (sigma[1] < 0) 280 | { 281 | FlipSign(1, U, sigma); 282 | FlipSign(2, U, sigma); 283 | } 284 | return; 285 | } 286 | if (sigma[2] < 0) 287 | { 288 | FlipSign(1, U, sigma); 289 | FlipSign(2, U, sigma); 290 | } 291 | Swap(sigma[1], sigma[2]); 292 | SwapColumn(U, 1, 2); 293 | SwapColumn(V, 1, 2); 294 | 295 | if (sigma[1] > sigma[0]) 296 | { 297 | Swap(sigma[0], sigma[1]); 298 | SwapColumn(U, 0, 1); 299 | SwapColumn(V, 0, 1); 300 | } 301 | else 302 | { 303 | FlipSignColumn(U, 2); 304 | FlipSignColumn(V, 2); 305 | } 306 | } 307 | 308 | void SortWithBotRightSub(inout float3x3 U, inout float3 sigma, inout float3x3 V) 309 | { 310 | if (abs(sigma[0]) >= abs(sigma[1])) 311 | { 312 | if (sigma[0] < 0) 313 | { 314 | FlipSign(0, U, sigma); 315 | FlipSign(2, U, sigma); 316 | } 317 | return; 318 | } 319 | Swap(sigma[0], sigma[1]); 320 | SwapColumn(U, 0, 1); 321 | SwapColumn(V, 0, 1); 322 | 323 | if (abs(sigma[1]) < abs(sigma[2])) 324 | { 325 | Swap(sigma[1], sigma[2]);; 326 | SwapColumn(U, 1, 2); 327 | SwapColumn(V, 1, 2); 328 | } 329 | else 330 | { 331 | FlipSignColumn(U, 2); 332 | FlipSignColumn(V, 2); 333 | } 334 | 335 | if (sigma[1] < 0) 336 | { 337 | FlipSign(1, U, sigma); 338 | FlipSign(2, U, sigma); 339 | } 340 | } 341 | 342 | void SolveReducedTopLeft(inout float3x3 B, inout float3x3 U, inout float3 sigma, inout float3x3 V) 343 | { 344 | float s3 = B[2][2]; 345 | //float2x2 u = G2(1, 0); 346 | //float2x2 v = G2(1, 0); 347 | 348 | float2x2 top_left = float2x2(B[0][0], B[0][1], B[1][0], B[1][1]); 349 | 350 | float2x2 A2 = top_left; 351 | float2x2 U2 = float2x2(0, 0, 0, 0); 352 | float2 D2 = float2(0, 0); 353 | float2x2 V2 = float2x2(0, 0, 0, 0); 354 | GetSVD2D(A2, U2, D2, V2); 355 | 356 | float3x3 u3 = G3_12_Direct(U2[0][0], U2[0][1]); 357 | float3x3 v3 = G3_12_Direct(V2[0][0], V2[0][1]); 358 | 359 | U = mul(U, u3); 360 | V = mul(V, v3); 361 | 362 | sigma = float3(D2, s3); 363 | } 364 | 365 | 366 | void SolveReducedBotRight(inout float3x3 B, inout float3x3 U, inout float3 sigma, inout float3x3 V) 367 | { 368 | float s1 = B[0][0]; 369 | //float2x2 u = G2(1, 0); 370 | //float2x2 v = G2(1, 0); 371 | 372 | float2x2 bot_right = float2x2(B[1][1], B[1][2], B[2][1], B[2][2]); 373 | 374 | float2x2 A2 = bot_right; 375 | float2x2 U2 = float2x2(0, 0, 0, 0); 376 | float2 D2 = float2(0, 0); 377 | float2x2 V2 = float2x2(0, 0, 0, 0); 378 | GetSVD2D(A2, U2, D2, V2); 379 | 380 | float3x3 u3 = G3_23_Direct(U2[0][0], U2[0][1]); 381 | float3x3 v3 = G3_23_Direct(V2[0][0], V2[0][1]); 382 | 383 | U = mul(U, u3); 384 | V = mul(V, v3); 385 | sigma = float3(s1, D2); 386 | } 387 | 388 | void PostProcess(float3x3 B, inout float3x3 U, inout float3x3 V, float3 alpha, float2 beta, inout float3 sigma, float tao) 389 | { 390 | if (abs(beta[1]) <= tao) 391 | { 392 | SolveReducedTopLeft(B, U, sigma, V); 393 | //checked 394 | SortWithTopLeftSub(U, sigma, V); 395 | //checked 396 | } 397 | else if (abs(beta[0]) <= tao) 398 | { 399 | SolveReducedBotRight(B, U, sigma, V); 400 | SortWithBotRightSub(U, sigma, V); 401 | //checked once 402 | } 403 | else if (abs(alpha[1]) <= tao) 404 | { 405 | //UnConventional G here 406 | float3x3 G = G3_23(B[1][2], B[2][2], false); 407 | B = mul(transpose(G), B); 408 | U = mul(U, G); 409 | 410 | SolveReducedTopLeft(B, U, sigma, V); 411 | SortWithTopLeftSub(U, sigma, V); 412 | } 413 | else if (abs(alpha[2]) <= tao) 414 | { 415 | float3x3 G = G3_23(B[1][1], B[1][2]); 416 | B = mul(B, G); 417 | V = mul(V, G); 418 | 419 | G = G3_13(B[0][0], B[0][2]); 420 | B = mul(B, G); 421 | V = mul(V, G); 422 | 423 | //checked 424 | SolveReducedTopLeft(B, U, sigma, V); 425 | //checked 426 | SortWithTopLeftSub(U, sigma, V); 427 | //checked 428 | } 429 | else if (abs(alpha[0]) <= tao) 430 | { 431 | //UnConventional G here 432 | float3x3 G = G3_12(B[0][1], B[1][1], false); 433 | B = mul(transpose(G), B); 434 | U = mul(U, G); 435 | 436 | //UnConventional G here 437 | G = G3_13(B[0][2], B[2][2], false); 438 | B = mul(transpose(G), B); 439 | U = mul(U, G); 440 | 441 | SolveReducedBotRight(B, U, sigma, V); 442 | SortWithBotRightSub(U, sigma, V); 443 | } 444 | } 445 | 446 | 447 | void GetSVD3D(in float3x3 A, out float3x3 U, out float3 D, out float3x3 V) 448 | { 449 | U = float3x3(1, 0, 0, 450 | 0, 1, 0, 451 | 0, 0, 1); 452 | D = float3(0, 0, 0); 453 | V = float3x3(1, 0, 0, 454 | 0, 1, 0, 455 | 0, 0, 1); 456 | 457 | float3x3 B = A; 458 | 459 | Bidiagonalize(U, B, V); 460 | //chekced 461 | 462 | float3 alpha = float3(B[0][0], B[1][1], B[2][2]); 463 | float2 beta = float2(B[0][1], B[1][2]); 464 | float2 gamma = float2(alpha[0] * beta[0], alpha[1] * beta[1]); 465 | 466 | float tol = 128 * EPSILON; 467 | float tao = tol * max(0.5 * FrobeniusNorm(B), 1.0); 468 | 469 | int count = 0; 470 | 471 | while (abs(beta[1]) > tao && abs(beta[0]) > tao && 472 | abs(alpha[0]) > tao && abs(alpha[1]) > tao && abs(alpha[2]) > tao) 473 | { 474 | float a1 = alpha[1] * alpha[1] + beta[0] * beta[0]; 475 | float a2 = alpha[2] * alpha[2] + beta[1] * beta[1]; 476 | float b1 = gamma[1]; 477 | 478 | 479 | float d = (a1 - a2) * 0.5; 480 | float mu = (b1 * b1) / (abs(d) + sqrt(d*d + b1*b1)); 481 | //copy sign from d to mu 482 | float d_sign = sign(d); 483 | mu = d_sign > 0 ? mu : -mu; 484 | 485 | 486 | //code not in the paper 487 | mu = a2 - mu; 488 | //---------------- 489 | 490 | float3x3 G = G3_12((alpha[0] * alpha[0]) - mu, gamma[0]); 491 | B = mul(B, G); 492 | V = mul(V, G); 493 | 494 | CodeZerochasing(U, B, V); 495 | 496 | alpha = float3(B[0][0], B[1][1], B[2][2]); 497 | beta = float2(B[0][1], B[1][2]); 498 | gamma = float2(alpha[0] * beta[0], alpha[1] * beta[1]); 499 | 500 | count++; 501 | 502 | } 503 | 504 | PostProcess(B, U, V, alpha, beta, D, tao); 505 | } 506 | 507 | 508 | 509 | inline float GetBSplineHelper(const float value) 510 | { 511 | float val = abs(value); 512 | float ret = 0; 513 | if (val < 1) 514 | { 515 | ret = (0.5f * val * val * val) - (val * val) + (2 / 3.0f); 516 | } 517 | else 518 | if (val < 2) 519 | { 520 | ret = (-1 / 6.0f) * (val * val * val) + (val *val) - (2 * val) + (4 / 3.0f); 521 | } 522 | else 523 | { 524 | return 0; 525 | } 526 | 527 | //if (ret < 1e-4f) 528 | // return 0; 529 | 530 | return ret; 531 | } 532 | 533 | inline float GetBSplineDerivativeHelper(float value) 534 | { 535 | float val = abs(value); 536 | if (val < 1) 537 | { 538 | return (1.5f * val * value) - 2 * value; 539 | } 540 | else 541 | if (value < 2) 542 | { 543 | return (-0.5f) * (val * value) + 2 * value - 2 * value / val; 544 | } 545 | else 546 | { 547 | return 0; 548 | } 549 | } 550 | 551 | float3x3 Math_OutProduct(float3 lhs, float3 rhs) 552 | { 553 | return float3x3(lhs[0] * rhs[0], lhs[0] * rhs[1], lhs[0] * rhs[2], 554 | lhs[1] * rhs[0], lhs[1] * rhs[1], lhs[1] * rhs[2], 555 | lhs[2] * rhs[0], lhs[2] * rhs[1], lhs[2] * rhs[2]); 556 | } 557 | 558 | 559 | float3 Math_GetBSpline(float3 value) 560 | { 561 | return float3(GetBSplineHelper(value.x), GetBSplineHelper(value.y), GetBSplineHelper(value.z)); 562 | } 563 | 564 | 565 | float3 Math_GetBSplineDerivative(float3 value) 566 | { 567 | return float3(GetBSplineDerivativeHelper(value.x), GetBSplineDerivativeHelper(value.y), GetBSplineDerivativeHelper(value.z)); 568 | } 569 | 570 | #endif -------------------------------------------------------------------------------- /UnitySVDComputeShader/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: d6b7d92eaa7bebd48ab728e0c9af1e7d 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | defaultScreenOrientation: 4 11 | targetDevice: 2 12 | useOnDemandResources: 0 13 | accelerometerFrequency: 60 14 | companyName: DefaultCompany 15 | productName: UnitySVDComputeShader 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: 0 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 | tvOSLargeIconLayers2x: [] 208 | tvOSTopShelfImageLayers: [] 209 | tvOSTopShelfImageLayers2x: [] 210 | tvOSTopShelfImageWideLayers: [] 211 | tvOSTopShelfImageWideLayers2x: [] 212 | iOSLaunchScreenType: 0 213 | iOSLaunchScreenPortrait: {fileID: 0} 214 | iOSLaunchScreenLandscape: {fileID: 0} 215 | iOSLaunchScreenBackgroundColor: 216 | serializedVersion: 2 217 | rgba: 0 218 | iOSLaunchScreenFillPct: 100 219 | iOSLaunchScreenSize: 100 220 | iOSLaunchScreenCustomXibPath: 221 | iOSLaunchScreeniPadType: 0 222 | iOSLaunchScreeniPadImage: {fileID: 0} 223 | iOSLaunchScreeniPadBackgroundColor: 224 | serializedVersion: 2 225 | rgba: 0 226 | iOSLaunchScreeniPadFillPct: 100 227 | iOSLaunchScreeniPadSize: 100 228 | iOSLaunchScreeniPadCustomXibPath: 229 | iOSUseLaunchScreenStoryboard: 0 230 | iOSLaunchScreenCustomStoryboardPath: 231 | iOSDeviceRequirements: [] 232 | iOSURLSchemes: [] 233 | iOSBackgroundModes: 0 234 | iOSMetalForceHardShadows: 0 235 | metalEditorSupport: 1 236 | metalAPIValidation: 1 237 | iOSRenderExtraFrameOnPause: 0 238 | appleDeveloperTeamID: 239 | iOSManualSigningProvisioningProfileID: 240 | tvOSManualSigningProvisioningProfileID: 241 | appleEnableAutomaticSigning: 0 242 | clonedFromGUID: 00000000000000000000000000000000 243 | AndroidTargetDevice: 0 244 | AndroidSplashScreenScale: 0 245 | androidSplashScreen: {fileID: 0} 246 | AndroidKeystoreName: 247 | AndroidKeyaliasName: 248 | AndroidTVCompatibility: 1 249 | AndroidIsGame: 1 250 | AndroidEnableTango: 0 251 | androidEnableBanner: 1 252 | androidUseLowAccuracyLocation: 0 253 | m_AndroidBanners: 254 | - width: 320 255 | height: 180 256 | banner: {fileID: 0} 257 | androidGamepadSupportLevel: 0 258 | resolutionDialogBanner: {fileID: 0} 259 | m_BuildTargetIcons: [] 260 | m_BuildTargetBatching: [] 261 | m_BuildTargetGraphicsAPIs: [] 262 | m_BuildTargetVRSettings: [] 263 | m_BuildTargetEnableVuforiaSettings: [] 264 | openGLRequireES31: 0 265 | openGLRequireES31AEP: 0 266 | m_TemplateCustomTags: {} 267 | mobileMTRendering: 268 | Android: 1 269 | iPhone: 1 270 | tvOS: 1 271 | m_BuildTargetGroupLightmapEncodingQuality: [] 272 | wiiUTitleID: 0005000011000000 273 | wiiUGroupID: 00010000 274 | wiiUCommonSaveSize: 4096 275 | wiiUAccountSaveSize: 2048 276 | wiiUOlvAccessKey: 0 277 | wiiUTinCode: 0 278 | wiiUJoinGameId: 0 279 | wiiUJoinGameModeMask: 0000000000000000 280 | wiiUCommonBossSize: 0 281 | wiiUAccountBossSize: 0 282 | wiiUAddOnUniqueIDs: [] 283 | wiiUMainThreadStackSize: 3072 284 | wiiULoaderThreadStackSize: 1024 285 | wiiUSystemHeapSize: 128 286 | wiiUTVStartupScreen: {fileID: 0} 287 | wiiUGamePadStartupScreen: {fileID: 0} 288 | wiiUDrcBufferDisabled: 0 289 | wiiUProfilerLibPath: 290 | playModeTestRunnerEnabled: 0 291 | actionOnDotNetUnhandledException: 1 292 | enableInternalProfiler: 0 293 | logObjCUncaughtExceptions: 1 294 | enableCrashReportAPI: 0 295 | cameraUsageDescription: 296 | locationUsageDescription: 297 | microphoneUsageDescription: 298 | switchNetLibKey: 299 | switchSocketMemoryPoolSize: 6144 300 | switchSocketAllocatorPoolSize: 128 301 | switchSocketConcurrencyLimit: 14 302 | switchScreenResolutionBehavior: 2 303 | switchUseCPUProfiler: 0 304 | switchApplicationID: 0x01004b9000490000 305 | switchNSODependencies: 306 | switchTitleNames_0: 307 | switchTitleNames_1: 308 | switchTitleNames_2: 309 | switchTitleNames_3: 310 | switchTitleNames_4: 311 | switchTitleNames_5: 312 | switchTitleNames_6: 313 | switchTitleNames_7: 314 | switchTitleNames_8: 315 | switchTitleNames_9: 316 | switchTitleNames_10: 317 | switchTitleNames_11: 318 | switchTitleNames_12: 319 | switchTitleNames_13: 320 | switchTitleNames_14: 321 | switchPublisherNames_0: 322 | switchPublisherNames_1: 323 | switchPublisherNames_2: 324 | switchPublisherNames_3: 325 | switchPublisherNames_4: 326 | switchPublisherNames_5: 327 | switchPublisherNames_6: 328 | switchPublisherNames_7: 329 | switchPublisherNames_8: 330 | switchPublisherNames_9: 331 | switchPublisherNames_10: 332 | switchPublisherNames_11: 333 | switchPublisherNames_12: 334 | switchPublisherNames_13: 335 | switchPublisherNames_14: 336 | switchIcons_0: {fileID: 0} 337 | switchIcons_1: {fileID: 0} 338 | switchIcons_2: {fileID: 0} 339 | switchIcons_3: {fileID: 0} 340 | switchIcons_4: {fileID: 0} 341 | switchIcons_5: {fileID: 0} 342 | switchIcons_6: {fileID: 0} 343 | switchIcons_7: {fileID: 0} 344 | switchIcons_8: {fileID: 0} 345 | switchIcons_9: {fileID: 0} 346 | switchIcons_10: {fileID: 0} 347 | switchIcons_11: {fileID: 0} 348 | switchIcons_12: {fileID: 0} 349 | switchIcons_13: {fileID: 0} 350 | switchIcons_14: {fileID: 0} 351 | switchSmallIcons_0: {fileID: 0} 352 | switchSmallIcons_1: {fileID: 0} 353 | switchSmallIcons_2: {fileID: 0} 354 | switchSmallIcons_3: {fileID: 0} 355 | switchSmallIcons_4: {fileID: 0} 356 | switchSmallIcons_5: {fileID: 0} 357 | switchSmallIcons_6: {fileID: 0} 358 | switchSmallIcons_7: {fileID: 0} 359 | switchSmallIcons_8: {fileID: 0} 360 | switchSmallIcons_9: {fileID: 0} 361 | switchSmallIcons_10: {fileID: 0} 362 | switchSmallIcons_11: {fileID: 0} 363 | switchSmallIcons_12: {fileID: 0} 364 | switchSmallIcons_13: {fileID: 0} 365 | switchSmallIcons_14: {fileID: 0} 366 | switchManualHTML: 367 | switchAccessibleURLs: 368 | switchLegalInformation: 369 | switchMainThreadStackSize: 1048576 370 | switchPresenceGroupId: 371 | switchLogoHandling: 0 372 | switchReleaseVersion: 0 373 | switchDisplayVersion: 1.0.0 374 | switchStartupUserAccount: 0 375 | switchTouchScreenUsage: 0 376 | switchSupportedLanguagesMask: 0 377 | switchLogoType: 0 378 | switchApplicationErrorCodeCategory: 379 | switchUserAccountSaveDataSize: 0 380 | switchUserAccountSaveDataJournalSize: 0 381 | switchApplicationAttribute: 0 382 | switchCardSpecSize: -1 383 | switchCardSpecClock: -1 384 | switchRatingsMask: 0 385 | switchRatingsInt_0: 0 386 | switchRatingsInt_1: 0 387 | switchRatingsInt_2: 0 388 | switchRatingsInt_3: 0 389 | switchRatingsInt_4: 0 390 | switchRatingsInt_5: 0 391 | switchRatingsInt_6: 0 392 | switchRatingsInt_7: 0 393 | switchRatingsInt_8: 0 394 | switchRatingsInt_9: 0 395 | switchRatingsInt_10: 0 396 | switchRatingsInt_11: 0 397 | switchLocalCommunicationIds_0: 398 | switchLocalCommunicationIds_1: 399 | switchLocalCommunicationIds_2: 400 | switchLocalCommunicationIds_3: 401 | switchLocalCommunicationIds_4: 402 | switchLocalCommunicationIds_5: 403 | switchLocalCommunicationIds_6: 404 | switchLocalCommunicationIds_7: 405 | switchParentalControl: 0 406 | switchAllowsScreenshot: 1 407 | switchAllowsVideoCapturing: 1 408 | switchAllowsRuntimeAddOnContentInstall: 0 409 | switchDataLossConfirmation: 0 410 | switchSupportedNpadStyles: 3 411 | switchSocketConfigEnabled: 0 412 | switchTcpInitialSendBufferSize: 32 413 | switchTcpInitialReceiveBufferSize: 64 414 | switchTcpAutoSendBufferSizeMax: 256 415 | switchTcpAutoReceiveBufferSizeMax: 256 416 | switchUdpSendBufferSize: 9 417 | switchUdpReceiveBufferSize: 42 418 | switchSocketBufferEfficiency: 4 419 | switchSocketInitializeEnabled: 1 420 | switchNetworkInterfaceManagerInitializeEnabled: 1 421 | switchPlayerConnectionEnabled: 1 422 | ps4NPAgeRating: 12 423 | ps4NPTitleSecret: 424 | ps4NPTrophyPackPath: 425 | ps4ParentalLevel: 11 426 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 427 | ps4Category: 0 428 | ps4MasterVersion: 01.00 429 | ps4AppVersion: 01.00 430 | ps4AppType: 0 431 | ps4ParamSfxPath: 432 | ps4VideoOutPixelFormat: 0 433 | ps4VideoOutInitialWidth: 1920 434 | ps4VideoOutBaseModeInitialWidth: 1920 435 | ps4VideoOutReprojectionRate: 60 436 | ps4PronunciationXMLPath: 437 | ps4PronunciationSIGPath: 438 | ps4BackgroundImagePath: 439 | ps4StartupImagePath: 440 | ps4StartupImagesFolder: 441 | ps4IconImagesFolder: 442 | ps4SaveDataImagePath: 443 | ps4SdkOverride: 444 | ps4BGMPath: 445 | ps4ShareFilePath: 446 | ps4ShareOverlayImagePath: 447 | ps4PrivacyGuardImagePath: 448 | ps4NPtitleDatPath: 449 | ps4RemotePlayKeyAssignment: -1 450 | ps4RemotePlayKeyMappingDir: 451 | ps4PlayTogetherPlayerCount: 0 452 | ps4EnterButtonAssignment: 1 453 | ps4ApplicationParam1: 0 454 | ps4ApplicationParam2: 0 455 | ps4ApplicationParam3: 0 456 | ps4ApplicationParam4: 0 457 | ps4DownloadDataSize: 0 458 | ps4GarlicHeapSize: 2048 459 | ps4ProGarlicHeapSize: 2560 460 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 461 | ps4pnSessions: 1 462 | ps4pnPresence: 1 463 | ps4pnFriends: 1 464 | ps4pnGameCustomData: 1 465 | playerPrefsSupport: 0 466 | restrictedAudioUsageRights: 0 467 | ps4UseResolutionFallback: 0 468 | ps4ReprojectionSupport: 0 469 | ps4UseAudio3dBackend: 0 470 | ps4SocialScreenEnabled: 0 471 | ps4ScriptOptimizationLevel: 0 472 | ps4Audio3dVirtualSpeakerCount: 14 473 | ps4attribCpuUsage: 0 474 | ps4PatchPkgPath: 475 | ps4PatchLatestPkgPath: 476 | ps4PatchChangeinfoPath: 477 | ps4PatchDayOne: 0 478 | ps4attribUserManagement: 0 479 | ps4attribMoveSupport: 0 480 | ps4attrib3DSupport: 0 481 | ps4attribShareSupport: 0 482 | ps4attribExclusiveVR: 0 483 | ps4disableAutoHideSplash: 0 484 | ps4videoRecordingFeaturesUsed: 0 485 | ps4contentSearchFeaturesUsed: 0 486 | ps4attribEyeToEyeDistanceSettingVR: 0 487 | ps4IncludedModules: [] 488 | monoEnv: 489 | psp2Splashimage: {fileID: 0} 490 | psp2NPTrophyPackPath: 491 | psp2NPSupportGBMorGJP: 0 492 | psp2NPAgeRating: 12 493 | psp2NPTitleDatPath: 494 | psp2NPCommsID: 495 | psp2NPCommunicationsID: 496 | psp2NPCommsPassphrase: 497 | psp2NPCommsSig: 498 | psp2ParamSfxPath: 499 | psp2ManualPath: 500 | psp2LiveAreaGatePath: 501 | psp2LiveAreaBackroundPath: 502 | psp2LiveAreaPath: 503 | psp2LiveAreaTrialPath: 504 | psp2PatchChangeInfoPath: 505 | psp2PatchOriginalPackage: 506 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 507 | psp2KeystoneFile: 508 | psp2MemoryExpansionMode: 0 509 | psp2DRMType: 0 510 | psp2StorageType: 0 511 | psp2MediaCapacity: 0 512 | psp2DLCConfigPath: 513 | psp2ThumbnailPath: 514 | psp2BackgroundPath: 515 | psp2SoundPath: 516 | psp2TrophyCommId: 517 | psp2TrophyPackagePath: 518 | psp2PackagedResourcesPath: 519 | psp2SaveDataQuota: 10240 520 | psp2ParentalLevel: 1 521 | psp2ShortTitle: Not Set 522 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 523 | psp2Category: 0 524 | psp2MasterVersion: 01.00 525 | psp2AppVersion: 01.00 526 | psp2TVBootMode: 0 527 | psp2EnterButtonAssignment: 2 528 | psp2TVDisableEmu: 0 529 | psp2AllowTwitterDialog: 1 530 | psp2Upgradable: 0 531 | psp2HealthWarning: 0 532 | psp2UseLibLocation: 0 533 | psp2InfoBarOnStartup: 0 534 | psp2InfoBarColor: 0 535 | psp2ScriptOptimizationLevel: 0 536 | psmSplashimage: {fileID: 0} 537 | splashScreenBackgroundSourceLandscape: {fileID: 0} 538 | splashScreenBackgroundSourcePortrait: {fileID: 0} 539 | spritePackerPolicy: 540 | webGLMemorySize: 256 541 | webGLExceptionSupport: 1 542 | webGLNameFilesAsHashes: 0 543 | webGLDataCaching: 0 544 | webGLDebugSymbols: 0 545 | webGLEmscriptenArgs: 546 | webGLModulesDirectory: 547 | webGLTemplate: APPLICATION:Default 548 | webGLAnalyzeBuildSize: 0 549 | webGLUseEmbeddedResources: 0 550 | webGLUseWasm: 0 551 | webGLCompressionFormat: 1 552 | scriptingDefineSymbols: {} 553 | platformArchitecture: {} 554 | scriptingBackend: {} 555 | incrementalIl2cppBuild: {} 556 | additionalIl2CppArgs: 557 | scriptingRuntimeVersion: 0 558 | apiCompatibilityLevelPerPlatform: {} 559 | m_RenderingPath: 1 560 | m_MobileRenderingPath: 1 561 | metroPackageName: UnitySVDComputeShader 562 | metroPackageVersion: 563 | metroCertificatePath: 564 | metroCertificatePassword: 565 | metroCertificateSubject: 566 | metroCertificateIssuer: 567 | metroCertificateNotAfter: 0000000000000000 568 | metroApplicationDescription: UnitySVDComputeShader 569 | wsaImages: {} 570 | metroTileShortName: 571 | metroCommandLineArgsFile: 572 | metroTileShowName: 0 573 | metroMediumTileShowName: 0 574 | metroLargeTileShowName: 0 575 | metroWideTileShowName: 0 576 | metroDefaultTileSize: 1 577 | metroTileForegroundText: 2 578 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 579 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 580 | a: 1} 581 | metroSplashScreenUseBackgroundColor: 0 582 | platformCapabilities: {} 583 | metroFTAName: 584 | metroFTAFileTypes: [] 585 | metroProtocolName: 586 | metroCompilationOverrides: 1 587 | tizenProductDescription: 588 | tizenProductURL: 589 | tizenSigningProfileName: 590 | tizenGPSPermissions: 0 591 | tizenMicrophonePermissions: 0 592 | tizenDeploymentTarget: 593 | tizenDeploymentTargetType: -1 594 | tizenMinOSVersion: 1 595 | n3dsUseExtSaveData: 0 596 | n3dsCompressStaticMem: 1 597 | n3dsExtSaveDataNumber: 0x12345 598 | n3dsStackSize: 131072 599 | n3dsTargetPlatform: 2 600 | n3dsRegion: 7 601 | n3dsMediaSize: 0 602 | n3dsLogoStyle: 3 603 | n3dsTitle: GameName 604 | n3dsProductCode: 605 | n3dsApplicationId: 0xFF3FF 606 | XboxOneProductId: 607 | XboxOneUpdateKey: 608 | XboxOneSandboxId: 609 | XboxOneContentId: 610 | XboxOneTitleId: 611 | XboxOneSCId: 612 | XboxOneGameOsOverridePath: 613 | XboxOnePackagingOverridePath: 614 | XboxOneAppManifestOverridePath: 615 | XboxOnePackageEncryption: 0 616 | XboxOnePackageUpdateGranularity: 2 617 | XboxOneDescription: 618 | XboxOneLanguage: 619 | - enus 620 | XboxOneCapability: [] 621 | XboxOneGameRating: {} 622 | XboxOneIsContentPackage: 0 623 | XboxOneEnableGPUVariability: 0 624 | XboxOneSockets: {} 625 | XboxOneSplashScreen: {fileID: 0} 626 | XboxOneAllowedProductIds: [] 627 | XboxOnePersistentLocalStorageSize: 0 628 | xboxOneScriptCompiler: 0 629 | vrEditorSettings: 630 | daydream: 631 | daydreamIconForeground: {fileID: 0} 632 | daydreamIconBackground: {fileID: 0} 633 | cloudServicesEnabled: {} 634 | facebookSdkVersion: 7.9.4 635 | apiCompatibilityLevel: 2 636 | cloudProjectId: 637 | projectName: 638 | organizationId: 639 | cloudEnabled: 0 640 | enableNativePlatformBackendsForNewInputSystem: 0 641 | disableOldInputManagerSupport: 0 642 | --------------------------------------------------------------------------------