Add water system package

This commit is contained in:
Vova
2023-12-06 20:29:45 +02:00
parent 627a90012a
commit 58d0f79bd1
140 changed files with 33167 additions and 3 deletions
@@ -0,0 +1,44 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e73e41b71c5f541679f1bb37dee026c1, type: 3}
m_Name: WaterResources
m_EditorClassIdentifier:
defaultFoamRamp: {fileID: 2800000, guid: 4098762bce32f44b9b7c56531d1a988e, type: 3}
defaultFoamMap: {fileID: 2800000, guid: ca439406e806ecf44a9586510be9477d, type: 3}
defaultSurfaceMap: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
defaultSeaMaterial: {fileID: 2100000, guid: 4849d4d15a9cb42eb9533ae935e2630b, type: 2}
defaultWaterMeshes:
- {fileID: 4300036, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300050, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300038, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300048, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300040, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300046, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300042, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300044, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300026, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300024, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300022, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300020, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300018, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300014, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300012, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300006, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300004, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300034, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300032, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300030, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300028, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300010, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300016, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300008, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
- {fileID: 4300002, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 40615c805d6e84ce7800418367985fe1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace WaterSystem
{
/// <summary>
/// This scriptable object holds default resources for the water rendering
/// </summary>
[System.Serializable][CreateAssetMenu(fileName = "WaterResources", menuName = "WaterSystem/Resource", order = 0)]
public class WaterResources : ScriptableObject
{
public Texture2D defaultFoamRamp; // a default foam ramp for the basic foam setting
public Texture2D defaultFoamMap; // a default foam texture map
public Texture2D defaultSurfaceMap; // a default normal/caustic map
public Material defaultSeaMaterial;
public Mesh[] defaultWaterMeshes;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e73e41b71c5f541679f1bb37dee026c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7ad544ee67a064d3eb407c8c47c67b8d, type: 3}
m_Name: WaterSettingsData
m_EditorClassIdentifier:
waterGeomType: 0
refType: 2
planarSettings:
m_ResolutionMultiplier: 1
m_ClipPlaneOffset: 0.24
m_ReflectLayers:
serializedVersion: 2
m_Bits: 4294967295
m_Shadows: 0
cubemapRefType: {fileID: 8900000, guid: a90d3c9b1c3ed4d36bffc02f6b335464, type: 3}
isInfinite: 0
originOffset: {x: 0, y: 0, z: 500, w: 500}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a4cacf74654e54b35b9eaea74fd20b4e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace WaterSystem.Data
{
/// <summary>
/// This scriptable object stores teh graphical/rendering settings for a water system
/// </summary>
[System.Serializable][CreateAssetMenu(fileName = "WaterSettingsData", menuName = "WaterSystem/Settings", order = 0)]
public class WaterSettingsData : ScriptableObject
{
public GeometryType waterGeomType; // The type of geometry, either vertex offset or tessellation
public ReflectionType refType = ReflectionType.PlanarReflection; // How the reflecitons are generated
// planar
public PlanarReflections.PlanarReflectionSettings planarSettings; // Planar reflection settings
// cubemap
public Cubemap cubemapRefType; // custom cubemap reference
public bool isInfinite; // Is the water infinite (shader incomplete)
public Vector4 originOffset = new Vector4(0f, 0f, 500f, 500f);
}
/// <summary>
/// The type of reflection source, custom cubemap, closest refelction probe, planar reflection
/// </summary>
[System.Serializable]
public enum ReflectionType
{
Cubemap,
ReflectionProbe,
PlanarReflection
}
/// <summary>
/// The type of geometry, either vertex offset or tessellation
/// </summary>
[System.Serializable]
public enum GeometryType
{
VertexOffset,
Tesselation
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ad544ee67a064d3eb407c8c47c67b8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,258 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b17284ebf5e80436eb6089f8c7459dab, type: 3}
m_Name: WaterSurfaceData
m_EditorClassIdentifier:
_waterMaxVisibility: 16.2
_absorptionRamp:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 0.18396229, g: 0.89963174, b: 1, a: 1}
key2: {r: 0.021626905, g: 0.49048996, b: 0.509434, a: 0}
key3: {r: 0, g: 0.275, b: 0.44, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 6746
ctime2: 20817
ctime3: 43581
ctime4: 65535
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 5
m_NumAlphaKeys: 2
_scatterRamp:
serializedVersion: 2
key0: {r: 0, g: 0, b: 0, a: 1}
key1: {r: 0.07843137, g: 0.24471705, b: 0.4117647, a: 1}
key2: {r: 0.12549019, g: 0.50673026, b: 0.58431375, a: 0}
key3: {r: 0.28888598, g: 0.45325178, b: 0.542, a: 0}
key4: {r: 0.19571698, g: 0.3647036, b: 0.45099998, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 3277
ctime2: 24672
ctime3: 52043
ctime4: 63029
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 4
m_NumAlphaKeys: 2
_waves:
- amplitude: 1
direction: -6.03
wavelength: 10
origin:
x: -146.4
y: 326.2
onmiDir: 1
- amplitude: 0.9
direction: 166
wavelength: 8
origin:
x: 0
y: 0
onmiDir: 0
- amplitude: 0.5
direction: 6.532788
wavelength: 7.455916
origin:
x: -63.14
y: 931.6
onmiDir: 1
- amplitude: 0.7
direction: 4.051435
wavelength: 4.6626315
origin:
x: -72.74
y: -16.01
onmiDir: 1
- amplitude: 0.5
direction: 180
wavelength: 2.6733496
origin:
x: -50.43
y: 0
onmiDir: 0
- amplitude: 0.5
direction: -151
wavelength: 2.9848163
origin:
x: 0
y: 0
onmiDir: 0
_customWaves: 0
randomSeed: 891
_basicWaveSettings:
numWaves: 6
amplitude: 0.6
direction: -176
wavelength: 8
_foamSettings:
foamType: 1
basicFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0.16228558
outSlope: 0.16228558
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0.15316528
- serializedVersion: 3
time: 0.6247411
value: 0.39698213
inSlope: 1.2551872
outSlope: 1.2551872
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.28785437
- serializedVersion: 3
time: 0.8523668
value: 0.81129223
inSlope: 1.9929253
outSlope: 1.9929253
tangentMode: 0
weightedMode: 0
inWeight: 0.27977753
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0.6611113
outSlope: 0.6611113
tangentMode: 0
weightedMode: 0
inWeight: 0.55429333
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
liteFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.2
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.4
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.7
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
mediumFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.4
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.7
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
denseFoam:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.7
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
_init: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 846f3dc3b5341447a86687211f741bc7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,86 @@
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
namespace WaterSystem.Data
{
/// <summary>
/// This scriptable object contains setting for how the water looks visually
/// </summary>
[System.Serializable][CreateAssetMenu(fileName = "WaterSurfaceData", menuName = "WaterSystem/Surface Data", order = 0)]
public class WaterSurfaceData : ScriptableObject
{
public float _waterMaxVisibility = 40.0f;
public Gradient _absorptionRamp;
public Gradient _scatterRamp;
public List<Wave> _waves = new List<Wave>();
public bool _customWaves = false;
public int randomSeed = 3234;
public BasicWaves _basicWaveSettings = new BasicWaves(1.5f, 45.0f, 5.0f);
public FoamSettings _foamSettings = new FoamSettings();
[SerializeField]
public bool _init = false;
}
[System.Serializable]
public struct Wave
{
public float amplitude; // height of the wave in units(m)
public float direction; // direction the wave travels in degrees from Z+
public float wavelength; // distance between crest>crest
public float2 origin; // Omi directional point of origin
public float onmiDir; // Is omni?
public Wave(float amp, float dir, float length, float2 org, bool omni)
{
amplitude = amp;
direction = dir;
wavelength = length;
origin = org;
onmiDir = omni ? 1 : 0;
}
}
[System.Serializable]
public class BasicWaves
{
public int numWaves = 6;
public float amplitude;
public float direction;
public float wavelength;
public BasicWaves(float amp, float dir, float len)
{
numWaves = 6;
amplitude = amp;
direction = dir;
wavelength = len;
}
}
[System.Serializable]
public class FoamSettings
{
public int foamType; // 0=default, 1=simple, 3=custom
public AnimationCurve basicFoam;
public AnimationCurve liteFoam;
public AnimationCurve mediumFoam;
public AnimationCurve denseFoam;
// Foam curves
public FoamSettings()
{
foamType = 0;
basicFoam = new AnimationCurve(new Keyframe[2]{new Keyframe(0.25f, 0f),
new Keyframe(1f, 1f)});
liteFoam = new AnimationCurve(new Keyframe[3]{new Keyframe(0.2f, 0f),
new Keyframe(0.4f, 1f),
new Keyframe(0.7f, 0f)});
mediumFoam = new AnimationCurve(new Keyframe[3]{new Keyframe(0.4f, 0f),
new Keyframe(0.7f, 1f),
new Keyframe(1f, 0f)});
denseFoam = new AnimationCurve(new Keyframe[2]{new Keyframe(0.7f, 0f),
new Keyframe(1f, 1f)});
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b17284ebf5e80436eb6089f8c7459dab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: