Stardust
Created "stardust" compute shader particle system Enabled asteroid icons on the map
This commit is contained in:
parent
76eca26972
commit
f8165878e0
16 changed files with 762 additions and 218 deletions
|
|
@ -1840,6 +1840,11 @@
|
|||
<e p="SimplexBrush.shader" t="Include" />
|
||||
</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>
|
||||
<e p="Dither Functions.cginc" t="Include" />
|
||||
<e p="DitheredParticles.shader" t="Include" />
|
||||
<e p="GalaxyMap.shader" t="Include" />
|
||||
|
|
|
|||
|
|
@ -675,6 +675,7 @@
|
|||
<Compile Include="Assets\Scripts\AetheriaInput.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\MinimapCameraTrack.cs" />
|
||||
<Compile Include="Assets\Scripts\Sector Display\MapView.cs" />
|
||||
<Compile Include="Assets\Shaders\Compute\Stardust.cs" />
|
||||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro.cginc" />
|
||||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Mobile Overlay.shader" />
|
||||
<None Include="Assets\Shaders\Clouds.shader" />
|
||||
|
|
@ -687,6 +688,8 @@
|
|||
<None Include="Assets\Shaders\GalaxyMap.shader" />
|
||||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Surface-Mobile.shader" />
|
||||
<None Include="Assets\Scripts\NIH\GPU Noise\SimplexNoise3D.cginc" />
|
||||
<None Include="Assets\Shaders\Compute\Stardust.compute" />
|
||||
<None Include="Assets\Shaders\Compute\Stardust.shader" />
|
||||
<None Include="Assets\Shaders\Brushes\PowerBrush.shader" />
|
||||
<None Include="Assets\Shaders\DitheredParticles.shader" />
|
||||
<None Include="Assets\Shaders\Raymarching\VolumeJupiter.shader" />
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ RenderTexture:
|
|||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthFormat: 0
|
||||
m_ColorFormat: 45
|
||||
m_ColorFormat: 49
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
|
|
|
|||
BIN
Assets/Resources/Gradients/blackbody.png
(Stored with Git LFS)
Normal file
BIN
Assets/Resources/Gradients/blackbody.png
(Stored with Git LFS)
Normal file
Binary file not shown.
118
Assets/Resources/Gradients/blackbody.png.meta
Normal file
118
Assets/Resources/Gradients/blackbody.png.meta
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 56db63da398b2d04394ddbccedce943c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -2553,7 +2553,7 @@ Transform:
|
|||
- {fileID: 488792361}
|
||||
- {fileID: 970624070}
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &204384462
|
||||
GameObject:
|
||||
|
|
@ -5233,36 +5233,6 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 460484048}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &475807987
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 475807989}
|
||||
m_Layer: 0
|
||||
m_Name: Top Down View Target
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &475807989
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 475807987}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -2.5}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &477175240
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -10864,7 +10834,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &937280109
|
||||
MonoBehaviour:
|
||||
|
|
@ -11761,6 +11731,7 @@ GameObject:
|
|||
- component: {fileID: 1009503732}
|
||||
- component: {fileID: 1009503733}
|
||||
- component: {fileID: 1009503734}
|
||||
- component: {fileID: 1009503735}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
|
|
@ -11837,7 +11808,6 @@ MonoBehaviour:
|
|||
MinimapGravityQuad: {fileID: 509767789}
|
||||
SceneCameras:
|
||||
- {fileID: 887677622}
|
||||
- {fileID: 1517471405}
|
||||
FogCameras:
|
||||
- {fileID: 559840917}
|
||||
- {fileID: 507065483}
|
||||
|
|
@ -11912,6 +11882,8 @@ MonoBehaviour:
|
|||
Material: {fileID: 2100000, guid: 9be65d82397829b46894243c2d91a06d, type: 2}
|
||||
AsteroidSpritesheetWidth: 4
|
||||
AsteroidSpritesheetHeight: 4
|
||||
AsteroidBeltUI: {fileID: 349597964696402918, guid: 1f1bfa2175a13b647888e2949e0cb138,
|
||||
type: 3}
|
||||
Planet: {fileID: 8287217960984982033, guid: 88ace6073e3db1a46bd3aaf4f971acb9, type: 3}
|
||||
GasGiant: {fileID: 3250623180916197132, guid: 85753b4a7c762274385af384abed7a04,
|
||||
type: 3}
|
||||
|
|
@ -12035,6 +12007,32 @@ MonoBehaviour:
|
|||
Minimap: {fileID: 970624071}
|
||||
GravityRenderer: {fileID: 509767789}
|
||||
ZoomSpeed: 0.001
|
||||
--- !u!114 &1009503735
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1009503727}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1d9e94d9c84cb6d46a2811d6a0e5e32e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
TargetCamera: {fileID: 2115559089}
|
||||
ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a, type: 3}
|
||||
ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2}
|
||||
Span: 256
|
||||
Speed: 0.125
|
||||
MinimumSize: 0.5
|
||||
MaximumSize: 3
|
||||
Spacing: 8
|
||||
Ceiling: -300
|
||||
Floor: 10
|
||||
HeightExponent: 16
|
||||
Heightmap: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
|
||||
ParticleColors: {fileID: 2800000, guid: 56db63da398b2d04394ddbccedce943c, type: 3}
|
||||
GravityCamera: {fileID: 1537342003}
|
||||
--- !u!1 &1015214589
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -13500,104 +13498,6 @@ MonoBehaviour:
|
|||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!1 &1243356017
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1243356018}
|
||||
- component: {fileID: 1243356022}
|
||||
- component: {fileID: 1243356021}
|
||||
- component: {fileID: 1243356020}
|
||||
- component: {fileID: 1243356019}
|
||||
m_Layer: 0
|
||||
m_Name: cm
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1243356018
|
||||
Transform:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1243356017}
|
||||
m_LocalRotation: {x: -0.2677866, y: 0.37796336, z: -0.115197934, w: 0.87872833}
|
||||
m_LocalPosition: {x: 0.27700424, y: 0.74153686, z: 4.1357794}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1517471404}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1243356019
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1243356017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a4c41ac9245b87c4192012080077d830, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Damping: 0
|
||||
--- !u!114 &1243356020
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1243356017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 68bb026fafb42b14791938953eaace77, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_NoiseProfile: {fileID: 11400000, guid: 46965f9cbaf525742a6da4c2172a99cd, type: 2}
|
||||
m_PivotOffset: {x: 0, y: 0, z: 0}
|
||||
m_AmplitudeGain: 0.125
|
||||
m_FrequencyGain: 0.5
|
||||
mNoiseOffsets: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1243356021
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1243356017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fa7155796051b734daa718462081dc5f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BindingMode: 1
|
||||
m_FollowOffset: {x: 0, y: 0, z: 0}
|
||||
m_XDamping: 1
|
||||
m_YDamping: 1
|
||||
m_ZDamping: 1
|
||||
m_AngularDampingMode: 0
|
||||
m_PitchDamping: 0
|
||||
m_YawDamping: 0
|
||||
m_RollDamping: 0
|
||||
m_AngularDamping: 0
|
||||
--- !u!114 &1243356022
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1243356017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1250229237
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -15913,73 +15813,6 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1505831356}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &1517471403
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1517471404}
|
||||
- component: {fileID: 1517471405}
|
||||
m_Layer: 0
|
||||
m_Name: Top Down Rig
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &1517471404
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1517471403}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -2.5}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1243356018}
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1517471405
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1517471403}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ExcludedPropertiesInInspector:
|
||||
- m_Script
|
||||
m_LockStageInInspector:
|
||||
m_StreamingVersion: 20170927
|
||||
m_Priority: 10
|
||||
m_StandbyUpdate: 2
|
||||
m_LookAt: {fileID: 0}
|
||||
m_Follow: {fileID: 475807989}
|
||||
m_Lens:
|
||||
FieldOfView: 60
|
||||
OrthographicSize: 5
|
||||
NearClipPlane: 0.3
|
||||
FarClipPlane: 1000
|
||||
Dutch: 0
|
||||
LensShift: {x: 0, y: 0}
|
||||
m_Transitions:
|
||||
m_BlendHint: 0
|
||||
m_InheritPosition: 0
|
||||
m_OnCameraLive:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_LegacyBlendHint: 0
|
||||
m_ComponentOwner: {fileID: 1243356018}
|
||||
--- !u!1001 &1527573892
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -16618,7 +16451,7 @@ Transform:
|
|||
- {fileID: 1537342002}
|
||||
- {fileID: 39508928}
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1547889400
|
||||
MonoBehaviour:
|
||||
|
|
@ -18722,7 +18555,6 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 887677623}
|
||||
- {fileID: 1517471404}
|
||||
- {fileID: 2115559090}
|
||||
- {fileID: 937280108}
|
||||
- {fileID: 1547889399}
|
||||
|
|
@ -23041,7 +22873,7 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 509767791}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &2098141212
|
||||
PrefabInstance:
|
||||
|
|
@ -23494,7 +23326,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 10.742, y: -15.218, z: 0}
|
||||
--- !u!114 &2115559091
|
||||
MonoBehaviour:
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class SectorRenderer : MonoBehaviour
|
|||
// public Material AsteroidMaterial;
|
||||
|
||||
[Header("Prefabs")]
|
||||
// public MeshFilter AsteroidBeltUI;
|
||||
public MeshFilter AsteroidBeltUI;
|
||||
public PlanetObject Planet;
|
||||
public GasGiantObject GasGiant;
|
||||
public SunObject Sun;
|
||||
|
|
@ -41,7 +41,7 @@ public class SectorRenderer : MonoBehaviour
|
|||
public Texture2D PlanetoidIcon;
|
||||
public Texture2D PlanetIcon;
|
||||
|
||||
// private Dictionary<Guid, AsteroidBeltUI> _beltObjects = new Dictionary<Guid, AsteroidBeltUI>();
|
||||
private Dictionary<Guid, AsteroidBeltUI> _beltObjects = new Dictionary<Guid, AsteroidBeltUI>();
|
||||
private Dictionary<Guid, PlanetObject> _planets = new Dictionary<Guid, PlanetObject>();
|
||||
private Dictionary<Guid, InstancedMesh[]> _beltMeshes = new Dictionary<Guid, InstancedMesh[]>();
|
||||
private Dictionary<Guid, Matrix4x4[][]> _beltMatrices = new Dictionary<Guid, Matrix4x4[][]>();
|
||||
|
|
@ -125,10 +125,10 @@ public class SectorRenderer : MonoBehaviour
|
|||
_beltMatrices[planetData.ID][i] = new Matrix4x4[i<meshes.Count-1 ? count : count+remainder];
|
||||
}
|
||||
|
||||
// var beltObject = Instantiate(AsteroidBeltUI, ZoneRoot);
|
||||
// var collider = beltObject.GetComponent<MeshCollider>();
|
||||
// var belt = new AsteroidBeltUI(_zone, _zone.AsteroidBelts[beltData.ID], beltObject, collider, AsteroidSpritesheetWidth, AsteroidSpritesheetHeight, Settings.MinimapAsteroidSize);
|
||||
// _beltObjects[beltData.ID] = belt;
|
||||
var beltObject = Instantiate(AsteroidBeltUI, ZoneRoot);
|
||||
var collider = beltObject.GetComponent<MeshCollider>();
|
||||
var belt = new AsteroidBeltUI(_zone, _zone.AsteroidBelts[beltData.ID], beltObject, collider, AsteroidSpritesheetWidth, AsteroidSpritesheetHeight, Settings.MinimapAsteroidSize);
|
||||
_beltObjects[beltData.ID] = belt;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -182,7 +182,6 @@ public class SectorRenderer : MonoBehaviour
|
|||
{
|
||||
foreach(var belt in _zone.AsteroidBelts)
|
||||
{
|
||||
// _beltObjects[belt.Key].Update();
|
||||
var meshes = _beltMeshes[belt.Key];
|
||||
for (int i = 0; i < _beltAsteroidPositions[belt.Key].Length; i++)
|
||||
_beltAsteroidPositions[belt.Key][i] = float3(belt.Value.Transforms[i].x, _zone.GetHeight(belt.Value.Transforms[i].xy), belt.Value.Transforms[i].y);
|
||||
|
|
@ -202,6 +201,7 @@ public class SectorRenderer : MonoBehaviour
|
|||
|
||||
Graphics.DrawMeshInstanced(meshes[i].Mesh, 0, meshes[i].Material, _beltMatrices[belt.Key][i]);
|
||||
}
|
||||
_beltObjects[belt.Key].Update(_beltAsteroidPositions[belt.Key]);
|
||||
}
|
||||
|
||||
foreach (var planet in _planets)
|
||||
|
|
@ -311,21 +311,21 @@ public class AsteroidBeltUI
|
|||
//_collider.sharedMesh = _mesh;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void Update(float3[] positions)
|
||||
{
|
||||
var parentPosition = _zone.GetOrbitPosition(_orbitParent);
|
||||
for (var i = 0; i < _belt.Data.Asteroids.Length; i++)
|
||||
{
|
||||
var rotation = Quaternion.Euler(90, _belt.Transforms[i].z, 0);
|
||||
var position = new Vector3(_belt.Transforms[i].x, _zone.GetHeight(parentPosition), _belt.Transforms[i].y);
|
||||
_vertices[i * 4] = rotation * new Vector3(-_belt.Transforms[i].w * _scale,-_belt.Transforms[i].w * _scale,0) + position;
|
||||
_vertices[i * 4 + 1] = rotation * new Vector3(-_belt.Transforms[i].w * _scale,_belt.Transforms[i].w * _scale,0) + position;
|
||||
_vertices[i * 4 + 2] = rotation * new Vector3(_belt.Transforms[i].w * _scale,_belt.Transforms[i].w * _scale,0) + position;
|
||||
_vertices[i * 4 + 3] = rotation * new Vector3(_belt.Transforms[i].w * _scale,-_belt.Transforms[i].w * _scale,0) + position;
|
||||
//var position = new Vector3(_belt.Transforms[i].x, _zone.GetHeight(parentPosition), _belt.Transforms[i].y);
|
||||
_vertices[i * 4] = rotation * new Vector3(-_belt.Transforms[i].w * _scale,-_belt.Transforms[i].w * _scale,0) + (Vector3) positions[i];
|
||||
_vertices[i * 4 + 1] = rotation * new Vector3(-_belt.Transforms[i].w * _scale,_belt.Transforms[i].w * _scale,0) + (Vector3) positions[i];
|
||||
_vertices[i * 4 + 2] = rotation * new Vector3(_belt.Transforms[i].w * _scale,_belt.Transforms[i].w * _scale,0) + (Vector3) positions[i];
|
||||
_vertices[i * 4 + 3] = rotation * new Vector3(_belt.Transforms[i].w * _scale,-_belt.Transforms[i].w * _scale,0) + (Vector3) positions[i];
|
||||
}
|
||||
|
||||
_mesh.bounds = new Bounds((Vector2) parentPosition, Vector3.one * (_size * 2));
|
||||
_mesh.bounds = new Bounds(new Vector3(parentPosition.x, 0, parentPosition.y), Vector3.one * (_size * 2));
|
||||
_mesh.vertices = _vertices;
|
||||
_collider.sharedMesh = _mesh;
|
||||
//_collider.sharedMesh = _mesh;
|
||||
}
|
||||
}
|
||||
8
Assets/Shaders/Compute.meta
Normal file
8
Assets/Shaders/Compute.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ead4ac133faacfb40869b2f1cb2c370b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
132
Assets/Shaders/Compute/Stardust.compute
Normal file
132
Assets/Shaders/Compute/Stardust.compute
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
//Tell unity that we have defined a kernel
|
||||
#pragma kernel UpdateParticles
|
||||
|
||||
//Store Particle data in a struct
|
||||
struct Particle
|
||||
{
|
||||
float3 position;
|
||||
float3 color;
|
||||
float size;
|
||||
};
|
||||
|
||||
RWStructuredBuffer<Particle> particles;
|
||||
|
||||
// Use this texture to spawn particles over terrain
|
||||
Texture2D Heightmap;
|
||||
SamplerState samplerHeightmap;
|
||||
|
||||
// Use this texture to choose the color of the particle
|
||||
Texture2D HueTexture;
|
||||
SamplerState samplerHueTexture;
|
||||
|
||||
uniform float4x4 noiseOffsetMatrix;
|
||||
|
||||
float time;
|
||||
float3 transform;
|
||||
float spacing;
|
||||
float ceilingHeight;
|
||||
float floorHeight;
|
||||
float maximumSize;
|
||||
float minimumSize;
|
||||
float heightExponent;
|
||||
uint span;
|
||||
|
||||
//================
|
||||
//Bonus: Random number generator
|
||||
//Using xorshift, and thread ID as a seed. If you only use xorshift,
|
||||
//there is too much correlation, so we first hash the seed id in RandomFirst()
|
||||
//See: http://www.reedbeta.com/blog/2013/01/12/quick-and-easy-gpu-random-numbers-in-d3d11/
|
||||
|
||||
uint rngState;
|
||||
|
||||
#define UINT_MAXF 4294967290.0f
|
||||
|
||||
|
||||
float RandomFirst(uint a, uint b)
|
||||
{
|
||||
//wang hash the seed first to get rid of correlation.
|
||||
a = (a ^ 61) ^ (a >> 16);
|
||||
a *= 9;
|
||||
a = a ^ (a >> 4);
|
||||
a *= 0x27d4eb2d;
|
||||
a = a ^ (a >> 15);
|
||||
|
||||
b -= (b<<6);
|
||||
b ^= (a>>17);
|
||||
b -= (b<<9);
|
||||
b ^= (a<<4);
|
||||
b -= (b<<3);
|
||||
b ^= (b<<10);
|
||||
b ^= (b>>15);
|
||||
|
||||
rngState = a ^ b;
|
||||
|
||||
return (float)rngState / UINT_MAXF;
|
||||
}
|
||||
|
||||
|
||||
float RandomValue()
|
||||
{
|
||||
// Xorshift algorithm from George Marsaglia's paper
|
||||
//You could use RandomFirst() all the time - it'd just be more expensive.
|
||||
rngState ^= (rngState << 13);
|
||||
rngState ^= (rngState >> 17);
|
||||
rngState ^= (rngState << 5);
|
||||
return (float) rngState / UINT_MAXF;
|
||||
}
|
||||
|
||||
#define HASHSCALE 0.1031
|
||||
|
||||
float hash(float p)
|
||||
{
|
||||
float3 p3 = frac(p.xxx * HASHSCALE);
|
||||
p3 += dot(p3, p3.yzx + 19.19);
|
||||
return frac((p3.x + p3.y) * p3.z);
|
||||
}
|
||||
|
||||
float fade(float t) { return t*t*t*(t*(6.*t-15.)+10.); }
|
||||
|
||||
float grad(float hash, float p)
|
||||
{
|
||||
int i = int(1e4*hash);
|
||||
return (i & 1) == 0 ? p : -p;
|
||||
}
|
||||
|
||||
float perlinNoise1D(float p)
|
||||
{
|
||||
float pi = floor(p), pf = p - pi, w = fade(pf);
|
||||
return lerp(grad(hash(pi), pf), grad(hash(pi + 1.0), pf - 1.0), w) * 2.0;
|
||||
}
|
||||
|
||||
const float4 irrationals = float4(1.41421, 3.14159, 2.71828, 1.61803);
|
||||
float noise(float p)
|
||||
{
|
||||
return (sin(irrationals.x * p) + sin(irrationals.y * p) + sin(irrationals.z * p) + sin(irrationals.w * p))/4;
|
||||
}
|
||||
|
||||
const uint offset = 65535;
|
||||
const float randomRange = 2048;
|
||||
|
||||
//Since we only have a long list of particles, our thread group is just a flat block of threads in the x direction
|
||||
//128 threads in a group is a good amount for a couple of reasons
|
||||
[numthreads(128, 1, 1)]
|
||||
void UpdateParticles(uint3 id : SV_DispatchThreadID, int3 groupID : SV_GroupThreadID)
|
||||
{
|
||||
int x = id % span - span / 2;
|
||||
int y = id / span - span / 2;
|
||||
|
||||
int xt = (int)(transform.x / spacing);
|
||||
int yt = (int)(transform.y / spacing);
|
||||
uint xp = x + xt + offset;
|
||||
uint yp = y + yt + offset;
|
||||
|
||||
particles[id.x].color = HueTexture.SampleLevel(samplerHueTexture, float2(RandomFirst(xp, yp), 0.0f), 0.0f).rgb;
|
||||
|
||||
particles[id.x].position = float3(
|
||||
x * spacing + xt * spacing + perlinNoise1D(RandomValue()*1024+time)*spacing, 0,
|
||||
y * spacing + yt * spacing + perlinNoise1D(RandomValue()*1024+time)*spacing);
|
||||
float2 puv = float2(.5,.5) - (particles[id.x].position.xz - transform.xy) / (transform.z);
|
||||
float gravDepth = Heightmap.SampleLevel(samplerHeightmap, puv, 0.0f).r;
|
||||
particles[id.x].position.y = lerp(-gravDepth + floorHeight, ceilingHeight, pow(RandomValue(), heightExponent)) + perlinNoise1D(RandomValue()*1024+time)*spacing/2;
|
||||
particles[id.x].size = lerp(minimumSize, maximumSize, RandomValue());
|
||||
}
|
||||
8
Assets/Shaders/Compute/Stardust.compute.meta
Normal file
8
Assets/Shaders/Compute/Stardust.compute.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f53a4ba56f0db2a49ad9f68150bf298a
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
currentAPIMask: 4
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
158
Assets/Shaders/Compute/Stardust.cs
Normal file
158
Assets/Shaders/Compute/Stardust.cs
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
|
||||
public class Stardust : MonoBehaviour
|
||||
{
|
||||
#region variables
|
||||
//public bool debugLog = false;
|
||||
//public float proxyPersistTime = 2;
|
||||
public Camera TargetCamera;
|
||||
public ComputeShader ParticleCalculation;
|
||||
public Material ParticleMaterial;
|
||||
public int Span = 512;
|
||||
public float Speed = .25f;
|
||||
|
||||
public float MinimumSize = .1f;
|
||||
public float MaximumSize = 2;
|
||||
|
||||
public float Spacing = 4.0f;
|
||||
public float Ceiling = -250.0f;
|
||||
public float Floor = -25.0f;
|
||||
public float HeightExponent = 4;
|
||||
|
||||
public Texture Heightmap;
|
||||
public Texture2D ParticleColors;
|
||||
//public Transform TargetTransform;
|
||||
public Camera GravityCamera;
|
||||
|
||||
private Vector3[] _vertices;
|
||||
|
||||
private const int GROUP_SIZE = 128;
|
||||
private int _updateParticlesKernel;
|
||||
|
||||
private float _maxTemperature = 0;
|
||||
#endregion
|
||||
|
||||
#region Structs
|
||||
//Notice that this struct has to match the one in the compute shader exactly.
|
||||
struct Particle
|
||||
{
|
||||
public Vector3 Position;
|
||||
public Vector3 Color; //Color is a float3 in the compute shader, we need a Vector3 to match that layout, not a Color!
|
||||
public float Size;
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region buffers
|
||||
private ComputeBuffer _particlesBuffer;
|
||||
private const int PARTICLE_STRIDE = 28;
|
||||
|
||||
private ComputeBuffer _quadPoints;
|
||||
private const int QUAD_STRIDE = 12;
|
||||
|
||||
#endregion
|
||||
|
||||
#region setup
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
//Find compute kernel
|
||||
_updateParticlesKernel = ParticleCalculation.FindKernel("UpdateParticles");
|
||||
|
||||
//Create particle buffer
|
||||
_particlesBuffer = new ComputeBuffer(Span * Span, PARTICLE_STRIDE);
|
||||
// _temperature = new ComputeBuffer(128, TEMP_STRIDE);
|
||||
|
||||
Particle[] particles = new Particle[Span * Span];
|
||||
|
||||
for (int i = 0; i < Span * Span; ++i)
|
||||
{
|
||||
particles[i].Position = Random.insideUnitSphere * 100;
|
||||
particles[i].Color = Vector3.one;//white
|
||||
particles[i].Size = Random.value;
|
||||
}
|
||||
|
||||
_particlesBuffer.SetData(particles);
|
||||
|
||||
//Create quad buffer
|
||||
_quadPoints = new ComputeBuffer(6, QUAD_STRIDE);
|
||||
|
||||
_quadPoints.SetData(new[] {
|
||||
new Vector3(-.5f, .5f),
|
||||
new Vector3(.5f, .5f),
|
||||
new Vector3(.5f, -.5f),
|
||||
new Vector3(.5f, -.5f),
|
||||
new Vector3(-.5f, -.5f),
|
||||
new Vector3(-.5f, .5f)
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Compute update
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//Bind resources to compute shader
|
||||
ParticleCalculation.SetBuffer(_updateParticlesKernel, "particles", _particlesBuffer);
|
||||
// ParticleCalculation.SetBuffer(_updateParticlesKernel, "temperature", _temperature);
|
||||
|
||||
ParticleCalculation.SetFloat("time", Time.time * Speed);
|
||||
|
||||
var pos = GravityCamera.transform.position;
|
||||
ParticleCalculation.SetVector("transform", new Vector4(pos.x,pos.z,GravityCamera.orthographicSize*2));
|
||||
ParticleCalculation.SetFloat("spacing", Spacing);
|
||||
ParticleCalculation.SetFloat("ceilingHeight", Ceiling);
|
||||
ParticleCalculation.SetFloat("floorHeight", Floor);
|
||||
ParticleCalculation.SetFloat("heightExponent", HeightExponent);
|
||||
ParticleCalculation.SetFloat("maximumSize", MaximumSize);
|
||||
ParticleCalculation.SetFloat("minimumSize", MinimumSize);
|
||||
ParticleCalculation.SetInt("span", Span);
|
||||
|
||||
ParticleCalculation.SetTexture(_updateParticlesKernel, "Heightmap", Heightmap);
|
||||
ParticleCalculation.SetTexture(_updateParticlesKernel, "HueTexture", ParticleColors);
|
||||
|
||||
//Dispatch, launch threads on GPU
|
||||
int numberOfGroups = Mathf.CeilToInt((float)Span * Span / GROUP_SIZE);
|
||||
ParticleCalculation.Dispatch(_updateParticlesKernel, numberOfGroups, 1, 1);
|
||||
|
||||
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);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region rendering
|
||||
// void OnRenderObject()
|
||||
// {
|
||||
// if (Camera.current == TargetCamera || Camera.current.name == "SceneCamera")
|
||||
// {
|
||||
// //Bind resources to material
|
||||
// ParticleMaterial.SetBuffer("particles", _particlesBuffer);
|
||||
// ParticleMaterial.SetBuffer("quadPoints", _quadPoints);
|
||||
// // ParticleMaterial.SetFloat("velocityStretch", ParticleVelocityStretch);
|
||||
// // ParticleMaterial.SetVector("velocity", PlayerVelocity);
|
||||
//
|
||||
// //Set the pass
|
||||
// ParticleMaterial.SetPass(0);
|
||||
//
|
||||
// //Draw
|
||||
// Graphics.DrawProceduralNow(MeshTopology.Triangles, 6, Span * Span);
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region cleanup
|
||||
void OnDestroy()
|
||||
{
|
||||
// m_emitterProxies.Release();
|
||||
// _temperature.Release();
|
||||
_particlesBuffer.Release();
|
||||
_quadPoints.Release();
|
||||
// m_livingProxyIndices.Release();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
19
Assets/Shaders/Compute/Stardust.cs.meta
Normal file
19
Assets/Shaders/Compute/Stardust.cs.meta
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1d9e94d9c84cb6d46a2811d6a0e5e32e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a,
|
||||
type: 3}
|
||||
- ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2}
|
||||
- ParticleDepthMaterial: {fileID: 2100000, guid: a4224fd7c4119ae4aa2ceb468dd05e44,
|
||||
type: 2}
|
||||
- HueTexture: {instanceID: 0}
|
||||
- Heightmap: {fileID: 8400000, guid: 55786e8a3fda620489070358940e3c04, type: 2}
|
||||
- Target: {instanceID: 0}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/Shaders/Compute/Stardust.mat
Normal file
82
Assets/Shaders/Compute/Stardust.mat
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
%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: Stardust
|
||||
m_Shader: {fileID: 4800000, guid: f55bf043766cdb64db43d788106e3984, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2000
|
||||
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: 2800000, guid: 89119c79d5a6d7c40b0056a02a542844, type: 3}
|
||||
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:
|
||||
- _AlphaClip: 0.05
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EmissionGain: 0.5
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Power: 16
|
||||
- _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}
|
||||
- _TintColor: {r: 1.4980392, g: 1.4980392, b: 1.4980392, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
8
Assets/Shaders/Compute/Stardust.mat.meta
Normal file
8
Assets/Shaders/Compute/Stardust.mat.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fc00c35c3c370774c88d55240b6538ce
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
159
Assets/Shaders/Compute/Stardust.shader
Normal file
159
Assets/Shaders/Compute/Stardust.shader
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
Shader "Aetheria/Stardust (Compute)"
|
||||
{
|
||||
Properties {
|
||||
[HDR] _TintColor("Tint Color", Color) = (0.5,0.5,0.5,0.5)
|
||||
_EmissionGain("Emission Gain", Range(0, 1)) = 0.3
|
||||
_Power("Power", Float) = 2
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Pass {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex particle_vertex
|
||||
#pragma fragment frag
|
||||
|
||||
#pragma target 5.0
|
||||
#include "UnityCG.cginc"
|
||||
#include "Assets/Shaders/Dither Functions.cginc"
|
||||
|
||||
struct Particle
|
||||
{
|
||||
float3 position;
|
||||
float3 color;
|
||||
float size;
|
||||
};
|
||||
|
||||
StructuredBuffer<Particle> particles;
|
||||
StructuredBuffer<float3> quadPoints;
|
||||
|
||||
float4 _TintColor;
|
||||
float _EmissionGain;
|
||||
float _Power;
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 screenPos : TEXCOORD1;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
//Vertex shader with no inputs
|
||||
//Uses the system values SV_VertexID and SV_InstanceID to read from compute buffers
|
||||
v2f particle_vertex(uint id : SV_VertexID, uint inst : SV_InstanceID)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
//Only transform world pos by view matrix
|
||||
//To Create a billboarding effect
|
||||
float3 worldPosition = particles[inst].position;
|
||||
|
||||
float4 cameraSpacePosition = mul(UNITY_MATRIX_V, float4(worldPosition, 1.0f));
|
||||
|
||||
float3 quadPoint = float3(quadPoints[id].xy, 0.0f) * particles[inst].size;
|
||||
o.pos = mul(UNITY_MATRIX_P, cameraSpacePosition + float4(quadPoint, 0.0f));
|
||||
|
||||
//Shift coordinates for uvs
|
||||
o.uv = quadPoints[id] + 0.5f;
|
||||
|
||||
//transfer color of particle and global tint to vertex
|
||||
o.color = float4(particles[inst].color, 1) * _TintColor;
|
||||
o.screenPos = ComputeScreenPos(o.pos);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float powerPulse( float x, float power )
|
||||
{
|
||||
x = saturate(abs(x));
|
||||
return pow((x + 1.0f) * (1.0f - x), power);
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : COLOR
|
||||
{
|
||||
float emission = powerPulse(length(i.uv-float2(.5,.5))*2,_Power);
|
||||
float2 screenUV = i.screenPos.xy / i.screenPos.w;
|
||||
ditherClip(screenUV, emission * i.color.a);
|
||||
return i.color * emission * (exp(_EmissionGain * 5.0f));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex particle_vertex
|
||||
#pragma fragment frag
|
||||
|
||||
#pragma target 5.0
|
||||
#include "UnityCG.cginc"
|
||||
#include "Assets/Shaders/Dither Functions.cginc"
|
||||
|
||||
struct Particle
|
||||
{
|
||||
float3 position;
|
||||
float3 color;
|
||||
float size;
|
||||
};
|
||||
|
||||
StructuredBuffer<Particle> particles;
|
||||
StructuredBuffer<float3> quadPoints;
|
||||
|
||||
float4 _TintColor;
|
||||
float _EmissionGain;
|
||||
float _Power;
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 screenPos : TEXCOORD1;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
//Vertex shader with no inputs
|
||||
//Uses the system values SV_VertexID and SV_InstanceID to read from compute buffers
|
||||
v2f particle_vertex(uint id : SV_VertexID, uint inst : SV_InstanceID)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
//Only transform world pos by view matrix
|
||||
//To Create a billboarding effect
|
||||
float3 worldPosition = particles[inst].position;
|
||||
|
||||
float4 cameraSpacePosition = mul(UNITY_MATRIX_V, float4(worldPosition, 1.0f));
|
||||
|
||||
float3 quadPoint = float3(quadPoints[id].xy, 0.0f) * particles[inst].size;
|
||||
o.pos = mul(UNITY_MATRIX_P, cameraSpacePosition + float4(quadPoint, 0.0f));
|
||||
|
||||
//Shift coordinates for uvs
|
||||
o.uv = quadPoints[id] + 0.5f;
|
||||
|
||||
//transfer color of particle and global tint to vertex
|
||||
o.color = float4(particles[inst].color, 1) * _TintColor;
|
||||
o.screenPos = ComputeScreenPos(o.pos);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float powerPulse( float x, float power )
|
||||
{
|
||||
x = saturate(abs(x));
|
||||
return pow((x + 1.0f) * (1.0f - x), power);
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : COLOR
|
||||
{
|
||||
float emission = powerPulse(length(i.uv-float2(.5,.5))*2,_Power);
|
||||
float2 screenUV = i.screenPos.xy / i.screenPos.w;
|
||||
ditherClip(screenUV, emission * i.color.a);
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Assets/Shaders/Compute/Stardust.shader.meta
Normal file
9
Assets/Shaders/Compute/Stardust.shader.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f55bf043766cdb64db43d788106e3984
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue