diff --git a/Assets/Project/SpaceEngine/Code/Managers/AsyncGPUManager.cs b/Assets/Project/SpaceEngine/Code/Managers/AsyncGPUManager.cs new file mode 100644 index 00000000..ff8862c9 --- /dev/null +++ b/Assets/Project/SpaceEngine/Code/Managers/AsyncGPUManager.cs @@ -0,0 +1,140 @@ +#region License +// Procedural planet generator. +// +// Copyright (C) 2015-2018 Denis Ovchinnikov [zameran] +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the copyright holders nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +// THE POSSIBILITY OF SUCH DAMAGE. +// +// Creation Date: 2018.03.15 +// Creation Time: 4:01 PM +// Creator: zameran +#endregion + +using System; +using System.Collections.Generic; + +using Unity.Collections; + +using UnityEngine; +using UnityEngine.Experimental.Rendering; + +namespace SpaceEngine.Managers +{ + public class AsyncGPUManager : MonoSingleton + { + public struct AsyncGPUReadbackRequestEntry where TType : struct + { + public AsyncGPUReadbackRequest Request; + + public int Layer; + + public Action> Callback; + + public AsyncGPUReadbackRequestEntry(AsyncGPUReadbackRequest request, int layer, Action> callback) + { + Request = request; + + Callback = callback; + + Layer = layer; + } + } + + private Queue> Entries; + + public bool CanEnqueue { get { return Entries.Count < 8; } } + + private void Awake() + { + Instance = this; + + Entries = new Queue>(); + } + + private void Update() + { + while (Entries.Count > 0) + { + var currentEntry = Entries.Peek(); + var currentRequest = currentEntry.Request; + + if (currentRequest.hasError) + { + Debug.LogError("AsyncGPUManager.Update: GPU Readback error!"); + + Entries.Dequeue(); + } + else if (currentRequest.done) + { + var data = currentRequest.GetData(currentEntry.Layer); + + if (currentEntry.Callback != null) currentEntry.Callback(data); + + Entries.Dequeue(); + } + else + { + break; + } + } + } + + protected override void OnDestroy() + { + Entries.Clear(); + + base.OnDestroy(); + } + + #region API + + private bool EnqueueCheck() + { + var canEnqueue = CanEnqueue; + + if (canEnqueue == false) Debug.LogWarning("AsyncGPUManager.EnqueueCheck: Too many requests! Can't proceed for now..."); + + return canEnqueue; + } + + public void Enqueue(Texture source, int mipIndex = 0, int layer = 0, Action> callback = null) + { + if (EnqueueCheck()) Entries.Enqueue(new AsyncGPUReadbackRequestEntry(AsyncGPUReadback.Request(source, mipIndex), layer, callback)); + } + + public void Enqueue(Texture source, int mipIndex, TextureFormat dstFormat, int layer = 0, Action> callback = null) + { + if (EnqueueCheck()) Entries.Enqueue(new AsyncGPUReadbackRequestEntry(AsyncGPUReadback.Request(source, mipIndex, dstFormat), layer, callback)); + } + + public void Enqueue(Texture source, int mipIndex, int x, int width, int y, int height, int z, int depth, int layer = 0, Action> callback = null) + { + if (EnqueueCheck()) Entries.Enqueue(new AsyncGPUReadbackRequestEntry(AsyncGPUReadback.Request(source, mipIndex, x, width, y, height, z, depth), layer, callback)); + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Project/SpaceEngine/Code/Managers/AsyncGPUManager.cs.meta b/Assets/Project/SpaceEngine/Code/Managers/AsyncGPUManager.cs.meta new file mode 100644 index 00000000..2dc54748 --- /dev/null +++ b/Assets/Project/SpaceEngine/Code/Managers/AsyncGPUManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 12ba892932897524e94a2fd939ef7354 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Project/SpaceEngine/Code/Test/AsyncGPUReadbackTest.cs b/Assets/Project/SpaceEngine/Code/Test/AsyncGPUReadbackTest.cs new file mode 100644 index 00000000..b08f9215 --- /dev/null +++ b/Assets/Project/SpaceEngine/Code/Test/AsyncGPUReadbackTest.cs @@ -0,0 +1,74 @@ +#region License +// Procedural planet generator. +// +// Copyright (C) 2015-2018 Denis Ovchinnikov [zameran] +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the copyright holders nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +// THE POSSIBILITY OF SUCH DAMAGE. +// +// Creation Date: 2018.03.15 +// Creation Time: 5:23 PM +// Creator: zameran +#endregion + +using SpaceEngine.Managers; + +using Unity.Collections; + +using UnityEngine; + +namespace SpaceEngine.Tests +{ + [RequireComponent(typeof(Camera))] + public class AsyncGPUReadbackTest : MonoBehaviour + { + private readonly CachedComponent CameraCachedComponent = new CachedComponent(); + + public Camera CameraComponent { get { return CameraCachedComponent.Component; } } + + [Range(1.0f, 16.0f)] + public int ReadbackCountPerFrame = 1; + + private void Start() + { + CameraCachedComponent.TryInit(this); + } + + private void OnRenderImage(RenderTexture source, RenderTexture destination) + { + for (var callIndex = 0; callIndex < ReadbackCountPerFrame; callIndex++) + { + AsyncGPUManager.Instance.Enqueue(source, 0, 0, ReadbackCallback); + } + + Graphics.Blit(source, destination); + } + + private void ReadbackCallback(NativeArray data) + { + // NOTE : Manipulation here! + } + } +} \ No newline at end of file diff --git a/Assets/Project/SpaceEngine/Code/Test/AsyncGPUReadbackTest.cs.meta b/Assets/Project/SpaceEngine/Code/Test/AsyncGPUReadbackTest.cs.meta new file mode 100644 index 00000000..9bb2fe31 --- /dev/null +++ b/Assets/Project/SpaceEngine/Code/Test/AsyncGPUReadbackTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e84203720ecedd45a10025ea06e87c9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Project/SpaceEngine/Scenes/Test/TestAsyncGPUManager.unity b/Assets/Project/SpaceEngine/Scenes/Test/TestAsyncGPUManager.unity new file mode 100644 index 00000000..46904a70 --- /dev/null +++ b/Assets/Project/SpaceEngine/Scenes/Test/TestAsyncGPUManager.unity @@ -0,0 +1,438 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0, g: 0, b: 0, a: 0.4} + m_AmbientEquatorColor: {r: 0.0456, g: 0.05, b: 0.053200003, a: 0.4} + m_AmbientGroundColor: {r: 0.0188, g: 0.0172, b: 0.014, a: 0.4} + m_AmbientIntensity: 0.4 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &562326319 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 562326323} + - component: {fileID: 562326322} + - component: {fileID: 562326321} + - component: {fileID: 562326320} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &562326320 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 562326319} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &562326321 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 562326319} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &562326322 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 562326319} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &562326323 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 562326319} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &680484789 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 680484794} + - component: {fileID: 680484793} + - component: {fileID: 680484792} + - component: {fileID: 680484791} + - component: {fileID: 680484790} + - component: {fileID: 680484796} + - component: {fileID: 680484795} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &680484790 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_Enabled: 1 +--- !u!124 &680484791 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_Enabled: 1 +--- !u!92 &680484792 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_Enabled: 1 +--- !u!20 &680484793 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: 3 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &680484794 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_LocalRotation: {x: 0.107503146, y: -0, z: -0, w: 0.99420476} + m_LocalPosition: {x: 0, y: 1.974, z: -5.28} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 12.287001, y: 0, z: 0} +--- !u!114 &680484795 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ce436c4563191b24693f6b336193306a, type: 3} + m_Name: + m_EditorClassIdentifier: + Enabled: 0 +--- !u!114 &680484796 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 680484789} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7e84203720ecedd45a10025ea06e87c9, type: 3} + m_Name: + m_EditorClassIdentifier: + ReadbackCountPerFrame: 1 +--- !u!1 &1208275201 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1208275203} + - component: {fileID: 1208275202} + m_Layer: 0 + m_Name: _AsyncGPUManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1208275202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1208275201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12ba892932897524e94a2fd939ef7354, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1208275203 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1208275201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1370843062 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1370843064} + - component: {fileID: 1370843063} + - component: {fileID: 1370843065} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1370843063 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1370843062} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 1 + m_Resolution: 3 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1370843064 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1370843062} + m_LocalRotation: {x: 0.4580791, y: -0.17804058, z: -0.094369076, w: 0.8657712} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 49.421, y: -37.63, z: -30.155} +--- !u!114 &1370843065 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1370843062} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f79d3d12661f88c4fb4eeecd852edae1, type: 3} + m_Name: + m_EditorClassIdentifier: + cubemapSize: 128 + oneFacePerFrame: 1 + layerMask: + serializedVersion: 2 + m_Bits: 4294967295 + cubeRenderTexture: {fileID: 0} diff --git a/Assets/Project/SpaceEngine/Scenes/Test/TestAsyncGPUManager.unity.meta b/Assets/Project/SpaceEngine/Scenes/Test/TestAsyncGPUManager.unity.meta new file mode 100644 index 00000000..901190a1 --- /dev/null +++ b/Assets/Project/SpaceEngine/Scenes/Test/TestAsyncGPUManager.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d68f17cd6184d6145ab6f5618ee6c1f6 +timeCreated: 1463341143 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Project/SpaceEngine/Shaders/PlanetTerrain.shader b/Assets/Project/SpaceEngine/Shaders/PlanetTerrain.shader index 7725d4a0..222b2ac3 100644 --- a/Assets/Project/SpaceEngine/Shaders/PlanetTerrain.shader +++ b/Assets/Project/SpaceEngine/Shaders/PlanetTerrain.shader @@ -162,9 +162,9 @@ Shader "SpaceEngine/Planet/Terrain (Deferred)" float3 invertedLightDistance = rsqrt(dot(WSPR.xyz, WSPR.xyz)); float3 lightPosition = WSPR.xyz * invertedLightDistance; - + float lightAngularRadius = asin(WSPR.w * invertedLightDistance); - + eclipse *= EclipseShadow(P, lightPosition, lightAngularRadius); #endif