Lightning

Created Lightning Gun effect (Uses LineRenderer, very slow)
Created GPU Lightning renderer (very fast, still needs integration)
This commit is contained in:
Reinier Vens 2021-02-04 04:37:47 +00:00
commit bb297bf84c
100 changed files with 7105 additions and 13 deletions

View file

@ -68,6 +68,42 @@
<e p="HoverCursorChange.cs" t="Include" />
<e p="ItemFilter.cs" t="Include" />
<e p="LineMaterialOffset.cs" t="Include" />
<e p="Packages" t="Include">
<e p="GPUTrail" t="Include">
<e p="GPUTrail.cs" t="Include" />
<e p="GPUTrailIndirect.cs" t="Include" />
<e p="GPUTrailIndirectCulling.cs" t="Include" />
<e p="Sample" t="Include">
<e p="GPUTrailIndirectSample" t="Include">
<e p="GPUTrailIndirectCullingSample.cs" t="Include" />
<e p="GPUTrailIndirectSample.cs" t="Include" />
<e p="GPUTrailIndirectSampleParticle.cs" t="Include" />
<e p="GPUTrailIndirectSampleParticleCS.compute" t="Include" />
</e>
<e p="GPUTrailSample" t="Include">
<e p="AutoRotate.cs" t="Include" />
<e p="GenerateSphere.cs" t="Include" />
</e>
<e p="GPUTrailSpline" t="Include">
<e p="GPUTrailSplineSample.cs" t="Include" />
</e>
</e>
<e p="Scripts" t="Include">
<e p="GPUTrailBase.cs" t="Include" />
<e p="GPUTrailSpline.cs" t="Include" />
</e>
<e p="Shaders" t="Include">
<e p="GPUTrail.compute" t="Include" />
<e p="GPUTrail.shader" t="Include" />
<e p="GPUTrailIndirect.compute" t="Include" />
<e p="GPUTrailIndirectCulling.compute" t="Include" />
<e p="GPUTrailInput.cginc" t="Include" />
<e p="GPUTrailVariables.cginc" t="Include" />
<e p="GPUTrailVariablesCS.compute" t="Include" />
<e p="GPUTrailVertex.cginc" t="Include" />
</e>
</e>
</e>
<e p="Plugins" t="Include">
<e p="AsyncAwaitUtil" t="Include">
<e p="Source" t="Include">
@ -1424,6 +1460,8 @@
<e p="InstantWeaponEffectManager.cs" t="Include" />
<e p="Laser.cs" t="Include" />
<e p="LaserManager.cs" t="Include" />
<e p="Lightning.cs" t="Include" />
<e p="LightningGunManager.cs" t="Include" />
<e p="ParticleChargeEffect.cs" t="Include" />
<e p="Projectile.cs" t="Include" />
<e p="ProjectileManager.cs" t="Include" />
@ -2059,9 +2097,17 @@
</e>
<e p="Clouds.shader" t="Include" />
<e p="Compute" t="Include">
<e p="Stardust.compute" t="Include" />
<e p="Stardust.cs" t="Include" />
<e p="Stardust.shader" t="Include" />
<e p="Lightning" t="Include">
<e p="Lightning.compute" t="Include" />
<e p="Lightning.shader" t="Include" />
<e p="LightningCompute.cs" t="Include" />
<e p="LightningVertex.cginc" t="Include" />
</e>
<e p="Stardust" t="Include">
<e p="Stardust.compute" t="Include" />
<e p="Stardust.cs" t="Include" />
<e p="Stardust.shader" t="Include" />
</e>
</e>
<e p="Dither Functions.cginc" t="Include" />
<e p="DitheredParticles.shader" t="Include" />

View file

