From 00f752edf70e2f7732c65d9d9a1c92d23d5d45ad Mon Sep 17 00:00:00 2001 From: Reinier Vens Date: Fri, 18 Jun 2021 12:32:03 +0100 Subject: [PATCH] Unified Volumetric Flow Fixed towing system Tweaked Nebula Flow (a lot) Extracted environment appearance settings into ZoneEnvironment data structure Stardust particles now follow global flow field --- .../Actor-Mixer Hierarchy/UI.wwu | 4 +- ...conomy_WwiseProject.rwvens.validationcache | 14 +- ...eria-Economy_WwiseProject.rwvens.wsettings | 25 +- .../Effects/Default Work Unit.wwu | 12 +- .../Events/Ship Audio.wwu | 141 ----------- .../Game Parameters/SFX.wwu | 8 +- Asset Sources/Adrasteia1.blend | 4 +- Assets/Materials/Brushes/Gravity Well.mat | 2 +- .../Materials/Brushes/Wormhole Gravity 2.mat | 80 ++++++ .../Brushes/Wormhole Gravity 2.mat.meta | 8 + Assets/Materials/Fog Marching Main Menu.mat | 34 ++- Assets/Materials/Fog Marching.mat | 55 ++-- .../Dithered Particle Trail AetherDrive.mat | 2 +- Assets/Materials/UI/Map Gravity Lines.mat | 2 +- Assets/Resources/Settings.asset | 4 +- Assets/Scenes/ARPG.unity | 36 ++- Assets/Scenes/Main Menu.unity | 41 ++- Assets/Scripts/Gameplay/ActionGameManager.cs | 3 +- Assets/Scripts/Gameplay/GameSettings.cs | 1 + Assets/Scripts/ServerShared/Enums.cs | 10 + Assets/Scripts/ServerShared/Environment.cs | 135 ++++++++++ .../Scripts/ServerShared/Environment.cs.meta | 3 + Assets/Scripts/ServerShared/ItemData.cs | 3 + .../Scripts/ServerShared/LoadoutGenerator.cs | 2 + Assets/Scripts/ServerShared/OrbitalEntity.cs | 1 + Assets/Scripts/ServerShared/Ship.cs | 1 - Assets/Scripts/Zone Display/VolumeSampling.cs | 45 +++- .../Shaders/Compute/Stardust/Stardust.compute | 34 ++- Assets/Shaders/Compute/Stardust/Stardust.cs | 35 ++- Assets/Shaders/Compute/Stardust/Stardust.mat | 6 +- .../Shaders/Compute/Stardust/Stardust.shader | 2 +- .../Shaders/Raymarching/VolumeRender.shader | 24 +- .../Raymarching/VolumeRenderCustom.shader | 236 ++++++++++++++++++ .../VolumeRenderCustom.shader.meta | 3 + Assets/Shaders/Volumetric.cginc | 100 ++++---- .../Audio/GeneratedSoundBanks/Wwise_IDs.h | 25 +- .../ProjectData/AkWwiseProjectData.asset | 4 +- GameData/PlayerSettings.msgpack | 4 +- UserSettings/EditorUserSettings.asset | 2 +- 39 files changed, 811 insertions(+), 340 deletions(-) delete mode 100644 Aetheria-Economy_WwiseProject/Events/Ship Audio.wwu create mode 100644 Assets/Materials/Brushes/Wormhole Gravity 2.mat create mode 100644 Assets/Materials/Brushes/Wormhole Gravity 2.mat.meta create mode 100644 Assets/Scripts/ServerShared/Environment.cs create mode 100644 Assets/Scripts/ServerShared/Environment.cs.meta create mode 100644 Assets/Shaders/Raymarching/VolumeRenderCustom.shader create mode 100644 Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta diff --git a/Aetheria-Economy_WwiseProject/Actor-Mixer Hierarchy/UI.wwu b/Aetheria-Economy_WwiseProject/Actor-Mixer Hierarchy/UI.wwu index e10416a96..3996c8bd5 100644 --- a/Aetheria-Economy_WwiseProject/Actor-Mixer Hierarchy/UI.wwu +++ b/Aetheria-Economy_WwiseProject/Actor-Mixer Hierarchy/UI.wwu @@ -1,7 +1,7 @@ - + - + diff --git a/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.validationcache b/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.validationcache index 95fba3998..96c9b5847 100644 --- a/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.validationcache +++ b/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.validationcache @@ -4,7 +4,7 @@ - + @@ -24,15 +24,15 @@ - + - + - + @@ -40,10 +40,10 @@ - + - + - + diff --git a/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.wsettings b/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.wsettings index 28ab95b4f..108d67321 100644 --- a/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.wsettings +++ b/Aetheria-Economy_WwiseProject/Aetheria-Economy_WwiseProject.rwvens.wsettings @@ -23,6 +23,7 @@ + @@ -33,6 +34,7 @@ + @@ -117,7 +119,7 @@ - + @@ -152,10 +154,10 @@ - - + + - + @@ -173,12 +175,12 @@ - - + + - - + + @@ -186,8 +188,11 @@ + + + @@ -197,9 +202,13 @@ + + + + diff --git a/Aetheria-Economy_WwiseProject/Effects/Default Work Unit.wwu b/Aetheria-Economy_WwiseProject/Effects/Default Work Unit.wwu index 1fac94979..2228e7793 100644 --- a/Aetheria-Economy_WwiseProject/Effects/Default Work Unit.wwu +++ b/Aetheria-Economy_WwiseProject/Effects/Default Work Unit.wwu @@ -55,7 +55,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -167,6 +167,12 @@ + + 462899 + + + + 462899 diff --git a/Aetheria-Economy_WwiseProject/Events/Ship Audio.wwu b/Aetheria-Economy_WwiseProject/Events/Ship Audio.wwu deleted file mode 100644 index 52bcc906d..000000000 --- a/Aetheria-Economy_WwiseProject/Events/Ship Audio.wwu +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Aetheria-Economy_WwiseProject/Game Parameters/SFX.wwu b/Aetheria-Economy_WwiseProject/Game Parameters/SFX.wwu index 1c09fe715..fac2e7865 100644 --- a/Aetheria-Economy_WwiseProject/Game Parameters/SFX.wwu +++ b/Aetheria-Economy_WwiseProject/Game Parameters/SFX.wwu @@ -1,7 +1,7 @@ - + - + @@ -23,7 +23,7 @@ - + @@ -79,7 +79,7 @@ - + diff --git a/Asset Sources/Adrasteia1.blend b/Asset Sources/Adrasteia1.blend index c08400c05..0b8ca956e 100644 --- a/Asset Sources/Adrasteia1.blend +++ b/Asset Sources/Adrasteia1.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52b4b4f33eed52c338fa5b9736f1bba716105aa3a6abaee74cce9a4800d1c2b8 -size 29492800 +oid sha256:fb4ca474eba4fbf27d16bac1a767adf702a88ce67242335258b3623eb2f12f7d +size 29495728 diff --git a/Assets/Materials/Brushes/Gravity Well.mat b/Assets/Materials/Brushes/Gravity Well.mat index da9b656a8..e0bd9f79d 100644 --- a/Assets/Materials/Brushes/Gravity Well.mat +++ b/Assets/Materials/Brushes/Gravity Well.mat @@ -58,7 +58,7 @@ Material: m_Floats: - _BumpScale: 1 - _Cutoff: 1 - - _Depth: 40 + - _Depth: 80 - _DetailNormalMapScale: 1 - _DstBlend: 0 - _GlossMapScale: 1 diff --git a/Assets/Materials/Brushes/Wormhole Gravity 2.mat b/Assets/Materials/Brushes/Wormhole Gravity 2.mat new file mode 100644 index 000000000..3ae24d6ee --- /dev/null +++ b/Assets/Materials/Brushes/Wormhole Gravity 2.mat @@ -0,0 +1,80 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Wormhole Gravity 1 + m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, 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: 1 + - _Depth: 54 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Power: 4 + - _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} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/Brushes/Wormhole Gravity 2.mat.meta b/Assets/Materials/Brushes/Wormhole Gravity 2.mat.meta new file mode 100644 index 000000000..fb6f1270d --- /dev/null +++ b/Assets/Materials/Brushes/Wormhole Gravity 2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ec0689c58b99c64297b3e429e1d9112 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Fog Marching Main Menu.mat b/Assets/Materials/Fog Marching Main Menu.mat index 8ee33d072..b22522a2d 100644 --- a/Assets/Materials/Fog Marching Main Menu.mat +++ b/Assets/Materials/Fog Marching Main Menu.mat @@ -27,6 +27,22 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _NebulaPatch: + m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NebulaPatchHeight: + m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NebulaSurfaceHeight: + m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NebulaTint: + m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _Patch: m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} m_Scale: {x: 1, y: 1} @@ -43,8 +59,12 @@ Material: - _AlphaFloor: 0 - _DepthBlend: 512 - _DepthCeiling: 1024 + - _Exposure: 100 + - _FlowAmplitude: 1 + - _FlowScale: 1 + - _FlowScroll: 1 - _FlowSpeed: 5 - - _Gamma: 0.5 + - _Gamma: 0.3 - _GridCeilingBlend: -300 - _GridCeilingDensity: 0.01 - _GridCeilingFollow: 0 @@ -55,6 +75,12 @@ Material: - _GridFloorOffset: 100 - _GridPatchBlend: 50 - _GridPatchDensity: 1 + - _NebulaFillDensity: 0.00075 + - _NebulaFloorBlend: 50 + - _NebulaFloorDensity: 1 + - _NebulaFloorOffset: 80 + - _NebulaPatchBlend: 25 + - _NebulaPatchDensity: 0.1 - _NoiseExponent: 2 - _NoiseFrequency: 0.02 - _NoiseSpeed: 0.00001 @@ -65,9 +91,9 @@ Material: - _ScatteringDistExponent: 0.5 - _ScatteringMinDist: 1 - _StepExponent: 2 - - _TintExponent: 0.4 - - _TurbulenceAmplitude: 50 - - _TurbulenceScale: 100 + - _TintExponent: 1.2 + - _TurbulenceAmplitude: 20 + - _TurbulenceScale: 30 m_Colors: - _Tint: {r: 0.09411765, g: 0.09411765, b: 0.09411765, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Materials/Fog Marching.mat b/Assets/Materials/Fog Marching.mat index 4fe8829bd..ea8595788 100644 --- a/Assets/Materials/Fog Marching.mat +++ b/Assets/Materials/Fog Marching.mat @@ -27,6 +27,22 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _NebulaPatch: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NebulaPatchHeight: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NebulaSurfaceHeight: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NebulaTint: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _Patch: m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} m_Scale: {x: 1, y: 1} @@ -43,8 +59,11 @@ Material: - _AlphaFloor: 0.01 - _DepthBlend: 512 - _DepthCeiling: 4096 - - _Exposure: 0.001 - - _FlowSpeed: 5 + - _Exposure: 2 + - _FlowAmplitude: 512 + - _FlowScale: 1024 + - _FlowScroll: 0 + - _FlowSpeed: 1 - _Gamma: 0.5 - _GridCeilingBlend: -300 - _GridCeilingDensity: 0.01 @@ -52,23 +71,29 @@ Material: - _GridCeilingOffset: 0 - _GridFillDensity: 0.0005 - _GridFloorBlend: 50 - - _GridFloorDensity: 2 + - _GridFloorDensity: 1 - _GridFloorOffset: 10 - _GridPatchBlend: 150 - - _GridPatchDensity: 2 - - _NoiseExponent: 2.25 - - _NoiseFrequency: 0.02 + - _GridPatchDensity: 1 + - _NebulaFillDensity: 0.00075 + - _NebulaFloorBlend: 150 + - _NebulaFloorDensity: 1 + - _NebulaFloorOffset: 0 + - _NebulaPatchBlend: 51.47 + - _NebulaPatchDensity: 0.25 + - _NoiseExponent: 3 + - _NoiseFrequency: 0.005 - _NoiseSpeed: 0 - - _NoiseStrength: 50 - - _SafetyDistance: 100 - - _Scattering: 100 - - _ScatteringDensityExponent: 0.175 - - _ScatteringDistExponent: 2 - - _ScatteringMinDist: 50 + - _NoiseStrength: -400 + - _SafetyDistance: 200 + - _Scattering: 50 + - _ScatteringDensityExponent: 1 + - _ScatteringDistExponent: 1.5 + - _ScatteringMinDist: 10 - _StepExponent: 2 - - _TintExponent: 2 - - _TurbulenceAmplitude: 100 - - _TurbulenceScale: 30 + - _TintExponent: 1.2 + - _TurbulenceAmplitude: 20 + - _TurbulenceScale: 60 m_Colors: - _Tint: {r: 0.01, g: 0.01, b: 0.01, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Materials/Particles/Dithered Particle Trail AetherDrive.mat b/Assets/Materials/Particles/Dithered Particle Trail AetherDrive.mat index a3ff81b42..5c2755f2a 100644 --- a/Assets/Materials/Particles/Dithered Particle Trail AetherDrive.mat +++ b/Assets/Materials/Particles/Dithered Particle Trail AetherDrive.mat @@ -73,6 +73,6 @@ Material: - _UVSec: 0 - _ZWrite: 1 m_Colors: - - _Color: {r: 95.87451, g: 95.87451, b: 95.87451, a: 0.5019608} + - _Color: {r: 1.216786, g: 1.216786, b: 1.216786, a: 0.5019608} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Materials/UI/Map Gravity Lines.mat b/Assets/Materials/UI/Map Gravity Lines.mat index ddb25cc97..a17a560ad 100644 --- a/Assets/Materials/UI/Map Gravity Lines.mat +++ b/Assets/Materials/UI/Map Gravity Lines.mat @@ -86,7 +86,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - - _Scale: 2.6751254 + - _Scale: 1.6688799 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 diff --git a/Assets/Resources/Settings.asset b/Assets/Resources/Settings.asset index 32d21fa46..b5346ded7 100644 --- a/Assets/Resources/Settings.asset +++ b/Assets/Resources/Settings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a8954922777a82108e5049d797d9b93b144ab3bc05f6151513ef524d3cbd9521 -size 12537 +oid sha256:f939d183994e9d1cd26ec5d4f3277bc12ef39ddfdc40c5aaed7df392166124bd +size 12900 diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index 25bd7cb5c..ab8f8982c 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -16163,17 +16163,22 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1d9e94d9c84cb6d46a2811d6a0e5e32e, type: 3} m_Name: m_EditorClassIdentifier: + Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2} TargetCamera: {fileID: 2115559089} ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a, type: 3} ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2} - Span: 512 - Speed: 0.25 + Span: 256 + Speed: -0.25 MinimumSize: 0.0025 MaximumSize: 0.005 - Spacing: 4 + Spacing: 1.5 Ceiling: -430 Floor: -50 HeightExponent: 100000 + NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} + NebulaPatchHeight: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} + NebulaPatch: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} + NebulaTint: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} Heightmap: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} ParticleColors: {fileID: 2800000, guid: 56db63da398b2d04394ddbccedce943c, type: 3} GravityCamera: {fileID: 1537342003} @@ -23726,12 +23731,12 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -23751,7 +23756,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -16 objectReference: {fileID: 0} - target: {fileID: 1713457305180270767, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -24938,12 +24943,12 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -24963,7 +24968,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -16 objectReference: {fileID: 0} - target: {fileID: 1713457305180270767, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -30775,9 +30780,9 @@ MonoBehaviour: antialiasingMode: 3 temporalAntialiasing: jitterSpread: 1 - sharpness: 0.5 - stationaryBlending: 0.98 - motionBlending: 0.95 + sharpness: 0 + stationaryBlending: 0.99 + motionBlending: 0.99 subpixelMorphologicalAntialiasing: quality: 2 fastApproximateAntialiasing: @@ -30862,8 +30867,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8c03374f22d0a3d4882018de66894a84, type: 3} m_Name: m_EditorClassIdentifier: - _volMaterial: {fileID: 2100000, guid: 2ff39f5d101241043ba1dcde19d92f77, type: 2} + VolMaterial: {fileID: 2100000, guid: 2ff39f5d101241043ba1dcde19d92f77, type: 2} GridTransform: {fileID: 0} + Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2} + NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} + NebulaPatchHeight: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} + NebulaPatch: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} + NebulaTint: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} --- !u!114 &2115559094 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Main Menu.unity b/Assets/Scenes/Main Menu.unity index 8fc404928..fa69bfbd0 100644 --- a/Assets/Scenes/Main Menu.unity +++ b/Assets/Scenes/Main Menu.unity @@ -802,8 +802,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 741153267} - m_LocalRotation: {x: 0.32744318, y: 0.17597876, z: -0.062211014, w: 0.92625177} - m_LocalPosition: {x: -144.10971, y: -28.69563, z: -126.68646} + m_LocalRotation: {x: 0.3274431, y: 0.17597422, z: -0.06220931, w: 0.9262527} + m_LocalPosition: {x: -144.10849, y: -28.695732, z: -126.68623} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 412917866} @@ -853,17 +853,22 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1d9e94d9c84cb6d46a2811d6a0e5e32e, type: 3} m_Name: m_EditorClassIdentifier: + Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2} TargetCamera: {fileID: 965376323} ParticleCalculation: {fileID: 7200000, guid: f53a4ba56f0db2a49ad9f68150bf298a, type: 3} ParticleMaterial: {fileID: 2100000, guid: fc00c35c3c370774c88d55240b6538ce, type: 2} Span: 256 - Speed: 0.25 + Speed: -0.25 MinimumSize: 0.0025 MaximumSize: 0.005 - Spacing: 4 + Spacing: 2 Ceiling: 0 Floor: -50 HeightExponent: 1000 + NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} + NebulaPatchHeight: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} + NebulaPatch: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} + NebulaTint: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} Heightmap: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} ParticleColors: {fileID: 2800000, guid: 56db63da398b2d04394ddbccedce943c, type: 3} GravityCamera: {fileID: 2103364771} @@ -1210,7 +1215,6 @@ GameObject: - component: {fileID: 965376325} - component: {fileID: 965376322} - component: {fileID: 965376328} - - component: {fileID: 965376330} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -1302,8 +1306,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 965376321} - m_LocalRotation: {x: 0.32744318, y: 0.17597876, z: -0.062211014, w: 0.92625177} - m_LocalPosition: {x: -144.10971, y: -28.69563, z: -126.68646} + m_LocalRotation: {x: 0.3274431, y: 0.17597422, z: -0.06220931, w: 0.9262527} + m_LocalPosition: {x: -144.10849, y: -28.695732, z: -126.68623} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -1419,24 +1423,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8c03374f22d0a3d4882018de66894a84, type: 3} m_Name: m_EditorClassIdentifier: - _volMaterial: {fileID: 2100000, guid: e21702a5e6e98b7409d6913663ceab7e, type: 2} + VolMaterial: {fileID: 2100000, guid: e21702a5e6e98b7409d6913663ceab7e, type: 2} GridTransform: {fileID: 1172538221} ---- !u!114 &965376330 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 965376321} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 899f97884c6d96b4ca20648ec109a37f, type: 3} - m_Name: - m_EditorClassIdentifier: - pattern: 12 - patternScale: 1 - activeSample: {x: -0.25, y: 0.16666669, z: 0, w: -0.16666666} - activeIndex: 1 + Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2} + NebulaSurfaceHeight: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2} + NebulaPatchHeight: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2} + NebulaPatch: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2} + NebulaTint: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2} --- !u!4 &971662241 stripped Transform: m_CorrespondingSourceObject: {fileID: 7852221720971737233, guid: 046dde0f4600bce41ad33c476f99b309, diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 336f0b038..ce2be4be6 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -774,7 +774,6 @@ public class ActionGameManager : MonoBehaviour true); // EntitySerializer.Unpack(ItemManager, Zone, Loadouts.First(x => x.Name == StarterShipTemplate), true); ((Ship) ship).IsPlayerShip = true; - ((Ship) ship).CanTow = true; ship.Position = float3.zero; ship.Zone = Zone; Zone.Entities.Add(ship); @@ -874,7 +873,7 @@ public class ActionGameManager : MonoBehaviour if (ZoneRenderer.Planets.ContainsKey(parentOrbitPlanet)) DockCamera.LookAt = ZoneRenderer.Planets[parentOrbitPlanet].Body.transform; else DockCamera.LookAt = ZoneRenderer.ZoneRoot; - if (dockingBay.DockedShip.CanTow) + if (entity is OrbitalEntity {CanTow: true}) TowingStation = entity; Menu.ShowTab(MenuTab.Inventory); } diff --git a/Assets/Scripts/Gameplay/GameSettings.cs b/Assets/Scripts/Gameplay/GameSettings.cs index c16b1e382..112c1bf07 100644 --- a/Assets/Scripts/Gameplay/GameSettings.cs +++ b/Assets/Scripts/Gameplay/GameSettings.cs @@ -45,6 +45,7 @@ public class GameSettings : ScriptableObject public Color GearHitColor; public Gradient ArmorGradient; public Gradient DurabilityGradient; + public ZoneEnvironment DefaultEnvironment; [HideInInspector] public Sprite[] ItemIcons; [HideInInspector] public Sprite[] WeaponTypeIcons; [HideInInspector] public Sprite[] WeaponCaliberIcons; diff --git a/Assets/Scripts/ServerShared/Enums.cs b/Assets/Scripts/ServerShared/Enums.cs index df60aea23..e556ba656 100644 --- a/Assets/Scripts/ServerShared/Enums.cs +++ b/Assets/Scripts/ServerShared/Enums.cs @@ -228,4 +228,14 @@ public enum MusicType Overworld, Combat, Boss +} + +[Flags] +public enum BrushLayer +{ + Gravity = 1 << 0, + Displacement = 1 << 1, + FogHeight = 1 << 2, + CloudHeight = 1 << 3, + CloudDepth = 1 << 4 } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Environment.cs b/Assets/Scripts/ServerShared/Environment.cs new file mode 100644 index 000000000..96a1a8df2 --- /dev/null +++ b/Assets/Scripts/ServerShared/Environment.cs @@ -0,0 +1,135 @@ +using System; +using MessagePack; +using Newtonsoft.Json; +using Unity.Mathematics; +using static Unity.Mathematics.math; +using static Unity.Mathematics.noise; +using float2 = Unity.Mathematics.float2; + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class ZoneEnvironment +{ + [JsonProperty("nebula"), Key(0)] public NebulaSettings Nebula; + [JsonProperty("flow"), Key(1)] public FlowSettings Flow; + [JsonProperty("noise"), Key(2)] public NoiseSettings Noise; +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class NebulaSettings +{ + [JsonProperty("fillDensity"), Key(0)] public float FillDensity; + [JsonProperty("fillDistance"), Key(1)] public float FillDistance; + [JsonProperty("fogDensity"), Key(2)] public float FloorDensity; + [JsonProperty("cloudDensity"), Key(3)] public float PatchDensity; + [JsonProperty("fogOffset"), Key(4)] public float FloorOffset; + [JsonProperty("fogBlend"), Key(5)] public float FloorBlend; + [JsonProperty("cloudBlend"), Key(6)] public float PatchBlend; +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class FlowSettings +{ + [JsonProperty("scale"), Key(0)] public float Scale; + [JsonProperty("amplitude"), Key(1)] public float Amplitude; + [JsonProperty("scrollSpeed"), Key(2)] public float ScrollSpeed; + [JsonProperty("velocity"), Key(3)] public float Speed; +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class NoiseSettings +{ + [JsonProperty("scale"), Key(0)] public float Scale; + [JsonProperty("amplitude"), Key(1)] public float Amplitude; + [JsonProperty("exponent"), Key(2)] public float Exponent; + [JsonProperty("speed"), Key(3)] public float Speed; +} + +[Union(0, typeof(PowerBrush)), + Union(1, typeof(SimplexBrush)), + Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public abstract class Brush +{ + [JsonProperty("layerMask"), Key(0)] public BrushLayer LayerMask; + [JsonProperty("cutoff"), Key(1)] public float Cutoff; + [JsonProperty("depth"), Key(2)] public float Depth; + [JsonProperty("envelopeExponent"), Key(3)] public float EnvelopeExponent; + + float powerPulse( float x, float power ) + { + x = saturate(abs(x))-.001f; + return pow((x + 1.0f) * (1.0f - x), power); + } + + protected abstract float Evaluate(float2 world, float2 uv); + + public float Evaluate(float2 world, float2 pos, float2 radius) + { + var uv = (world - pos) / radius; + float dist = length(uv)*2; + float envelope = min(Cutoff, powerPulse(dist,EnvelopeExponent)) * smoothstep(1, .95f, dist); + return Depth * Evaluate(world, uv) * envelope; + } +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class PowerBrush : Brush +{ + protected override float Evaluate(float2 world, float2 uv) + { + return 1; + } +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public abstract class TextureBrush : Brush +{ + [JsonProperty("frequency"), Key(4)] public float2 Frequency; + [JsonProperty("phase"), Key(5)] public float2 Phase; +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public abstract class AnimatedBrush : TextureBrush +{ + [JsonProperty("animationSpeed"), Key(6)] public float AnimationSpeed; + + [IgnoreMember] + public float Time { get; set; } +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class SimplexBrush : TextureBrush +{ + [JsonProperty("absolute"), Key(6)] public bool AbsoluteValue; + + protected override float Evaluate(float2 world, float2 uv) + { + var noise = snoise(world * Frequency + Phase); + return AbsoluteValue ? abs(noise) : noise; + } +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class AnimatedSimplexBrush : AnimatedBrush +{ + [JsonProperty("absolute"), Key(7)] public bool AbsoluteValue; + + protected override float Evaluate(float2 world, float2 uv) + { + var noise = snoise(float3(float2(world * Frequency + Phase), AnimationSpeed * Time)); + return AbsoluteValue ? abs(noise) : noise; + } +} + +[Serializable, MessagePackObject, JsonObject(MemberSerialization.OptIn)] +public class RadialWaveBrush : TextureBrush +{ + [JsonProperty("waveExponent"), Key(7)] public float WaveExponent; + + protected override float Evaluate(float2 world, float2 uv) + { + float dist = length(uv); + float ang = atan2(uv.y,uv.x); + return cos((ang + Phase.x) * Frequency.x * PI + (pow(dist, WaveExponent) + Phase.y) * Frequency.y); + } +} + diff --git a/Assets/Scripts/ServerShared/Environment.cs.meta b/Assets/Scripts/ServerShared/Environment.cs.meta new file mode 100644 index 000000000..f5be31efb --- /dev/null +++ b/Assets/Scripts/ServerShared/Environment.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b4fc7c09c95c487baeffbd139abe89b9 +timeCreated: 1622614593 \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/ItemData.cs b/Assets/Scripts/ServerShared/ItemData.cs index a3085135a..716ff3eb6 100644 --- a/Assets/Scripts/ServerShared/ItemData.cs +++ b/Assets/Scripts/ServerShared/ItemData.cs @@ -520,6 +520,9 @@ public class HullData : EquippableItemData [Inspectable, JsonProperty("drag"), Key(28)] public float Drag; + + [Inspectable, JsonProperty("canTow"), Key(29)] + public bool CanTow; [IgnoreMember] public Shape InteriorCells diff --git a/Assets/Scripts/ServerShared/LoadoutGenerator.cs b/Assets/Scripts/ServerShared/LoadoutGenerator.cs index 612b62f66..56904c902 100644 --- a/Assets/Scripts/ServerShared/LoadoutGenerator.cs +++ b/Assets/Scripts/ServerShared/LoadoutGenerator.cs @@ -95,6 +95,8 @@ public class LoadoutGenerator var instance = ItemManager.CreateInstance(item); cargo.TryStore(instance); } + + entity.CanTow = hullData.CanTow; return EntitySerializer.Pack(entity) as OrbitalEntityPack; } diff --git a/Assets/Scripts/ServerShared/OrbitalEntity.cs b/Assets/Scripts/ServerShared/OrbitalEntity.cs index ea4f09b59..d76b16b95 100644 --- a/Assets/Scripts/ServerShared/OrbitalEntity.cs +++ b/Assets/Scripts/ServerShared/OrbitalEntity.cs @@ -15,6 +15,7 @@ public class OrbitalEntity : Entity public SecurityLevel SecurityLevel; public float SecurityRadius; public LocationStory Story; + public bool CanTow; public OrbitalEntity(ItemManager itemManager, Zone zone, EquippableItem hull, Guid orbit, EntitySettings settings) : base(itemManager, zone, hull, settings) { diff --git a/Assets/Scripts/ServerShared/Ship.cs b/Assets/Scripts/ServerShared/Ship.cs index f806f8405..529c07b39 100644 --- a/Assets/Scripts/ServerShared/Ship.cs +++ b/Assets/Scripts/ServerShared/Ship.cs @@ -26,7 +26,6 @@ public class Ship : Entity public Entity HomeEntity; public float2 MovementDirection; public bool IsPlayerShip; - public bool CanTow; private HashSet _thrusterItems; private Thruster[] _allThrusters; diff --git a/Assets/Scripts/Zone Display/VolumeSampling.cs b/Assets/Scripts/Zone Display/VolumeSampling.cs index 0a1f84e26..ad9eca5c6 100644 --- a/Assets/Scripts/Zone Display/VolumeSampling.cs +++ b/Assets/Scripts/Zone Display/VolumeSampling.cs @@ -6,6 +6,7 @@ using System; using UnityEngine; using Unity.Mathematics; using UnityEngine.Experimental.Rendering; +using UnityEngine.Serialization; using static Unity.Mathematics.math; using static Unity.Mathematics.noise; @@ -16,15 +17,23 @@ using static Unity.Mathematics.noise; [RequireComponent( typeof( Camera ) ), ImageEffectAllowedInSceneView] public class VolumeSampling : MonoBehaviour { - public Material _volMaterial; + [FormerlySerializedAs("_volMaterial")] public Material VolMaterial; public Transform GridTransform; + public GameSettings Settings; //public int DownsampleBlurMask = 2; private Camera _camera; private RenderBuffer[] _mrt; private RenderTexture _blurMask; private Texture2D _disabledBlurMask; + private float _flowScroll; + + public RenderTexture NebulaSurfaceHeight; + public RenderTexture NebulaPatchHeight; + public RenderTexture NebulaPatch; + public RenderTexture NebulaTint; public bool EnableDepth { get; set; } = true; + private void Start() { @@ -39,19 +48,19 @@ public class VolumeSampling : MonoBehaviour void OnRenderImage(RenderTexture source, RenderTexture destination) { // check for no shader / shader compile error - if( _volMaterial == null ) + if( VolMaterial == null ) { Graphics.Blit(source, destination); return; } // Shader needs this matrix to generate world space rays - _volMaterial.SetMatrix("_CamProj", (_camera.projectionMatrix * _camera.worldToCameraMatrix).inverse); - _volMaterial.SetMatrix("_CamInvProj", (_camera.projectionMatrix * _camera.worldToCameraMatrix).inverse); + VolMaterial.SetMatrix("_CamProj", (_camera.projectionMatrix * _camera.worldToCameraMatrix).inverse); + VolMaterial.SetMatrix("_CamInvProj", (_camera.projectionMatrix * _camera.worldToCameraMatrix).inverse); // Shader needs to know the position and scale of cameras used to render input textures if(GridTransform != null) - _volMaterial.SetVector("_GridTransform", new Vector4(GridTransform.position.x,GridTransform.position.z,GridTransform.localScale.x)); + VolMaterial.SetVector("_GridTransform", new Vector4(GridTransform.position.x,GridTransform.position.z,GridTransform.localScale.x)); _mrt[0] = destination.colorBuffer; _mrt[1] = _blurMask.colorBuffer; @@ -59,7 +68,7 @@ public class VolumeSampling : MonoBehaviour // Blit with a MRT. Graphics.SetRenderTarget(_mrt, source.depthBuffer); - Graphics.Blit( source, _volMaterial, 0 ); + Graphics.Blit( source, VolMaterial, 0 ); //Graphics.Blit(rt1, destination); @@ -67,5 +76,29 @@ public class VolumeSampling : MonoBehaviour Shader.SetGlobalTexture("_DoFBlurTex", _blurMask); else Shader.SetGlobalTexture("_DoFBlurTex", _disabledBlurMask); + + Shader.SetGlobalTexture("_NebulaSurfaceHeight", NebulaSurfaceHeight); + Shader.SetGlobalTexture("_NebulaPatchHeight", NebulaPatchHeight); + Shader.SetGlobalTexture("_NebulaPatch", NebulaPatch); + Shader.SetGlobalTexture("_NebulaTint", NebulaTint); + + Shader.SetGlobalFloat("_NebulaFillDensity", Settings.DefaultEnvironment.Nebula.FillDensity); + Shader.SetGlobalFloat("_SafetyDistance", Settings.DefaultEnvironment.Nebula.FillDistance); + Shader.SetGlobalFloat("_NebulaFloorDensity", Settings.DefaultEnvironment.Nebula.FloorDensity); + Shader.SetGlobalFloat("_NebulaPatchDensity", Settings.DefaultEnvironment.Nebula.PatchDensity); + Shader.SetGlobalFloat("_NebulaFloorOffset", Settings.DefaultEnvironment.Nebula.FloorOffset); + Shader.SetGlobalFloat("_NebulaFloorBlend", Settings.DefaultEnvironment.Nebula.FloorBlend); + Shader.SetGlobalFloat("_NebulaPatchBlend", Settings.DefaultEnvironment.Nebula.PatchBlend); + // Shader.SetGlobalFloat("_TintExponent", Settings.DefaultEnvironment.); + Shader.SetGlobalFloat("_NoiseScale", Settings.DefaultEnvironment.Noise.Scale); + Shader.SetGlobalFloat("_NoiseExponent", Settings.DefaultEnvironment.Noise.Exponent); + Shader.SetGlobalFloat("_NoiseAmplitude", Settings.DefaultEnvironment.Noise.Amplitude); + Shader.SetGlobalFloat("_NoiseSpeed", Settings.DefaultEnvironment.Noise.Speed); + Shader.SetGlobalFloat("_FlowScale", Settings.DefaultEnvironment.Flow.Scale); + Shader.SetGlobalFloat("_FlowAmplitude", Settings.DefaultEnvironment.Flow.Amplitude); + _flowScroll += Settings.DefaultEnvironment.Flow.ScrollSpeed * Time.deltaTime; + Shader.SetGlobalFloat("_FlowScroll", _flowScroll); + Shader.SetGlobalFloat("_FlowSpeed", Settings.DefaultEnvironment.Flow.Speed); + // Shader.SetGlobalFloat("_SafetyDistance", Settings.DefaultEnvironment.); } } diff --git a/Assets/Shaders/Compute/Stardust/Stardust.compute b/Assets/Shaders/Compute/Stardust/Stardust.compute index 6a48c6073..45e3ffe25 100644 --- a/Assets/Shaders/Compute/Stardust/Stardust.compute +++ b/Assets/Shaders/Compute/Stardust/Stardust.compute @@ -1,4 +1,6 @@ -//Tell unity that we have defined a kernel +#include "Assets/Shaders/Volumetric.cginc" + +//Tell unity that we have defined a kernel #pragma kernel UpdateParticles //Store Particle data in a struct @@ -22,7 +24,6 @@ SamplerState samplerHueTexture; //uniform float4x4 noiseOffsetMatrix; float time; -float3 transform; float spacing; float ceilingHeight; float floorHeight; @@ -115,19 +116,26 @@ void UpdateParticles(uint3 id : SV_DispatchThreadID, int3 groupID : SV_GroupThre int x = id % span - span / 2; int y = id / span - span / 2; - int xt = (int)(transform.x / spacing); - int yt = (int)(transform.y / spacing); + int xt = (int)(_GridTransform.x / spacing); + int yt = (int)(_GridTransform.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; + + const float l = frac(time+RandomFirst(xp, yp)); 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; - float headroom = (ceilingHeight+gravDepth); - particles[id.x].position.y = -gravDepth + floorHeight + -floorHeight * 4 * pow(RandomValue(), max(1, heightExponent/(headroom*headroom))) + perlinNoise1D(RandomValue()*1024+time)*spacing/2; - particles[id.x].size = lerp(minimumSize, maximumSize, RandomValue()); + x * spacing + xt * spacing + perlinNoise1D(RandomValue()*1024)*spacing, 0, + y * spacing + yt * spacing + perlinNoise1D(RandomValue()*1024)*spacing); + float n; + const float2 puv = float2(.5,.5) - (particles[id.x].position.xz - _GridTransform.xy) / _GridTransform.z; + const float gravDepth = Heightmap.SampleLevel(samplerHeightmap, puv, 0.0f).r; + const float headroom = ceilingHeight + gravDepth; + particles[id.x].position.y = -gravDepth + floorHeight + -floorHeight * 4 * + pow(RandomValue(), max(1, heightExponent/(headroom*headroom))) + + perlinNoise1D(RandomValue()*1024)*spacing/2; + const float3 f = flow(particles[id.x].position, n); + particles[id.x].position += f * (l * n); + const float density = d(particles[id.x].position); + particles[id.x].size = lerp(minimumSize, maximumSize, RandomValue() * n * density) * parabola(l, 2); + particles[id.x].color = HueTexture.SampleLevel(samplerHueTexture, float2(RandomValue(), 0.0f), 0.0f).rgb; } \ No newline at end of file diff --git a/Assets/Shaders/Compute/Stardust/Stardust.cs b/Assets/Shaders/Compute/Stardust/Stardust.cs index 5d4f099b2..e5d9ac1f8 100644 --- a/Assets/Shaders/Compute/Stardust/Stardust.cs +++ b/Assets/Shaders/Compute/Stardust/Stardust.cs @@ -10,6 +10,7 @@ public class Stardust : MonoBehaviour #region variables //public bool debugLog = false; //public float proxyPersistTime = 2; + public GameSettings Settings; public Camera TargetCamera; public ComputeShader ParticleCalculation; public Material ParticleMaterial; @@ -24,11 +25,16 @@ public class Stardust : MonoBehaviour public float Floor = -25.0f; public float HeightExponent = 4; + public RenderTexture NebulaSurfaceHeight; + public RenderTexture NebulaPatchHeight; + public RenderTexture NebulaPatch; + public RenderTexture NebulaTint; public Texture Heightmap; public Texture2D ParticleColors; //public Transform TargetTransform; public Camera GravityCamera; + private float _flowScroll; private const int GROUP_SIZE = 128; private int _updateParticlesKernel; #endregion @@ -67,7 +73,7 @@ public class Stardust : MonoBehaviour for (int i = 0; i < Span * Span; ++i) { particles[i].Position = Random.insideUnitSphere * 100; - particles[i].Color = Vector3.one;//white + particles[i].Color = Vector3.one; //white particles[i].Size = Random.value; } @@ -98,7 +104,7 @@ public class Stardust : MonoBehaviour ParticleCalculation.SetFloat("time", Time.time * Speed); var pos = GravityCamera.transform.position; - ParticleCalculation.SetVector("transform", new Vector4(pos.x,pos.z,GravityCamera.orthographicSize*2)); + ParticleCalculation.SetVector("_GridTransform", new Vector4(pos.x,pos.z,GravityCamera.orthographicSize*2)); ParticleCalculation.SetFloat("spacing", Spacing); ParticleCalculation.SetFloat("ceilingHeight", Ceiling); ParticleCalculation.SetFloat("floorHeight", Floor); @@ -109,6 +115,29 @@ public class Stardust : MonoBehaviour ParticleCalculation.SetTexture(_updateParticlesKernel, "Heightmap", Heightmap); ParticleCalculation.SetTexture(_updateParticlesKernel, "HueTexture", ParticleColors); + + ParticleCalculation.SetTexture(_updateParticlesKernel, "_NebulaSurfaceHeight", NebulaSurfaceHeight); + ParticleCalculation.SetTexture(_updateParticlesKernel, "_NebulaPatchHeight", NebulaPatchHeight); + ParticleCalculation.SetTexture(_updateParticlesKernel, "_NebulaPatch", NebulaPatch); + ParticleCalculation.SetTexture(_updateParticlesKernel, "_NebulaTint", NebulaTint); + + ParticleCalculation.SetFloat("_NebulaFillDensity", Settings.DefaultEnvironment.Nebula.FillDensity); + ParticleCalculation.SetFloat("_SafetyDistance", Settings.DefaultEnvironment.Nebula.FillDistance); + ParticleCalculation.SetFloat("_NebulaFloorDensity", Settings.DefaultEnvironment.Nebula.FloorDensity); + ParticleCalculation.SetFloat("_NebulaPatchDensity", Settings.DefaultEnvironment.Nebula.PatchDensity); + ParticleCalculation.SetFloat("_NebulaFloorOffset", Settings.DefaultEnvironment.Nebula.FloorOffset); + ParticleCalculation.SetFloat("_NebulaFloorBlend", Settings.DefaultEnvironment.Nebula.FloorBlend); + ParticleCalculation.SetFloat("_NebulaPatchBlend", Settings.DefaultEnvironment.Nebula.PatchBlend); + // Shader.SetGlobalFloat("_TintExponent", Settings.DefaultEnvironment.); + ParticleCalculation.SetFloat("_NoiseScale", Settings.DefaultEnvironment.Noise.Scale); + ParticleCalculation.SetFloat("_NoiseExponent", Settings.DefaultEnvironment.Noise.Exponent); + ParticleCalculation.SetFloat("_NoiseAmplitude", Settings.DefaultEnvironment.Noise.Amplitude); + ParticleCalculation.SetFloat("_NoiseSpeed", Settings.DefaultEnvironment.Noise.Speed); + ParticleCalculation.SetFloat("_FlowScale", Settings.DefaultEnvironment.Flow.Scale); + ParticleCalculation.SetFloat("_FlowAmplitude", Settings.DefaultEnvironment.Flow.Amplitude); + _flowScroll += Settings.DefaultEnvironment.Flow.ScrollSpeed * Time.deltaTime; + ParticleCalculation.SetFloat("_FlowScroll", _flowScroll); + ParticleCalculation.SetFloat("_FlowSpeed", Settings.DefaultEnvironment.Flow.Speed); //Dispatch, launch threads on GPU int numberOfGroups = Mathf.CeilToInt((float)Span * Span / GROUP_SIZE); @@ -116,7 +145,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.Off, false, 0); + Graphics.DrawProcedural(ParticleMaterial, new Bounds(pos, new Vector3(Spacing * Span, 2048, Spacing * Span)), MeshTopology.Triangles, 6, Span * Span, TargetCamera, null, ShadowCastingMode.Off, false, 0); } #endregion diff --git a/Assets/Shaders/Compute/Stardust/Stardust.mat b/Assets/Shaders/Compute/Stardust/Stardust.mat index bc9da2381..2b43011b3 100644 --- a/Assets/Shaders/Compute/Stardust/Stardust.mat +++ b/Assets/Shaders/Compute/Stardust/Stardust.mat @@ -61,7 +61,7 @@ Material: - _Cutoff: 0.5 - _DetailNormalMapScale: 1 - _DstBlend: 0 - - _EmissionGain: 0.716 + - _EmissionGain: 0.103 - _GlossMapScale: 1 - _Glossiness: 0.5 - _GlossyReflections: 1 @@ -69,7 +69,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - - _Power: 2 + - _Power: 0.5 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 @@ -78,5 +78,5 @@ Material: 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} + - _TintColor: {r: 5.992157, g: 5.992157, b: 5.992157, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Shaders/Compute/Stardust/Stardust.shader b/Assets/Shaders/Compute/Stardust/Stardust.shader index e8882e88d..9b105e8c3 100644 --- a/Assets/Shaders/Compute/Stardust/Stardust.shader +++ b/Assets/Shaders/Compute/Stardust/Stardust.shader @@ -138,7 +138,7 @@ o.uv = quadPoints[id] + 0.5f; //transfer color of particle and global tint to vertex - o.color = float4(particles[inst].color, 1) * _TintColor * 10000 / (dist * dist); + o.color = float4(particles[inst].color * _TintColor.rgb, 10000 / (dist * dist)); o.screenPos = ComputeScreenPos(o.pos); return o; diff --git a/Assets/Shaders/Raymarching/VolumeRender.shader b/Assets/Shaders/Raymarching/VolumeRender.shader index c29a64298..cc6e47faa 100644 --- a/Assets/Shaders/Raymarching/VolumeRender.shader +++ b/Assets/Shaders/Raymarching/VolumeRender.shader @@ -1,31 +1,13 @@ -Shader "VolSample/Volume Render" { +Shader "VolSample/Volume Render Auto" { Properties { _MainTex( "", 2D ) = "white" {} _StepExponent("Step Exponent", float) = 1 - _Surface("Surface", 2D) = "black" {} - _Patch("Patch", 2D) = "black" {} - _Displacement("Displacement", 2D) = "black" {} - _TintTexture("Tint Texture", 2D ) = "white" {} - [HDR]_Tint("Tint Color", Color) = (1,1,1,1) //_GridTransform("Grid Transform", Vector) = (0,0,0,0) - _GridFillDensity("Fill Density", float) = 1 - _GridFloorDensity("Floor Density", float) = 1 - _GridPatchDensity("Patch Density", float) = 1 - _GridFloorOffset("Floor Offset", float) = 1 - _GridFloorBlend("Floor Blend", float) = 1 - _GridPatchBlend("Patch Blend", float) = 1 _Exposure("Exposure", float) = 1 _Gamma("Gamma", float) = .5 _TintExponent("Tint Exponent", float) = .5 _DepthCeiling("Depth Ceiling", float) = 1000 _DepthBlend("Depth Blend", float) = 100 - _NoiseStrength("Noise Strength", float) = 1 - _NoiseFrequency("Noise Frequency", float) = 1 - _NoiseExponent("Noise Exponent", float) = 2 - _NoiseSpeed("Noise Speed", float) = 1 - _TurbulenceScale("Turbulence Scale", float) = 1 - _TurbulenceAmplitude("Turbulence Amplitude", float) = 1 - _FlowSpeed("Flow Speed", float) = 1 _SafetyDistance("Safety Distance", float) = 20 _Scattering("Scattering", float) = 1 _ScatteringMinDist("ScatteringMinDist", float) = 1 @@ -80,7 +62,7 @@ col.a *= stepSize * weight; sum.rgb += col.rgb * col.a * (1.0 - sum.a); sum.a += col.a; - scatterSum += pow(col.a, _ScatteringDensityExponent) * scatter; + scatterSum += pow(sum.a, _ScatteringDensityExponent) * scatter; } float4 RayMarch( in float3 origin, in float3 direction, in float zbuf, in float2 screenUV, out float scatterSum ) @@ -111,7 +93,7 @@ RaymarchStep( origin + rayDist * direction, step, 1-rayDist/_DepthCeiling, sum, _Scattering/pow(max(rayDist,_ScatteringMinDist),_ScatteringDistExponent), scatterSum); } - sum.rgb = pow( sum.rgb, 1 / _Gamma ) * _Exposure; + sum.rgb = pow( sum.rgb / pow(100,_TintExponent), 1 / _Gamma ) * _Exposure; return sum; } diff --git a/Assets/Shaders/Raymarching/VolumeRenderCustom.shader b/Assets/Shaders/Raymarching/VolumeRenderCustom.shader new file mode 100644 index 000000000..cf0a548b3 --- /dev/null +++ b/Assets/Shaders/Raymarching/VolumeRenderCustom.shader @@ -0,0 +1,236 @@ +Shader "VolSample/Volume Render" { + Properties { + _MainTex( "", 2D ) = "white" {} + _StepExponent("Step Exponent", float) = 1 + _NebulaSurfaceHeight("Surface Displacement", 2D) = "black" {} + _NebulaPatch("Patch", 2D) = "black" {} + _NebulaPatchHeight("Patch Displacement", 2D) = "black" {} + _NebulaTint("Tint Texture", 2D ) = "white" {} + [HDR]_Tint("Tint Color", Color) = (1,1,1,1) + //_GridTransform("Grid Transform", Vector) = (0,0,0,0) + _NebulaFillDensity("Fill Density", float) = 1 + _NebulaFloorDensity("Floor Density", float) = 1 + _NebulaPatchDensity("Patch Density", float) = 1 + _NebulaFloorOffset("Floor Offset", float) = 1 + _NebulaFloorBlend("Floor Blend", float) = 1 + _NebulaPatchBlend("Patch Blend", float) = 1 + _Exposure("Exposure", float) = 1 + _Gamma("Gamma", float) = .5 + _TintExponent("Tint Exponent", float) = .5 + _DepthCeiling("Depth Ceiling", float) = 1000 + _DepthBlend("Depth Blend", float) = 100 + _NoiseAmplitude("Noise Amplitude", float) = 1 + _NoiseScale("Noise Scale", float) = 100 + _NoiseExponent("Noise Exponent", float) = 2 + _NoiseSpeed("Noise Speed", float) = 1 + _FlowScroll("Flow Scroll", float) = 1 + _FlowScale("Flow Scale", float) = 1 + _FlowAmplitude("Flow Amplitude", float) = 1 + _FlowSpeed("Flow Speed", float) = 1 + _SafetyDistance("Safety Distance", float) = 20 + _Scattering("Scattering", float) = 1 + _ScatteringMinDist("ScatteringMinDist", float) = 1 + _ScatteringDistExponent("ScatteringDistExponent", float) = 1 + _ScatteringDensityExponent("ScatteringDensityExponent", float) = 1 + } + + CGINCLUDE; + + uniform sampler2D _MainTex; + uniform sampler2D _CameraDepthTexture; + + #include "UnityCG.cginc" + #include "Assets/Shaders/Volumetric.cginc" + + // the number of volume samples to take + #define SAMPLE_COUNT 96 + + // Shared shader code for pixel view rays, given screen pos and camera frame vectors. + // Camera vectors are passed in as this shader is run from a post proc camera, so the unity built-in values are not useful. + uniform float4x4 _CamProj; + uniform float4x4 _CamInvProj; + uniform float3 _CamPos; + uniform float3 _CamForward; + uniform float3 _CamRight; + uniform float _HalfFov; + uniform int _FrameNumber; + + uniform float _StepExponent; + + uniform half _Gamma, + _Exposure, + _DepthCeiling, + _DepthBlend, + _Scattering, + _ScatteringDensityExponent, + _ScatteringDistExponent, + _ScatteringMinDist; + + // Dithering + sampler2D _DitheringTex; + float4 _DitheringCoords; + + inline float nrand(float2 ScreenUVs) + { + return frac(sin(ScreenUVs.x * 12.9898 + ScreenUVs.y * 78.233) * 43758.5453); + } + + void RaymarchStep( in float3 pos, in float stepSize, in float weight, inout float4 sum, in float scatter, inout float scatterSum) + { + float4 col = VolumeSampleColor( pos ); + col.a *= stepSize * weight; + sum.rgb += col.rgb * col.a * (1.0 - sum.a); + sum.a += col.a; + scatterSum += pow(col.a, _ScatteringDensityExponent) * scatter; + } + + float4 RayMarch( in float3 origin, in float3 direction, in float zbuf, in float2 screenUV, out float scatterSum ) + { + scatterSum = 0; + float blue = tex2D(_DitheringTex, screenUV * _DitheringCoords.xy + _DitheringCoords.zw).r; + //float rand = frac(blue + _FrameNumber * 1.61803398875); + //return float4(rand, rand, rand, 1); + //half rand = frac(nrand(screenUV) + _FrameNumber * 1.61803398875); + //half rand = nrand(screenUV + frac(_Time.x)); + half rand = blue; + float4 sum = (float4)0.; + scatterSum = 0.; + + // setup sampling + + float rayDist = 0; + for( int i = 0; i < SAMPLE_COUNT; i++ ) + { + float prevRayDist = rayDist; + rayDist = pow((i+rand)/SAMPLE_COUNT,_StepExponent) * _DepthCeiling + 1; + float distToSurf = zbuf - rayDist; + if( distToSurf <= 0.001 || sum.a > .99) break; + + float step = rayDist - prevRayDist; + //float wt = (distToSurf >= step) ? 1. : distToSurf / step; + + RaymarchStep( origin + rayDist * direction, step, 1-rayDist/_DepthCeiling, sum, _Scattering/pow(max(rayDist,_ScatteringMinDist),_ScatteringDistExponent), scatterSum); + } + + sum.rgb = pow( sum.rgb, 1 / _Gamma ) * _Exposure; + return sum; + } + + struct v2f + { + float4 pos : SV_POSITION; + float4 screenPos : TEXCOORD1; + }; + + v2f vert( appdata_base v ) + { + v2f o; + o.pos = UnityObjectToClipPos( v.vertex ); + o.screenPos = ComputeScreenPos( o.pos ); + return o; + } + + void computeCamera( in float2 q, out float3 rayOrigin, out float3 rd ) + { + rayOrigin = _WorldSpaceCameraPos; + + float2 p = 2.0*(q - 0.5); + float4 d = mul(_CamProj, float4(p, 0, 1)); + d.xyz /= d.w; + //rd = (d - rayOrigin); + rd = normalize(d - rayOrigin); + rayOrigin = d; + //rayOrigin += _ProjectionParams.y * rd; + } + + inline float LinearEyeDepthToOutDepth(float z) + { + return (1 - _ZBufferParams.w * z) / (_ZBufferParams.z * z); + } + + float3 DepthToWorld(float2 uv, float depth) { + float z = (1-depth) * 2.0 - 1.0; + + float4 clipSpacePosition = float4(uv * 2.0 - 1.0, z, 1.0); + + float4 viewSpacePosition = mul(_CamInvProj,clipSpacePosition); + viewSpacePosition /= viewSpacePosition.w; + + float4 worldSpacePosition = mul(unity_ObjectToWorld,viewSpacePosition); + + return worldSpacePosition.xyz; + } + + // MRT shader + struct FragmentOutput + { + half4 dest0 : COLOR0; + half4 dest1 : COLOR1; + }; + + FragmentOutput frag( v2f i ) : SV_Target //out float outDepth : SV_Depth + { + FragmentOutput o; + + float2 q = i.screenPos.xy / i.screenPos.w; + + // camera + float3 rayOrigin, rayDirection; + computeCamera( q, rayOrigin, rayDirection ); + + // z buffer / scene depth for this pixel + float4 screenPos = UNITY_PROJ_COORD( i.screenPos ); + float2 screenUV = screenPos.xy / screenPos.w; + + float depthSample = tex2Dproj( _CameraDepthTexture, screenPos ).r; + //float depthValue = LinearEyeDepth(depthSample); + + float3 worldDepth = DepthToWorld(screenPos, depthSample); + float depthValue = length(worldDepth-rayOrigin); + + // march through volume + float scatter; + float4 clouds = RayMarch( rayOrigin, rayDirection, depthValue, screenUV, scatter ); + o.dest1 = .5 + scatter*.5;//smoothstep(1,.99,clouds.a)*pow(clouds.a,1)*.5; + + float3 bgcol = tex2Dlod( _MainTex, float4(q, 0., 0.) ); + // add in camera render colours, if not zfar (so we exclude skybox) + if(clouds.a < .99 && depthValue < _DepthCeiling) + { + // Blend out camera render when outside marching range + if( depthValue >= _DepthCeiling - _DepthBlend ) + clouds.a = lerp(clouds.a, 1, (depthValue - (_DepthCeiling - _DepthBlend)) / _DepthBlend); + + //clouds.xyz = lerp(clouds.xyz, bgcol, 1-clouds.a); + clouds.xyz += (1. - clouds.a) * bgcol; + // assume zbuffer represents opaque surface + + } + clouds.a = 1.; + + //outDepth = LinearEyeDepthToOutDepth(min(depthValue, rayDist)); + + o.dest0 = clouds; + return o; + } + + + ENDCG + + Subshader + { + Pass + { + ZTest Always Cull Off ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma vertex vert + #pragma fragment frag + ENDCG + } + } + + Fallback off + +} // shader diff --git a/Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta b/Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta new file mode 100644 index 000000000..a0f8d767f --- /dev/null +++ b/Assets/Shaders/Raymarching/VolumeRenderCustom.shader.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7940bc6e15d348ff930f4ebb3c475cf2 +timeCreated: 1623409494 \ No newline at end of file diff --git a/Assets/Shaders/Volumetric.cginc b/Assets/Shaders/Volumetric.cginc index 7a7a6e556..dc155f86b 100644 --- a/Assets/Shaders/Volumetric.cginc +++ b/Assets/Shaders/Volumetric.cginc @@ -1,3 +1,4 @@ +#include "UnityCG.cginc" // // Value Noise 3D Deriv @@ -35,30 +36,29 @@ float4 Value3D_Deriv( float3 P ) return float4(1,1,1,1); } -uniform sampler2D _Surface; -float4 _Surface_TexelSize; -uniform sampler2D _Patch; -uniform sampler2D _Displacement; -uniform sampler2D _TintTexture; -float4 _TintTexture_TexelSize; +uniform sampler2D _NebulaSurfaceHeight; +float4 _NebulaSurfaceHeight_TexelSize; +uniform sampler2D _NebulaPatch; +uniform sampler2D _NebulaPatchHeight; +uniform sampler2D _NebulaTint; +float4 _NebulaTint_TexelSize; uniform float3 _GridTransform; - -uniform half4 _Tint; -uniform half _GridFillDensity, - _GridFloorDensity, - _GridPatchDensity, - _GridFloorOffset, - _GridFloorBlend, - _GridPatchBlend, +uniform half _NebulaFillDensity, + _NebulaFloorDensity, + _NebulaPatchDensity, + _NebulaFloorOffset, + _NebulaFloorBlend, + _NebulaPatchBlend, _TintExponent, - _NoiseFrequency, + _NoiseScale, _NoiseExponent, - _NoiseStrength, + _NoiseAmplitude, _NoiseSpeed, - _TurbulenceScale, - _TurbulenceAmplitude, + _FlowScale, + _FlowAmplitude, + _FlowScroll, _FlowSpeed, _SafetyDistance; @@ -93,19 +93,19 @@ float parabola( float x, float k ) float f(float3 pos) { float2 uv = -(pos.xz-_GridTransform.xy)/_GridTransform.z + float2(.5,.5); - const float surface = tex2Dlod(_Surface, half4(uv, 0, 0)).r; - const float dist = pos.y + surface - _GridFloorOffset; + const float surfaceDisp = tex2Dlod(_NebulaSurfaceHeight, half4(uv, 0, 0)).r; + const float dist = pos.y + surfaceDisp - _NebulaFloorOffset; - const float fillDensity = smoothstep(_SafetyDistance,0,dist) * _GridFillDensity; + const float fillDensity = smoothstep(_SafetyDistance,0,dist) * _NebulaFillDensity; if(dist < _SafetyDistance) { - const float patch = tex2Dlod(_Patch, half4(uv, 0, 0)).r; - const float displacement = tex2Dlod(_Displacement, half4(uv, 0, 0)).r; + const float patch = tex2Dlod(_NebulaPatch, half4(uv, 0, 0)).r; + const float patchDisp = tex2Dlod(_NebulaPatchHeight, half4(uv, 0, 0)).r; - const float patchDensity = saturate((-abs(pos.y+displacement)+patch)/_GridPatchBlend)*_GridPatchDensity; + const float patchDensity = saturate((-abs(pos.y+patchDisp - _NebulaFloorOffset)+patch)/_NebulaPatchBlend)*_NebulaPatchDensity; const float floorDist = -dist; - const float floorDensity = floorDist/_GridFloorBlend*_GridFloorDensity; + const float floorDensity = floorDist/_NebulaFloorBlend*_NebulaFloorDensity; const float fogDensity = patchDensity + max(0,floorDensity); return fogDensity + fillDensity; } @@ -117,13 +117,13 @@ float f(float3 pos) float3 calcNormal (float3 pos, float2 uv) { float3 n = float3(pos.x, - tex2D(_Surface, float2(uv.x, uv.y + _Surface_TexelSize.y)).x, - pos.z + _Surface_TexelSize.y * _GridTransform.z); + tex2D(_NebulaSurfaceHeight, float2(uv.x, uv.y + _NebulaSurfaceHeight_TexelSize.y)).x, + pos.z + _NebulaSurfaceHeight_TexelSize.y * _GridTransform.z); float3 me = float3(pos.x, - tex2D(_Surface, float2(uv.x, uv.y)).x, + tex2D(_NebulaSurfaceHeight, float2(uv.x, uv.y)).x, pos.z); - float3 e = float3(pos.x + _Surface_TexelSize.x * _GridTransform.z, - tex2D(_Surface, float2(uv.x + _Surface_TexelSize.x, uv.y)).x, + float3 e = float3(pos.x + _NebulaSurfaceHeight_TexelSize.x * _GridTransform.z, + tex2D(_NebulaSurfaceHeight, float2(uv.x + _NebulaSurfaceHeight_TexelSize.x, uv.y)).x, pos.z); float3 norm = cross(normalize(n-me),normalize(e-me)); return norm; @@ -131,11 +131,11 @@ float3 calcNormal (float3 pos, float2 uv) float2 tintGradient (float3 pos, float2 uv, float mip, out float3 tint) { - tint = tex2Dlod(_TintTexture, float4(uv.x, uv.y, 0, mip)); + tint = tex2Dlod(_NebulaTint, float4(uv.x, uv.y, 0, mip)); float me = length(tint); return float2( - length(tex2Dlod(_TintTexture, float4(uv.x + 0.001953125, uv.y, 0, mip))) - me, - length(tex2Dlod(_TintTexture, float4(uv.x, uv.y + 0.001953125, 0, mip))) - me + length(tex2Dlod(_NebulaTint, float4(uv.x + 0.001953125, uv.y, 0, mip))) - me, + length(tex2Dlod(_NebulaTint, float4(uv.x, uv.y + 0.001953125, 0, mip))) - me ); } @@ -149,22 +149,26 @@ float3 calcNormal( float3 p ) // for function f(p) k.xxx*f( p + k.xxx*h ) ); } -float3 flow(float3 pos, out float3 normal) +float3 flow(float3 pos, out float noise) { //float2 uv = -(pos.xz-_GridTransform.xy)/_GridTransform.z + float2(.5,.5); - normal = calcNormal(pos); + //normal = calcNormal(pos); //return normalize(float3(-normal.x,0,-normal.z)) * _TurbulenceAmplitude; - const float4 simplex = Value3D_Deriv( pos / _TurbulenceScale - float3(0,_Time.x,0) ); - return cross(normalize(simplex.yzw), normal) * _TurbulenceAmplitude * (simplex.x-.5); + const float4 noiseSample1 = Value3D_Deriv( pos / _FlowScale - float3(0,_FlowScroll,0) ); + const float4 noiseSample2 = Value3D_Deriv( (pos / _FlowScale - float3(0,_FlowScroll,0)) / 1.61803398875 ); // make it golden + noise = noiseSample1.x; + return cross(normalize(noiseSample2.yzw), normalize(noiseSample1.yzw)) * _FlowAmplitude; + //return BitangentNoise3D(pos / _FlowScale - float3(0,_FlowScroll,0)) * _FlowAmplitude; } -float d(float3 pos, out float3 normal) +float d(float3 pos) { - const float3 turbulence = flow(pos, normal); - const float lerp1 = frac(_Time.x * _FlowSpeed); - const float lerp2 = frac(_Time.x * _FlowSpeed + .5); - const float noise1 = pow(triNoise3d((pos+turbulence * lerp1)*_NoiseFrequency),_NoiseExponent) * _NoiseStrength * parabola(lerp1, 2); - const float noise2 = pow(triNoise3d((pos+turbulence * lerp2)*_NoiseFrequency),_NoiseExponent) * _NoiseStrength * parabola(lerp2, 2); + float noise; + const float3 fl = flow(pos, noise); + const float lerp1 = frac(_Time.x * _FlowSpeed + noise); + const float lerp2 = frac(_Time.x * _FlowSpeed + noise + .5); + const float noise1 = pow(triNoise3d((pos+fl * lerp1) / _NoiseScale),_NoiseExponent) * _NoiseAmplitude * parabola(lerp1, 2); + const float noise2 = pow(triNoise3d((pos+fl * lerp2) / _NoiseScale),_NoiseExponent) * _NoiseAmplitude * parabola(lerp2, 2); pos.y += (noise1 + noise2); return f(pos); } @@ -172,12 +176,12 @@ float d(float3 pos, out float3 normal) float4 VolumeSampleColor(float3 pos) { float2 uv = -(pos.xz-_GridTransform.xy)/_GridTransform.z + float2(.5,.5); - float3 normal; - float density = d(pos, normal); - float3 tint = tex2Dlod(_TintTexture, float4(uv.x, uv.y, 0, 1 / pow(density, .25))); + float density = d(pos); + float3 tint = tex2Dlod(_NebulaTint, float4(uv.x, uv.y, 0, 1 / pow(density, .25))); //float2 tintGrad = tintGradient(pos, uv, 1 / pow(density, .25), tint); //float3 tintNormal = normalize(float3(tintGrad.x, 0, tintGrad.y)); //tint *= abs(dot(normal, float3(0,-1,0))); - const float albedo = pow(1/max(.01,density), _TintExponent) * smoothstep(0,-250,pos.y); - return float4(albedo*_Tint.rgb*tint, density); + // pow(abs(1-density), _TintExponent) + const float albedo = smoothstep(0,-250,pos.y) * pow(1/max(.01,density), _TintExponent); + return float4(albedo*tint, density); } diff --git a/Assets/StreamingAssets/Audio/GeneratedSoundBanks/Wwise_IDs.h b/Assets/StreamingAssets/Audio/GeneratedSoundBanks/Wwise_IDs.h index 0468ce176..69e38c59c 100644 --- a/Assets/StreamingAssets/Audio/GeneratedSoundBanks/Wwise_IDs.h +++ b/Assets/StreamingAssets/Audio/GeneratedSoundBanks/Wwise_IDs.h @@ -36,15 +36,15 @@ namespace AK static const AkUniqueID GEN_COMBAT_1_STOP = 4289205743U; static const AkUniqueID GEN_OW_01_PLAY = 4009869725U; static const AkUniqueID GEN_OW_01_STOP = 1900744459U; - static const AkUniqueID IONCANNON_CHARGE_PLAY = 1733674570U; - static const AkUniqueID IONCANNON_CHARGE_STOP = 3179453300U; - static const AkUniqueID IONCANNON_FAIL = 216684405U; - static const AkUniqueID IONCANNON_FIRE = 299292453U; - static const AkUniqueID IONCANNON_HIT = 1028672300U; - static const AkUniqueID IONCANNON_MISS = 4133048765U; - static const AkUniqueID IONCANNON_SHIP_DESTROYED = 3465139343U; static const AkUniqueID KAWAII_FUTURE_BASS_PLAY = 2854353632U; static const AkUniqueID KAWAII_FUTURE_BASS_STOP = 1197715810U; + static const AkUniqueID LASER_CHARGE_PLAY = 2438116838U; + static const AkUniqueID LASER_CHARGE_STOP = 4247541464U; + static const AkUniqueID LASER_FAIL = 2129362585U; + static const AkUniqueID LASER_FIRE = 1675087065U; + static const AkUniqueID LASER_HIT = 2023124656U; + static const AkUniqueID LASER_MISS = 2058729561U; + static const AkUniqueID LASER_SHIP_DESTROYED = 304646619U; static const AkUniqueID LIGHTNINGGUN_CHARGE_PLAY = 2129771581U; static const AkUniqueID LIGHTNINGGUN_CHARGE_STOP = 62119851U; static const AkUniqueID LIGHTNINGGUN_FAIL = 1293013044U; @@ -107,14 +107,19 @@ namespace AK namespace GAME_PARAMETERS { static const AkUniqueID CHARGE_LEVEL = 1574608066U; + static const AkUniqueID PERFORMANCE_DURABILITY = 965148665U; + static const AkUniqueID PERFORMANCE_QUALITY = 875134311U; + static const AkUniqueID PERFORMANCE_THERMAL = 3835443961U; + static const AkUniqueID REACTOR_LOAD = 3735272724U; static const AkUniqueID SFX_REACTOR_ALARM = 2441699439U; static const AkUniqueID SFX_REACTOR_DISTORTION1 = 364563454U; static const AkUniqueID SFX_REACTOR_DISTORTION2 = 364563453U; static const AkUniqueID SFX_REACTOR_GRAIN_SPEED = 1663874485U; - static const AkUniqueID SFX_REACTOR_PITCH = 12206642U; static const AkUniqueID SFX_SHARED_INTENSITY = 211338040U; static const AkUniqueID SFX_SHARED_LFO_FREQUENCY = 3222479589U; static const AkUniqueID SFX_SHARED_LFO_INTENSITY = 561757932U; + static const AkUniqueID SFX_SHARED_PITCH = 2398401357U; + static const AkUniqueID SFX_SHARED_QUALITY = 3813090976U; static const AkUniqueID SFX_SHIP_DRIVE_ELECTRIC_FUZZBOX_FILTER = 2008207144U; static const AkUniqueID SFX_SHIP_DRIVE_NUCLEAR_FILTERDURATION = 255764574U; static const AkUniqueID SFX_SHIP_DRIVE_NUCLEAR_GRAIN_SPEED_MOD = 675480480U; @@ -125,7 +130,9 @@ namespace AK static const AkUniqueID SFX_WEAPON_LIGHTNING_GRAIN_FILTER = 3528347615U; static const AkUniqueID SFX_WEAPON_LIGHTNING_PITCH = 1365951697U; static const AkUniqueID SHIP_VELOCITY = 3579545711U; + static const AkUniqueID SHIP_VELOCITY_01 = 2790036083U; static const AkUniqueID TARGET_LOCKING = 3288537160U; + static const AkUniqueID THRUSTER_THROTTLE = 4116566921U; } // namespace GAME_PARAMETERS namespace BANKS @@ -138,7 +145,7 @@ namespace AK static const AkUniqueID COMBAT_GENERIC = 1516113159U; static const AkUniqueID COMBAT_METAL = 681474673U; static const AkUniqueID GENERAL = 133642231U; - static const AkUniqueID IONCANNON = 3364802794U; + static const AkUniqueID LASER = 3982605422U; static const AkUniqueID LIGHTNINGGUN = 772093933U; static const AkUniqueID MACHINEGUN = 3678545986U; static const AkUniqueID MAIN_MENU = 2005704188U; diff --git a/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset b/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset index be66d0871..aad622d91 100644 --- a/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset +++ b/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbd45de8e5d11d1591de681868e3b1c9ab869e87da5b1f4cf7106fa5bd0af152 -size 112456 +oid sha256:3f5d5042dfede5bc580a89b71c89a03ba49bc35b992e13f7d366bcfa3393c229 +size 107288 diff --git a/GameData/PlayerSettings.msgpack b/GameData/PlayerSettings.msgpack index c6b501fe2..774b7c881 100644 --- a/GameData/PlayerSettings.msgpack +++ b/GameData/PlayerSettings.msgpack @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:86cdea3834a123670cd98980a37547607b5c364703dc0f72d2a89149f0739176 -size 42803 +oid sha256:eb59659d0706f53d82adbe4c1e65cf806a6c749dbb9b1dd37d063d334794f249 +size 66094 diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index f33a7228f..fb93f74d9 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:447234e8c4d8ad0cbbdc75de56e2d314a113b5969f4fe0e37f1012457f829739 +oid sha256:642cf805309acafa4b513535bd41e7af6a774bd8002dd6096c9a774a1c66369d size 1687