From bb297bf84ce8a432a1f8be6bd745129d9f16509e Mon Sep 17 00:00:00 2001 From: Reinier Vens Date: Thu, 4 Feb 2021 04:37:47 +0000 Subject: [PATCH] Lightning Created Lightning Gun effect (Uses LineRenderer, very slow) Created GPU Lightning renderer (very fast, still needs integration) --- .../.idea/contentModel.xml | 52 +- Assembly-CSharp-firstpass.csproj | 20 + Assembly-CSharp.csproj | 12 +- Assets/Plugins/GPUTrail.meta | 5 + Assets/Plugins/GPUTrail/GPUTrail.cs | 155 +++ Assets/Plugins/GPUTrail/GPUTrail.cs.meta | 14 + Assets/Plugins/GPUTrail/GPUTrailIndirect.cs | 70 ++ .../Plugins/GPUTrail/GPUTrailIndirect.cs.meta | 14 + .../GPUTrail/GPUTrailIndirectCulling.cs | 145 +++ .../GPUTrail/GPUTrailIndirectCulling.cs.meta | 14 + Assets/Plugins/GPUTrail/Materials.meta | 9 + .../Plugins/GPUTrail/Materials/GPUTrail.mat | 36 + .../GPUTrail/Materials/GPUTrail.mat.meta | 4 + Assets/Plugins/GPUTrail/Sample.meta | 9 + .../GPUTrailIndirectCullingSample.unity | 584 +++++++++++ .../GPUTrailIndirectCullingSample.unity.meta | 4 + .../Sample/GPUTrailIndirectSample.meta | 9 + .../Sample/GPUTrailIndirectSample.unity | 507 ++++++++++ .../Sample/GPUTrailIndirectSample.unity.meta | 4 + .../GPUTrailIndirectCullingSample.cs | 37 + .../GPUTrailIndirectCullingSample.cs.meta | 14 + .../GPUTrailIndirectSample.cs | 38 + .../GPUTrailIndirectSample.cs.meta | 14 + .../GPUTrailIndirectSampleParticle.cs | 64 ++ .../GPUTrailIndirectSampleParticle.cs.meta | 14 + .../GPUTrailIndirectSampleParticleCS.compute | 56 ++ ...TrailIndirectSampleParticleCS.compute.meta | 9 + .../GPUTrail/Sample/GPUTrailSample.meta | 9 + .../GPUTrail/Sample/GPUTrailSample.unity | 945 ++++++++++++++++++ .../GPUTrail/Sample/GPUTrailSample.unity.meta | 4 + .../Sample/GPUTrailSample/AutoRotate.cs | 14 + .../Sample/GPUTrailSample/AutoRotate.cs.meta | 8 + .../Sample/GPUTrailSample/GenerateSphere.cs | 52 + .../GPUTrailSample/GenerateSphere.cs.meta | 8 + .../GPUTrailSample/Sphere.physicMaterial | 16 + .../GPUTrailSample/Sphere.physicMaterial.meta | 4 + .../Sample/GPUTrailSample/Sphere.prefab | 162 +++ .../Sample/GPUTrailSample/Sphere.prefab.meta | 4 + .../GPUTrail/Sample/GPUTrailSpline.meta | 9 + .../GPUTrailSpline/GPUTrailSplineSample.cs | 30 + .../GPUTrailSplineSample.cs.meta | 12 + .../Sample/GPUTrailSplineSample.unity | 915 +++++++++++++++++ .../Sample/GPUTrailSplineSample.unity.meta | 8 + Assets/Plugins/GPUTrail/Scripts.meta | 9 + .../Plugins/GPUTrail/Scripts/GPUTrailBase.cs | 175 ++++ .../GPUTrail/Scripts/GPUTrailBase.cs.meta | 14 + .../GPUTrail/Scripts/GPUTrailSpline.cs | 26 + .../GPUTrail/Scripts/GPUTrailSpline.cs.meta | 12 + Assets/Plugins/GPUTrail/Shaders.meta | 9 + .../Plugins/GPUTrail/Shaders/GPUTrail.compute | 106 ++ .../GPUTrail/Shaders/GPUTrail.compute.meta | 9 + .../Plugins/GPUTrail/Shaders/GPUTrail.shader | 66 ++ .../GPUTrail/Shaders/GPUTrail.shader.meta | 5 + .../GPUTrail/Shaders/GPUTrailIndirect.compute | 139 +++ .../Shaders/GPUTrailIndirect.compute.meta | 4 + .../Shaders/GPUTrailIndirectCulling.compute | 100 ++ .../GPUTrailIndirectCulling.compute.meta | 4 + .../GPUTrail/Shaders/GPUTrailInput.cginc | 10 + .../GPUTrail/Shaders/GPUTrailInput.cginc.meta | 10 + .../GPUTrail/Shaders/GPUTrailVariables.cginc | 25 + .../Shaders/GPUTrailVariables.cginc.meta | 9 + .../Shaders/GPUTrailVariablesCS.compute | 55 + .../Shaders/GPUTrailVariablesCS.compute.meta | 4 + .../GPUTrail/Shaders/GPUTrailVertex.cginc | 22 + .../Shaders/GPUTrailVertex.cginc.meta | 9 + .../Prefabs/Weapons/Lightning Rifle.prefab | 744 ++++++++++++++ .../Weapons/Lightning Rifle.prefab.meta | 7 + Assets/Scenes/ARPG.unity | 4 +- Assets/Scenes/LightningTestScene.unity | 537 ++++++++++ Assets/Scenes/LightningTestScene.unity.meta | 7 + .../Gameplay/Weapons/GuidedProjectile.cs | 2 +- Assets/Scripts/Gameplay/Weapons/Lightning.cs | 146 +++ .../Gameplay/Weapons/Lightning.cs.meta | 11 + .../Gameplay/Weapons/LightningGunManager.cs | 24 + .../Weapons/LightningGunManager.cs.meta | 11 + .../Scripts/Sector Display/SectorRenderer.cs | 1 + .../Scripts/ServerShared/Behaviors/Reactor.cs | 1 + Assets/Scripts/ServerShared/GlobalData.cs | 31 +- Assets/Shaders/Compute/Lightning.meta | 8 + .../Compute/Lightning/Lightning.compute | 140 +++ .../Compute/Lightning/Lightning.compute.meta | 9 + .../Shaders/Compute/Lightning/Lightning.mat | 80 ++ .../Compute/Lightning/Lightning.mat.meta | 8 + .../Compute/Lightning/Lightning.shader | 73 ++ .../Compute/Lightning/Lightning.shader.meta | 3 + .../Compute/Lightning/LightningCompute.cs | 288 ++++++ .../Lightning/LightningCompute.cs.meta | 11 + .../Compute/Lightning/LightningVertex.cginc | 20 + .../Lightning/LightningVertex.cginc.meta | 3 + Assets/Shaders/Compute/Stardust.meta | 8 + .../Compute/{ => Stardust}/Stardust.compute | 0 .../{ => Stardust}/Stardust.compute.meta | 0 .../Compute/{ => Stardust}/Stardust.cs | 2 +- .../Compute/{ => Stardust}/Stardust.cs.meta | 0 .../Compute/{ => Stardust}/Stardust.mat | 0 .../Compute/{ => Stardust}/Stardust.mat.meta | 0 .../Compute/{ => Stardust}/Stardust.shader | 0 .../{ => Stardust}/Stardust.shader.meta | 0 GameData/Presets/Longinus.preset | Bin 2746 -> 2683 bytes UserSettings/EditorUserSettings.asset | 4 +- 100 files changed, 7105 insertions(+), 13 deletions(-) create mode 100644 Assets/Plugins/GPUTrail.meta create mode 100644 Assets/Plugins/GPUTrail/GPUTrail.cs create mode 100644 Assets/Plugins/GPUTrail/GPUTrail.cs.meta create mode 100644 Assets/Plugins/GPUTrail/GPUTrailIndirect.cs create mode 100644 Assets/Plugins/GPUTrail/GPUTrailIndirect.cs.meta create mode 100644 Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs create mode 100644 Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Materials.meta create mode 100644 Assets/Plugins/GPUTrail/Materials/GPUTrail.mat create mode 100644 Assets/Plugins/GPUTrail/Materials/GPUTrail.mat.meta create mode 100644 Assets/Plugins/GPUTrail/Sample.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSpline.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity create mode 100644 Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity.meta create mode 100644 Assets/Plugins/GPUTrail/Scripts.meta create mode 100644 Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs create mode 100644 Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs create mode 100644 Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute.meta create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc create mode 100644 Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc.meta create mode 100644 Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab create mode 100644 Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab.meta create mode 100644 Assets/Scenes/LightningTestScene.unity create mode 100644 Assets/Scenes/LightningTestScene.unity.meta create mode 100644 Assets/Scripts/Gameplay/Weapons/Lightning.cs create mode 100644 Assets/Scripts/Gameplay/Weapons/Lightning.cs.meta create mode 100644 Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs create mode 100644 Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs.meta create mode 100644 Assets/Shaders/Compute/Lightning.meta create mode 100644 Assets/Shaders/Compute/Lightning/Lightning.compute create mode 100644 Assets/Shaders/Compute/Lightning/Lightning.compute.meta create mode 100644 Assets/Shaders/Compute/Lightning/Lightning.mat create mode 100644 Assets/Shaders/Compute/Lightning/Lightning.mat.meta create mode 100644 Assets/Shaders/Compute/Lightning/Lightning.shader create mode 100644 Assets/Shaders/Compute/Lightning/Lightning.shader.meta create mode 100644 Assets/Shaders/Compute/Lightning/LightningCompute.cs create mode 100644 Assets/Shaders/Compute/Lightning/LightningCompute.cs.meta create mode 100644 Assets/Shaders/Compute/Lightning/LightningVertex.cginc create mode 100644 Assets/Shaders/Compute/Lightning/LightningVertex.cginc.meta create mode 100644 Assets/Shaders/Compute/Stardust.meta rename Assets/Shaders/Compute/{ => Stardust}/Stardust.compute (100%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.compute.meta (100%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.cs (98%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.cs.meta (100%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.mat (100%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.mat.meta (100%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.shader (100%) rename Assets/Shaders/Compute/{ => Stardust}/Stardust.shader.meta (100%) diff --git a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml index f9c3afc80..98d09efc3 100644 --- a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml +++ b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml @@ -68,6 +68,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1424,6 +1460,8 @@ + + @@ -2059,9 +2097,17 @@ - - - + + + + + + + + + + + diff --git a/Assembly-CSharp-firstpass.csproj b/Assembly-CSharp-firstpass.csproj index 6ca781442..23969979b 100644 --- a/Assembly-CSharp-firstpass.csproj +++ b/Assembly-CSharp-firstpass.csproj @@ -65,6 +65,7 @@ + @@ -88,6 +89,7 @@ + @@ -125,6 +127,7 @@ + @@ -209,6 +212,7 @@ + @@ -237,6 +241,7 @@ + @@ -287,6 +292,7 @@ + @@ -294,6 +300,7 @@ + @@ -318,6 +325,7 @@ + @@ -370,6 +378,7 @@ + @@ -551,6 +560,7 @@ + @@ -570,6 +580,7 @@ + @@ -661,6 +672,7 @@ + @@ -673,16 +685,21 @@ + + + + + @@ -690,8 +707,11 @@ + + + diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 195664948..286e5708a 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -78,6 +78,7 @@ + @@ -141,6 +142,7 @@ + @@ -160,12 +162,13 @@ - + + @@ -179,6 +182,7 @@ + @@ -187,6 +191,7 @@ + @@ -194,8 +199,8 @@ - - + + @@ -213,6 +218,7 @@ + diff --git a/Assets/Plugins/GPUTrail.meta b/Assets/Plugins/GPUTrail.meta new file mode 100644 index 000000000..acde57d72 --- /dev/null +++ b/Assets/Plugins/GPUTrail.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 052800b5846fe8c4ca5858477fb80bc2 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/GPUTrail.cs b/Assets/Plugins/GPUTrail/GPUTrail.cs new file mode 100644 index 000000000..9a1902b74 --- /dev/null +++ b/Assets/Plugins/GPUTrail/GPUTrail.cs @@ -0,0 +1,155 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine.Assertions; + +public class GPUTrail : GPUTrailBase +{ + LinkedList _posLog = new LinkedList(); + int _totalInputIdx = -1; + + ComputeBuffer _inputBuffer; + + protected float _startTime; + + protected override int TrailNumMax { get { return 1; } } + + protected override void Awake() + { + base.Awake(); + + _inputBuffer = new ComputeBuffer(InputNumMax, Marshal.SizeOf(typeof(Node))); + } + + + void Start() + { + _posLog.AddLast(transform.position); + } + + protected override void ReleaseBuffer() + { + base.ReleaseBuffer(); + if (_inputBuffer != null) _inputBuffer.Release(); + } + + + void _LerpPos(int inputNum, Vector3 pos) + { + var timeStep = Time.deltaTime / inputNum; + var timePrev = Time.time - Time.deltaTime; + + var posPrev = _posLog.Last(); + var posStep = (pos - posPrev) / inputNum; + + for (var i = 1; i < inputNum; ++i) + { + _newPoints.Add(new Node() + { + pos = posPrev + posStep * i, + time = timePrev + timeStep * i + }); + } + } + + List _newPoints = new List(); + protected override void UpdateVertex() + { + var pos = transform.position; + var posPrev = _posLog.Last(); + + if ((Vector3.Distance(posPrev, pos) > MINNodeDistance)) + { + var inputNum = Mathf.Clamp(Mathf.FloorToInt(Time.deltaTime * InputPerSec), 1, InputNumMax); + //inputNum = 1; + + if (inputNum > 1) + { + _LerpPos(inputNum, pos); + } + + _newPoints.Add(new Node() + { + pos = pos, + time = Time.time + }); + + _posLog.AddLast(pos); + + // _posLogには過去2つの位置を保存しとく + for (var i = 0; i < _posLog.Count - 2; ++i) + { + _posLog.RemoveFirst(); + } + } + + _UpdateVertex(_newPoints); + + _newPoints.Clear(); + } + + const int NUM_THREAD_X = 16; + void _UpdateVertex(List newPoints) + { + Assert.IsTrue(newPoints.Count <= InputNumMax); + + var inputNum = newPoints.Count; + if (inputNum > 0) + { + _inputBuffer.SetData(newPoints.ToArray()); + if (_totalInputIdx < 0) _startTime = Time.time; + _totalInputIdx += inputNum; + } + + if (_totalInputIdx >= 0) + { + SetCommonParameterForCs(); + + Cs.SetInt("_InputNum", inputNum); + Cs.SetInt("_TotalInputIdx", _totalInputIdx); + Cs.SetInt("_BufferSize", nodeNumPerTrail); + Cs.SetFloat("_StartTime", _startTime); + + var kernel = Cs.FindKernel("CreateWidth"); + Cs.SetBuffer(kernel, "_InputBuffer", _inputBuffer); + Cs.SetBuffer(kernel, "_NodeBuffer", nodeBuffer); + Cs.SetBuffer(kernel, "_VertexBuffer", vertexBuffer); + + Cs.Dispatch(kernel, Mathf.CeilToInt((float)nodeBuffer.count / NUM_THREAD_X), 1, 1); + } + } + + + public bool _debugDrawLogPoint; + public bool _debugDrawVertexBuf; + + public void OnDrawGizmosSelected() + { + if (_debugDrawLogPoint) + { + Gizmos.color = Color.magenta; + _posLog.ToList().ForEach(p => + { + Gizmos.DrawWireSphere(p, MINNodeDistance); + }); + } + + if (_debugDrawVertexBuf) + { + Gizmos.color = Color.yellow; + var data = new Vertex[vertexBuffer.count]; + vertexBuffer.GetData(data); + + var num = vertexBuffer.count / 2; + for(var i=0; i< num; ++i) + { + var v0 = data[2*i]; + var v1 = data[2*i +1]; + + Gizmos.DrawLine(v0.pos, v1.pos); + } + } + } +} diff --git a/Assets/Plugins/GPUTrail/GPUTrail.cs.meta b/Assets/Plugins/GPUTrail/GPUTrail.cs.meta new file mode 100644 index 000000000..ee84bbb17 --- /dev/null +++ b/Assets/Plugins/GPUTrail/GPUTrail.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 6af463c098fe7e445addb01c1c7e5c49 +timeCreated: 1485348647 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - _cs: {fileID: 7200000, guid: f88322fe9ecec1e41b2a237407abddad, type: 3} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/GPUTrailIndirect.cs b/Assets/Plugins/GPUTrail/GPUTrailIndirect.cs new file mode 100644 index 000000000..6fd7eb8fc --- /dev/null +++ b/Assets/Plugins/GPUTrail/GPUTrailIndirect.cs @@ -0,0 +1,70 @@ +using UnityEngine; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine.Assertions; + +public abstract class GPUTrailIndirect : GPUTrailBase +{ + #region TypeDefine + public struct Trail + { + public float startTime; + public int totalInputNum; + } + + + public struct InputData + { + public Vector3 position; + public Color color; + } + #endregion + + protected ComputeBuffer _inputBuffer; + ComputeBuffer _trailBuffer; + + + override protected void Awake() + { + base.Awake(); + + _trailBuffer = new ComputeBuffer(TrailNumMax, Marshal.SizeOf(typeof(Trail))); + _trailBuffer.SetData(Enumerable.Repeat(default(Trail), TrailNumMax).ToArray()); + + _inputBuffer = new ComputeBuffer(TrailNumMax, Marshal.SizeOf(typeof(InputData))); + } + + override protected void ReleaseBuffer() + { + base.ReleaseBuffer(); + if (_inputBuffer != null) _inputBuffer.Release(); + if (_trailBuffer != null) _trailBuffer.Release(); + } + + const int NUM_THREAD_X = 32; + protected override void UpdateVertex() + { + // AddNode + SetCommonParameterForCs(); + + var success = UpdateInputBuffer(); + if (success) + { + var kernel = Cs.FindKernel("AddNode"); + Cs.SetBuffer(kernel, "_InputBuffer", _inputBuffer); + Cs.SetBuffer(kernel, "_TrailBufferW", _trailBuffer); + Cs.SetBuffer(kernel, "_NodeBufferW", nodeBuffer); + + Cs.Dispatch(kernel, Mathf.CeilToInt((float)_trailBuffer.count / NUM_THREAD_X), 1, 1); + + // CreateWidth + kernel = Cs.FindKernel("CreateWidth"); + Cs.SetBuffer(kernel, "_TrailBuffer", _trailBuffer); + Cs.SetBuffer(kernel, "_NodeBuffer", nodeBuffer); + Cs.SetBuffer(kernel, "_VertexBuffer", vertexBuffer); + Cs.Dispatch(kernel, Mathf.CeilToInt((float)nodeBuffer.count / NUM_THREAD_X), 1, 1); + } + } + + protected abstract bool UpdateInputBuffer(); +} diff --git a/Assets/Plugins/GPUTrail/GPUTrailIndirect.cs.meta b/Assets/Plugins/GPUTrail/GPUTrailIndirect.cs.meta new file mode 100644 index 000000000..24ea76646 --- /dev/null +++ b/Assets/Plugins/GPUTrail/GPUTrailIndirect.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 823d3c29066f5024db13a827ea33b232 +timeCreated: 1485156615 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs b/Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs new file mode 100644 index 000000000..bb3ce2513 --- /dev/null +++ b/Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs @@ -0,0 +1,145 @@ +using UnityEngine; +using System.Linq; +using UnityEngine.Assertions; +using System.Collections.Generic; + +/// +/// GPUTrailIndirectCulling +/// cull processing for many camera(same position because GPUTrail faces one point) +/// +public abstract class GPUTrailIndirectCulling : GPUTrailIndirect +{ + #region TypeDefine + public class Data + { + public ComputeBuffer _trailIsInViews; + public ComputeBuffer _trailIsInViewsAppend; + public ComputeBuffer _trailIsInViewArgs; + + + public Data(int trailNumMax, int indexNumPerTrail, int vertexBuferSize) + { + _trailIsInViews = new ComputeBuffer(trailNumMax, 4); // bool buffer but stride must be amultiple of 4 + _trailIsInViewsAppend = new ComputeBuffer(trailNumMax, sizeof(uint), ComputeBufferType.Append); + _trailIsInViewArgs = new ComputeBuffer(4, sizeof(int), ComputeBufferType.IndirectArguments); + _trailIsInViewArgs.SetData(new[] { indexNumPerTrail, 1, 0, 0 }); + } + + public void Release() + { + new[] { _trailIsInViews, _trailIsInViewsAppend, _trailIsInViewArgs } + .Where(b => b != null) + .ToList() + .ForEach(b => b.Release()); + } + + const int NUM_THREAD_X = 32; + public void Update(ComputeShader cs, Camera camera, ComputeBuffer nodeBuffer, ComputeBuffer vertexBufferOrig) + { + var kernel = cs.FindKernel("ClearIsInView"); + cs.SetBuffer(kernel, "_IsInViewW", _trailIsInViews); + cs.Dispatch(kernel, Mathf.CeilToInt((float)_trailIsInViews.count / NUM_THREAD_X), 1, 1); + + kernel = cs.FindKernel("UpdateIsInView"); + + var planes = GeometryUtility.CalculateFrustumPlanes(camera); + var normals = planes.Take(4).Select(p => p.normal).ToList(); + planes.Take(4).ToList().ForEach(plane => Debug.DrawRay(camera.transform.position, plane.normal* 10f)); + var normalsFloat = Enumerable.Range(0, 3).SelectMany(i => normals.Select(n => n[i])).ToArray(); // row major -> column major + cs.SetFloats("_CameraFrustumNormals", normalsFloat); + + cs.SetBuffer(kernel, "_IsInViewW", _trailIsInViews); + cs.SetBuffer(kernel, "_NodeBuffer", nodeBuffer); + cs.Dispatch(kernel, Mathf.CeilToInt((float)nodeBuffer.count / NUM_THREAD_X), 1, 1); + + + _trailIsInViewsAppend.SetCounterValue(0); + + kernel = cs.FindKernel("UpdateTrailAppend"); + cs.SetBuffer(kernel, "_IsInView", _trailIsInViews); + cs.SetBuffer(kernel, "_IsInViewAppend", _trailIsInViewsAppend); + cs.Dispatch(kernel, Mathf.CeilToInt((float)_trailIsInViews.count / NUM_THREAD_X), 1, 1); + + ComputeBuffer.CopyCount(_trailIsInViewsAppend, _trailIsInViewArgs, 4); // int[4]{ indexNumPerNode, trailNum, 0, 0} + } + } + #endregion + + public ComputeShader _cullingCS; + public bool _cullingEnable = true; + + protected override void OnRenderObjectInternal() + { + var cam = Camera.current; + if (_cullingEnable && !cam.orthographic) + { + if (!_cameraDatas.ContainsKey(cam)) + { + _cameraDatas[cam] = null; // このフレームは登録だけ + } + else { + var data = _cameraDatas[cam]; + if (data != null) + { + + material.EnableKeyword("GPUTRAIL_TRAIL_INDEX_ON"); + SetCommonMaterialParam(); + + material.SetBuffer("_TrailIndexBuffer", data._trailIsInViewsAppend); + material.SetPass(0); + + Graphics.DrawProceduralIndirectNow(MeshTopology.Triangles, data._trailIsInViewArgs); + } + } + } + else + { + base.OnRenderObjectInternal(); + } + } + + + protected override void LateUpdate() + { + base.LateUpdate(); + + if (_cullingEnable) + { + _cameraDatas.Keys.Where(cam => cam == null).ToList().ForEach(cam => _cameraDatas.Remove(cam)); + _cameraDatas.Keys + .Where(cam => cam.isActiveAndEnabled) + .ToList().ForEach(cam => + { + UpdateVertexBuffer(cam); + }); + } + } + + + Dictionary _cameraDatas = new Dictionary(); + void UpdateVertexBuffer(Camera camera) + { +#if UNITY_EDITOR + if (CameraPos != camera.transform.position) { + Debug.LogWarning("GPUTrail faces to main camera. but different position camera detected! culling operation is uncertain."); + } +#endif + + Data data = _cameraDatas[camera]; + if ( data == null ) + { + data = _cameraDatas[camera] = new Data(TrailNumMax, IndexNumPerTrail, VertexBufferSize); + } + + _SetCommonParameterForCS(_cullingCS); + data.Update(_cullingCS, camera, nodeBuffer, vertexBuffer); + } + + protected override void ReleaseBuffer() + { + base.ReleaseBuffer(); + + _cameraDatas.Values.Where(d => d!=null).ToList().ForEach(d => d.Release()); + _cameraDatas.Clear(); + } +} diff --git a/Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs.meta b/Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs.meta new file mode 100644 index 000000000..00aa67112 --- /dev/null +++ b/Assets/Plugins/GPUTrail/GPUTrailIndirectCulling.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b3756aede1b1bae4b8c51a5b6f19bb31 +timeCreated: 1485156615 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Materials.meta b/Assets/Plugins/GPUTrail/Materials.meta new file mode 100644 index 000000000..befc44f5d --- /dev/null +++ b/Assets/Plugins/GPUTrail/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ef617e94019158342b615fa339b392e1 +folderAsset: yes +timeCreated: 1484908289 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Materials/GPUTrail.mat b/Assets/Plugins/GPUTrail/Materials/GPUTrail.mat new file mode 100644 index 000000000..fcd010d5a --- /dev/null +++ b/Assets/Plugins/GPUTrail/Materials/GPUTrail.mat @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: GPUTrail + m_Shader: {fileID: 4800000, guid: aa7a048c89ecc5c4bad74dee290e8ac2, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Sprite: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Life: 1000 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EndColor: {r: 0, g: 0.25220004, b: 0.291, a: 0} + - _StartColor: {r: 11.984314, g: 0.627451, b: 10.792157, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/GPUTrail/Materials/GPUTrail.mat.meta b/Assets/Plugins/GPUTrail/Materials/GPUTrail.mat.meta new file mode 100644 index 000000000..cbd9c65a6 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Materials/GPUTrail.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c1c458d860a40bc4f836b8625223124f +NativeFormatImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Sample.meta b/Assets/Plugins/GPUTrail/Sample.meta new file mode 100644 index 000000000..26bfa6cdf --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8800f49c2f304ce4fa5829a607612554 +folderAsset: yes +timeCreated: 1484652950 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity new file mode 100644 index 000000000..88f161d37 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity @@ -0,0 +1,584 @@ +%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: 8 + 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.2, g: 0.2, b: 0.2, a: 1} + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 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} +--- !u!157 &4 +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: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 9 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 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: 0 + 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: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &5 +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.16666666 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &104940725 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 104940730} + - component: {fileID: 104940729} + - component: {fileID: 104940727} + - component: {fileID: 104940726} + 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 &104940726 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!124 &104940727 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!20 &104940729 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + 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: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &104940730 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -100} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 911709187} + m_Father: {fileID: 310526803} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &310526802 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 310526803} + - component: {fileID: 310526804} + m_Layer: 0 + m_Name: CemeraCenter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &310526803 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -25, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 104940730} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &310526804 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 47e64413aeb5ae740b410d70fb05d20c, type: 3} + m_Name: + m_EditorClassIdentifier: + rotSpeed: {x: 0, y: 1, z: 0} +--- !u!1 &911709186 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 911709187} + m_Layer: 0 + m_Name: CullingTestCameras + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &911709187 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 911709186} + 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: + - {fileID: 1128910013} + - {fileID: 928204800} + - {fileID: 1844795435} + - {fileID: 1043586159} + m_Father: {fileID: 104940730} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &928204799 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 928204800} + - component: {fileID: 928204804} + m_Layer: 0 + m_Name: Camera2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &928204800 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 928204799} + m_LocalRotation: {x: -0, y: 1, z: -0, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 911709187} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!20 &928204804 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 928204799} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + 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: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!1 &1043586158 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1043586159} + - component: {fileID: 1043586163} + m_Layer: 0 + m_Name: Camera4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1043586159 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1043586158} + m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 911709187} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!20 &1043586163 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1043586158} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + 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: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!1 &1128910012 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1128910013} + - component: {fileID: 1128910017} + m_Layer: 0 + m_Name: Camera1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1128910013 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1128910012} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 911709187} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} +--- !u!20 &1128910017 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1128910012} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + 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: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!1 &1844795434 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1844795435} + - component: {fileID: 1844795439} + m_Layer: 0 + m_Name: Camera3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1844795435 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1844795434} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: -0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 911709187} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 270, z: 0} +--- !u!20 &1844795439 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1844795434} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + 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: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!1 &1927869132 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1927869134} + - component: {fileID: 1927869133} + m_Layer: 0 + m_Name: GPUTrailIndirectCullingSample + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1927869133 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1927869132} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 976dc38227ec0784fb630ff2d0b49f26, type: 3} + m_Name: + m_EditorClassIdentifier: + _cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + _life: 1 + _inputPerSec: 60 + _inputNumMax: 5 + _lerpType: 0 + _minNodeDistance: 0.1 + _startWidth: 0.05 + _endWidth: 0.05 + _cullingCS: {fileID: 7200000, guid: 4d2092e994db09747aba3bb6375f54c7, type: 3} + _cullingEnable: 1 + _particle: + _particleCS: {fileID: 7200000, guid: 16daaa733f6a1194394beb0d2f0d6fb9, type: 3} + _particleNum: 100000 + _startSpeed: 0.5 + _forceRate: 0.1 + _damping: 0.99 + _gravity: 0.0001 + _bounds: {x: 150, y: 50, z: 150} +--- !u!4 &1927869134 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1927869132} + 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: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity.meta new file mode 100644 index 000000000..42f2d519f --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectCullingSample.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1c58eccb616ffaa4abc8f41d4f27ec8b +DefaultImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.meta new file mode 100644 index 000000000..630dcb8c4 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5ac0b91fd841f424d8d05418be4c6b9c +folderAsset: yes +timeCreated: 1484820531 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity new file mode 100644 index 000000000..0d105ff7f --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity @@ -0,0 +1,507 @@ +%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.2, g: 0.2, b: 0.2, a: 1} + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 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 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 1 + m_BakeResolution: 50 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 0 + 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: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 1821185769} +--- !u!196 &5 +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.16666666 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &104940725 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 104940730} + - component: {fileID: 104940729} + - component: {fileID: 104940727} + - component: {fileID: 104940726} + - component: {fileID: 104940728} + 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 &104940726 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!124 &104940727 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!114 &104940728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 104940730} + volumeLayer: + serializedVersion: 2 + m_Bits: 256 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 0 + antialiasingMode: 3 + temporalAntialiasing: + jitterSpread: 0.75 + sharpness: 0.25 + stationaryBlending: 0.95 + motionBlending: 0.85 + subpixelMorphologicalAntialiasing: + quality: 2 + fastApproximateAntialiasing: + fastMode: 0 + keepAlpha: 0 + fog: + enabled: 1 + excludeSkybox: 1 + debugLayer: + lightMeter: + width: 512 + height: 256 + showCurves: 1 + histogram: + width: 512 + height: 256 + channel: 3 + waveform: + exposure: 0.12 + height: 256 + vectorscope: + size: 256 + exposure: 0.12 + overlaySettings: + linearDepth: 0 + motionColorIntensity: 4 + motionGridSize: 64 + colorBlindnessType: 0 + colorBlindnessStrength: 1 + m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} + m_ShowToolkit: 0 + m_ShowCustomSorter: 0 + breakBeforeColorGrading: 0 + m_BeforeTransparentBundles: [] + m_BeforeStackBundles: [] + m_AfterStackBundles: [] +--- !u!20 &104940729 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.397, g: 0.397, b: 0.397, a: 0.019607844} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + 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: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &104940730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -100} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 310526803} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &310526802 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 310526803} + - component: {fileID: 310526804} + m_Layer: 0 + m_Name: CameraCenter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &310526803 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -25, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 104940730} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &310526804 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 47e64413aeb5ae740b410d70fb05d20c, type: 3} + m_Name: + m_EditorClassIdentifier: + rotSpeed: {x: 0, y: 1, z: 0} +--- !u!1 &1812750579 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1812750581} + - component: {fileID: 1812750580} + m_Layer: 8 + m_Name: PP + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1812750580 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1812750579} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 11400000, guid: 59a61f0cd928369448838883100e06e6, type: 2} + isGlobal: 1 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!4 &1812750581 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1812750579} + 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: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!850595691 &1821185769 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 3 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 0 + m_BakeBackend: 0 + m_LightmapMaxSize: 1024 + m_BakeResolution: 50 + m_Padding: 2 + m_TextureCompression: 0 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 1 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 1 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 +--- !u!1 &1988754119 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988754121} + - component: {fileID: 1988754122} + - component: {fileID: 1988754120} + m_Layer: 0 + m_Name: GPUTrailIndirectSample + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1988754120 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988754119} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 13f1fa636e0245e42be783568a76e3d6, type: 3} + m_Name: + m_EditorClassIdentifier: + NoiseTexture: {fileID: 2800000, guid: 7c0a392de8821f345824a79dea0d0d41, type: 3} +--- !u!4 &1988754121 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988754119} + 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: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1988754122 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988754119} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 665b0a84258e7534787071e45a68c201, type: 3} + m_Name: + m_EditorClassIdentifier: + Cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + MaterialShared: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + Life: 10 + InputPerSec: 60 + InputNumMax: 5 + LerpType: 0 + MINNodeDistance: 0.1 + StartWidth: 0.1 + EndWidth: 0.333 + Draw: 1 + _particle: + _particleCS: {fileID: 7200000, guid: 16daaa733f6a1194394beb0d2f0d6fb9, type: 3} + _particleNum: 1000 + _startSpeed: 1 + _forceRate: 0.15 + _damping: 0.95 + _gravity: 0.001 + _bounds: {x: 100, y: 50, z: 100} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity.meta new file mode 100644 index 000000000..06c328308 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 34434622149c0594f86fe9841b125833 +DefaultImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs new file mode 100644 index 000000000..980238d14 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using System.Runtime.InteropServices; + +public class GPUTrailIndirectCullingSample : GPUTrailIndirectCulling +{ + public GPUTrailIndirectSampleParticle _particle; + + protected override int TrailNumMax + { + get + { + return _particle._particleNum; + } + } + + protected override void Awake() + { + base.Awake(); + + _particle.Init(); + } + + + + protected override bool UpdateInputBuffer() + { + _particle.UpdateInputBuffer(_inputBuffer); + return true; + } + + protected override void ReleaseBuffer() + { + base.ReleaseBuffer(); + + _particle.ReleaseBuffer(); + } +} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs.meta new file mode 100644 index 000000000..c9463956b --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectCullingSample.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 976dc38227ec0784fb630ff2d0b49f26 +timeCreated: 1485156615 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs new file mode 100644 index 000000000..652fb2a02 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs @@ -0,0 +1,38 @@ +using UnityEngine; +using System.Runtime.InteropServices; +using System; + +public class GPUTrailIndirectSample : GPUTrailIndirect +{ + public GPUTrailIndirectSampleParticle _particle; + + protected override int TrailNumMax + { + get + { + return _particle._particleNum; + } + } + + protected override void Awake() + { + base.Awake(); + + _particle.Init(); + } + + + + protected override bool UpdateInputBuffer() + { + _particle.UpdateInputBuffer(_inputBuffer); + return true; + } + + protected override void ReleaseBuffer() + { + base.ReleaseBuffer(); + + _particle.ReleaseBuffer(); + } +} \ No newline at end of file diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs.meta new file mode 100644 index 000000000..ef292b2b0 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSample.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 665b0a84258e7534787071e45a68c201 +timeCreated: 1485429859 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - _cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs new file mode 100644 index 000000000..8b2d47edf --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs @@ -0,0 +1,64 @@ + +using UnityEngine; +using System.Runtime.InteropServices; + + +[System.Serializable] +public class GPUTrailIndirectSampleParticle +{ + struct Particle + { + public Vector3 velocity; + public Vector3 pos; + } + + ComputeBuffer _particleBuffer; + + + public ComputeShader _particleCS; + public int _particleNum = 1000; + public float _startSpeed = 1f; + public float _forceRate = 0.01f; + public float _damping = 0.99f; + public float _gravity = 0.01f; + public Vector3 _bounds; + + public void Init() + { + _particleBuffer = new ComputeBuffer(_particleNum, Marshal.SizeOf(typeof(Particle))); + + var data = new Particle[_particleBuffer.count]; + for (var i = 0; i < data.Length; ++i) + { + data[i] = new Particle + { + pos = -Vector3.up * _bounds.y * 0.5f, + velocity = Vector3.Scale(Random.insideUnitSphere, Vector3.up * _startSpeed) + }; + } + + _particleBuffer.SetData(data); + } + + const int NUM_THREAD_X = 8; + public void UpdateInputBuffer(ComputeBuffer inputBuffer) + { + _particleCS.SetFloat("_Time", Time.time); + _particleCS.SetFloat("_ForceRate", _forceRate); + _particleCS.SetFloat("_Damping", _damping); + _particleCS.SetFloat("_Gravity", _gravity); + _particleCS.SetFloats("_Bounds", _bounds.x, _bounds.y, _bounds.z); + + + var kernel = _particleCS.FindKernel("CSMain"); + _particleCS.SetBuffer(kernel, "_ParticleBuffer", _particleBuffer); + _particleCS.SetBuffer(kernel, "_InputBuffer", inputBuffer); + + _particleCS.Dispatch(kernel, Mathf.CeilToInt((float)_particleBuffer.count / NUM_THREAD_X), 1, 1); + } + + public void ReleaseBuffer() + { + if (_particleBuffer != null) _particleBuffer.Release(); + } +} \ No newline at end of file diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs.meta new file mode 100644 index 000000000..a7fbeae78 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticle.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a3c656aeaa021ad47b3436f65d3d8ad8 +timeCreated: 1485156615 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - cs: {fileID: 7200000, guid: 5e0b0e8f0f658774f9dca7b0695eacd4, type: 3} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute new file mode 100644 index 000000000..8c56e5b45 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute @@ -0,0 +1,56 @@ +#pragma kernel CSMain + +#define NUM_THREAD_X 16 + +struct Particle +{ + float3 velocity; + float3 pos; +}; + +float _Time; +float _ForceRate; +float _Damping; +float _Gravity; +float3 _Bounds; +RWStructuredBuffer _ParticleBuffer; +RWStructuredBuffer _InputBuffer; + +float rand(float2 co){ + return frac(sin(dot(co.xy ,float2(12.9898,78.233))) * 43758.5453); +} + +[numthreads(NUM_THREAD_X,1,1)] +void CSMain (uint3 id : SV_DispatchThreadID) +{ + uint idx = id.x; + + Particle particle = _ParticleBuffer[idx]; + float3 force = float3 ( + rand(float2(idx, _Time )) - 0.5, + rand(float2(idx, _Time*2)) - 0.5, + rand(float2(idx, _Time*3)) - 0.5 + ); + + float3 velocity = particle.velocity * _Damping + force * _ForceRate; + + velocity.y -= _Gravity; + + float3 pos = particle.pos + velocity; + + float3 overPlus = pos - _Bounds; + if ( overPlus.x > 0) { pos.x = _Bounds.x; velocity.x *= -0.95;} + if ( overPlus.y > 0) { pos.y = _Bounds.y; velocity.y *= -0.95;} + if ( overPlus.z > 0) { pos.z = _Bounds.z; velocity.z *= -0.95;} + + float3 overMinus = pos + _Bounds; + if ( overMinus.x < 0){ pos.x = -_Bounds.x; velocity.x *= -0.95;} + if ( overMinus.y < 0){ pos.y = -_Bounds.y; velocity.y *= -0.95;} + if ( overMinus.z < 0){ pos.z = -_Bounds.z; velocity.z *= -0.95;} + + particle.pos = pos; + particle.velocity = velocity; + _ParticleBuffer[idx] = particle; + + _InputBuffer[idx] = particle.pos; +} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute.meta new file mode 100644 index 000000000..4bf9ebd74 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailIndirectSample/GPUTrailIndirectSampleParticleCS.compute.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 16daaa733f6a1194394beb0d2f0d6fb9 +timeCreated: 1484821669 +licenseType: Pro +ComputeShaderImporter: + currentAPIMask: 4 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.meta new file mode 100644 index 000000000..5aea10ae4 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 45abad6e576141f4bb85acdbebe2dc3e +folderAsset: yes +timeCreated: 1463641382 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity new file mode 100644 index 000000000..4ccd72108 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity @@ -0,0 +1,945 @@ +%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: 8 + 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.2, g: 0.2, b: 0.2, a: 1} + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientIntensity: 1 + 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} +--- !u!157 &4 +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: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 9 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 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: 0 + 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: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &5 +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.16666666 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &104940725 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 104940730} + - component: {fileID: 104940729} + - component: {fileID: 104940728} + - component: {fileID: 104940727} + - component: {fileID: 104940726} + 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 &104940726 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!124 &104940727 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!92 &104940728 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!20 &104940729 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + 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: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &104940730 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -15} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 310526803} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &162078551 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 162078555} + - component: {fileID: 162078554} + - component: {fileID: 162078553} + - component: {fileID: 162078552} + m_Layer: 0 + m_Name: Quad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &162078552 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 162078551} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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!64 &162078553 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 162078551} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 0 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &162078554 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 162078551} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &162078555 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 162078551} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: -0.7071068} + m_LocalPosition: {x: -50, y: 0, z: 0} + m_LocalScale: {x: 100, y: 100, z: 100} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &214960284 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 214960285} + m_Layer: 0 + m_Name: Room + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &214960285 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 214960284} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 5, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: + - {fileID: 1556364049} + - {fileID: 1072976965} + - {fileID: 1574509241} + - {fileID: 2009213998} + - {fileID: 162078555} + - {fileID: 418943869} + - {fileID: 1500030161} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &310526802 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 310526803} + - component: {fileID: 310526804} + m_Layer: 0 + m_Name: CemeraCenter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &310526803 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 4.3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 104940730} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &310526804 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 47e64413aeb5ae740b410d70fb05d20c, type: 3} + m_Name: + m_EditorClassIdentifier: + rotSpeed: {x: 0, y: 10, z: 0} +--- !u!1 &418943865 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 418943869} + - component: {fileID: 418943868} + - component: {fileID: 418943867} + - component: {fileID: 418943866} + m_Layer: 0 + m_Name: Quad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &418943866 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 418943865} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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!64 &418943867 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 418943865} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 0 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &418943868 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 418943865} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &418943869 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 418943865} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: -0.7071068} + m_LocalPosition: {x: 0, y: 50, z: 0} + m_LocalScale: {x: 100, y: 100, z: 100} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &567255964 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalPosition.y + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 439478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &1072976961 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1072976965} + - component: {fileID: 1072976964} + - component: {fileID: 1072976963} + - component: {fileID: 1072976962} + m_Layer: 0 + m_Name: Quad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1072976962 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1072976961} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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!64 &1072976963 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1072976961} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 0 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1072976964 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1072976961} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1072976965 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1072976961} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 50} + m_LocalScale: {x: 100, y: 100, z: 100} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1451545202 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1451545204} + - component: {fileID: 1451545203} + m_Layer: 0 + m_Name: Generator + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1451545203 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1451545202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c4a3d260b8b4b1049bf05a10bcc97301, type: 3} + m_Name: + m_EditorClassIdentifier: + prefab: {fileID: 139478, guid: 34e81c32db6482d4c82c12160b1d7071, type: 2} + num: 1 + radius: 4 +--- !u!4 &1451545204 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1451545202} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1500030159 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1500030161} + - component: {fileID: 1500030160} + m_Layer: 0 + m_Name: Point light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1500030160 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1500030159} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 2 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1.28 + m_Range: 30 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + 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: 1 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1500030161 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1500030159} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 40, z: 0} + m_LocalScale: {x: 1000, y: 1000, z: 1000} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1556364045 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1556364049} + - component: {fileID: 1556364048} + - component: {fileID: 1556364047} + - component: {fileID: 1556364046} + m_Layer: 0 + m_Name: Quad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1556364046 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1556364045} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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!64 &1556364047 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1556364045} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 0 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1556364048 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1556364045} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1556364049 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1556364045} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: -50, z: 0} + m_LocalScale: {x: 100, y: 100, z: 100} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1574509237 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1574509241} + - component: {fileID: 1574509240} + - component: {fileID: 1574509239} + - component: {fileID: 1574509238} + m_Layer: 0 + m_Name: Quad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1574509238 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1574509237} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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!64 &1574509239 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1574509237} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 0 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1574509240 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1574509237} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1574509241 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1574509237} + m_LocalRotation: {x: 0, y: 1, z: 0, w: -0.00000004371139} + m_LocalPosition: {x: 0, y: 0, z: -50} + m_LocalScale: {x: 100, y: 100, z: 100} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2009213994 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2009213998} + - component: {fileID: 2009213997} + - component: {fileID: 2009213996} + - component: {fileID: 2009213995} + m_Layer: 0 + m_Name: Quad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &2009213995 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2009213994} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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!64 &2009213996 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2009213994} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 0 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &2009213997 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2009213994} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &2009213998 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2009213994} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 100, y: 100, z: 100} + m_Children: [] + m_Father: {fileID: 214960285} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity.meta new file mode 100644 index 000000000..0b5b1ba97 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5e752ff29789a674abd0569dfcb75579 +DefaultImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs new file mode 100644 index 000000000..c207adda1 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using System.Collections; + +public class AutoRotate : MonoBehaviour { + + public Vector3 rotSpeed; + + + void Update () { + + transform.Rotate(rotSpeed * Time.deltaTime); + + } +} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs.meta new file mode 100644 index 000000000..e1bc59577 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47e64413aeb5ae740b410d70fb05d20c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs new file mode 100644 index 000000000..f12c53109 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs @@ -0,0 +1,52 @@ +using UnityEngine; +using System.Collections; + +public class GenerateSphere : MonoBehaviour { + + public GameObject prefab; + public int num; + public float radius; + + void Awake () { + + for(var i=0; i().velocity = Random.insideUnitSphere * 10f; + } + } + + } + + void Update() + { + if ( Input.GetMouseButton(0)) + { + var pos = Camera.main.transform.position; + var foward = Camera.main.transform.forward; + + var go = Instantiate(prefab, pos + foward*2f, Quaternion.identity) as GameObject; + if ( go ) + { + go.transform.SetParent(transform); + go.GetComponent().velocity = Camera.main.transform.TransformVector(Quaternion.Euler(Random.Range(-30f, 10f), 0f, 0f) * Vector3.forward * Random.Range(10f, 100f)); + } + } + } + + public void OnGUI() + { + GUILayout.Label("SphereCount: " + transform.childCount); + if ( GUILayout.Button("Clear") ) + { + var num = transform.childCount; + for (var i = 0; i < num; ++i) + Destroy(transform.GetChild(i).gameObject); + } + + } +} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs.meta new file mode 100644 index 000000000..7dffe7737 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/GenerateSphere.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4a3d260b8b4b1049bf05a10bcc97301 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial new file mode 100644 index 000000000..e9011005d --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Sphere + dynamicFriction: 0 + staticFriction: 0 + bounciness: 1 + frictionCombine: 0 + bounceCombine: 0 + frictionDirection2: {x: 0, y: 0, z: 0} + dynamicFriction2: 0 + staticFriction2: 0 diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial.meta new file mode 100644 index 000000000..27ad2ee96 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.physicMaterial.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6b91e96dd2563eb45b1def3be8081baa +NativeFormatImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab new file mode 100644 index 000000000..1f5f5021d --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab @@ -0,0 +1,162 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &139476 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 439476} + - component: {fileID: 11439478} + m_Layer: 0 + m_Name: GPUTrail + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &139478 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 439478} + - component: {fileID: 3339478} + - component: {fileID: 13539478} + - component: {fileID: 2339478} + - component: {fileID: 5461184} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &439476 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139476} + 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: 439478} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &439478 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139478} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 5, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_Children: + - {fileID: 439476} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &2339478 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139478} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, 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_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &3339478 +MeshFilter: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139478} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!54 &5461184 +Rigidbody: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139478} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 1 +--- !u!114 &11439478 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139476} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6af463c098fe7e445addb01c1c7e5c49, type: 3} + m_Name: + m_EditorClassIdentifier: + _cs: {fileID: 7200000, guid: f88322fe9ecec1e41b2a237407abddad, type: 3} + _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + _life: 3 + _inputPerSec: 60 + _inputNumMax: 5 + _lerpType: 1 + _minNodeDistance: 0.1 + _startWidth: 0.1 + _endWidth: 0.1 + _debugDrawLogPoint: 0 + _debugDrawVertexBuf: 0 +--- !u!135 &13539478 +SphereCollider: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139478} + m_Material: {fileID: 13400000, guid: 6b91e96dd2563eb45b1def3be8081baa, type: 2} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 139478} + m_IsPrefabParent: 1 diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab.meta new file mode 100644 index 000000000..75af97c13 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 34e81c32db6482d4c82c12160b1d7071 +NativeFormatImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline.meta new file mode 100644 index 000000000..0b80fb4a7 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cc699637ce28d0f4796f8299f7e06255 +folderAsset: yes +timeCreated: 1463641411 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs b/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs new file mode 100644 index 000000000..d162b6897 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +public class GPUTrailSplineSample : MonoBehaviour +{ + public int step = 10; + public List _transforms = new List(); + + + public void OnDrawGizmos() + { + var stepInv = 1f / step; + for(var i=2; i<_transforms.Count; ++i) + { + for(var s=0; s< step; ++s) + { + var prev = _transforms[i - 2].position; + var start = _transforms[i - 1].position; + var end = _transforms[i].position; + + var pos = GPUTrailSpline.CatmullRom(stepInv * s, prev, start, end); + var posNext = GPUTrailSpline.CatmullRom(stepInv * (s+1), prev, start, end); + + + Gizmos.DrawLine(pos, posNext); + } + } + } +} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs.meta new file mode 100644 index 000000000..932fcb0b8 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSpline/GPUTrailSplineSample.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2395ee23edd5af441965999fca9b7105 +timeCreated: 1463641475 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity b/Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity new file mode 100644 index 000000000..483fb202b --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity @@ -0,0 +1,915 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + 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.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 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} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &46407785 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 46407786} + - 33: {fileID: 46407789} + - 23: {fileID: 46407787} + m_Layer: 0 + m_Name: Sphere (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &46407786 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46407785} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 2.27, y: 15.45, z: 0.9} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 2 +--- !u!23 &46407787 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46407785} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &46407789 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46407785} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &151062349 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 151062351} + - 114: {fileID: 151062350} + m_Layer: 0 + m_Name: GPUTrailSpline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &151062350 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 151062349} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2395ee23edd5af441965999fca9b7105, type: 3} + m_Name: + m_EditorClassIdentifier: + step: 10 + _transforms: + - {fileID: 1370784389} + - {fileID: 1941937444} + - {fileID: 46407786} + - {fileID: 1528504086} + - {fileID: 1374583017} + - {fileID: 1844678454} + - {fileID: 1675057710} + - {fileID: 1659699795} + - {fileID: 1560026041} + - {fileID: 1039563666} +--- !u!4 &151062351 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 151062349} + 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: + - {fileID: 1370784389} + - {fileID: 1941937444} + - {fileID: 46407786} + - {fileID: 1528504086} + - {fileID: 1374583017} + - {fileID: 1844678454} + - {fileID: 1675057710} + - {fileID: 1659699795} + - {fileID: 1560026041} + - {fileID: 1039563666} + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &356296280 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 356296285} + - 20: {fileID: 356296284} + - 92: {fileID: 356296283} + - 124: {fileID: 356296282} + - 81: {fileID: 356296281} + 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 &356296281 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 356296280} + m_Enabled: 1 +--- !u!124 &356296282 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 356296280} + m_Enabled: 1 +--- !u!92 &356296283 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 356296280} + m_Enabled: 1 +--- !u!20 &356296284 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 356296280} + 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: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &356296285 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 356296280} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &608905212 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 608905214} + - 108: {fileID: 608905213} + 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 &608905213 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 608905212} + m_Enabled: 1 + serializedVersion: 6 + 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: 2 + m_Resolution: -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_BounceIntensity: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_AreaSize: {x: 1, y: 1} +--- !u!4 &608905214 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 608905212} + m_LocalRotation: {x: 0.40821794, y: -0.23456973, z: 0.109381676, w: 0.87542605} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1039563665 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1039563666} + - 33: {fileID: 1039563669} + - 23: {fileID: 1039563667} + m_Layer: 0 + m_Name: Sphere (9) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1039563666 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1039563665} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.74, y: 22.19, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 9 +--- !u!23 &1039563667 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1039563665} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1039563669 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1039563665} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1370784388 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1370784389} + - 33: {fileID: 1370784392} + - 23: {fileID: 1370784390} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1370784389 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1370784388} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -7.62, y: 12.728808, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 0 +--- !u!23 &1370784390 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1370784388} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1370784392 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1370784388} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1374583016 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1374583017} + - 33: {fileID: 1374583020} + - 23: {fileID: 1374583018} + m_Layer: 0 + m_Name: Sphere (4) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1374583017 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1374583016} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 5.08, y: 7.52, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 4 +--- !u!23 &1374583018 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1374583016} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1374583020 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1374583016} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1528504085 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1528504086} + - 33: {fileID: 1528504089} + - 23: {fileID: 1528504087} + m_Layer: 0 + m_Name: Sphere (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1528504086 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1528504085} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 15.19, y: 18.64, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 3 +--- !u!23 &1528504087 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1528504085} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1528504089 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1528504085} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1560026040 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1560026041} + - 33: {fileID: 1560026044} + - 23: {fileID: 1560026042} + m_Layer: 0 + m_Name: Sphere (8) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1560026041 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1560026040} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.2332458, y: 24.06, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 8 +--- !u!23 &1560026042 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1560026040} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1560026044 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1560026040} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1659699794 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1659699795} + - 33: {fileID: 1659699798} + - 23: {fileID: 1659699796} + m_Layer: 0 + m_Name: Sphere (7) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1659699795 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1659699794} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -28, y: 10.7, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 7 +--- !u!23 &1659699796 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1659699794} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1659699798 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1659699794} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1675057709 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1675057710} + - 33: {fileID: 1675057713} + - 23: {fileID: 1675057711} + m_Layer: 0 + m_Name: Sphere (6) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675057710 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1675057709} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -35.1, y: 2.8, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 6 +--- !u!23 &1675057711 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1675057709} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1675057713 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1675057709} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1844678453 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1844678454} + - 33: {fileID: 1844678457} + - 23: {fileID: 1844678455} + m_Layer: 0 + m_Name: Sphere (5) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1844678454 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1844678453} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -15.41, y: 4.56, z: -7.3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 5 +--- !u!23 &1844678455 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1844678453} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1844678457 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1844678453} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1941937443 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1941937444} + - 33: {fileID: 1941937447} + - 23: {fileID: 1941937445} + m_Layer: 0 + m_Name: Sphere (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1941937444 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1941937443} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.67, y: 15.59, z: -2.5895195} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 151062351} + m_RootOrder: 1 +--- !u!23 &1941937445 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1941937443} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 1 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1941937447 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1941937443} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} diff --git a/Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity.meta b/Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity.meta new file mode 100644 index 000000000..dbafe10ee --- /dev/null +++ b/Assets/Plugins/GPUTrail/Sample/GPUTrailSplineSample.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f29045ba16334440adcef4ad73c0a46 +timeCreated: 1463641449 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Scripts.meta b/Assets/Plugins/GPUTrail/Scripts.meta new file mode 100644 index 000000000..2e83ac35d --- /dev/null +++ b/Assets/Plugins/GPUTrail/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 87add697784154b4a89202c61a7db91a +folderAsset: yes +timeCreated: 1484908277 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs b/Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs new file mode 100644 index 000000000..91d34d529 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs @@ -0,0 +1,175 @@ +using UnityEngine; +using System.Linq; +using System.Runtime.InteropServices; + +public abstract class GPUTrailBase : MonoBehaviour +{ + #region TypeDefine + + public struct Node + { + public Vector3 pos; + public float time; + public Color color; + } + + public struct Vertex + { + public Vector3 pos; + public Vector2 uv; + public Color color; + } + + #endregion + + + public ComputeShader Cs; + public Material MaterialShared; + public float Life = 10f; + public float InputPerSec = 60f; + public int InputNumMax = 5; + public float MINNodeDistance = 0.1f; + public float StartWidth = 1f; + public float EndWidth = 1f; + public bool Draw = true; + + protected int nodeNumPerTrail; + + protected ComputeBuffer nodeBuffer; + protected ComputeBuffer vertexBuffer; + protected ComputeBuffer indexBuffer; + + protected Material material; + + protected abstract int TrailNumMax { get; } + public int NodeBufferSize { get { return TrailNumMax * nodeNumPerTrail; } } + public int VertexBufferSize { get { return NodeBufferSize * 2; } } + + public int VertexNumPerTrail { get { return nodeNumPerTrail * 2; } } + public int IndexNumPerTrail { get { return (nodeNumPerTrail - 1) * 6; } } + + protected virtual void Awake() + { + ReleaseBuffer(); + + nodeNumPerTrail = Mathf.CeilToInt(Life * InputPerSec); + InitBuffer(); + + material = new Material(MaterialShared); + } + + + protected virtual void InitBuffer() + { + nodeBuffer = new ComputeBuffer(NodeBufferSize, Marshal.SizeOf(typeof(Node))); + nodeBuffer.SetData(Enumerable.Repeat(default(Node), nodeBuffer.count).ToArray()); + + vertexBuffer = new ComputeBuffer(VertexBufferSize, Marshal.SizeOf(typeof(Vertex))); // 1 node to 2 vtx(left,right) + vertexBuffer.SetData(Enumerable.Repeat(default(Vertex), vertexBuffer.count).ToArray()); + + // 各Nodeの最後と次のNodeの最初はポリゴンを繋がないので-1 + var indexData = new int[IndexNumPerTrail]; + var iidx = 0; + for (var iNode = 0; iNode < nodeNumPerTrail - 1; ++iNode) + { + var offset = +iNode * 2; + indexData[iidx++] = 0 + offset; + indexData[iidx++] = 1 + offset; + indexData[iidx++] = 2 + offset; + indexData[iidx++] = 2 + offset; + indexData[iidx++] = 1 + offset; + indexData[iidx++] = 3 + offset; + } + + indexBuffer = new ComputeBuffer(indexData.Length, Marshal.SizeOf(typeof(uint))); // 1 node to 2 triangles(6vertexs) + indexBuffer.SetData(indexData); + } + + + + protected virtual void ReleaseBuffer() + { + new[] { nodeBuffer, vertexBuffer, indexBuffer } + .Where(b => b != null) + .ToList().ForEach(buffer => + { + buffer.Release(); + }); + } + + + protected virtual bool IsCameraOrthographic { get { return Camera.main.orthographic; } } + protected virtual Vector3 ToOrthographicCameraDir { get { return -Camera.main.transform.forward; } } + protected virtual Vector3 CameraPos { get { return Camera.main.transform.position; } } + + protected void SetCommonParameterForCs() + { + _SetCommonParameterForCS(Cs); + } + protected void _SetCommonParameterForCS(ComputeShader cs) + { + cs.SetInt("_TrailNum", TrailNumMax); + cs.SetInt("_NodeNumPerTrail", nodeNumPerTrail); + + cs.SetInt("_InputNodeNum", Mathf.Min(InputNumMax, Mathf.FloorToInt(_inputNumCurrent))); + //cs.SetInt("_LerpType", (int)_lerpType); + cs.SetFloat("_MinNodeDistance", MINNodeDistance); + cs.SetFloat("_Time", Time.time); + cs.SetFloat("_Life", Life); + + cs.SetVector("_ToCameraDir", IsCameraOrthographic ? ToOrthographicCameraDir : Vector3.zero); + cs.SetVector("_CameraPos", CameraPos); + cs.SetFloat("_StartWidth", StartWidth); + cs.SetFloat("_EndWidth", EndWidth); + } + + float _inputNumCurrent; + protected virtual void LateUpdate() + { + _inputNumCurrent = Time.deltaTime * InputPerSec + (_inputNumCurrent - Mathf.Floor(_inputNumCurrent)); // continue under dicimal + UpdateVertex(); + } + + protected abstract void UpdateVertex(); + + + void OnRenderObject() + { + if (Draw) + { + if ((Camera.current.cullingMask & (1 << gameObject.layer)) == 0) + { + return; + } + + OnRenderObjectInternal(); + } + } + + + protected virtual void SetMaterialParam() { } + protected virtual void SetCommonMaterialParam() + { + SetMaterialParam(); + material.SetInt("_VertexNumPerTrail", VertexNumPerTrail); + material.SetBuffer("_IndexBuffer", indexBuffer); + material.SetBuffer("_VertexBuffer", vertexBuffer); + } + + protected virtual void OnRenderObjectInternal() + { + SetCommonMaterialParam(); + + material.DisableKeyword("GPUTRAIL_TRAIL_INDEX_ON"); + material.SetPass(0); + + Graphics.DrawProceduralNow(MeshTopology.Triangles, indexBuffer.count, TrailNumMax); + } + + public void OnDestroy() + { + ReleaseBuffer(); + + Destroy(material); + } +} diff --git a/Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs.meta b/Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs.meta new file mode 100644 index 000000000..9a297a6e3 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Scripts/GPUTrailBase.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 57deac542dd2b2a40bde9a026090d417 +timeCreated: 1485156582 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - cs: {instanceID: 0} + - _material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs b/Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs new file mode 100644 index 000000000..6977c519d --- /dev/null +++ b/Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using System.Collections; + +public class GPUTrailSpline : MonoBehaviour +{ + /// + /// start~end をつなぐ曲線上の点をtに応じて求める + /// http://t-pot.com/program/2_3rdcurve/index.html + /// + /// 0f~1f + /// + /// + /// + /// + public static Vector3 CatmullRom(float t, Vector3 prev, Vector3 start, Vector3 end) + { + var t2 = t * t; + + return + 0.5f * ( + t2 * (prev - 2f * start + end) + + t * (-prev + end) + ) + + start; + } +} diff --git a/Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs.meta b/Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs.meta new file mode 100644 index 000000000..c8d75b77a --- /dev/null +++ b/Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 45d00a08e3faffd4a953ac1e71b719b4 +timeCreated: 1484652959 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Shaders.meta b/Assets/Plugins/GPUTrail/Shaders.meta new file mode 100644 index 000000000..a6c1a5b60 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e8f569d24bcf60b429791c2b847eda51 +folderAsset: yes +timeCreated: 1484908254 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute new file mode 100644 index 000000000..046f41a90 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute @@ -0,0 +1,106 @@ +#pragma kernel CreateWidth + +#define NUM_THREAD_X 16 + +#include "GPUTrailVariablesCS.compute" + +int _InputNum; +int _TotalInputIdx; +uint _BufferSize; +float _StartTime; + +StructuredBuffer _InputBuffer; +RWStructuredBuffer _NodeBuffer; +RWStructuredBuffer _VertexBuffer; + + +// idx must 0~_BufferSize-1 +int GetInputBufIdx(int idx) +{ + //今回のInputに含まれるIdx + int inputFirst = (_TotalInputIdx - _InputNum + 1) % _BufferSize; + int idxWithOffset = idx + ((idx < inputFirst) ? _BufferSize : 0); + + return ((inputFirst <= idxWithOffset) && (idxWithOffset < (inputFirst + _InputNum))) + ? idxWithOffset - inputFirst + : -1; +} + +Node GetNode(int idx) +{ + int inputBufIdx = GetInputBufIdx(idx); + if ( inputBufIdx >= 0 ) + { + return _InputBuffer[inputBufIdx]; + } + + return _NodeBuffer[min(idx, _TotalInputIdx)]; // unused buffer is map to last input buffer +} + +[numthreads(NUM_THREAD_X,1,1)] +void CreateWidth (uint3 id : SV_DispatchThreadID) +{ + int idx = id.x; + if ( idx < (int)_BufferSize ) + { + int inputIdxLast = _TotalInputIdx % _BufferSize; + int inputBufIdx = GetInputBufIdx(idx); + if ( inputBufIdx >= 0 ) + { + _NodeBuffer[idx] = _InputBuffer[inputBufIdx]; + } + + + Vertex v0 = GetDefaultVertex(); + Vertex v1 = GetDefaultVertex(); + + Node node = GetNode(idx); + float3 pos = node.pos; + + float3 dirPrev = float3(0,0,0); + float3 dirNext = float3(0,0,0); + if ( idx <= _TotalInputIdx ) + { + int prevIdx = (idx-1 +_BufferSize) % _BufferSize; + bool prevEnable = (prevIdx != inputIdxLast); + if ( prevEnable ) + { + Node nodePrev = GetNode(prevIdx); + dirPrev = normalize(pos - nodePrev.pos); + } + + int nextIdx = (idx+1) % _BufferSize; + bool nextEnable = idx != inputIdxLast; + if ( nextEnable ) + { + Node nodeNext = GetNode(nextIdx); + dirNext = normalize(nodeNext.pos - pos); + } + } + + + float life = min(_Life, _Time - _StartTime); + float rate = life <= 0 ? 1 : max(0, 1 - ((_Time - node.time) / life)); + + float3 dir = normalize(dirPrev + dirNext); + + float3 toCameraDir = calcToCameraDir(pos); + float3 right = normalize(cross(dir, toCameraDir)) * lerp(_EndWidth, _StartWidth, rate) * 0.5f; + + v0.pos = pos - right; + v0.uv = float2(rate, 0); + v0.color = node.color; + + v1.pos = pos + right; + v1.uv = float2(rate, 1); + v1.color = node.color; + + int drawIdx = inputIdxLast - (int)idx; + drawIdx = (drawIdx + _BufferSize) % _BufferSize; + + + uint vId = drawIdx * 2; + _VertexBuffer[vId] = v0; + _VertexBuffer[vId+1] = v1; + } +} diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute.meta new file mode 100644 index 000000000..e7b8370fe --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.compute.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f88322fe9ecec1e41b2a237407abddad +timeCreated: 1484808801 +licenseType: Pro +ComputeShaderImporter: + currentAPIMask: 4 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader new file mode 100644 index 000000000..11faeb436 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader @@ -0,0 +1,66 @@ +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + +Shader "GPUTrail/StartEndColor" { +Properties { + [HDR]_StartColor("StartColor", Color) = (1,1,1,1) + [HDR]_EndColor("EndColor", Color) = (0,0,0,1) +} + +SubShader { +Pass{ + Tags { "RenderType"="Opaque" } +// Cull Off Fog { Mode Off } +// ZWrite Off +// Blend SrcAlpha One + + CGPROGRAM + #pragma target 5.0 + #pragma shader_feature GPUTRAIL_TRAIL_INDEX_ON + + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + #include "GPUTrailVariables.cginc" + #include "Assets/Shaders/Dither Functions.cginc" + + struct vs_out { + float4 pos : SV_POSITION; + float4 col : COLOR; + float2 uv : TEXCOORD; + float4 screenPos : TEXCOORD1; + }; + + vs_out vert (uint id : SV_VertexID, uint iId : SV_InstanceID) + { + vs_out Out; + Vertex vtx = GetVertex(id, iId); + + Out.pos = UnityObjectToClipPos(float4(vtx.pos, 1.0)); + Out.uv = vtx.uv; + Out.col = lerp(_EndColor, _StartColor, vtx.uv.x); + Out.screenPos = ComputeScreenPos(float4(vtx.pos, 1.0)); + + return Out; + } + + fixed4 frag (vs_out In) : COLOR0 + { + // Simple quadratic curve "texture" + float x = 2 * In.uv.y - 1; + float a = 1 - x * x; + + // Apply screen space dithering + float2 screenUV = In.screenPos.xy / In.screenPos.w; + ditherClip(screenUV, a); + return In.col * a; + } + + ENDCG + + } +} + +Fallback Off +} + diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader.meta new file mode 100644 index 000000000..1c7bdce34 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrail.shader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: aa7a048c89ecc5c4bad74dee290e8ac2 +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute new file mode 100644 index 000000000..96643e726 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute @@ -0,0 +1,139 @@ +#pragma kernel AddNode +#pragma kernel CreateWidth + +#define NUM_THREAD_X 32 + +#include "GPUTrailVariablesCS.compute" + +//////////////////////////////////////////////////////////////////////////////// +// AddNode +//////////////////////////////////////////////////////////////////////////////// +StructuredBuffer _InputBuffer; +RWStructuredBuffer _TrailBufferW; +RWStructuredBuffer _NodeBufferW; + +[numthreads(NUM_THREAD_X,1,1)] +void AddNode (uint3 id : SV_DispatchThreadID) +{ + uint trailIdx = id.x; + if ( trailIdx < _TrailNum ) + { + Trail trail = _TrailBufferW[trailIdx]; + uint totalInputNum = trail.totalInputNum; + bool isFirst = (totalInputNum==0); + + InputData inputData = _InputBuffer[trailIdx]; + if ( isFirst || (_MinNodeDistance <= distance(inputData.pos, _NodeBufferW[calcNodeIdx(trailIdx, totalInputNum-1)].pos))) + { + Node node; + node.pos = inputData.pos; + node.time = _Time; + node.color = inputData.color; + uint nodeIdx = calcNodeIdx(trailIdx, totalInputNum); + _NodeBufferW[nodeIdx] = node; + + trail.startTime = isFirst ? _Time : trail.startTime; + trail.totalInputNum++; + + _TrailBufferW[trailIdx] = trail; + } + } +} + +//////////////////////////////////////////////////////////////////////////////// +// CreateWidth +//////////////////////////////////////////////////////////////////////////////// +StructuredBuffer _TrailBuffer; +StructuredBuffer _NodeBuffer; +RWStructuredBuffer _VertexBuffer; + + +uint calcPrevIdxInTrail(uint idx) +{ + return (idx + _NodeNumPerTrail-1) % _NodeNumPerTrail; +} +uint calcNextIdxInTrail(uint idx) +{ + return (idx + 1) % _NodeNumPerTrail; +} + +uint calcNodeIdxFromInTrail(uint trailIdx, uint idxInTrail) +{ + return trailIdx * _NodeNumPerTrail + idxInTrail; +} + +Node getNode(uint trailIdx, uint idxInTrail, uint totalInputNum) +{ + idxInTrail = min(idxInTrail, totalInputNum-1); // 未使用ノードのIdxが指定されたら最新のノードを返す + return _NodeBuffer[calcNodeIdxFromInTrail(trailIdx, idxInTrail)]; +} + +float3 calcNodeDir(uint trailIdx, uint nodeIdxInTrail, uint totalInputNum) +{ + float3 dirPrev = float3(0,0,0); + float3 dirNext = float3(0,0,0); + + float3 pos = getNode(trailIdx, nodeIdxInTrail, totalInputNum).pos; + + uint prevIdxInTrail = calcPrevIdxInTrail(nodeIdxInTrail); + uint inputIdxInTrail = calcPrevIdxInTrail(totalInputNum); + + bool prevEnable = (prevIdxInTrail != inputIdxInTrail) && (prevIdxInTrail < totalInputNum); + if ( prevEnable ) + { + dirPrev = normalize(pos - getNode(trailIdx, prevIdxInTrail, totalInputNum).pos); + } + + bool nextEnable = nodeIdxInTrail!= inputIdxInTrail; + if ( nextEnable ) + { + uint nextIdxInTrail = calcNextIdxInTrail(nodeIdxInTrail); + dirNext = normalize(getNode(trailIdx, nextIdxInTrail, totalInputNum).pos - pos); + } + + return normalize(dirPrev + dirNext); +} + +[numthreads(NUM_THREAD_X,1,1)] +void CreateWidth (uint3 id : SV_DispatchThreadID) +{ + uint nodeIdx = id.x; + uint trailIdx = nodeIdx / _NodeNumPerTrail; + if ( trailIdx < _TrailNum ) + { + Trail trail = _TrailBuffer[trailIdx]; + uint totalInputNum = trail.totalInputNum; + uint nodeIdxInTrail = nodeIdx % _NodeNumPerTrail; + + Vertex v0 = GetDefaultVertex(); + Vertex v1 = GetDefaultVertex(); + { + Node node = getNode(trailIdx, nodeIdxInTrail, totalInputNum); + + float life = min(_Life, _Time - trail.startTime); + float rate = life <= 0 ? 1 : max(0, 1 - ((_Time - node.time) / life)); + + float3 pos = node.pos; + float3 dir = calcNodeDir(trailIdx, nodeIdxInTrail, totalInputNum); + + float3 toCameraDir = calcToCameraDir(pos); + float3 right = normalize(cross(dir, toCameraDir)) * lerp(_EndWidth, _StartWidth, rate) * 0.5f; + + v0.pos = pos - right; + v0.uv = float2(rate, 0); + v0.color = node.color; + + v1.pos = pos + right; + v1.uv = float2(rate, 1); + v1.color = node.color; + } + + uint startIdxInTrail = (totalInputNum <= _NodeNumPerTrail) ? 0 : calcNextIdxInTrail(totalInputNum-1); + uint nodeIdxFromStartInTrail = ((nodeIdxInTrail + _NodeNumPerTrail) - startIdxInTrail) % _NodeNumPerTrail; + uint drawIdx = calcNodeIdxFromInTrail(trailIdx, nodeIdxFromStartInTrail); + + uint vIdx = drawIdx * 2; + _VertexBuffer[vIdx] = v0; + _VertexBuffer[vIdx+1] = v1; + } +} diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute.meta new file mode 100644 index 000000000..9381b9952 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirect.compute.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5e0b0e8f0f658774f9dca7b0695eacd4 +ComputeShaderImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute new file mode 100644 index 000000000..331c13aaa --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute @@ -0,0 +1,100 @@ +#pragma kernel ClearIsInView +#pragma kernel UpdateIsInView +#pragma kernel UpdateTrailAppend +#pragma kernel CopyVertex + +#define NUM_THREAD_X 32 + +#include "GPUTrailVariablesCS.compute" + + +//////////////////////////////////////////////////////////////////////////////// +// Clear/UpdateIsInView +//////////////////////////////////////////////////////////////////////////////// +RWStructuredBuffer _IsInViewW; + +[numthreads(NUM_THREAD_X,1,1)] +void ClearIsInView (uint3 id : SV_DispatchThreadID) +{ + uint trailIdx = id.x; + if ( trailIdx < _TrailNum ) + { + _IsInViewW[trailIdx] = false; + } +} + +float4x3 _CameraFrustumNormals; +StructuredBuffer _NodeBuffer; + +[numthreads(NUM_THREAD_X,1,1)] +void UpdateIsInView (uint3 id : SV_DispatchThreadID) +{ + uint nodeIdx = id.x; + uint trailIdx = calcTrailIdx(nodeIdx); + if ( trailIdx < _TrailNum ) + { + Node node = _NodeBuffer[nodeIdx]; + if ( node.time > 0) + { + // CheckCulling! + float3 posFromCamera = node.pos - _CameraPos; + float width = max(_StartWidth, _EndWidth); + + if ( + (dot(_CameraFrustumNormals[0], posFromCamera) > -width ) + && (dot(_CameraFrustumNormals[1], posFromCamera) > -width ) + && (dot(_CameraFrustumNormals[2], posFromCamera) > -width ) + && (dot(_CameraFrustumNormals[3], posFromCamera) > -width ) + ) + { + _IsInViewW[trailIdx] = true; + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// +// UpdateTrailAppend +//////////////////////////////////////////////////////////////////////////////// +StructuredBuffer _IsInView; +AppendStructuredBuffer _IsInViewAppend; + +[numthreads(NUM_THREAD_X,1,1)] +void UpdateTrailAppend (uint3 id : SV_DispatchThreadID) +{ + uint trailIdx = id.x; + if ( trailIdx < _TrailNum ) + { + if ( _IsInView[trailIdx] ) _IsInViewAppend.Append(trailIdx); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// CopyVertex +//////////////////////////////////////////////////////////////////////////////// +StructuredBuffer _IsInViewIdxs; +StructuredBuffer _VertexBufferSrc; +RWStructuredBuffer _VertexBufferDst; + +[numthreads(NUM_THREAD_X,1,1)] +void CopyVertex (uint3 id : SV_DispatchThreadID) +{ + uint vertexIdx = id.x; + uint nodeIdx = vertexIdx / 2; + uint isInViewIdx = calcTrailIdx(nodeIdx); + + uint numStruct; + uint stride; + _IsInViewIdxs.GetDimensions(numStruct, stride); + if ( isInViewIdx < numStruct ) + { + uint trailIdx = _IsInViewIdxs[isInViewIdx]; + //uint trailIdx = isInViewIdx; + uint nodeIdxInTrail = nodeIdx % _NodeNumPerTrail; + uint nodeIdxSrc = calcNodeIdx(trailIdx, nodeIdxInTrail); + uint vertexIdxSrc = nodeIdxSrc * 2 + vertexIdx % 2; + + _VertexBufferDst[vertexIdx] = _VertexBufferSrc[vertexIdxSrc]; + } + +} diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute.meta new file mode 100644 index 000000000..a02ea5274 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailIndirectCulling.compute.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4d2092e994db09747aba3bb6375f54c7 +ComputeShaderImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc b/Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc new file mode 100644 index 000000000..2302c421f --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc @@ -0,0 +1,10 @@ +#ifndef GPUTRAIL_INPUT_INCLUDED +#define GPUTRAIL_INPUT_INCLUDED + +struct InputData +{ + float3 pos; + float4 color; +}; + +#endif // GPUTRAIL_INPUT_INCLUDED diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc.meta new file mode 100644 index 000000000..5ad05f64c --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailInput.cginc.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 41fea103c13a630439d32ae76aa6e2e0 +timeCreated: 1510730009 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc new file mode 100644 index 000000000..41b1af70c --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc @@ -0,0 +1,25 @@ +#ifndef GPUTRAIL_VARIABLES_INCLUDED +#define GPUTRAIL_VARIABLES_INCLUDED + +#include "GPUTrailVertex.cginc" + +fixed4 _StartColor; +fixed4 _EndColor; +uint _VerticesPerInstance; +StructuredBuffer _IndexBuffer; +StructuredBuffer _VertexBuffer; + +#ifdef GPUTRAIL_TRAIL_INDEX_ON +StructuredBuffer _TrailIndexBuffer; +#endif + +Vertex GetVertex(uint indexBufferIdx, uint trailIdx){ +#ifdef GPUTRAIL_TRAIL_INDEX_ON + trailIdx = _TrailIndexBuffer[trailIdx]; +#endif + uint idx = _IndexBuffer[indexBufferIdx]; + idx += trailIdx * _VerticesPerInstance; + return _VertexBuffer[idx]; +} + +#endif // GPUTRAIL_VARIABLES_INCLUDED diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc.meta new file mode 100644 index 000000000..740a4ca34 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariables.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b64a9ffbf8d3f004b9100df18c455bb2 +timeCreated: 1484809989 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute new file mode 100644 index 000000000..394dc5456 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute @@ -0,0 +1,55 @@ +#ifndef GPUTRAIL_VARIABLES_CS_INCLUDED +#define GPUTRAIL_VARIABLES_CS_INCLUDED + +#include "GPUTrailInput.cginc" +#include "GPUTrailVertex.cginc" + +// #define LERP_TYPE_NONE 0 +// #define LERP_TYPE_SPLINE 1 + +struct Trail +{ + float startTime; + uint totalInputNum; +}; + +struct Node +{ + float3 pos; + float time; + half4 color; +}; + +uint _TrailNum; +uint _NodeNumPerTrail; +uint _InputNodeNum; +// uint _LerpType; +float _MinNodeDistance; +float _Time; +float _Life; +float3 _ToCameraDir; // for orthographics camera +float3 _CameraPos; // for perspective camera +float _StartWidth; +float _EndWidth; + + +uint calcTrailIdx(uint nodeIdx) +{ + return nodeIdx / _NodeNumPerTrail; +} +uint calcNodeIdx(uint trailIdx, uint nodeIdxInTrail) +{ + return (trailIdx * _NodeNumPerTrail) + (nodeIdxInTrail % _NodeNumPerTrail); +} + +inline bool useToCameraDir() +{ + return all(_ToCameraDir == 0); +} + +inline float3 calcToCameraDir(float3 pos) +{ + return useToCameraDir() ? normalize(_CameraPos - pos) : _ToCameraDir; +} + +#endif // GPUTRAIL_VARIABLES_CS_INCLUDED diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute.meta new file mode 100644 index 000000000..dbf091e3f --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d8aece58a94168249a2913cb85ec5a8c +ComputeShaderImporter: + userData: diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc new file mode 100644 index 000000000..aaf1ff3dc --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc @@ -0,0 +1,22 @@ +#ifndef GPUTRAIL_VARTEX_INCLUDED +#define GPUTRAIL_VARTEX_INCLUDED + +struct Vertex +{ + float3 pos; + float2 uv; + half4 color; +}; + +inline Vertex GetDefaultVertex() { + + Vertex ret; + ret.pos = (0).xxx; + ret.uv = (-1).xx; + ret.color = (0).xxxx; + + return ret; +} + + +#endif // GPUTRAIL_VARTEX_INCLUDED diff --git a/Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc.meta b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc.meta new file mode 100644 index 000000000..106841d91 --- /dev/null +++ b/Assets/Plugins/GPUTrail/Shaders/GPUTrailVertex.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bdb091613de042b42b193c0294db26da +timeCreated: 1484809989 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab b/Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab new file mode 100644 index 000000000..c08de4a52 --- /dev/null +++ b/Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab @@ -0,0 +1,744 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &776367907867687054 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4033498549525708839} + - component: {fileID: 5568196571670878057} + - component: {fileID: 4364339867848153585} + m_Layer: 0 + m_Name: Bolt + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4033498549525708839 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 776367907867687054} + 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: + - {fileID: 7930492351484902759} + - {fileID: 8908669924470592673} + m_Father: {fileID: 6101924816820053886} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5568196571670878057 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 776367907867687054} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c75d76a7b418d3479761187b2d420bc, type: 3} + m_Name: + m_EditorClassIdentifier: + Trunk: {fileID: 1576755778947147315} + BranchPrototype: {fileID: 7950428215667845793} + HitRadius: 5 + Duration: 0.5 + IntensityCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 15.255 + outSlope: 15.255 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0.2198576 + - serializedVersion: 3 + time: 0.099529654 + value: 0.7125015 + inSlope: -0.07577679 + outSlope: -0.07577679 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.07689258 + - serializedVersion: 3 + time: 0.23082784 + value: 0.23103416 + inSlope: 4.1353536 + outSlope: 4.1353536 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.48861334 + - serializedVersion: 3 + time: 0.352674 + value: 0.9862572 + inSlope: 0.11107577 + outSlope: 0.11107577 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.0907272 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -2.1678352 + outSlope: -2.1678352 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.07860794 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + BranchCount: 8 + BranchDistance: 32 + PointCount: 256 + BranchPointCount: 64 + MorphSpeed: 20 + Octaves: 3 + Frequency: 0.01 + Offset: 0 + Amplitude: 15 + Lacunarity: 2 + Gain: 0.5 +--- !u!114 &4364339867848153585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 776367907867687054} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7951616788986827504 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6101924816820053886} + - component: {fileID: 54194200898280364} + m_Layer: 0 + m_Name: Lightning Rifle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6101924816820053886 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7951616788986827504} + 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: + - {fileID: 4033498549525708839} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &54194200898280364 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7951616788986827504} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9aff863873a6a6d41a619e63a0898c3d, type: 3} + m_Name: + m_EditorClassIdentifier: + Prototype: {fileID: 4364339867848153585} +--- !u!1 &8231147997880483471 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7930492351484902759} + - component: {fileID: 1576755778947147315} + m_Layer: 0 + m_Name: Line + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7930492351484902759 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8231147997880483471} + 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: 4033498549525708839} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!120 &1576755778947147315 +LineRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8231147997880483471} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9c20b9ccbbbb1b14cb5729e0c8460cd9, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_Positions: + - {x: 0, y: 0, z: 0} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + m_Parameters: + serializedVersion: 3 + widthMultiplier: 1 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: -0.5 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0.5 + inSlope: -0.5 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 1, g: 0.050000012, b: 0.9991149, a: 1} + key1: {r: 0.050000012, g: 0.3610669, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 0 + numCapVertices: 0 + alignment: 0 + textureMode: 0 + shadowBias: 0.5 + generateLightingData: 0 + m_UseWorldSpace: 1 + m_Loop: 0 +--- !u!1 &9043411360431727333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8908669924470592673} + - component: {fileID: 7280962290875153966} + - component: {fileID: 7950428215667845793} + m_Layer: 0 + m_Name: Branch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8908669924470592673 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9043411360431727333} + 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: 4033498549525708839} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!120 &7280962290875153966 +LineRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9043411360431727333} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9c20b9ccbbbb1b14cb5729e0c8460cd9, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_Positions: + - {x: 0, y: 0, z: 0} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + - {x: 0, y: 0, z: 1} + m_Parameters: + serializedVersion: 3 + widthMultiplier: 1 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: -1 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -1 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 0} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 0 + numCapVertices: 0 + alignment: 0 + textureMode: 0 + shadowBias: 0.5 + generateLightingData: 0 + m_UseWorldSpace: 1 + m_Loop: 0 +--- !u!114 &7950428215667845793 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9043411360431727333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab.meta b/Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab.meta new file mode 100644 index 000000000..307ec5561 --- /dev/null +++ b/Assets/Resources/Prefabs/Weapons/Lightning Rifle.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 212ff21571a845b43ad9f1b923694d34 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index b5d7cdc3b..000f53c28 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -17819,7 +17819,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 55.675 + value: 0 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -18750,7 +18750,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 60.98 + value: 0 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} diff --git a/Assets/Scenes/LightningTestScene.unity b/Assets/Scenes/LightningTestScene.unity new file mode 100644 index 000000000..9174cd28a --- /dev/null +++ b/Assets/Scenes/LightningTestScene.unity @@ -0,0 +1,537 @@ +%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.2, g: 0.2, b: 0.2, a: 1} + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 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 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 1 + m_BakeResolution: 50 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 0 + 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: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 1821185769} +--- !u!196 &5 +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.16666666 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &23518774 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 23518775} + - component: {fileID: 23518776} + m_Layer: 0 + m_Name: Lightning + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &23518775 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 23518774} + 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!114 &23518776 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 23518774} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 044c2be5da0fc2340a09f856be731cea, type: 3} + m_Name: + m_EditorClassIdentifier: + StartPosition: {x: 0, y: 500, z: 0} + EndPosition: {x: 0, y: 0, z: 0} + StartWidth: 2.5 + EndWidth: 0.5 + BranchLength: 50 + MorphSpeed: 2.5 + NoiseAmplitude: 80 + NoiseFrequency: 0.0025 + NoiseGain: 0.2 + NoiseLacunarity: 6 + Camera: {fileID: 104940729} + TrunkNodeCount: 4096 + BranchCount: 8 + BranchNodeCount: 128 + RenderMaterial: {fileID: 2100000, guid: c94ec17d8118c2749ad885c2b378ea01, type: 2} + ComputeShader: {fileID: 7200000, guid: a974189fea3fe9a46a7859ef6ea8da09, type: 3} + DebugDrawNodes: 0 + DebugDrawVertices: 0 +--- !u!1 &104940725 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 104940730} + - component: {fileID: 104940729} + - component: {fileID: 104940727} + - component: {fileID: 104940726} + - component: {fileID: 104940728} + 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 &104940726 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!124 &104940727 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 +--- !u!114 &104940728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 104940730} + volumeLayer: + serializedVersion: 2 + m_Bits: 256 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 0 + antialiasingMode: 3 + temporalAntialiasing: + jitterSpread: 0.75 + sharpness: 0.25 + stationaryBlending: 0.95 + motionBlending: 0.85 + subpixelMorphologicalAntialiasing: + quality: 2 + fastApproximateAntialiasing: + fastMode: 0 + keepAlpha: 0 + fog: + enabled: 1 + excludeSkybox: 1 + debugLayer: + lightMeter: + width: 512 + height: 256 + showCurves: 1 + histogram: + width: 512 + height: 256 + channel: 3 + waveform: + exposure: 0.12 + height: 256 + vectorscope: + size: 256 + exposure: 0.12 + overlaySettings: + linearDepth: 0 + motionColorIntensity: 4 + motionGridSize: 64 + colorBlindnessType: 0 + colorBlindnessStrength: 1 + m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} + m_ShowToolkit: 0 + m_ShowCustomSorter: 0 + breakBeforeColorGrading: 0 + m_BeforeTransparentBundles: [] + m_BeforeStackBundles: [] + m_AfterStackBundles: [] +--- !u!20 &104940729 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.199, g: 0.199, b: 0.199, a: 0.019607844} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + 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: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &104940730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104940725} + m_LocalRotation: {x: -0.258819, y: 0, z: 0, w: 0.9659259} + m_LocalPosition: {x: 0, y: 0, z: -285} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 310526803} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -30, y: 0, z: 0} +--- !u!1 &310526802 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 310526803} + - component: {fileID: 310526804} + m_Layer: 0 + m_Name: CameraCenter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &310526803 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310526802} + 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: + - {fileID: 104940730} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &310526804 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310526802} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 47e64413aeb5ae740b410d70fb05d20c, type: 3} + m_Name: + m_EditorClassIdentifier: + rotSpeed: {x: 0, y: 1, z: 0} +--- !u!1 &1812750579 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1812750581} + - component: {fileID: 1812750580} + m_Layer: 8 + m_Name: PP + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1812750580 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1812750579} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 11400000, guid: 59a61f0cd928369448838883100e06e6, type: 2} + isGlobal: 1 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!4 &1812750581 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1812750579} + 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: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!850595691 &1821185769 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 3 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 0 + m_BakeBackend: 0 + m_LightmapMaxSize: 1024 + m_BakeResolution: 50 + m_Padding: 2 + m_TextureCompression: 0 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 1 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 1 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 +--- !u!1 &1988754119 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988754121} + - component: {fileID: 1988754120} + m_Layer: 0 + m_Name: NoiseProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1988754120 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988754119} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 13f1fa636e0245e42be783568a76e3d6, type: 3} + m_Name: + m_EditorClassIdentifier: + NoiseTexture: {fileID: 2800000, guid: 7c0a392de8821f345824a79dea0d0d41, type: 3} +--- !u!4 &1988754121 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988754119} + 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: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/LightningTestScene.unity.meta b/Assets/Scenes/LightningTestScene.unity.meta new file mode 100644 index 000000000..743e98d77 --- /dev/null +++ b/Assets/Scenes/LightningTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5ebe5ec781779b74a8ec23c0717cd0b0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs b/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs index 15f9189f1..e1bf45331 100644 --- a/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs +++ b/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs @@ -31,7 +31,6 @@ public class GuidedProjectile : MonoBehaviour public float Thrust; public float TopSpeed; public Transform Source; - public Transform Target; public Func TargetPosition; private float _phase; @@ -39,6 +38,7 @@ public class GuidedProjectile : MonoBehaviour private bool _active; private bool _alive; + public Transform Target { get; set; } public float3 StartPosition { get; set; } public float Range { get; set; } public Vector3 Velocity { get; set; } diff --git a/Assets/Scripts/Gameplay/Weapons/Lightning.cs b/Assets/Scripts/Gameplay/Weapons/Lightning.cs new file mode 100644 index 000000000..8acbaeba0 --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/Lightning.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Unity.Mathematics; +using static Unity.Mathematics.math; +using static Unity.Mathematics.noise; +using Random = UnityEngine.Random; + +public class Lightning : MonoBehaviour +{ + public LineRenderer Trunk; + public Prototype BranchPrototype; + public float HitRadius; + public float Duration; + public AnimationCurve IntensityCurve; + public int BranchCount; + public float BranchDistance; + public int PointCount; + public int BranchPointCount; + public int MorphSpeed; + + public int Octaves; + public float Frequency; + public float Offset; + public float Amplitude; + public float Lacunarity; + public float Gain; + + public float Damage { get; set; } + public float Penetration { get; set; } + public float Spread { get; set; } + public DamageType DamageType { get; set; } + public EntityInstance Source { get; set; } + public float Range { get; set; } + public EntityInstance Target { get; set; } + public Transform Barrel { get; set; } + + private float _startTime; + private LineRenderer[] _branches; + private Vector3[] _points; + private Vector3[][] _branchPoints; + private int[] _branchStarts; + private bool _colliderHit; + private Vector3 _colliderLocalPosition; + private Transform _colliderTransform; + private Vector3 _endpoint; + private float _offset; + + private void Awake() + { + _points = new Vector3[PointCount]; + _branchPoints = new Vector3[BranchCount][]; + _branchStarts = new int[BranchCount]; + _branches = new LineRenderer[BranchCount]; + for (int i = 0; i < BranchCount; i++) + { + _branchPoints[i] = new Vector3[BranchPointCount]; + _branches[i] = BranchPrototype.Instantiate(); + } + } + + public void Fire() + { + _offset = Random.value * 1000; + _startTime = Time.time; + Trunk.widthMultiplier = 0; + foreach(var line in _branches) + line.widthMultiplier = 0; + + for (int i = 0; i < BranchCount; i++) + { + _branchStarts[i] = Random.Range(0, PointCount); + var lerp = (float) _branchStarts[i] / PointCount; + _branches[i].startColor = Trunk.colorGradient.Evaluate(lerp); + } + + _colliderHit = false; + var hits = Physics.SphereCastAll(Barrel.position, HitRadius, Barrel.forward, Range, 1); + foreach (var hit in hits) + { + var hull = hit.collider.GetComponent(); + if (hull) + { + if (hull.Entity == Source.Entity) continue; + hull.SendHit(Damage, Penetration, Spread, DamageType, Source.Entity, hit, Barrel.forward); + } + + _colliderHit = true; + _colliderLocalPosition = hit.collider.transform.InverseTransformPoint(hit.point); + _colliderTransform = hit.collider.transform; + break; + } + } + + private void Update() + { + if (Barrel == null) return; + var time = (Time.time - _startTime) / Duration; + if (time > 1) + { + GetComponent().ReturnToPool(); + return; + } + Trunk.widthMultiplier = IntensityCurve.Evaluate(time); + + if (_colliderHit) + { + if(_colliderTransform) _endpoint = _colliderTransform.TransformPoint(_colliderLocalPosition); + } + else _endpoint = Barrel.position + Barrel.forward * Range + (Vector3) NoiseFbm.fBm3(Time.time, Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain); + var startPoint = Barrel.position; + var dist = (_endpoint - startPoint).magnitude; + var startOffset = -NoiseFbm.fBm3(float2(0+_offset, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain); + var endOffset = -NoiseFbm.fBm3(float2(dist+_offset, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain); + for (int i = 0; i < PointCount; i++) + { + var l = (float) i / (PointCount - 1); + var sampleDist = dist * l; + var pos = lerp(startPoint, _endpoint, l) + + NoiseFbm.fBm3(float2(sampleDist+_offset, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain); + if (l < .5f) pos += startOffset * (1 - l * 2); + else pos += endOffset * (2 * (l - .5f)); + _points[i] = pos; + } + Trunk.SetPositions(_points); + + for (int i = 0; i < BranchCount; i++) + { + _branches[i].widthMultiplier = Trunk.widthMultiplier * Trunk.widthCurve.Evaluate((float) _branchStarts[i] / PointCount); + var branchStartPoint = _points[_branchStarts[i]]; + var branchEndPoint = branchStartPoint + Random.onUnitSphere * BranchDistance; + var branchstartOffset = -NoiseFbm.fBm3(float2(_branchStarts[i]*10, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain); + for (int j = 0; j < BranchPointCount; j++) + { + var l = (float) j / (BranchPointCount - 1); + var sampleDist = BranchDistance * l + _branchStarts[i]*10; + var pos = lerp(branchStartPoint, branchEndPoint, l) + + NoiseFbm.fBm3(float2(sampleDist * 2, Time.time * MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain); + if (l < .5f) pos += branchstartOffset * (1 - l * 2); + _branchPoints[i][j] = pos; + } + _branches[i].SetPositions(_branchPoints[i]); + } + } +} diff --git a/Assets/Scripts/Gameplay/Weapons/Lightning.cs.meta b/Assets/Scripts/Gameplay/Weapons/Lightning.cs.meta new file mode 100644 index 000000000..8c5bab994 --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/Lightning.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c75d76a7b418d3479761187b2d420bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs b/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs new file mode 100644 index 000000000..93621217a --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LightningGunManager : InstantWeaponEffectManager +{ + public Prototype Prototype; + + public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target) + { + var p = Prototype.Instantiate(); + var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y]; + var barrel = source.GetBarrel(hp); + p.Barrel = barrel; + p.Source = source; + p.Damage = weapon.Damage; + p.Range = weapon.Range; + p.Penetration = weapon.Penetration; + p.Spread = weapon.DamageSpread; + p.DamageType = weapon.WeaponData.DamageType; + p.Target = target; + p.Fire(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs.meta b/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs.meta new file mode 100644 index 000000000..8682c9f04 --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9aff863873a6a6d41a619e63a0898c3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Sector Display/SectorRenderer.cs b/Assets/Scripts/Sector Display/SectorRenderer.cs index b1b8c8cd1..abd88b874 100644 --- a/Assets/Scripts/Sector Display/SectorRenderer.cs +++ b/Assets/Scripts/Sector Display/SectorRenderer.cs @@ -201,6 +201,7 @@ public class SectorRenderer : MonoBehaviour } instance.Entity = entity; + foreach (var hullCollider in instance.Prefab.HullColliders) hullCollider.Entity = entity; foreach (var item in entity.Equipment) { diff --git a/Assets/Scripts/ServerShared/Behaviors/Reactor.cs b/Assets/Scripts/ServerShared/Behaviors/Reactor.cs index df6a37f75..72e218da8 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Reactor.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Reactor.cs @@ -78,6 +78,7 @@ public class Reactor : IBehavior, IOrderedBehavior int chargedCapacitors = 0; do { + chargedCapacitors = 0; var chargeToRemove = -Entity.Energy; foreach (var cap in _capacitors) { diff --git a/Assets/Scripts/ServerShared/GlobalData.cs b/Assets/Scripts/ServerShared/GlobalData.cs index c3da2383d..b6ceb1e87 100644 --- a/Assets/Scripts/ServerShared/GlobalData.cs +++ b/Assets/Scripts/ServerShared/GlobalData.cs @@ -81,6 +81,14 @@ public class GalaxyMapLayerData : DatabaseEntry, INamedEntry public static class NoiseFbm { + public static float3 fBm3(float2 p, int octaves, float frequency, float offset, float amplitude, float lacunarity, float gain) + { + return float3( + fBm(p, octaves, frequency, offset, amplitude, lacunarity, gain), + fBm(p+10, octaves, frequency, offset, amplitude, lacunarity, gain), + fBm(p+20, octaves, frequency, offset, amplitude, lacunarity, gain)); + } + public static float fBm(float2 p, int octaves, float frequency, float offset, float amplitude, float lacunarity, float gain) { float freq = frequency, amp = .5f; @@ -93,4 +101,25 @@ public static class NoiseFbm } return (sum + offset)*amplitude; } -} \ No newline at end of file + + public static float3 fBm3(float p, int octaves, float frequency, float offset, float amplitude, float lacunarity, float gain) + { + return float3( + fBm(p, octaves, frequency, offset, amplitude, lacunarity, gain), + fBm(p+10, octaves, frequency, offset, amplitude, lacunarity, gain), + fBm(p+20, octaves, frequency, offset, amplitude, lacunarity, gain)); + } + + public static float fBm(float p, int octaves, float frequency, float offset, float amplitude, float lacunarity, float gain) + { + float freq = frequency, amp = .5f; + float sum = 0; + for(int i = 0; i < octaves; i++) + { + sum += Noise1D.noise(p * freq) * amp; + freq *= lacunarity; + amp *= gain; + } + return (sum + offset)*amplitude; + } +} diff --git a/Assets/Shaders/Compute/Lightning.meta b/Assets/Shaders/Compute/Lightning.meta new file mode 100644 index 000000000..b84eb7cf2 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5923c75973a59304d98edd57680ec454 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/Compute/Lightning/Lightning.compute b/Assets/Shaders/Compute/Lightning/Lightning.compute new file mode 100644 index 000000000..5c3292169 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/Lightning.compute @@ -0,0 +1,140 @@ +// Each #kernel tells which function to compile; you can have many kernels +#pragma kernel UpdateNodes +#pragma kernel CreateWidth + +#define NUM_THREAD_X 64 + +#include "LightningVertex.cginc" +#include "Assets/Plugins/GPU Noise/SimplexNoise2D.cginc" + +struct Node +{ + float3 pos; + int bolt; + float time; +}; + +struct Bolt +{ + float3 startPos; + float3 endPos; + float startTime; + int startIndex; + float3 startOffset; + float3 endOffset; +}; + +RWStructuredBuffer _NodeBuffer; +RWStructuredBuffer _VertexBuffer; +RWStructuredBuffer _BoltBuffer; + +float _NoiseAmplitude; +float _NoiseFrequency; +float _NoiseGain; +float _NoiseLacunarity; +float _Time; +float _StartWidth; +float _EndWidth; +int _TrunkNodeCount; +//int _BranchCount; +int _BranchNodeCount; +float3 _CameraPos; // for perspective camera + +float fbm(float2 p) +{ + float freq = _NoiseFrequency, amp = _NoiseAmplitude; + float sum = 0; + for(int i = 0; i < 4; i++) + { + sum += snoise(p * freq) * amp; + freq *= _NoiseLacunarity; + amp *= _NoiseGain; + } + return sum; +} + +float3 fbm3(float2 p) +{ + return float3( + fbm(p), + fbm(p+10), + fbm(p+20)); +} + +inline float3 calcToCameraDir(float3 pos) +{ + return normalize(_CameraPos - pos); +} + +[numthreads(NUM_THREAD_X,1,1)] +void UpdateNodes (uint3 id : SV_DispatchThreadID) +{ + int idx = id.x; + + Node node = _NodeBuffer[idx]; + Bolt bolt = _BoltBuffer[node.bolt]; + + float3 samplePos = lerp(bolt.startPos, bolt.endPos, node.time); + + float distance = length(bolt.startPos - samplePos); + + node.pos = samplePos + + fbm3(float2(distance, _Time + node.bolt * 10)) + + bolt.startOffset * max(.5 - node.time, 0) * 2 + + bolt.endOffset * max(node.time - .5, 0) * 2; + + _NodeBuffer[idx] = node; +} + +[numthreads(NUM_THREAD_X,1,1)] +void CreateWidth (uint3 id : SV_DispatchThreadID) +{ + int idx = id.x; + + Vertex v0 = GetDefaultVertex(); + Vertex v1 = GetDefaultVertex(); + + Node node = _NodeBuffer[idx]; + Bolt bolt = _BoltBuffer[node.bolt]; + + float3 pos = node.pos; + + float3 dirPrev = float3(0,0,0); + float3 dirNext = float3(0,0,0); + + if ( idx!=bolt.startIndex ) + { + Node nodePrev = _NodeBuffer[idx-1]; + dirPrev = normalize(pos - nodePrev.pos); + } + + bool enableNext; + if(idx < _TrunkNodeCount) + enableNext = idx < _TrunkNodeCount - 1; + else enableNext = (idx - _TrunkNodeCount) % _BranchNodeCount < _BranchNodeCount - 1; + if ( enableNext ) + { + Node nodeNext = _NodeBuffer[idx+1]; + dirNext = normalize(nodeNext.pos - pos); + } + + float3 dir = normalize(dirPrev + dirNext); + + float width; + if(idx < _TrunkNodeCount) width = lerp(_StartWidth, _EndWidth, node.time); + else width = (1-node.time) * lerp(_StartWidth, _EndWidth, bolt.startTime); + + float3 toCameraDir = calcToCameraDir(pos); + float3 right = normalize(cross(dir, toCameraDir)) * width * 0.5f; + + float uvx = bolt.startTime + node.time * (1-bolt.startTime); + v0.pos = pos - right; + v0.uv = float2(uvx, 0); + + v1.pos = pos + right; + v1.uv = float2(uvx, 1); + + uint vId = idx * 2; + _VertexBuffer[vId] = v0; + _VertexBuffer[vId+1] = v1; +} diff --git a/Assets/Shaders/Compute/Lightning/Lightning.compute.meta b/Assets/Shaders/Compute/Lightning/Lightning.compute.meta new file mode 100644 index 000000000..684669c55 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/Lightning.compute.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a974189fea3fe9a46a7859ef6ea8da09 +ComputeShaderImporter: + externalObjects: {} + currentAPIMask: 4 + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/Compute/Lightning/Lightning.mat b/Assets/Shaders/Compute/Lightning/Lightning.mat new file mode 100644 index 000000000..2807a1544 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/Lightning.mat @@ -0,0 +1,80 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Lightning + m_Shader: {fileID: 4800000, guid: 21dd485e846b4d3a8213cf5551832776, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _EndColor: {r: 0.40784314, g: 0.9411765, b: 8, a: 0} + - _StartColor: {r: 16, g: 0.8156863, b: 11.043138, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Shaders/Compute/Lightning/Lightning.mat.meta b/Assets/Shaders/Compute/Lightning/Lightning.mat.meta new file mode 100644 index 000000000..6dce22c07 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/Lightning.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c94ec17d8118c2749ad885c2b378ea01 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/Compute/Lightning/Lightning.shader b/Assets/Shaders/Compute/Lightning/Lightning.shader new file mode 100644 index 000000000..4b4ee54af --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/Lightning.shader @@ -0,0 +1,73 @@ +Shader "Aetheria/GPU Lightning" { +Properties { + [HDR]_StartColor("StartColor", Color) = (1,1,1,1) + [HDR]_EndColor("EndColor", Color) = (0,0,0,1) +} + +SubShader { +Pass{ + Tags { "RenderType"="Opaque" } + + CGPROGRAM + #pragma target 5.0 + #pragma shader_feature GPUTRAIL_TRAIL_INDEX_ON + + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + #include "LightningVertex.cginc" + #include "Assets/Shaders/Dither Functions.cginc" + + fixed4 _StartColor; + fixed4 _EndColor; + uint _VerticesPerInstance; + StructuredBuffer _IndexBuffer; + StructuredBuffer _VertexBuffer; + + Vertex GetVertex(uint indexBufferIdx) { + uint idx = _IndexBuffer[indexBufferIdx]; + return _VertexBuffer[idx]; + } + + struct vs_out { + float4 pos : SV_POSITION; + float4 col : COLOR; + float2 uv : TEXCOORD; + float4 screenPos : TEXCOORD1; + }; + + vs_out vert (uint id : SV_VertexID, uint iId : SV_InstanceID) + { + vs_out Out; + Vertex vtx = GetVertex(id); + + Out.pos = UnityObjectToClipPos(float4(vtx.pos, 1.0)); + Out.uv = vtx.uv; + Out.col = lerp(_StartColor, _EndColor, vtx.uv.x); + Out.screenPos = ComputeScreenPos(float4(vtx.pos, 1.0)); + + return Out; + } + + fixed4 frag (vs_out In) : COLOR0 + { + // Simple quadratic curve "texture" + float x = 2 * In.uv.y - 1; + float a = 1 - x * x; + + // Apply screen space dithering + float2 screenUV = In.screenPos.xy / In.screenPos.w; + ditherClip(screenUV, a); + + return In.col * a; + } + + ENDCG + + } +} + +Fallback Off +} + diff --git a/Assets/Shaders/Compute/Lightning/Lightning.shader.meta b/Assets/Shaders/Compute/Lightning/Lightning.shader.meta new file mode 100644 index 000000000..9e37a870a --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/Lightning.shader.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 21dd485e846b4d3a8213cf5551832776 +timeCreated: 1612395387 \ No newline at end of file diff --git a/Assets/Shaders/Compute/Lightning/LightningCompute.cs b/Assets/Shaders/Compute/Lightning/LightningCompute.cs new file mode 100644 index 000000000..578b21fa8 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/LightningCompute.cs @@ -0,0 +1,288 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine; +using UnityEngine.Rendering; +using Unity.Mathematics; +using static Unity.Mathematics.math; +using static Unity.Mathematics.noise; +using Random = UnityEngine.Random; + +public class LightningCompute : MonoBehaviour +{ + [Header("Bolt Properties")] + public Vector3 StartPosition; + public Vector3 EndPosition; + public float StartWidth; + public float EndWidth; + public float BranchLength; + public float MorphSpeed; + public float NoiseAmplitude; + public float NoiseFrequency; + public float NoiseGain; + public float NoiseLacunarity; + public Camera Camera; + + [Header("Buffer Sizes")] + public int TrunkNodeCount; + public int BranchCount; + public int BranchNodeCount; + + [Header("Shaders")] + public Material RenderMaterial; + public ComputeShader ComputeShader; + + public bool DebugDrawNodes; + public bool DebugDrawVertices; + + private Transform _cameraTransform; + + private ComputeBuffer _nodeBuffer; + private ComputeBuffer _vertexBuffer; + private ComputeBuffer _indexBuffer; + private ComputeBuffer _boltBuffer; + private Bolt[] _bolts; + private Vector3[] _branchEndpoints; + + private const int GROUP_SIZE = 64; + private int _updateKernel; + private int _createWidthKernel; + + private int NodeBufferSize => TrunkNodeCount + BranchCount * BranchNodeCount; + private int VertexBufferSize => NodeBufferSize * 2; + private int IndexBufferSize => (NodeBufferSize - (BranchCount + 1)) * 6; + + public struct Node + { + public Vector3 pos; + public int bolt; + public float time; + } + + public struct Vertex + { + public Vector3 pos; + public Vector2 uv; + } + + public struct Bolt + { + public Vector3 startPos; + public Vector3 endPos; + public float startTime; + public int startIndex; + public Vector3 startOffset; + public Vector3 endOffset; + } + + void Start() + { + _cameraTransform = Camera.transform; + _updateKernel = ComputeShader.FindKernel("UpdateNodes"); + _createWidthKernel = ComputeShader.FindKernel("CreateWidth"); + InitBuffers(); + } + + void InitBuffers() + { + _nodeBuffer = new ComputeBuffer(NodeBufferSize, Marshal.SizeOf(typeof(Node))); + var nodeList = new List(); + for (int i = 0; i < TrunkNodeCount; i++) + { + nodeList.Add(new Node{bolt = 0, pos = Vector3.zero, time = (float)i/(TrunkNodeCount-1)}); + } + + for (int branch = 0; branch < BranchCount; branch++) + { + for (int branchNode = 0; branchNode < BranchNodeCount; branchNode++) + { + nodeList.Add(new Node{bolt = branch+1, pos = Vector3.zero, time = (float)branchNode/(BranchNodeCount-1)}); + } + } + + _nodeBuffer.SetData(nodeList.ToArray()); + + + _boltBuffer = new ComputeBuffer(BranchCount + 1, Marshal.SizeOf(typeof(Bolt))); + _branchEndpoints = new Vector3[BranchCount]; + _bolts = new Bolt[BranchCount + 1]; + _bolts[0] = new Bolt + { + startPos = StartPosition, + endPos = EndPosition, + startTime = 0 + }; + for (int i = 0; i < BranchCount; i++) + { + _branchEndpoints[i] = Random.insideUnitSphere * BranchLength; + var parent = nodeList[(int)((float) i / BranchCount * TrunkNodeCount)]; + _bolts[i+1] = new Bolt + { + startPos = parent.pos, + endPos = parent.pos + _branchEndpoints[i], + startTime = parent.time + }; + } + + _boltBuffer.SetData(_bolts); + + _vertexBuffer = new ComputeBuffer(VertexBufferSize, Marshal.SizeOf(typeof(Vertex))); // 1 node to 2 vtx(left,right) + _vertexBuffer.SetData(Enumerable.Repeat(default(Vertex), _vertexBuffer.count).ToArray()); + + var indexData = new int[IndexBufferSize]; + var index = 0; + for (var iNode = 0; iNode < TrunkNodeCount - 1; iNode++) + { + var offset = iNode * 2; + indexData[index++] = 0 + offset; + indexData[index++] = 1 + offset; + indexData[index++] = 2 + offset; + indexData[index++] = 2 + offset; + indexData[index++] = 1 + offset; + indexData[index++] = 3 + offset; + } + for (int iBranch = 0; iBranch < BranchCount; iBranch++) + { + for (int iBranchNode = 0; iBranchNode < BranchNodeCount - 1; iBranchNode++) + { + var offset = iBranchNode * 2 + (TrunkNodeCount) * 2 + iBranch * (BranchNodeCount) * 2; + indexData[index++] = 0 + offset; + indexData[index++] = 1 + offset; + indexData[index++] = 2 + offset; + indexData[index++] = 2 + offset; + indexData[index++] = 1 + offset; + indexData[index++] = 3 + offset; + } + } + + _indexBuffer = new ComputeBuffer(indexData.Length, Marshal.SizeOf(typeof(uint))); // 1 node to 2 triangles(6vertexs) + _indexBuffer.SetData(indexData); + } + + float fbm(float2 p) + { + float freq = NoiseFrequency, amp = NoiseAmplitude; + float sum = 0; + for(int i = 0; i < 4; i++) + { + sum += snoise(p * freq) * amp; + freq *= NoiseLacunarity; + amp *= NoiseGain; + } + return sum; + } + + float3 fbm3(float2 p) + { + return float3( + fbm(p), + fbm(p+10), + fbm(p+20)); + } + + void Update() + { + var time = Time.time * MorphSpeed; + var diff = EndPosition - StartPosition; + var dist = diff.magnitude; + _bolts[0].startPos = StartPosition; + _bolts[0].startOffset = -(Vector3) fbm3(float2(0, time)); + _bolts[0].endPos = EndPosition; + _bolts[0].endOffset = -(Vector3) fbm3(float2(dist, time)); + + for (int i = 0; i < BranchCount; i++) + { + var root = Vector3.Lerp(StartPosition, EndPosition, _bolts[i + 1].startTime); + var rootDist = _bolts[i + 1].startTime * dist; + _bolts[i + 1].startPos = + root + (Vector3) fbm3(float2(rootDist, time)) + + _bolts[0].startOffset * (max(.5f - _bolts[i + 1].startTime, 0) * 2) + + _bolts[0].endOffset * (max(_bolts[i + 1].startTime - .5f, 0) * 2); + _bolts[i + 1].startOffset = -(Vector3) fbm3(float2(0, time + (i + 1) * 10)); + _bolts[i + 1].endPos = root + _branchEndpoints[i]; + } + + _boltBuffer.SetData(_bolts); + + ComputeShader.SetBuffer(_updateKernel, "_NodeBuffer", _nodeBuffer); + ComputeShader.SetBuffer(_updateKernel, "_BoltBuffer", _boltBuffer); + + ComputeShader.SetFloat("_Time", time); + ComputeShader.SetFloat("_NoiseAmplitude", NoiseAmplitude); + ComputeShader.SetFloat("_NoiseFrequency", NoiseFrequency); + ComputeShader.SetFloat("_NoiseGain", NoiseGain); + ComputeShader.SetFloat("_NoiseLacunarity", NoiseLacunarity); + + ComputeShader.Dispatch(_updateKernel, NodeBufferSize/GROUP_SIZE, 1, 1); + + ComputeShader.SetInt("_TrunkNodeCount", TrunkNodeCount); + ComputeShader.SetInt("_BranchNodeCount", BranchNodeCount); + ComputeShader.SetVector("_CameraPos", _cameraTransform.position); + ComputeShader.SetFloat("_StartWidth", StartWidth); + ComputeShader.SetFloat("_EndWidth", EndWidth); + + ComputeShader.SetBuffer(_createWidthKernel, "_NodeBuffer", _nodeBuffer); + ComputeShader.SetBuffer(_createWidthKernel, "_BoltBuffer", _boltBuffer); + ComputeShader.SetBuffer(_createWidthKernel, "_VertexBuffer", _vertexBuffer); + + ComputeShader.Dispatch(_createWidthKernel, NodeBufferSize/GROUP_SIZE, 1, 1); + + RenderMaterial.SetBuffer("_IndexBuffer", _indexBuffer); + RenderMaterial.SetBuffer("_VertexBuffer", _vertexBuffer); + Graphics.DrawProcedural( + RenderMaterial, + new Bounds((EndPosition + StartPosition) / 2, (EndPosition - StartPosition).magnitude * Vector3.one), + MeshTopology.Triangles, + IndexBufferSize, + 1, + Camera, + null, + ShadowCastingMode.Off, + false, + 0); + } + + #region cleanup + void OnDestroy() + { + if(_indexBuffer!=null) + { + _indexBuffer.Release(); + _boltBuffer.Release(); + _nodeBuffer.Release(); + _vertexBuffer.Release(); + } + } + #endregion + + public void OnDrawGizmosSelected() + { + if (DebugDrawNodes && _nodeBuffer != null) + { + Gizmos.color = Color.magenta; + var data = new Node[_nodeBuffer.count]; + _nodeBuffer.GetData(data); + foreach(var node in data) + { + Gizmos.DrawWireSphere(node.pos, StartWidth); + }; + } + + if (DebugDrawVertices && _vertexBuffer != null) + { + Gizmos.color = Color.yellow; + var data = new Vertex[_vertexBuffer.count]; + _vertexBuffer.GetData(data); + + var num = _vertexBuffer.count / 2; + for(var i=0; i< num; ++i) + { + var v0 = data[2*i]; + var v1 = data[2*i +1]; + + Gizmos.DrawLine(v0.pos, v1.pos); + } + } + } +} diff --git a/Assets/Shaders/Compute/Lightning/LightningCompute.cs.meta b/Assets/Shaders/Compute/Lightning/LightningCompute.cs.meta new file mode 100644 index 000000000..155a0283f --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/LightningCompute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 044c2be5da0fc2340a09f856be731cea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/Compute/Lightning/LightningVertex.cginc b/Assets/Shaders/Compute/Lightning/LightningVertex.cginc new file mode 100644 index 000000000..ab45431a1 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/LightningVertex.cginc @@ -0,0 +1,20 @@ +#ifndef LIGHTNING_VERTEX_INCLUDED +#define LIGHTNING_VERTEX_INCLUDED + +struct Vertex +{ + float3 pos; + float2 uv; +}; + +inline Vertex GetDefaultVertex() { + + Vertex ret; + ret.pos = (0).xxx; + ret.uv = (-1).xx; + + return ret; +} + + +#endif // LIGHTNING_VERTEX_INCLUDED diff --git a/Assets/Shaders/Compute/Lightning/LightningVertex.cginc.meta b/Assets/Shaders/Compute/Lightning/LightningVertex.cginc.meta new file mode 100644 index 000000000..cbc8cf873 --- /dev/null +++ b/Assets/Shaders/Compute/Lightning/LightningVertex.cginc.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 73ccd50b02d44a0185deea93c36ffb55 +timeCreated: 1612367245 \ No newline at end of file diff --git a/Assets/Shaders/Compute/Stardust.meta b/Assets/Shaders/Compute/Stardust.meta new file mode 100644 index 000000000..41618f1fe --- /dev/null +++ b/Assets/Shaders/Compute/Stardust.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1a10e817dfc0d294fb8a3760cac10f78 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/Compute/Stardust.compute b/Assets/Shaders/Compute/Stardust/Stardust.compute similarity index 100% rename from Assets/Shaders/Compute/Stardust.compute rename to Assets/Shaders/Compute/Stardust/Stardust.compute diff --git a/Assets/Shaders/Compute/Stardust.compute.meta b/Assets/Shaders/Compute/Stardust/Stardust.compute.meta similarity index 100% rename from Assets/Shaders/Compute/Stardust.compute.meta rename to Assets/Shaders/Compute/Stardust/Stardust.compute.meta diff --git a/Assets/Shaders/Compute/Stardust.cs b/Assets/Shaders/Compute/Stardust/Stardust.cs similarity index 98% rename from Assets/Shaders/Compute/Stardust.cs rename to Assets/Shaders/Compute/Stardust/Stardust.cs index 5f2f2eb9f..82183b6f3 100644 --- a/Assets/Shaders/Compute/Stardust.cs +++ b/Assets/Shaders/Compute/Stardust/Stardust.cs @@ -121,7 +121,7 @@ public class Stardust : MonoBehaviour ParticleMaterial.SetBuffer("particles", _particlesBuffer); ParticleMaterial.SetBuffer("quadPoints", _quadPoints); - Graphics.DrawProcedural(ParticleMaterial, new Bounds(pos, Spacing * Span * Vector3.one), MeshTopology.Triangles, 6, Span * Span, TargetCamera, null, ShadowCastingMode.On, false, 0); + Graphics.DrawProcedural(ParticleMaterial, new Bounds(pos, Spacing * Span * Vector3.one), MeshTopology.Triangles, 6, Span * Span, TargetCamera, null, ShadowCastingMode.Off, false, 0); } #endregion diff --git a/Assets/Shaders/Compute/Stardust.cs.meta b/Assets/Shaders/Compute/Stardust/Stardust.cs.meta similarity index 100% rename from Assets/Shaders/Compute/Stardust.cs.meta rename to Assets/Shaders/Compute/Stardust/Stardust.cs.meta diff --git a/Assets/Shaders/Compute/Stardust.mat b/Assets/Shaders/Compute/Stardust/Stardust.mat similarity index 100% rename from Assets/Shaders/Compute/Stardust.mat rename to Assets/Shaders/Compute/Stardust/Stardust.mat diff --git a/Assets/Shaders/Compute/Stardust.mat.meta b/Assets/Shaders/Compute/Stardust/Stardust.mat.meta similarity index 100% rename from Assets/Shaders/Compute/Stardust.mat.meta rename to Assets/Shaders/Compute/Stardust/Stardust.mat.meta diff --git a/Assets/Shaders/Compute/Stardust.shader b/Assets/Shaders/Compute/Stardust/Stardust.shader similarity index 100% rename from Assets/Shaders/Compute/Stardust.shader rename to Assets/Shaders/Compute/Stardust/Stardust.shader diff --git a/Assets/Shaders/Compute/Stardust.shader.meta b/Assets/Shaders/Compute/Stardust/Stardust.shader.meta similarity index 100% rename from Assets/Shaders/Compute/Stardust.shader.meta rename to Assets/Shaders/Compute/Stardust/Stardust.shader.meta diff --git a/GameData/Presets/Longinus.preset b/GameData/Presets/Longinus.preset index 40b529f0afd4189f467a1d2cb39987359eeea644..7b6a2a85a3756286aa88021f38d6ba16a2a260c3 100644 GIT binary patch delta 869 zcmdlb`degzJd52ls~rbYTVl1{BCw%~NfTHPBcqR)l0U2uR)=f@k@?)`mkhNekH?#HR4@}}Lc8BJy0dj&^ z>|?I$OipAroBWnpoW<7S-hs&+ES@ZO57ln~8Af)D95apxT>1F@p}v&2=PV)D2w%sC zGZ{|VoqBP0!V!V|1cAb1|4p2?Sj%hcU*Gs|y-#L(MoC^~Ub;e1W?D|_ zB9QF_+k%sTxe~jfAcy=82N3~4L*tSBgwsH<1k6-u0KohRbrzTlB*5P5{{I8yUS=Qx z^rQCV2OL}yKt9Zb?*G3*(qL0rfT5=`*??Vv$4LPw0wpHjV>e)T`~Vbi{4n_=hs@*& z9BhmqCUI)3LIpuG3*ZDurz2Q<0g&ZX0M){+2UY@>g_s4`fsnwWO#mT_=>(I>57@W` d9l_d=2%wAgf!<)-Y{hBB$aY}D#0e87000;jLXZFe delta 821 zcmXZaeMl2w90%~*?Y47G+EQzqbGkCivKQZKsOg$lVJcfqkf4ZWQAT4%&Z3Z6QUAoq z&1b~Oq!;atOs#NIvuU+a91D^V5`!%4?}q*nw$i>gy+1xYFTd~adG5G)+N+hGET+6` z{eah5`6*FF8t^8DnEGgUH2YBu1+kqy3s26Dw0byV*l*;_YQjl0U4BW}p3?^XMn{GTUVt zD3!S>-k8~<^n{h;@9YQ2zJM`lP{> zWgebZH{725k%N43YbIF`7m{f)PTlQ3jftVay2k(DdkWdj=yso7ILu8v@~JFwz5j z!@wT|H@kSQJ@y>@dd73thmt|y5TcEDfo_WDyyNeICk8Bipe7eoN05!U1z0fZ6j}wq zt$fgl&h4=qLeoz4vjw)nLENvS>Rar$*BHna|qUeNT-lV4}CZQy;B2CEhrWi#fC6pz0mnD?*6dsS)