@ -65,6 +65,7 @@
<Compile Include="Assets\Plugins\MSAGL\Routing\Visibility\VisibilityEdge.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\SplineRouter.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\GraphAlgorithms\IEdge.cs" />
<Compile Include="Assets\Plugins\GPUTrail\GPUTrailIndirect.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\Layered\Ordering\ConstrainedOrderMeasure.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\Curves\CurvatureDerivative.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalClusterScanLine.cs" />
@ -88,6 +89,7 @@
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\Bundling\EdgeNudger.cs" />
<Compile Include="Assets\Plugins\AsyncAwaitUtil\Tests\Util\TestButtonHandler.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\DataStructures\GenericHeapElement.cs" />
<Compile Include="Assets\Plugins\GPUTrail\GPUTrail.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\DataStructures\Size.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\LargeGraphLayout\DeviceIndependedZoomCalculatorForNodes.cs" />
<Compile Include="Assets\Plugins\MSAGL\Miscellaneous\ConstrainedSkeleton\SteinerCdt.cs" />
@ -125,6 +127,7 @@
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\ConeSpanner\LeftObstacleSide.cs" />
<Compile Include="Assets\Plugins\MIConvexHull\Triangulation\DelaunayTrianglationInternal.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\Bundling\FlipSwitcher.cs" />
<Compile Include="Assets\Plugins\GPUTrail\GPUTrailIndirectCulling.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalClusterEvent.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\MDS\MDSLayoutSettings.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\Layered\Ordering\ConstrainedOrdering.cs" />
@ -209,6 +212,7 @@
<Compile Include="Assets\Plugins\MSAGL\Core\Layout\CurvePort.cs" />
<Compile Include="Assets\Plugins\MSAGL\DebugHelpers\DebugShape.cs" />
<Compile Include="Assets\Plugins\MSAGL\GraphmapsWithMesh\ComponentCollection.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Scripts\GPUTrailBase.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\Incremental\Multipole\MultipoleCoefficients.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Routing\BundlingSettings.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Rectilinear\SparseVisibilityGraphGenerator.cs" />
@ -237,6 +241,7 @@
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\Bundling\PointPairOrder.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\DataStructures\RBTree\RBTree.cs" />
<Compile Include="Assets\Plugins\MSAGL\Miscellaneous\Ranking\Centrality.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Sample\GPUTrailSample\AutoRotate.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Routing\EdgeRoutingMode.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\LargeGraphLayout\Interval.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Rectilinear\Nudging\Path.cs" />
@ -287,6 +292,7 @@
<Compile Include="Assets\Plugins\NaughtyAttributes\Scripts\Core\DrawerAttributes\ResizableTextAreaAttribute.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\Curves\CubicBezierSegment.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Visibility\InteractiveTangentVisibilityGraphCalculator.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Sample\GPUTrailSpline\GPUTrailSplineSample.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\VoteBlock.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Layout\LayoutChangeEventArgs.cs" />
<Compile Include="Assets\Plugins\Celestial Body\Scripts\SphereMesh.cs" />
@ -294,6 +300,7 @@
<Compile Include="Assets\Plugins\MSAGL\Core\Layout\LayoutAlgorithmSettings.cs" />
<Compile Include="Assets\Plugins\MIConvexHull\ConvexHull\Collections.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Layout\LgNodeInfoKind.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Sample\GPUTrailSample\GenerateSphere.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\LargeGraphLayout\LgPathRouter.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\Incremental\AxisSolver.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Layout\ProximityOverlapRemoval\MST\MstOnDelaunayTriangulation.cs" />
@ -318,6 +325,7 @@
<Compile Include="Assets\Plugins\MSAGL\Layout\Layered\LayerCalculator.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\ProjectionSolver\ConstraintVector.cs" />
<Compile Include="Assets\Plugins\MSAGL\Miscellaneous\Routing\ShortestPathTree.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Scripts\GPUTrailSpline.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\Bundling\Station.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Rectilinear\GroupBoundaryCrossing.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Visibility\VisibilityVertex.cs" />
@ -370,6 +378,7 @@
<Compile Include="Assets\Plugins\MSAGL\Layout\Layered\VertexEnumerators.cs" />
<Compile Include="Assets\Plugins\NaughtyAttributes\Scripts\Core\DrawerAttributes\ShowNativePropertyAttribute.cs" />
<Compile Include="Assets\Plugins\MSAGL\Layout\Layered\NetworkEdge.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Sample\GPUTrailIndirectSample\GPUTrailIndirectSampleParticle.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\ConeSpanner\VertexEvent.cs" />
<Compile Include="Assets\Plugins\Celestial Body\Scripts\LODHandler.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\RectanglePacking\RectangleToPack.cs" />
@ -551,6 +560,7 @@
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\RectanglePacking\OptimalColumnPacking.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtFrontElement.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\Geometry\Curves\ParallelogramNodeOverICurve.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Sample\GPUTrailIndirectSample\GPUTrailIndirectSample.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\ProjectionSolver\Variable.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Rectilinear\Nudging\AxisEdgeHighPointEvent.cs" />
<Compile Include="Assets\Plugins\MSAGL\Miscellaneous\NonOverlappingBoundaries\AllPairsNonOverlappingBoundaries.cs" />
@ -570,6 +580,7 @@
<Compile Include="Assets\Plugins\MSAGL\Core\ProjectionSolver\UniformSolverVar.cs" />
<Compile Include="Assets\Plugins\Celestial Body\Scripts\Shading\ColourHelper.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\GraphAlgorithms\MinimumSpanningTreeByPrim.cs" />
<Compile Include="Assets\Plugins\GPUTrail\Sample\GPUTrailIndirectSample\GPUTrailIndirectCullingSample.cs" />
<Compile Include="Assets\Plugins\MSAGL\Routing\Spline\ConeSpanner\ConeSideComparer.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\GraphAlgorithms\BasicGraph.cs" />
<Compile Include="Assets\Plugins\MSAGL\Core\ProjectionSolver\SolverAlgorithm.cs" />
@ -661,6 +672,7 @@
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\PostProcessing\OceanEffect.shader" />
<None Include="Assets\Plugins\Celestial Body\Textures\_Sources.txt" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\Triplanar.cginc" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrailInput.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\PostProcessing\Test.shader" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\SimplexNoise2.cginc" />
<None Include="Assets\Plugins\GPU Noise\ClassicNoise2D.cginc" />
@ -673,16 +685,21 @@
<None Include="Assets\Plugins\Celestial Body\Scripts\Test\Phase.shader" />
<None Include="Assets\Plugins\GPU Noise\SimplexNoise3D.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\PostProcessing\Atmosphere.shader" />
<None Include="Assets\Plugins\GPUTrail\Sample\GPUTrailIndirectSample\GPUTrailIndirectSampleParticleCS.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Atmosphere\AtmosphereTexture.compute" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrailVariables.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Other\SteepnessCompute.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Height\EarthHeight.compute" />
<None Include="Assets\Plugins\GPU Noise\SimplexNoiseGrad3D.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Surface\MoonB.shader" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Textures\TextureGenerator.compute" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrailVariablesCS.compute" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrail.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Other\PerturbPoints.compute" />
<None Include="Assets\Plugins\GPU Noise\SimplexNoise2D.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\SimplexNoise.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\FractalNoise.cginc" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrail.shader" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Surface\Earth.shader" />
<None Include="Assets\Plugins\GPU Noise\ClassicNoise3D.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Textures\Blur.compute" />
@ -690,8 +707,11 @@
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Other\PerturbPointsPlatelike.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Height\MoonHeight.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Other\OceanMask.shader" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrailIndirectCulling.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\Math.cginc" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrailVertex.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\SimplexNoise3.cginc" />
<None Include="Assets\Plugins\GPUTrail\Shaders\GPUTrailIndirect.compute" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Includes\Craters.cginc" />
<None Include="Assets\Plugins\Celestial Body\Scripts\Shaders\Compute\Shading\MoonShading.compute" />
<Reference Include="UnityEngine">

View file

@ -78,6 +78,7 @@
<Compile Include="Assets\Scripts\UI\InputField.cs" />
<Compile Include="Assets\Scripts\UI\IncrementField.cs" />
<Compile Include="Assets\Scripts\UI\MenuPanel.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\LightningGunManager.cs" />
<Compile Include="Assets\Scripts\UI\ZoneObject.cs" />
<Compile Include="Assets\Scripts\Sector Display\SunMaterial.cs" />
<Compile Include="Assets\Scripts\UI\ZoneRenderer.cs" />
@ -141,6 +142,7 @@
<Compile Include="Assets\Scripts\UI\SchematicTriggerGroupElement.cs" />
<Compile Include="Assets\Scripts\UI\ConsoleView.cs" />
<Compile Include="Assets\Scripts\UI\MinimapCameraTrack.cs" />
<Compile Include="Assets\Shaders\Compute\Lightning\LightningCompute.cs" />
<Compile Include="Assets\Scripts\Sector Display\MapView.cs" />
<Compile Include="Assets\Scripts\MarkovNameGenerator.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\Laser.cs" />
@ -160,12 +162,13 @@
<Compile Include="Assets\Scripts\Gameplay\ThrusterHardpoint.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\ProjectileManager.cs" />
<Compile Include="Assets\Scripts\UI\TabButton.cs" />
<Compile Include="Assets\Shaders\Compute\Stardust.cs" />
<Compile Include="Assets\Shaders\Compute\Stardust\Stardust.cs" />
<Compile Include="Assets\Scripts\UI\EnumField.cs" />
<Compile Include="Assets\HoverCursorChange.cs" />
<Compile Include="Assets\Scripts\Sector Display\WaveScroll.cs" />
<Compile Include="Assets\Scripts\UI\MouseHover.cs" />
<Compile Include="Assets\Scripts\UI\PropertiesList.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\Lightning.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\WeaponChargeEffect.cs" />
<Compile Include="Assets\Scripts\UI\MenuTabButton.cs" />
<Compile Include="Assets\Scripts\UI\ContextMenuOption.cs" />
@ -179,6 +182,7 @@
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UI Particle Add.shader" />
<None Include="Assets\Shaders\Clouds.shader" />
<None Include="Assets\Shaders\AdditiveUI.shader" />
<None Include="Assets\Shaders\Compute\Lightning\Lightning.shader" />
<None Include="Assets\Shaders\Brushes\LinearWaveBrush.shader" />
<None Include="Assets\Resources\Sprites\Attribution.txt" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_Bitmap.shader" />
@ -187,6 +191,7 @@
<None Include="Assets\Allegorithmic\Plugins\EULA.txt" />
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UIMultiply.shader" />
<None Include="Assets\Shaders\GalaxyMap.shader" />
<None Include="Assets\Shaders\Compute\Lightning\LightningVertex.cginc" />
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UILinearDodge.shader" />
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UI Particle Alpha Blend.shader" />
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\SoftMaskShader.shader" />
@ -194,8 +199,8 @@
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UI Particle VertexLit Blended.shader" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Surface-Mobile.shader" />
<None Include="Assets\Shaders\IsolinesUI.shader" />
<None Include="Assets\Shaders\Compute\Stardust.compute" />
<None Include="Assets\Shaders\Compute\Stardust.shader" />
<None Include="Assets\Shaders\Compute\Stardust\Stardust.compute" />
<None Include="Assets\Shaders\Compute\Stardust\Stardust.shader" />
<None Include="Assets\Shaders\MaskedWorldSpaceUI.shader" />
<None Include="Assets\Shaders\Brushes\PowerBrush.shader" />
<None Include="Assets\Shaders\DitheredParticles.shader" />
@ -213,6 +218,7 @@
<None Include="Assets\TextMesh Pro\Resources\LineBreaking Leading Characters.txt" />
<None Include="Assets\Shaders\MaskedUIBlur.shader" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro_Properties.cginc" />
<None Include="Assets\Shaders\Compute\Lightning\Lightning.compute" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro_Surface.cginc" />
<None Include="Assets\Shaders\Raymarching\VolumeRender.shader" />
<None Include="Assets\Shaders\Background.shader" />

View file

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 052800b5846fe8c4ca5858477fb80bc2
folderAsset: yes
DefaultImporter:
userData:

View file

@ -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<Vector3> _posLog = new LinkedList<Vector3>();
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<Node> _newPoints = new List<Node>();
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<Node> 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);
}
}
}
}

View file

@ -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:

View file

@ -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();
}

View file

@ -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:

View file

@ -0,0 +1,145 @@
using UnityEngine;
using System.Linq;
using UnityEngine.Assertions;
using System.Collections.Generic;
/// <summary>
/// GPUTrailIndirectCulling
/// cull processing for many camera(same position because GPUTrail faces one point)
/// </summary>
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<Camera, Data> _cameraDatas = new Dictionary<Camera, Data>();
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();
}
}

View file

@ -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:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ef617e94019158342b615fa339b392e1
folderAsset: yes
timeCreated: 1484908289
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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: []

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: c1c458d860a40bc4f836b8625223124f
NativeFormatImporter:
userData:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8800f49c2f304ce4fa5829a607612554
folderAsset: yes
timeCreated: 1484652950
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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}

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 1c58eccb616ffaa4abc8f41d4f27ec8b
DefaultImporter:
userData:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5ac0b91fd841f424d8d05418be4c6b9c
folderAsset: yes
timeCreated: 1484820531
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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}

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 34434622149c0594f86fe9841b125833
DefaultImporter:
userData:

View file

@ -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();
}
}

View file

@ -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:

View file

@ -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();
}
}

View file

@ -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:

View file

@ -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();
}
}

View file

@ -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:

View file

@ -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<Particle> _ParticleBuffer;
RWStructuredBuffer<float3> _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;
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 16daaa733f6a1194394beb0d2f0d6fb9
timeCreated: 1484821669
licenseType: Pro
ComputeShaderImporter:
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 45abad6e576141f4bb85acdbebe2dc3e
folderAsset: yes
timeCreated: 1463641382
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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}

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 5e752ff29789a674abd0569dfcb75579
DefaultImporter:
userData:

View file

@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections;
public class AutoRotate : MonoBehaviour {
public Vector3 rotSpeed;
void Update () {
transform.Rotate(rotSpeed * Time.deltaTime);
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 47e64413aeb5ae740b410d70fb05d20c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -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<num; ++i)
{
var pos = Random.insideUnitSphere * radius + transform.position;
var go = Instantiate(prefab, pos, Quaternion.identity) as GameObject;
if (go)
{
go.transform.SetParent(transform);
go.GetComponent<Rigidbody>().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<Rigidbody>().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);
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c4a3d260b8b4b1049bf05a10bcc97301
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -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

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 6b91e96dd2563eb45b1def3be8081baa
NativeFormatImporter:
userData:

View file

@ -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

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 34e81c32db6482d4c82c12160b1d7071
NativeFormatImporter:
userData:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cc699637ce28d0f4796f8299f7e06255
folderAsset: yes
timeCreated: 1463641411
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GPUTrailSplineSample : MonoBehaviour
{
public int step = 10;
public List<Transform> _transforms = new List<Transform>();
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);
}
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2395ee23edd5af441965999fca9b7105
timeCreated: 1463641475
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f29045ba16334440adcef4ad73c0a46
timeCreated: 1463641449
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 87add697784154b4a89202c61a7db91a
folderAsset: yes
timeCreated: 1484908277
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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);
}
}

View file

@ -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:

View file

@ -0,0 +1,26 @@
using UnityEngine;
using System.Collections;
public class GPUTrailSpline : MonoBehaviour
{
/// <summary>
/// start~end をつなぐ曲線上の点をtに応じて求める
/// http://t-pot.com/program/2_3rdcurve/index.html
/// </summary>
/// <param name="t">0f~1f</param>
/// <param name="prev"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
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;
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 45d00a08e3faffd4a953ac1e71b719b4
timeCreated: 1484652959
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e8f569d24bcf60b429791c2b847eda51
folderAsset: yes
timeCreated: 1484908254
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,106 @@
#pragma kernel CreateWidth
#define NUM_THREAD_X 16
#include "GPUTrailVariablesCS.compute"
int _InputNum;
int _TotalInputIdx;
uint _BufferSize;
float _StartTime;
StructuredBuffer<Node> _InputBuffer;
RWStructuredBuffer<Node> _NodeBuffer;
RWStructuredBuffer<Vertex> _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;
}
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f88322fe9ecec1e41b2a237407abddad
timeCreated: 1484808801
licenseType: Pro
ComputeShaderImporter:
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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
}

View file

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: aa7a048c89ecc5c4bad74dee290e8ac2
ShaderImporter:
defaultTextures: []
userData:

View file

@ -0,0 +1,139 @@
#pragma kernel AddNode
#pragma kernel CreateWidth
#define NUM_THREAD_X 32
#include "GPUTrailVariablesCS.compute"
////////////////////////////////////////////////////////////////////////////////
// AddNode
////////////////////////////////////////////////////////////////////////////////
StructuredBuffer<InputData> _InputBuffer;
RWStructuredBuffer<Trail> _TrailBufferW;
RWStructuredBuffer<Node> _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<Trail> _TrailBuffer;
StructuredBuffer<Node> _NodeBuffer;
RWStructuredBuffer<Vertex> _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;
}
}

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 5e0b0e8f0f658774f9dca7b0695eacd4
ComputeShaderImporter:
userData:

View file

@ -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<bool> _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<Node> _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<bool> _IsInView;
AppendStructuredBuffer<uint> _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<uint> _IsInViewIdxs;
StructuredBuffer<Vertex> _VertexBufferSrc;
RWStructuredBuffer<Vertex> _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];
}
}

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 4d2092e994db09747aba3bb6375f54c7
ComputeShaderImporter:
userData:

View file

@ -0,0 +1,10 @@
#ifndef GPUTRAIL_INPUT_INCLUDED
#define GPUTRAIL_INPUT_INCLUDED
struct InputData
{
float3 pos;
float4 color;
};
#endif // GPUTRAIL_INPUT_INCLUDED

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 41fea103c13a630439d32ae76aa6e2e0
timeCreated: 1510730009
licenseType: Pro
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,25 @@
#ifndef GPUTRAIL_VARIABLES_INCLUDED
#define GPUTRAIL_VARIABLES_INCLUDED
#include "GPUTrailVertex.cginc"
fixed4 _StartColor;
fixed4 _EndColor;
uint _VerticesPerInstance;
StructuredBuffer<uint> _IndexBuffer;
StructuredBuffer<Vertex> _VertexBuffer;
#ifdef GPUTRAIL_TRAIL_INDEX_ON
StructuredBuffer<uint> _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

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b64a9ffbf8d3f004b9100df18c455bb2
timeCreated: 1484809989
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: d8aece58a94168249a2913cb85ec5a8c
ComputeShaderImporter:
userData:

View file

@ -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

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bdb091613de042b42b193c0294db26da
timeCreated: 1484809989
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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:

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 212ff21571a845b43ad9f1b923694d34
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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}

View file

@ -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}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5ebe5ec781779b74a8ec23c0717cd0b0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -31,7 +31,6 @@ public class GuidedProjectile : MonoBehaviour
public float Thrust;
public float TopSpeed;
public Transform Source;
public Transform Target;
public Func<Vector3> 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; }

View file

@ -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<LineRenderer>();
}
}
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<HullCollider>();
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<Prototype>().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]);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5c75d76a7b418d3479761187b2d420bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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<Lightning>();
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();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9aff863873a6a6d41a619e63a0898c3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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)
{

View file

@ -78,6 +78,7 @@ public class Reactor : IBehavior, IOrderedBehavior
int chargedCapacitors = 0;
do
{
chargedCapacitors = 0;
var chargeToRemove = -Entity.Energy;
foreach (var cap in _capacitors)
{

View file

@ -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;
}
}
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;
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5923c75973a59304d98edd57680ec454
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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<Node> _NodeBuffer;
RWStructuredBuffer<Vertex> _VertexBuffer;
RWStructuredBuffer<Bolt> _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;
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a974189fea3fe9a46a7859ef6ea8da09
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c94ec17d8118c2749ad885c2b378ea01
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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<uint> _IndexBuffer;
StructuredBuffer<Vertex> _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
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 21dd485e846b4d3a8213cf5551832776
timeCreated: 1612395387

View file

@ -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<Node>();
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);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 044c2be5da0fc2340a09f856be731cea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 73ccd50b02d44a0185deea93c36ffb55
timeCreated: 1612367245

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a10e817dfc0d294fb8a3760cac10f78
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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

Binary file not shown.

BIN
UserSettings/EditorUserSettings.asset (Stored with Git LFS)

Binary file not shown.