还原水插件

This commit is contained in:
2026-03-05 00:14:42 +08:00
parent 0de35591e7
commit e82f2ea6b7
270 changed files with 2773 additions and 12445 deletions

View File

@@ -23286,8 +23286,8 @@ MonoBehaviour:
Dependencies: []
Tags:
- Name: main/item.bundle
Hash: 7ddffaa0a08d5e27fba7fad7df9fa94f
Size: 542454050
Hash: 30830b32d82d58c86991dcce49a9ea8e
Size: 542453520
Assets:
- Path: Assets/ResRaw/gfx/baits/black_leech/black_leech.prefab
Address: Item/black_leech
@@ -41553,8 +41553,8 @@ MonoBehaviour:
Dependencies: []
Tags:
- Name: main/plyaer.bundle
Hash: 0765d7b38fb20176d24357d15a00b8f2
Size: 378600019
Hash: bbba633188707d96572ed1a4c0d88e63
Size: 378832435
Assets:
- Path: Assets/ResRaw/Prefabs/Line/fishing line float set.prefab
Address: Plyaer/fishing line float set
@@ -41631,6 +41631,21 @@ MonoBehaviour:
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/ResRaw/Prefabs/Line/Float (4).prefab
Address: Plyaer/Float (4)
Type: GameObject
Bundle: main/plyaer.bundle
Tags:
Group:
Name: Plyaer
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/ResRaw/Prefabs/Line/LineSolver.prefab
Address: Plyaer/LineSolver
Type: GameObject

View File

@@ -186,6 +186,12 @@ MonoBehaviour:
customValue: 100
additiveValue: 0
multiplyValue: 1
sunInitialRotation:
m_OverrideState: 0
m_Value: -Infinity
lockSun:
m_OverrideState: 0
m_Value: 0
enableBackplate:
m_OverrideState: 0
m_Value: 0
@@ -306,6 +312,18 @@ MonoBehaviour:
skyAmbientMode:
m_OverrideState: 0
m_Value: 0
planetRadius:
m_OverrideState: 0
m_Value: 6378.1
renderingSpace:
m_OverrideState: 0
m_Value: 1
centerMode:
m_OverrideState: 0
m_Value: 0
planetCenter:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.1, z: 0}
windOrientation:
m_OverrideState: 0
m_Value: 0
@@ -315,6 +333,7 @@ MonoBehaviour:
fogType:
m_OverrideState: 0
m_Value: 0
m_Version: 1
--- !u!114 &5315503232242033309
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -630,6 +649,7 @@ MonoBehaviour:
m_Name: HDShadowSettings
m_EditorClassIdentifier:
active: 1
interCascadeBorders: 1
maxShadowDistance:
m_OverrideState: 1
m_Value: 150
@@ -650,10 +670,10 @@ MonoBehaviour:
m_Value: 0.3
cascadeShadowBorder0:
m_OverrideState: 1
m_Value: 0.13333334
m_Value: 0.06905067
cascadeShadowBorder1:
m_OverrideState: 1
m_Value: 0.06666666
m_Value: 0.05086228
cascadeShadowBorder2:
m_OverrideState: 0
m_Value: 0

View File

@@ -70,6 +70,9 @@ MonoBehaviour:
sliceDistributionUniformity:
m_OverrideState: 1
m_Value: 0
multipleScatteringIntensity:
m_OverrideState: 0
m_Value: 0
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
@@ -113,6 +116,11 @@ MonoBehaviour:
rayMiss:
m_OverrideState: 0
m_Value: 3
adaptiveProbeVolumesLayerMask:
m_OverrideState: 0
m_Value:
serializedVersion: 0
m_Bits: 1
depthBufferThickness:
m_OverrideState: 1
m_Value: 0.2
@@ -230,18 +238,15 @@ MonoBehaviour:
type:
m_OverrideState: 1
m_Value: 2
sphericalMode:
m_OverrideState: 1
atmosphericScattering:
m_OverrideState: 0
m_Value: 1
seaLevel:
renderingMode:
m_OverrideState: 0
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378100
planetCenterPosition:
m_OverrideState: 1
m_Value: {x: 0, y: -6378100, z: 0}
material:
m_OverrideState: 0
m_Value: {fileID: 0}
airDensityR:
m_OverrideState: 1
m_Value: 0.04534
@@ -253,7 +258,7 @@ MonoBehaviour:
m_Value: 0.2326406
airTint:
m_OverrideState: 1
m_Value: {r: 0.9019608, g: 0.9019608, b: 1, a: 1}
m_Value: {r: 1, g: 1, b: 1, a: 1}
airMaximumAltitude:
m_OverrideState: 1
m_Value: 55261.97
@@ -269,9 +274,15 @@ MonoBehaviour:
aerosolAnisotropy:
m_OverrideState: 1
m_Value: 0
numberOfBounces:
m_OverrideState: 1
m_Value: 8
ozoneDensityDimmer:
m_OverrideState: 0
m_Value: 1
ozoneMinimumAltitude:
m_OverrideState: 0
m_Value: 20000
ozoneLayerWidth:
m_OverrideState: 0
m_Value: 20000
groundTint:
m_OverrideState: 1
m_Value: {r: 0.94547063, g: 0.83922887, b: 0.78070223, a: 1}
@@ -314,10 +325,16 @@ MonoBehaviour:
horizonZenithShift:
m_OverrideState: 1
m_Value: 0
m_SkyVersion: 1
m_SkyVersion: 2
m_ObsoleteEarthPreset:
m_OverrideState: 1
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378100
planetCenterPosition:
m_OverrideState: 1
m_Value: {x: 0, y: -6378100, z: 0}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -372,6 +389,7 @@ MonoBehaviour:
m_Name: HDShadowSettings
m_EditorClassIdentifier:
active: 1
interCascadeBorders: 1
maxShadowDistance:
m_OverrideState: 1
m_Value: 700
@@ -424,6 +442,18 @@ MonoBehaviour:
skyAmbientMode:
m_OverrideState: 1
m_Value: 1
planetRadius:
m_OverrideState: 1
m_Value: 6378.1
renderingSpace:
m_OverrideState: 0
m_Value: 1
centerMode:
m_OverrideState: 0
m_Value: 0
planetCenter:
m_OverrideState: 1
m_Value: {x: 0, y: -6378.1, z: 0}
windOrientation:
m_OverrideState: 0
m_Value: 0
@@ -433,6 +463,7 @@ MonoBehaviour:
fogType:
m_OverrideState: 1
m_Value: 3
m_Version: 1
--- !u!114 &114369445541307930
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -502,6 +533,12 @@ MonoBehaviour:
customValue: 100
additiveValue: 0
multiplyValue: 1
sunInitialRotation:
m_OverrideState: 0
m_Value: -Infinity
lockSun:
m_OverrideState: 0
m_Value: 0
enableBackplate:
m_OverrideState: 0
m_Value: 0
@@ -653,9 +690,9 @@ MonoBehaviour:
m_DenoiserRadius:
m_OverrideState: 0
m_Value: 16
m_AffectSmoothSurfaces:
m_DenoiserAntiFlickeringStrength:
m_OverrideState: 0
m_Value: 0
m_Value: 1
mode:
m_OverrideState: 0
m_Value: 2
@@ -671,6 +708,11 @@ MonoBehaviour:
m_RayMaxIterationsRT:
m_OverrideState: 0
m_Value: 48
adaptiveProbeVolumesLayerMask:
m_OverrideState: 0
m_Value:
serializedVersion: 0
m_Bits: 1
--- !u!114 &114471737410181332
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -1027,6 +1069,9 @@ MonoBehaviour:
sliceDistributionUniformity:
m_OverrideState: 1
m_Value: 1
multipleScatteringIntensity:
m_OverrideState: 0
m_Value: 0
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
@@ -1091,18 +1136,15 @@ MonoBehaviour:
type:
m_OverrideState: 0
m_Value: 1
sphericalMode:
atmosphericScattering:
m_OverrideState: 0
m_Value: 1
seaLevel:
renderingMode:
m_OverrideState: 0
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378.759
planetCenterPosition:
material:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.759, z: 0}
m_Value: {fileID: 0}
airDensityR:
m_OverrideState: 0
m_Value: 0.04534
@@ -1114,7 +1156,7 @@ MonoBehaviour:
m_Value: 0.23264056
airTint:
m_OverrideState: 0
m_Value: {r: 0.9, g: 0.9, b: 1, a: 1}
m_Value: {r: 1, g: 1, b: 1, a: 1}
airMaximumAltitude:
m_OverrideState: 1
m_Value: 70
@@ -1130,9 +1172,15 @@ MonoBehaviour:
aerosolAnisotropy:
m_OverrideState: 1
m_Value: 0
numberOfBounces:
m_OverrideState: 1
m_Value: 8
ozoneDensityDimmer:
m_OverrideState: 0
m_Value: 1
ozoneMinimumAltitude:
m_OverrideState: 0
m_Value: 20000
ozoneLayerWidth:
m_OverrideState: 0
m_Value: 20000
groundTint:
m_OverrideState: 0
m_Value: {r: 0.4, g: 0.25, b: 0.15, a: 1}
@@ -1175,7 +1223,13 @@ MonoBehaviour:
horizonZenithShift:
m_OverrideState: 0
m_Value: 0
m_SkyVersion: 1
m_SkyVersion: 2
m_ObsoleteEarthPreset:
m_OverrideState: 0
m_Value: 1
planetaryRadius:
m_OverrideState: 1
m_Value: 6378.759
planetCenterPosition:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.759, z: 0}

View File

@@ -70,6 +70,9 @@ MonoBehaviour:
sliceDistributionUniformity:
m_OverrideState: 1
m_Value: 0
multipleScatteringIntensity:
m_OverrideState: 0
m_Value: 0
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
@@ -113,6 +116,11 @@ MonoBehaviour:
rayMiss:
m_OverrideState: 0
m_Value: 3
adaptiveProbeVolumesLayerMask:
m_OverrideState: 0
m_Value:
serializedVersion: 0
m_Bits: 1
depthBufferThickness:
m_OverrideState: 1
m_Value: 0.1
@@ -238,6 +246,7 @@ MonoBehaviour:
m_Name: HDShadowSettings
m_EditorClassIdentifier:
active: 1
interCascadeBorders: 1
maxShadowDistance:
m_OverrideState: 1
m_Value: 700
@@ -290,6 +299,18 @@ MonoBehaviour:
skyAmbientMode:
m_OverrideState: 1
m_Value: 1
planetRadius:
m_OverrideState: 0
m_Value: 6378.1
renderingSpace:
m_OverrideState: 0
m_Value: 1
centerMode:
m_OverrideState: 0
m_Value: 0
planetCenter:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.1, z: 0}
windOrientation:
m_OverrideState: 0
m_Value: 0
@@ -299,6 +320,7 @@ MonoBehaviour:
fogType:
m_OverrideState: 1
m_Value: 3
m_Version: 1
--- !u!114 &114369445541307930
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -368,6 +390,12 @@ MonoBehaviour:
customValue: 100
additiveValue: 0
multiplyValue: 1
sunInitialRotation:
m_OverrideState: 0
m_Value: -Infinity
lockSun:
m_OverrideState: 0
m_Value: 0
enableBackplate:
m_OverrideState: 0
m_Value: 0
@@ -519,9 +547,9 @@ MonoBehaviour:
m_DenoiserRadius:
m_OverrideState: 0
m_Value: 16
m_AffectSmoothSurfaces:
m_DenoiserAntiFlickeringStrength:
m_OverrideState: 0
m_Value: 0
m_Value: 1
mode:
m_OverrideState: 0
m_Value: 2
@@ -537,6 +565,11 @@ MonoBehaviour:
m_RayMaxIterationsRT:
m_OverrideState: 0
m_Value: 48
adaptiveProbeVolumesLayerMask:
m_OverrideState: 0
m_Value:
serializedVersion: 0
m_Bits: 1
--- !u!114 &114471737410181332
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -893,6 +926,9 @@ MonoBehaviour:
sliceDistributionUniformity:
m_OverrideState: 1
m_Value: 0.5
multipleScatteringIntensity:
m_OverrideState: 0
m_Value: 0
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
@@ -957,18 +993,15 @@ MonoBehaviour:
type:
m_OverrideState: 1
m_Value: 1
sphericalMode:
m_OverrideState: 1
atmosphericScattering:
m_OverrideState: 0
m_Value: 1
seaLevel:
renderingMode:
m_OverrideState: 0
m_Value: 0
planetaryRadius:
material:
m_OverrideState: 0
m_Value: 6378100
planetCenterPosition:
m_OverrideState: 0
m_Value: {x: 0, y: -6378100, z: 0}
m_Value: {fileID: 0}
airDensityR:
m_OverrideState: 0
m_Value: 0.04534
@@ -980,7 +1013,7 @@ MonoBehaviour:
m_Value: 0.23264056
airTint:
m_OverrideState: 0
m_Value: {r: 0.9, g: 0.9, b: 1, a: 1}
m_Value: {r: 1, g: 1, b: 1, a: 1}
airMaximumAltitude:
m_OverrideState: 0
m_Value: 55261.973
@@ -996,9 +1029,15 @@ MonoBehaviour:
aerosolAnisotropy:
m_OverrideState: 1
m_Value: 0
numberOfBounces:
ozoneDensityDimmer:
m_OverrideState: 0
m_Value: 8
m_Value: 1
ozoneMinimumAltitude:
m_OverrideState: 0
m_Value: 20000
ozoneLayerWidth:
m_OverrideState: 0
m_Value: 20000
groundTint:
m_OverrideState: 1
m_Value: {r: 0.21698111, g: 0.19883622, b: 0.18768866, a: 1}
@@ -1041,10 +1080,16 @@ MonoBehaviour:
horizonZenithShift:
m_OverrideState: 0
m_Value: 0
m_SkyVersion: 1
m_SkyVersion: 2
m_ObsoleteEarthPreset:
m_OverrideState: 1
m_Value: 1
planetaryRadius:
m_OverrideState: 0
m_Value: 6378100
planetCenterPosition:
m_OverrideState: 0
m_Value: {x: 0, y: -6378100, z: 0}
--- !u!114 &8363329657589183425
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -1091,18 +1136,15 @@ MonoBehaviour:
type:
m_OverrideState: 0
m_Value: 1
sphericalMode:
atmosphericScattering:
m_OverrideState: 0
m_Value: 1
seaLevel:
renderingMode:
m_OverrideState: 0
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378.759
planetCenterPosition:
material:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.759, z: 0}
m_Value: {fileID: 0}
airDensityR:
m_OverrideState: 0
m_Value: 0.04534
@@ -1114,7 +1156,7 @@ MonoBehaviour:
m_Value: 0.23264056
airTint:
m_OverrideState: 0
m_Value: {r: 0.9, g: 0.9, b: 1, a: 1}
m_Value: {r: 1, g: 1, b: 1, a: 1}
airMaximumAltitude:
m_OverrideState: 1
m_Value: 70
@@ -1130,9 +1172,15 @@ MonoBehaviour:
aerosolAnisotropy:
m_OverrideState: 1
m_Value: 0
numberOfBounces:
m_OverrideState: 1
m_Value: 8
ozoneDensityDimmer:
m_OverrideState: 0
m_Value: 1
ozoneMinimumAltitude:
m_OverrideState: 0
m_Value: 20000
ozoneLayerWidth:
m_OverrideState: 0
m_Value: 20000
groundTint:
m_OverrideState: 0
m_Value: {r: 0.4, g: 0.25, b: 0.15, a: 1}
@@ -1175,7 +1223,13 @@ MonoBehaviour:
horizonZenithShift:
m_OverrideState: 0
m_Value: 0
m_SkyVersion: 1
m_SkyVersion: 2
m_ObsoleteEarthPreset:
m_OverrideState: 0
m_Value: 1
planetaryRadius:
m_OverrideState: 1
m_Value: 6378.759
planetCenterPosition:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.759, z: 0}

View File

@@ -70,6 +70,9 @@ MonoBehaviour:
sliceDistributionUniformity:
m_OverrideState: 1
m_Value: 0
multipleScatteringIntensity:
m_OverrideState: 0
m_Value: 0
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
@@ -134,18 +137,15 @@ MonoBehaviour:
type:
m_OverrideState: 1
m_Value: 2
sphericalMode:
m_OverrideState: 1
atmosphericScattering:
m_OverrideState: 0
m_Value: 1
seaLevel:
renderingMode:
m_OverrideState: 0
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378100
planetCenterPosition:
m_OverrideState: 1
m_Value: {x: 0, y: -6378100, z: 0}
material:
m_OverrideState: 0
m_Value: {fileID: 0}
airDensityR:
m_OverrideState: 1
m_Value: 0.04534
@@ -157,7 +157,7 @@ MonoBehaviour:
m_Value: 0.2326406
airTint:
m_OverrideState: 1
m_Value: {r: 0.9019608, g: 0.9019608, b: 1, a: 1}
m_Value: {r: 1, g: 1, b: 1, a: 1}
airMaximumAltitude:
m_OverrideState: 1
m_Value: 55261.97
@@ -173,9 +173,15 @@ MonoBehaviour:
aerosolAnisotropy:
m_OverrideState: 1
m_Value: 0
numberOfBounces:
m_OverrideState: 1
m_Value: 8
ozoneDensityDimmer:
m_OverrideState: 0
m_Value: 1
ozoneMinimumAltitude:
m_OverrideState: 0
m_Value: 20000
ozoneLayerWidth:
m_OverrideState: 0
m_Value: 20000
groundTint:
m_OverrideState: 1
m_Value: {r: 0.5872523, g: 0.79400826, b: 0.9591518, a: 1}
@@ -218,10 +224,16 @@ MonoBehaviour:
horizonZenithShift:
m_OverrideState: 1
m_Value: 0
m_SkyVersion: 1
m_SkyVersion: 2
m_ObsoleteEarthPreset:
m_OverrideState: 1
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378100
planetCenterPosition:
m_OverrideState: 1
m_Value: {x: 0, y: -6378100, z: 0}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -276,6 +288,7 @@ MonoBehaviour:
m_Name: HDShadowSettings
m_EditorClassIdentifier:
active: 1
interCascadeBorders: 1
maxShadowDistance:
m_OverrideState: 1
m_Value: 700
@@ -328,6 +341,18 @@ MonoBehaviour:
skyAmbientMode:
m_OverrideState: 1
m_Value: 1
planetRadius:
m_OverrideState: 1
m_Value: 6378.1
renderingSpace:
m_OverrideState: 0
m_Value: 1
centerMode:
m_OverrideState: 0
m_Value: 0
planetCenter:
m_OverrideState: 1
m_Value: {x: 0, y: -6378.1, z: 0}
windOrientation:
m_OverrideState: 0
m_Value: 0
@@ -337,6 +362,7 @@ MonoBehaviour:
fogType:
m_OverrideState: 1
m_Value: 3
m_Version: 1
--- !u!114 &114369445541307930
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -406,6 +432,12 @@ MonoBehaviour:
customValue: 100
additiveValue: 0
multiplyValue: 1
sunInitialRotation:
m_OverrideState: 0
m_Value: -Infinity
lockSun:
m_OverrideState: 0
m_Value: 0
enableBackplate:
m_OverrideState: 0
m_Value: 0
@@ -557,9 +589,9 @@ MonoBehaviour:
m_DenoiserRadius:
m_OverrideState: 0
m_Value: 16
m_AffectSmoothSurfaces:
m_DenoiserAntiFlickeringStrength:
m_OverrideState: 0
m_Value: 0
m_Value: 1
mode:
m_OverrideState: 0
m_Value: 2
@@ -575,6 +607,11 @@ MonoBehaviour:
m_RayMaxIterationsRT:
m_OverrideState: 0
m_Value: 48
adaptiveProbeVolumesLayerMask:
m_OverrideState: 0
m_Value:
serializedVersion: 0
m_Bits: 1
--- !u!114 &114471737410181332
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -886,6 +923,11 @@ MonoBehaviour:
rayMiss:
m_OverrideState: 0
m_Value: 3
adaptiveProbeVolumesLayerMask:
m_OverrideState: 0
m_Value:
serializedVersion: 0
m_Bits: 1
depthBufferThickness:
m_OverrideState: 1
m_Value: 0.2
@@ -1027,6 +1069,9 @@ MonoBehaviour:
sliceDistributionUniformity:
m_OverrideState: 1
m_Value: 1
multipleScatteringIntensity:
m_OverrideState: 0
m_Value: 0
m_FogControlMode:
m_OverrideState: 0
m_Value: 0
@@ -1091,18 +1136,15 @@ MonoBehaviour:
type:
m_OverrideState: 0
m_Value: 1
sphericalMode:
atmosphericScattering:
m_OverrideState: 0
m_Value: 1
seaLevel:
renderingMode:
m_OverrideState: 0
m_Value: 0
planetaryRadius:
m_OverrideState: 1
m_Value: 6378.759
planetCenterPosition:
material:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.759, z: 0}
m_Value: {fileID: 0}
airDensityR:
m_OverrideState: 0
m_Value: 0.04534
@@ -1114,7 +1156,7 @@ MonoBehaviour:
m_Value: 0.23264056
airTint:
m_OverrideState: 0
m_Value: {r: 0.9, g: 0.9, b: 1, a: 1}
m_Value: {r: 1, g: 1, b: 1, a: 1}
airMaximumAltitude:
m_OverrideState: 1
m_Value: 70
@@ -1130,9 +1172,15 @@ MonoBehaviour:
aerosolAnisotropy:
m_OverrideState: 1
m_Value: 0
numberOfBounces:
m_OverrideState: 1
m_Value: 8
ozoneDensityDimmer:
m_OverrideState: 0
m_Value: 1
ozoneMinimumAltitude:
m_OverrideState: 0
m_Value: 20000
ozoneLayerWidth:
m_OverrideState: 0
m_Value: 20000
groundTint:
m_OverrideState: 0
m_Value: {r: 0.4, g: 0.25, b: 0.15, a: 1}
@@ -1175,7 +1223,13 @@ MonoBehaviour:
horizonZenithShift:
m_OverrideState: 0
m_Value: 0
m_SkyVersion: 1
m_SkyVersion: 2
m_ObsoleteEarthPreset:
m_OverrideState: 0
m_Value: 1
planetaryRadius:
m_OverrideState: 1
m_Value: 6378.759
planetCenterPosition:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.759, z: 0}

View File

@@ -22,6 +22,18 @@ MonoBehaviour:
skyAmbientMode:
m_OverrideState: 0
m_Value: 1
planetRadius:
m_OverrideState: 0
m_Value: 6378.1
renderingSpace:
m_OverrideState: 0
m_Value: 1
centerMode:
m_OverrideState: 0
m_Value: 0
planetCenter:
m_OverrideState: 0
m_Value: {x: 0, y: -6378.1, z: 0}
windOrientation:
m_OverrideState: 0
m_Value: 0
@@ -31,6 +43,7 @@ MonoBehaviour:
fogType:
m_OverrideState: 0
m_Value: 0
m_Version: 1
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@@ -1084,7 +1084,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_Version: 0
_WorldSpace: 0
_Axis: {x: 0, y: 1, z: 0}
_Amplitude: 0
_Frequency: 1
@@ -1395,7 +1394,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_Version: 0
_WorldSpace: 0
_Axis: {x: 0, y: 0, z: 1}
_Amplitude: 10
_Frequency: 1
@@ -1655,7 +1653,7 @@ MonoBehaviour:
_TimeSliceBoundsUpdateFrameCount: 1
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Version: 2
_Version: 1
_Camera: {fileID: 0}
_TimeProvider: {fileID: 0}
_WindZone: {fileID: 0}
@@ -1683,10 +1681,7 @@ MonoBehaviour:
_Resolution: 384
_GeometryDownSampleFactor: 2
_ExtentsSizeMultiplier: 100
_MultipleViewpoints: 0
_Viewpoint: {fileID: 0}
_CameraExclusions: -1
_DataBackgroundMode: 3
_CenterOfDetailDisplacementCorrection: 1
_SampleTerrainHeightForScale: 1
_ForceScaleChangeSmoothing: 0
@@ -1722,11 +1717,10 @@ MonoBehaviour:
_Portals:
rid: 162836781179600907
_ShowWaterProxyPlane: 0
_EditModeFrameRate: 30
_FollowSceneCamera: 1
_EditorMultipleViewpoints: 1
_HeightQueries: 1
_Debug:
_SimulatePaused: 0
_AttachDebugGUI: 0
_ShowHiddenObjects: 0
_DisableFollowViewpoint: 0
@@ -1736,8 +1730,6 @@ MonoBehaviour:
_LogScaleChange: 0
_PauseOnScaleChange: 0
_IgnoreWavesForScaleChange: 0
_OverrideScale: 0
_ScaleOverride: 0
_ForceNoGraphics: 0
_Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2}
references:
@@ -1751,8 +1743,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 7
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 1.026, g: 2.085, b: 2.5500002, a: 0.306}
_ShorelineColorMaximumDistance: 10
@@ -1765,8 +1755,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 23
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 0, g: 0.588, b: 1.2, a: 6}
_ShorelineColorMaximumDistance: 10
@@ -1776,16 +1764,14 @@ MonoBehaviour:
data:
_Version: 0
_Enabled: 1
_MeshType: 0
_Layer: 4
_Material: {fileID: 2100000, guid: a8dc4e412bc6749cca29b3232bcb0f18, type: 2}
_Material: {fileID: 2100000, guid: 8ab064b6606504a55b489af2787350c2, type: 2}
_VolumeMaterial: {fileID: 0}
_ChunkTemplate: {fileID: 1516456258233481520, guid: 17840562212c147d6bdb5144d35bc442,
type: 3}
_CastShadows: 0
_WaterBodyCulling: 1
_TimeSliceBoundsUpdateFrameCount: 1
_CameraExclusions: 6
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Debug:
@@ -1797,26 +1783,21 @@ MonoBehaviour:
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2}
_CameraExclusions: 6
- rid: 162836781179600896
type: {class: AnimatedWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Enabled: 1
_OverrideResolution: 0
_Resolution: 256
_TextureFormatMode: 200
_TextureFormatMode: 100
_TextureFormat: 48
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 4096
_CollisionLayers: -1
_BakedWaveData: {fileID: 0}
_WaveSampling: 0
_WaveResolutionMultiplier: 1
_AttenuationInShallows: 0.95
_ShallowsMaximumDepth: 1000
_CollisionSource: 2
_CollisionLayers: -1
_MaximumQueryCount: 4096
_BakedWaveData: {fileID: 0}
- rid: 162836781179600897
type: {class: DepthLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1825,10 +1806,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 512
_IncludeTerrainHeight: 0
_EnableSignedDistanceFields: 1
- rid: 162836781179600898
@@ -1839,8 +1816,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 300
_TextureFormat: 45
_Blur: 0
_BlurIterations: 4
- rid: 162836781179600899
type: {class: FoamLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1849,8 +1824,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 45
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 30
_Prewarm: 1
_Settings: {fileID: 11400000, guid: 01b6d2d72f0e04b0abc7d62cfc8b5355, type: 2}
@@ -1862,8 +1835,6 @@ MonoBehaviour:
_Resolution: 512
_TextureFormatMode: 300
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 120
_AttenuationInShallows: 1
_Settings: {fileID: 11400000, guid: 97eb5eccada85449e9c98d91709b5f74, type: 2}
@@ -1875,10 +1846,6 @@ MonoBehaviour:
_Resolution: 128
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 1024
- rid: 162836781179600902
type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1887,8 +1854,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 6
_Blur: 1
_BlurIterations: 1
_SimulationFrequency: 60
_DynamicSoftShadows: 1
_SoftJitterExtinctionFactor: 0.75
@@ -1906,8 +1871,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 5
_Blur: 0
_BlurIterations: 1
_DefaultClippingState: 0
- rid: 162836781179600904
type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
@@ -1917,8 +1880,6 @@ MonoBehaviour:
_Resolution: 768
_TextureFormatMode: 100
_TextureFormat: 8
_Blur: 0
_BlurIterations: 1
- rid: 162836781179600905
type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1929,13 +1890,13 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1
_Resolution: 256
_Overscan: 1.5
_RenderOnlySingleCamera: 0
_Sky: 0
_DisablePixelLights: 1
_DisableShadows: 1
_HDR: 1
_Stencil: 0
_AllowMSAA: 0
_QualitySettingsOverride:
_OverrideLodBias: 0
_LodBias: Infinity
@@ -1954,18 +1915,17 @@ MonoBehaviour:
_Debug:
_ShowHiddenObjects: 0
_DisableRecursiveRendering: 0
_ForceCompatibility: 0
_AllowMSAA: 0
- rid: 162836781179600906
type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Version: 0
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2}
_EnvironmentalLightingEnable: 0
_EnvironmentalLightingWeight: 1
_EnvironmentalLightingVolumeProfile: {fileID: 0}
_CameraExclusions: 6
_AllCameras: 0
_CopyWaterMaterialParametersEachFrame: 1
_FarPlaneMultiplier: 0.68
_CullLimit: 0.001
@@ -1976,8 +1936,6 @@ MonoBehaviour:
_DisableHeightAboveWaterOptimization: 0
_DisableArtifactCorrection: 0
_OnlyReflectionCameras: 0
_Version: 0
_AllCameras: 0
- rid: 162836781179600907
type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest}
data:
@@ -2270,27 +2228,24 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: 4fde516347f8f410cb7bf7ec2b66c163, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 0
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:
@@ -3240,7 +3195,7 @@ MonoBehaviour:
_OctaveWavelength: 0
_MaximumDisplacementVertical: 0
_MaximumDisplacementHorizontal: 0
_ReportRendererBounds: 1
_ReportRendererBounds: 0
_Version: 1
_RenderPostCombine: 1
references:
@@ -4262,32 +4217,32 @@ PrefabInstance:
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.6865763
value: 0.68926716
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0.2843892
value: 0.2855038
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.6181962
value: -0.61519444
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.z
value: 0.25606522
value: 0.25482187
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 45
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -84
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}

View File

@@ -55,7 +55,7 @@ MonoBehaviour:
_TimeSliceBoundsUpdateFrameCount: 1
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Version: 2
_Version: 1
_Camera: {fileID: 0}
_TimeProvider: {fileID: 0}
_WindZone: {fileID: 0}
@@ -83,10 +83,7 @@ MonoBehaviour:
_Resolution: 384
_GeometryDownSampleFactor: 2
_ExtentsSizeMultiplier: 100
_MultipleViewpoints: 0
_Viewpoint: {fileID: 0}
_CameraExclusions: -1
_DataBackgroundMode: 3
_CenterOfDetailDisplacementCorrection: 1
_SampleTerrainHeightForScale: 1
_ForceScaleChangeSmoothing: 0
@@ -122,11 +119,10 @@ MonoBehaviour:
_Portals:
rid: 162836781179600923
_ShowWaterProxyPlane: 0
_EditModeFrameRate: 30
_FollowSceneCamera: 1
_EditorMultipleViewpoints: 1
_HeightQueries: 1
_Debug:
_SimulatePaused: 0
_AttachDebugGUI: 0
_ShowHiddenObjects: 0
_DisableFollowViewpoint: 0
@@ -136,8 +132,6 @@ MonoBehaviour:
_LogScaleChange: 0
_PauseOnScaleChange: 0
_IgnoreWavesForScaleChange: 0
_OverrideScale: 0
_ScaleOverride: 0
_ForceNoGraphics: 0
_Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2}
references:
@@ -151,8 +145,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 7
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 1.026, g: 2.085, b: 2.5500002, a: 0.306}
_ShorelineColorMaximumDistance: 10
@@ -165,8 +157,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 23
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 0, g: 0.588, b: 1.2, a: 6}
_ShorelineColorMaximumDistance: 10
@@ -176,16 +166,14 @@ MonoBehaviour:
data:
_Version: 0
_Enabled: 1
_MeshType: 0
_Layer: 4
_Material: {fileID: 2100000, guid: a8dc4e412bc6749cca29b3232bcb0f18, type: 2}
_Material: {fileID: 2100000, guid: 8ab064b6606504a55b489af2787350c2, type: 2}
_VolumeMaterial: {fileID: 0}
_ChunkTemplate: {fileID: 1516456258233481520, guid: 17840562212c147d6bdb5144d35bc442,
type: 3}
_CastShadows: 0
_WaterBodyCulling: 1
_TimeSliceBoundsUpdateFrameCount: 1
_CameraExclusions: 6
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Debug:
@@ -197,7 +185,6 @@ MonoBehaviour:
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2}
_CameraExclusions: 6
- rid: 162836781179600912
type: {class: AnimatedWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -206,17 +193,13 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 48
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 4096
_CollisionLayers: -1
_BakedWaveData: {fileID: 0}
_WaveSampling: 0
_WaveResolutionMultiplier: 1
_AttenuationInShallows: 0.95
_ShallowsMaximumDepth: 1000
_CollisionSource: 2
_CollisionLayers: -1
_MaximumQueryCount: 4096
_BakedWaveData: {fileID: 0}
- rid: 162836781179600913
type: {class: DepthLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -225,10 +208,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 512
_IncludeTerrainHeight: 0
_EnableSignedDistanceFields: 1
- rid: 162836781179600914
@@ -239,8 +218,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 300
_TextureFormat: 45
_Blur: 0
_BlurIterations: 4
- rid: 162836781179600915
type: {class: FoamLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -249,8 +226,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 45
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 30
_Prewarm: 1
_Settings: {fileID: 11400000, guid: 01b6d2d72f0e04b0abc7d62cfc8b5355, type: 2}
@@ -262,8 +237,6 @@ MonoBehaviour:
_Resolution: 512
_TextureFormatMode: 300
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 120
_AttenuationInShallows: 1
_Settings: {fileID: 11400000, guid: 97eb5eccada85449e9c98d91709b5f74, type: 2}
@@ -275,10 +248,6 @@ MonoBehaviour:
_Resolution: 128
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 1024
- rid: 162836781179600918
type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -287,8 +256,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 6
_Blur: 1
_BlurIterations: 1
_SimulationFrequency: 60
_DynamicSoftShadows: 1
_SoftJitterExtinctionFactor: 0.75
@@ -306,8 +273,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 5
_Blur: 0
_BlurIterations: 1
_DefaultClippingState: 0
- rid: 162836781179600920
type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
@@ -317,8 +282,6 @@ MonoBehaviour:
_Resolution: 768
_TextureFormatMode: 100
_TextureFormat: 8
_Blur: 0
_BlurIterations: 1
- rid: 162836781179600921
type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -329,13 +292,13 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1
_Resolution: 256
_Overscan: 1.5
_RenderOnlySingleCamera: 0
_Sky: 0
_DisablePixelLights: 1
_DisableShadows: 1
_HDR: 1
_Stencil: 0
_AllowMSAA: 0
_QualitySettingsOverride:
_OverrideLodBias: 0
_LodBias: Infinity
@@ -354,18 +317,17 @@ MonoBehaviour:
_Debug:
_ShowHiddenObjects: 0
_DisableRecursiveRendering: 0
_ForceCompatibility: 0
_AllowMSAA: 0
- rid: 162836781179600922
type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Version: 0
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2}
_EnvironmentalLightingEnable: 0
_EnvironmentalLightingWeight: 1
_EnvironmentalLightingVolumeProfile: {fileID: 0}
_CameraExclusions: 6
_AllCameras: 0
_CopyWaterMaterialParametersEachFrame: 1
_FarPlaneMultiplier: 0.68
_CullLimit: 0.001
@@ -376,8 +338,6 @@ MonoBehaviour:
_DisableHeightAboveWaterOptimization: 0
_DisableArtifactCorrection: 0
_OnlyReflectionCameras: 0
_Version: 0
_AllCameras: 0
- rid: 162836781179600923
type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest}
data:
@@ -441,27 +401,24 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: 28a29b5ef0c644735b5d7ba47d2863d4, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 180
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 32
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: 32
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:
@@ -1304,32 +1261,32 @@ PrefabInstance:
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.6865763
value: 0.7016851
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0.2843892
value: 0.29064745
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.6181962
value: -0.6009921
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.z
value: 0.25606522
value: 0.24893905
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 45
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -84
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}

View File

@@ -155,23 +155,18 @@ Material:
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 10
- _DstBlend2: 0
- _DstBlendAlpha: 10
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _ExcludeFromTUAndAA: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _MaterialID: 1
- _MaterialTypeMask: 2
- _Metallic: 0
- _Mode: 3
- _Normal_Flip_Back_Faces: 1
- _OcclusionStrength: 1
- _OpaqueCullMode: 2
- _Parallax: 0.02
- _PerPixelSorting: 0
- _QueueControl: 0
- _QueueOffset: 0
- _RayTracing: 0
@@ -186,7 +181,6 @@ Material:
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _StencilRef: 0
- _StencilRefDepth: 0
- _StencilRefDistortionVec: 4
@@ -200,7 +194,6 @@ Material:
- _SupportDecals: 1
- _Surface: 1
- _SurfaceType: 1
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
@@ -210,7 +203,6 @@ Material:
- _TransparentZWrite: 0
- _UVSec: 0
- _UseShadowThreshold: 0
- _Water_Volume_Multiplier: 1
- _WorkflowMode: 1
- _ZTest: 4
- _ZTestDepthEqualForOpaque: 4

View File

@@ -54,12 +54,12 @@ Material:
m_Parent: {fileID: -876546973899608171, guid: 00ffe7d0b7161420897069dc6e12822c, type: 3}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- CREST_FLOW_ON
- _ALPHATEST_ON
- _BUILTIN_ALPHATEST_ON
- _BUILTIN_AlphaClip
- _BUILTIN_SURFACE_TYPE_TRANSPARENT
- _BUILTIN_TRANSPARENT_RECEIVES_SHADOWS
- _CREST_FLOW_LOD
- _DOUBLESIDED_ON
- _ENABLE_FOG_ON_TRANSPARENT
- _SURFACE_TYPE_TRANSPARENT
@@ -86,11 +86,11 @@ Material:
m_TexEnvs: []
m_Ints: []
m_Floats:
- CREST_FLOW: 1
- _BUILTIN_DstBlend: 10
- _BUILTIN_QueueControl: 0
- _BUILTIN_SrcBlend: 5
- _BUILTIN_ZWrite: 1
- _CREST_FLOW_LOD: 1
- _Crest_AlbedoEnabled: 1
- _Crest_FoamFeather: 1
- _Crest_FoamScale: 1.3

View File

@@ -314,27 +314,24 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: e13a1902b10e34e9fb08e1d09e39b5d4, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 0
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 32
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.35
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:
@@ -1379,7 +1376,7 @@ MonoBehaviour:
_TimeSliceBoundsUpdateFrameCount: 1
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Version: 2
_Version: 1
_Camera: {fileID: 0}
_TimeProvider: {fileID: 0}
_WindZone: {fileID: 0}
@@ -1407,10 +1404,7 @@ MonoBehaviour:
_Resolution: 384
_GeometryDownSampleFactor: 2
_ExtentsSizeMultiplier: 100
_MultipleViewpoints: 0
_Viewpoint: {fileID: 2613380069347621712}
_CameraExclusions: -1
_DataBackgroundMode: 3
_CenterOfDetailDisplacementCorrection: 1
_SampleTerrainHeightForScale: 1
_ForceScaleChangeSmoothing: 0
@@ -1446,11 +1440,10 @@ MonoBehaviour:
_Portals:
rid: 1011
_ShowWaterProxyPlane: 0
_EditModeFrameRate: 30
_FollowSceneCamera: 1
_EditorMultipleViewpoints: 1
_HeightQueries: 1
_Debug:
_SimulatePaused: 0
_AttachDebugGUI: 0
_ShowHiddenObjects: 0
_DisableFollowViewpoint: 0
@@ -1460,8 +1453,6 @@ MonoBehaviour:
_LogScaleChange: 0
_PauseOnScaleChange: 0
_IgnoreWavesForScaleChange: 0
_OverrideScale: 0
_ScaleOverride: 0
_ForceNoGraphics: 0
_Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2}
references:
@@ -1475,8 +1466,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 7
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 1.026, g: 2.085, b: 2.5500002, a: 0.306}
_ShorelineColorMaximumDistance: 10
@@ -1489,10 +1478,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 512
_IncludeTerrainHeight: 0
_EnableSignedDistanceFields: 1
- rid: 1002
@@ -1503,8 +1488,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 300
_TextureFormat: 45
_Blur: 0
_BlurIterations: 4
- rid: 1003
type: {class: FoamLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1513,8 +1496,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 45
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 30
_Prewarm: 1
_Settings: {fileID: 0}
@@ -1526,8 +1507,6 @@ MonoBehaviour:
_Resolution: 512
_TextureFormatMode: 300
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 120
_AttenuationInShallows: 1
_Settings: {fileID: 0}
@@ -1539,10 +1518,6 @@ MonoBehaviour:
_Resolution: 128
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 1024
- rid: 1006
type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1551,8 +1526,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 6
_Blur: 1
_BlurIterations: 1
_SimulationFrequency: 60
_DynamicSoftShadows: 1
_SoftJitterExtinctionFactor: 0.75
@@ -1570,8 +1543,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 5
_Blur: 0
_BlurIterations: 1
_DefaultClippingState: 1
- rid: 1008
type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
@@ -1581,8 +1552,6 @@ MonoBehaviour:
_Resolution: 768
_TextureFormatMode: 100
_TextureFormat: 8
_Blur: 0
_BlurIterations: 1
- rid: 1009
type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1593,13 +1562,13 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1
_Resolution: 256
_Overscan: 1.5
_RenderOnlySingleCamera: 0
_Sky: 0
_DisablePixelLights: 1
_DisableShadows: 1
_HDR: 1
_Stencil: 0
_AllowMSAA: 0
_QualitySettingsOverride:
_OverrideLodBias: 0
_LodBias: 0.5
@@ -1618,18 +1587,17 @@ MonoBehaviour:
_Debug:
_ShowHiddenObjects: 0
_DisableRecursiveRendering: 0
_ForceCompatibility: 0
_AllowMSAA: 0
- rid: 1010
type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Version: 0
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2}
_EnvironmentalLightingEnable: 0
_EnvironmentalLightingWeight: 1
_EnvironmentalLightingVolumeProfile: {fileID: 0}
_CameraExclusions: 6
_AllCameras: 0
_CopyWaterMaterialParametersEachFrame: 1
_FarPlaneMultiplier: 0.68
_CullLimit: 0.001
@@ -1640,8 +1608,6 @@ MonoBehaviour:
_DisableHeightAboveWaterOptimization: 0
_DisableArtifactCorrection: 0
_OnlyReflectionCameras: 0
_Version: 0
_AllCameras: 0
- rid: 1011
type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest}
data:
@@ -1657,8 +1623,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 23
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 0, g: 0.588, b: 1.2, a: 6}
_ShorelineColorMaximumDistance: 10
@@ -1668,7 +1632,6 @@ MonoBehaviour:
data:
_Version: 0
_Enabled: 1
_MeshType: 0
_Layer: 4
_Material: {fileID: 2100000, guid: d82d92d8d8f214cd0b8bf7c185b2c341, type: 2}
_VolumeMaterial: {fileID: 0}
@@ -1676,7 +1639,6 @@ MonoBehaviour:
_CastShadows: 0
_WaterBodyCulling: 1
_TimeSliceBoundsUpdateFrameCount: 1
_CameraExclusions: 6
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Debug:
@@ -1688,7 +1650,6 @@ MonoBehaviour:
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2}
_CameraExclusions: 6
- rid: 5163698739167625228
type: {class: AnimatedWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -1697,17 +1658,13 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 48
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 4096
_CollisionLayers: -1
_BakedWaveData: {fileID: 0}
_WaveSampling: 0
_WaveResolutionMultiplier: 1
_AttenuationInShallows: 0.95
_ShallowsMaximumDepth: 1000
_CollisionSource: 2
_CollisionLayers: -1
_MaximumQueryCount: 4096
_BakedWaveData: {fileID: 0}
--- !u!1 &9077896628645171223
GameObject:
m_ObjectHideFlags: 0

View File

@@ -119,6 +119,171 @@ MonoBehaviour:
_ShaderPassIndex: 0
_CheckShaderName: 1
_CheckShaderPasses: 1
--- !u!1 &4811082362463432963
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3045335462880455184}
- component: {fileID: 1686987402272609885}
- component: {fileID: 493122196572431846}
m_Layer: 0
m_Name: Albedo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &3045335462880455184
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4811082362463432963}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2657230488372934684}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1686987402272609885
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4811082362463432963}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c948522afe4014818ad3ab8b5dad00b6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Previous: 44
_Next: 46
_Prefabs: []
--- !u!114 &493122196572431846
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4811082362463432963}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a8eca7a783ef84759a4e965c9d6d8827, type: 3}
m_Name:
m_EditorClassIdentifier:
_Version: 0
_ExecuteUpdateEvery: 0
_StopExecutingUpdateAfter: Infinity
_OnEnable:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.UI.Text, UnityEngine.UI
m_MethodName: set_text
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: Albedo
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.UI.Slider, UnityEngine.UI
m_MethodName: set_maxValue
m_Mode: 4
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
_OnDisable:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: Crest.OceanRenderer, Crest
m_MethodName: ClearLodData
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
_OnUpdate:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.UI.Slider, UnityEngine.UI
m_MethodName: set_value
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
_OnLegacyRenderPipeline:
m_PersistentCalls:
m_Calls: []
_OnHighDefinitionPipeline:
m_PersistentCalls:
m_Calls: []
_OnUniversalRenderPipeline:
m_PersistentCalls:
m_Calls: []
--- !u!1001 &4865865868520106964
PrefabInstance:
m_ObjectHideFlags: 0
@@ -225,6 +390,10 @@ PrefabInstance:
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
insertIndex: -1
addedObject: {fileID: 3045335462880455184}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
insertIndex: -1

View File

@@ -178,7 +178,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_Version: 0
_WorldSpace: 0
_Axis: {x: 0, y: 0, z: 1}
_Amplitude: 10
_Frequency: 1

View File

@@ -168,7 +168,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
_Version: 0
_Source: 0
_Viewer: {fileID: 0}
_Layer: 0
_MinimumWavelength: 1
_DistanceFromSurfaceSigned: 0

View File

@@ -121,7 +121,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
_Version: 0
_Source: 0
_Viewer: {fileID: 0}
_Layer: 0
_MinimumWavelength: 1
_DistanceFromSurfaceSigned: 0

View File

@@ -628,7 +628,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_Version: 0
_WorldSpace: 0
_Axis: {x: 0, y: 1, z: 0}
_Amplitude: 0
_Frequency: 1

View File

@@ -8,90 +8,111 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 809695123049724894, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 809695123049724894, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 809695123049724894, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 809695123049724894, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2823138595762987762, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 2823138595762987762, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_Name
value: Examples_FloatingObjects
objectReference: {fileID: 0}
- target: {fileID: 2853796242865667210, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 2853796242865667210, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: managedReferences[1004]._Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5549572483640152611, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5549572483640152611, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_MaxValue
value: 5
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 5655619906866042202, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6119524809475244111, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- target: {fileID: 6119524809475244111, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
propertyPath: m_Text
value: Floating Objects
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
insertIndex: -1
addedObject: {fileID: 4586859356124459972}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
insertIndex: -1
addedObject: {fileID: 510414307367690215}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
insertIndex: -1
addedObject: {fileID: 8023298220426844320}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
- targetCorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
insertIndex: -1
addedObject: {fileID: 1585603024147405864}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
--- !u!4 &7195797433741594109 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1, type: 3}
m_CorrespondingSourceObject: {fileID: 7451036494515983304, guid: 8b98a14ae91dd498d8f577f0f8f4aff1,
type: 3}
m_PrefabInstance: {fileID: 341145004360408629}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2066873169911808049
@@ -102,47 +123,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 7195797433741594109}
m_Modifications:
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_Name
value: Examples_FloatingBox (2)
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.y
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
@@ -153,7 +185,8 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
--- !u!4 &8023298220426844320 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
m_PrefabInstance: {fileID: 2066873169911808049}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5499094441694620501
@@ -164,51 +197,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 7195797433741594109}
m_Modifications:
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_Name
value: Examples_FloatingBox
objectReference: {fileID: 0}
- target: {fileID: 7065213192571102027, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
@@ -219,7 +259,8 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
--- !u!4 &4586859356124459972 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
m_PrefabInstance: {fileID: 5499094441694620501}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7347139586002683065
@@ -230,47 +271,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 7195797433741594109}
m_Modifications:
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_Name
value: Examples_FloatingBox (3)
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
@@ -281,7 +333,8 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
--- !u!4 &1585603024147405864 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
m_PrefabInstance: {fileID: 7347139586002683065}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8422331713121437558
@@ -292,47 +345,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 7195797433741594109}
m_Modifications:
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 875385380025743593, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_Name
value: Examples_FloatingBox (1)
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.y
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
- target: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
@@ -343,6 +407,7 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
--- !u!4 &510414307367690215 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200, type: 3}
m_CorrespondingSourceObject: {fileID: 8356280719142672529, guid: 84f17dfc7c7a7485296643a4e64d6200,
type: 3}
m_PrefabInstance: {fileID: 8422331713121437558}
m_PrefabAsset: {fileID: 0}

View File

@@ -56,27 +56,24 @@ MonoBehaviour:
_Spectrum: {fileID: 0}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 0
_OverrideGlobalWindSpeed: 1
_WindSpeed: 3
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:

View File

@@ -56,13 +56,11 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: 6b50b5218dbe2488fb5d00db49d15dae, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 0
_OverrideGlobalWindSpeed: 1
_WindSpeed: 150
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_Swell: 0
@@ -70,7 +68,7 @@ MonoBehaviour:
_ComponentsPerOctave: 8
_RandomSeed: 0
_ManualGeneration: 0
_Version: 3
_Version: 2
references:
version: 2
RefIds:

View File

@@ -212,13 +212,11 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: e13a1902b10e34e9fb08e1d09e39b5d4, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: -58.00273
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_Swell: 0
@@ -226,7 +224,7 @@ MonoBehaviour:
_ComponentsPerOctave: 8
_RandomSeed: 0
_ManualGeneration: 0
_Version: 3
_Version: 2
references:
version: 2
RefIds:
@@ -427,27 +425,24 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: e13a1902b10e34e9fb08e1d09e39b5d4, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 0
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:

View File

@@ -140,7 +140,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_Version: 0
_WorldSpace: 0
_Axis: {x: 1, y: 0, z: 1}
_Amplitude: 15
_Frequency: 1

View File

@@ -58,27 +58,24 @@ MonoBehaviour:
_Spectrum: {fileID: 0}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 0
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 32
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:

View File

@@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 10
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
@@ -42,8 +42,8 @@ RenderSettings:
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
m_BakeOnSceneLoad: 1
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
@@ -66,6 +66,9 @@ LightmapSettings:
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
@@ -93,8 +96,9 @@ LightmapSettings:
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 112000000, guid: be61fd374ee0fad46a337d78e0ed01ae, type: 2}
m_LightingSettings: {fileID: 4890085278179872738, guid: 6e72aca972f324f7886200f86939d735, type: 2}
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 4890085278179872738, guid: 6e72aca972f324f7886200f86939d735,
type: 2}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
@@ -542,6 +546,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c948522afe4014818ad3ab8b5dad00b6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Previous: 110
_Next: 109
_Prefabs:
- {fileID: 7253832949013104934, guid: c991a6f7c7bf14d29a1868ab0ba78d9b, type: 3}
- {fileID: 4743998664470201614, guid: d567dc7b091ab41dca1737015904294c, type: 3}
@@ -742,7 +748,6 @@ GameObject:
- component: {fileID: 1122580655}
- component: {fileID: 1122580654}
- component: {fileID: 1122580653}
- component: {fileID: 1122580657}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
@@ -766,17 +771,28 @@ MonoBehaviour:
m_MoveRepeatDelay: 0.5
m_MoveRepeatRate: 0.1
m_XRTrackingOrigin: {fileID: 0}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_PointAction: {fileID: 1054132383583890850, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MoveAction: {fileID: 3710738434707379630, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_SubmitAction: {fileID: 2064916234097673511, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_CancelAction: {fileID: -1967631576421560919, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_LeftClickAction: {fileID: 8056856818456041789, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MiddleClickAction: {fileID: 3279352641294131588, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_RightClickAction: {fileID: 3837173908680883260, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_ScrollWheelAction: {fileID: 4502412055082496612, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDevicePositionAction: {fileID: 4754684134866288074, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDeviceOrientationAction: {fileID: 1025543830046995696, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_PointAction: {fileID: 1054132383583890850, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_MoveAction: {fileID: 3710738434707379630, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_SubmitAction: {fileID: 2064916234097673511, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_CancelAction: {fileID: -1967631576421560919, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_LeftClickAction: {fileID: 8056856818456041789, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_MiddleClickAction: {fileID: 3279352641294131588, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_RightClickAction: {fileID: 3837173908680883260, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_ScrollWheelAction: {fileID: 4502412055082496612, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_TrackedDevicePositionAction: {fileID: 4754684134866288074, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_TrackedDeviceOrientationAction: {fileID: 1025543830046995696, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_DeselectOnBackgroundClick: 1
m_PointerBehavior: 0
m_CursorLockBehavior: 0
@@ -831,18 +847,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1122580657
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1122580652}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 539016482e955484bbeb4193a95d3e15, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1131128992
GameObject:
m_ObjectHideFlags: 0
@@ -878,11 +882,6 @@ MeshRenderer:
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@@ -904,7 +903,6 @@ MeshRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
@@ -940,47 +938,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1845454492}
m_Modifications:
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.9063079
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalRotation.z
value: -0.42261827
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 105
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 15
objectReference: {fileID: 0}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5304508333967466499, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
- target: {fileID: 5304508333967466499, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
propertyPath: m_Name
value: Sun
objectReference: {fileID: 0}
@@ -991,7 +1000,8 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
--- !u!4 &1364867124 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3}
m_CorrespondingSourceObject: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a,
type: 3}
m_PrefabInstance: {fileID: 1364867123}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1682107712
@@ -1083,47 +1093,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1845454492}
m_Modifications:
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2942909709672342223, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
- target: {fileID: 2942909709672342223, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
propertyPath: m_Name
value: Atmosphere
objectReference: {fileID: 0}
@@ -1134,7 +1155,8 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
--- !u!4 &1734491900 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3}
m_CorrespondingSourceObject: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e,
type: 3}
m_PrefabInstance: {fileID: 1734491899}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1835631273
@@ -1282,47 +1304,58 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1845454492}
m_Modifications:
- target: {fileID: 963553959586484309, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 963553959586484309, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_Name
value: Lighting
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
- target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
@@ -1333,7 +1366,8 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
--- !u!4 &1886939755 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3}
m_CorrespondingSourceObject: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6,
type: 3}
m_PrefabInstance: {fileID: 1886939754}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2128464135

View File

@@ -1,14 +1,9 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#if d_Unity_InputSystem && ENABLE_INPUT_SYSTEM
#define INPUT_SYSTEM_ENABLED
#endif
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.InputSystem;
namespace WaveHarmonic.Crest.Examples
{
@@ -17,6 +12,12 @@ namespace WaveHarmonic.Crest.Examples
#endif
sealed class ExamplesController : MonoBehaviour
{
[@DecoratedField, SerializeField]
KeyCode _Previous = KeyCode.Comma;
[@DecoratedField, SerializeField]
KeyCode _Next = KeyCode.Period;
[SerializeField]
List<GameObject> _Prefabs = new();
@@ -50,19 +51,11 @@ namespace WaveHarmonic.Crest.Examples
void Update()
{
#if INPUT_SYSTEM_ENABLED
if (Keyboard.current[Key.N].wasReleasedThisFrame)
#else
if (Input.GetKeyUp(KeyCode.N))
#endif
if (Input.GetKeyUp(_Previous))
{
Previous();
}
#if INPUT_SYSTEM_ENABLED
else if (Keyboard.current[Key.M].wasReleasedThisFrame)
#else
else if (Input.GetKeyUp(KeyCode.M))
#endif
else if (Input.GetKeyUp(_Next))
{
Next();
}

View File

@@ -59,7 +59,6 @@ Material:
- _BUILTIN_QueueControl: 0
- _BUILTIN_SrcBlend: 5
- _BUILTIN_ZWrite: 1
- _Crest_NormalMapTurbulenceStrength: 0.5
- _Crest_SSSDirectionalFalloff: 2
- _Crest_SSSEnabled: 1
- _Crest_SSSIntensity: 10

View File

@@ -56,27 +56,24 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: ce5a3f1aff978418c90b45d58f574528, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 0
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: 180
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:
@@ -310,7 +307,7 @@ MonoBehaviour:
_TimeSliceBoundsUpdateFrameCount: 1
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Version: 2
_Version: 1
_Camera: {fileID: 0}
_TimeProvider: {fileID: 0}
_WindZone: {fileID: 0}
@@ -338,10 +335,7 @@ MonoBehaviour:
_Resolution: 384
_GeometryDownSampleFactor: 4
_ExtentsSizeMultiplier: 100
_MultipleViewpoints: 0
_Viewpoint: {fileID: 0}
_CameraExclusions: -1
_DataBackgroundMode: 3
_CenterOfDetailDisplacementCorrection: 1
_SampleTerrainHeightForScale: 1
_ForceScaleChangeSmoothing: 0
@@ -377,11 +371,10 @@ MonoBehaviour:
_Portals:
rid: 7000983677634084867
_ShowWaterProxyPlane: 0
_EditModeFrameRate: 30
_FollowSceneCamera: 1
_EditorMultipleViewpoints: 1
_HeightQueries: 1
_Debug:
_SimulatePaused: 0
_AttachDebugGUI: 0
_ShowHiddenObjects: 0
_DisableFollowViewpoint: 0
@@ -391,8 +384,6 @@ MonoBehaviour:
_LogScaleChange: 0
_PauseOnScaleChange: 0
_IgnoreWavesForScaleChange: 0
_OverrideScale: 0
_ScaleOverride: 0
_ForceNoGraphics: 0
_Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2}
references:
@@ -406,17 +397,13 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 48
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 4096
_CollisionLayers: -1
_BakedWaveData: {fileID: 0}
_WaveSampling: 0
_WaveResolutionMultiplier: 1
_AttenuationInShallows: 0.85
_ShallowsMaximumDepth: 1000
_CollisionSource: 2
_CollisionLayers: -1
_MaximumQueryCount: 4096
_BakedWaveData: {fileID: 0}
- rid: 1001
type: {class: DepthLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -425,10 +412,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 512
_IncludeTerrainHeight: 0
_EnableSignedDistanceFields: 1
- rid: 1002
@@ -439,8 +422,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 45
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 30
_Prewarm: 1
_Settings: {fileID: 11400000, guid: e0a56d841e8854da48f505141f729c19, type: 2}
@@ -452,8 +433,6 @@ MonoBehaviour:
_Resolution: 512
_TextureFormatMode: 300
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 60
_AttenuationInShallows: 1
_Settings: {fileID: 0}
@@ -465,10 +444,6 @@ MonoBehaviour:
_Resolution: 128
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 1024
- rid: 1005
type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -477,8 +452,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 6
_Blur: 1
_BlurIterations: 1
_SimulationFrequency: 60
_DynamicSoftShadows: 1
_SoftJitterExtinctionFactor: 0.75
@@ -496,8 +469,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 5
_Blur: 0
_BlurIterations: 1
_DefaultClippingState: 0
- rid: 1007
type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
@@ -507,8 +478,6 @@ MonoBehaviour:
_Resolution: 768
_TextureFormatMode: 100
_TextureFormat: 8
_Blur: 0
_BlurIterations: 1
- rid: 1008
type: {class: AbsorptionLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -517,8 +486,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 7
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 1.026, g: 2.085, b: 2.5500002, a: 0.306}
_ShorelineColorMaximumDistance: 10
@@ -531,8 +498,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 23
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 0, g: 0.588, b: 1.2, a: 6}
_ShorelineColorMaximumDistance: 10
@@ -542,7 +507,6 @@ MonoBehaviour:
data:
_Version: 0
_Enabled: 1
_MeshType: 0
_Layer: 4
_Material: {fileID: 2100000, guid: d340825b528984c3ea62563460223aa4, type: 2}
_VolumeMaterial: {fileID: 0}
@@ -550,7 +514,6 @@ MonoBehaviour:
_CastShadows: 0
_WaterBodyCulling: 1
_TimeSliceBoundsUpdateFrameCount: 1
_CameraExclusions: 6
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Debug:
@@ -562,17 +525,17 @@ MonoBehaviour:
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2}
_CameraExclusions: 6
- rid: 1720327093404827648
type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Version: 0
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2}
_EnvironmentalLightingEnable: 0
_EnvironmentalLightingWeight: 1
_EnvironmentalLightingVolumeProfile: {fileID: 0}
_CameraExclusions: 6
_AllCameras: 0
_CopyWaterMaterialParametersEachFrame: 1
_FarPlaneMultiplier: 0.68
_CullLimit: 0.001
@@ -583,8 +546,6 @@ MonoBehaviour:
_DisableHeightAboveWaterOptimization: 0
_DisableArtifactCorrection: 0
_OnlyReflectionCameras: 0
_Version: 0
_AllCameras: 0
- rid: 1720327093404827649
type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -595,13 +556,13 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 2147483649
_Resolution: 1024
_Overscan: 1.5
_RenderOnlySingleCamera: 0
_Sky: 1
_DisablePixelLights: 1
_DisableShadows: 0
_HDR: 1
_Stencil: 0
_AllowMSAA: 0
_QualitySettingsOverride:
_OverrideLodBias: 0
_LodBias: 0.5
@@ -620,8 +581,6 @@ MonoBehaviour:
_Debug:
_ShowHiddenObjects: 0
_DisableRecursiveRendering: 0
_ForceCompatibility: 0
_AllowMSAA: 0
- rid: 7000983677634084866
type: {class: LevelLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -630,8 +589,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 300
_TextureFormat: 45
_Blur: 0
_BlurIterations: 4
- rid: 7000983677634084867
type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest}
data:

View File

@@ -648,7 +648,7 @@ MonoBehaviour:
_TimeSliceBoundsUpdateFrameCount: 1
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Version: 2
_Version: 1
_Camera: {fileID: 0}
_TimeProvider: {fileID: 0}
_WindZone: {fileID: 0}
@@ -676,10 +676,7 @@ MonoBehaviour:
_Resolution: 384
_GeometryDownSampleFactor: 2
_ExtentsSizeMultiplier: 100
_MultipleViewpoints: 0
_Viewpoint: {fileID: 0}
_CameraExclusions: -1
_DataBackgroundMode: 3
_CenterOfDetailDisplacementCorrection: 1
_SampleTerrainHeightForScale: 1
_ForceScaleChangeSmoothing: 0
@@ -715,11 +712,10 @@ MonoBehaviour:
_Portals:
rid: 9154139594981113870
_ShowWaterProxyPlane: 0
_EditModeFrameRate: 30
_FollowSceneCamera: 1
_EditorMultipleViewpoints: 1
_HeightQueries: 1
_Debug:
_SimulatePaused: 0
_AttachDebugGUI: 0
_ShowHiddenObjects: 0
_DisableFollowViewpoint: 0
@@ -729,8 +725,6 @@ MonoBehaviour:
_LogScaleChange: 0
_PauseOnScaleChange: 0
_IgnoreWavesForScaleChange: 0
_OverrideScale: 0
_ScaleOverride: 0
_ForceNoGraphics: 0
_Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2}
references:
@@ -744,8 +738,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 7
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 1.026, g: 2.085, b: 2.5500002, a: 0.306}
_ShorelineColorMaximumDistance: 10
@@ -758,8 +750,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 23
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 0, g: 0.588, b: 1.2, a: 6}
_ShorelineColorMaximumDistance: 10
@@ -769,7 +759,6 @@ MonoBehaviour:
data:
_Version: 0
_Enabled: 1
_MeshType: 0
_Layer: 4
_Material: {fileID: 2100000, guid: aa74fe26a90564079a48cdae97645f7b, type: 2}
_VolumeMaterial: {fileID: 0}
@@ -778,7 +767,6 @@ MonoBehaviour:
_CastShadows: 0
_WaterBodyCulling: 1
_TimeSliceBoundsUpdateFrameCount: 1
_CameraExclusions: 6
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Debug:
@@ -790,7 +778,6 @@ MonoBehaviour:
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2}
_CameraExclusions: 6
- rid: 9154139594981113859
type: {class: AnimatedWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -799,17 +786,13 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 48
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 4096
_CollisionLayers: -1
_BakedWaveData: {fileID: 0}
_WaveSampling: 0
_WaveResolutionMultiplier: 1
_AttenuationInShallows: 0.95
_ShallowsMaximumDepth: 1000
_CollisionSource: 2
_CollisionLayers: -1
_MaximumQueryCount: 4096
_BakedWaveData: {fileID: 0}
- rid: 9154139594981113860
type: {class: DepthLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -818,10 +801,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 512
_IncludeTerrainHeight: 0
_EnableSignedDistanceFields: 1
- rid: 9154139594981113861
@@ -832,8 +811,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 300
_TextureFormat: 45
_Blur: 0
_BlurIterations: 4
- rid: 9154139594981113862
type: {class: FoamLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -842,8 +819,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 45
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 30
_Prewarm: 1
_Settings: {fileID: 0}
@@ -855,8 +830,6 @@ MonoBehaviour:
_Resolution: 512
_TextureFormatMode: 300
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 60
_AttenuationInShallows: 1
_Settings: {fileID: 0}
@@ -868,10 +841,6 @@ MonoBehaviour:
_Resolution: 128
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 1024
- rid: 9154139594981113865
type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -880,8 +849,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 6
_Blur: 1
_BlurIterations: 1
_SimulationFrequency: 60
_DynamicSoftShadows: 1
_SoftJitterExtinctionFactor: 0.75
@@ -899,8 +866,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 5
_Blur: 0
_BlurIterations: 1
_DefaultClippingState: 0
- rid: 9154139594981113867
type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
@@ -910,8 +875,6 @@ MonoBehaviour:
_Resolution: 768
_TextureFormatMode: 100
_TextureFormat: 8
_Blur: 0
_BlurIterations: 1
- rid: 9154139594981113868
type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -922,13 +885,13 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1
_Resolution: 512
_Overscan: 1.5
_RenderOnlySingleCamera: 0
_Sky: 1
_DisablePixelLights: 1
_DisableShadows: 1
_HDR: 1
_Stencil: 0
_AllowMSAA: 0
_QualitySettingsOverride:
_OverrideLodBias: 0
_LodBias: 0.5
@@ -947,18 +910,17 @@ MonoBehaviour:
_Debug:
_ShowHiddenObjects: 0
_DisableRecursiveRendering: 0
_ForceCompatibility: 0
_AllowMSAA: 0
- rid: 9154139594981113869
type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Version: 0
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2}
_EnvironmentalLightingEnable: 0
_EnvironmentalLightingWeight: 1
_EnvironmentalLightingVolumeProfile: {fileID: 0}
_CameraExclusions: 6
_AllCameras: 0
_CopyWaterMaterialParametersEachFrame: 1
_FarPlaneMultiplier: 0.68
_CullLimit: 0.001
@@ -969,8 +931,6 @@ MonoBehaviour:
_DisableHeightAboveWaterOptimization: 0
_DisableArtifactCorrection: 0
_OnlyReflectionCameras: 0
_Version: 0
_AllCameras: 0
- rid: 9154139594981113870
type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest}
data:

View File

@@ -76,8 +76,6 @@ Material:
- _BUILTIN_SrcBlend: 5
- _BUILTIN_ZWrite: 1
- _Crest_Anisotropy: 0
- _Crest_NormalMapTurbulenceCoverage: 1
- _Crest_NormalMapTurbulenceStrength: 1
- _CullMode: 0
- _CullModeForward: 0
- _DstBlend: 10

View File

@@ -280,7 +280,7 @@ MonoBehaviour:
_TimeSliceBoundsUpdateFrameCount: 1
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Version: 2
_Version: 1
_Camera: {fileID: 0}
_TimeProvider: {fileID: 0}
_WindZone: {fileID: 0}
@@ -308,10 +308,7 @@ MonoBehaviour:
_Resolution: 384
_GeometryDownSampleFactor: 2
_ExtentsSizeMultiplier: 100
_MultipleViewpoints: 0
_Viewpoint: {fileID: 0}
_CameraExclusions: -1
_DataBackgroundMode: 3
_CenterOfDetailDisplacementCorrection: 1
_SampleTerrainHeightForScale: 1
_ForceScaleChangeSmoothing: 0
@@ -347,11 +344,10 @@ MonoBehaviour:
_Portals:
rid: 162836781179600935
_ShowWaterProxyPlane: 0
_EditModeFrameRate: 30
_FollowSceneCamera: 1
_EditorMultipleViewpoints: 1
_HeightQueries: 1
_Debug:
_SimulatePaused: 0
_AttachDebugGUI: 0
_ShowHiddenObjects: 0
_DisableFollowViewpoint: 0
@@ -361,8 +357,6 @@ MonoBehaviour:
_LogScaleChange: 0
_PauseOnScaleChange: 0
_IgnoreWavesForScaleChange: 0
_OverrideScale: 0
_ScaleOverride: 0
_ForceNoGraphics: 0
_Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2}
references:
@@ -376,8 +370,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 7
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 1.026, g: 2.085, b: 2.5500002, a: 0.306}
_ShorelineColorMaximumDistance: 10
@@ -390,8 +382,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 200
_TextureFormat: 23
_Blur: 0
_BlurIterations: 1
_ShorelineColorSource: 0
_ShorelineColor: {r: 0, g: 0.588, b: 1.2, a: 6}
_ShorelineColorMaximumDistance: 10
@@ -401,7 +391,6 @@ MonoBehaviour:
data:
_Version: 0
_Enabled: 1
_MeshType: 0
_Layer: 4
_Material: {fileID: 2100000, guid: d6e4d43be817745be8c654fe12d10077, type: 2}
_VolumeMaterial: {fileID: 0}
@@ -410,7 +399,6 @@ MonoBehaviour:
_CastShadows: 0
_WaterBodyCulling: 1
_TimeSliceBoundsUpdateFrameCount: 1
_CameraExclusions: 6
_SurfaceSelfIntersectionFixMode: 4
_AllowRenderQueueSorting: 0
_Debug:
@@ -422,7 +410,6 @@ MonoBehaviour:
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2}
_CameraExclusions: 6
- rid: 162836781179600924
type: {class: AnimatedWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -431,17 +418,13 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 48
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 4096
_CollisionLayers: -1
_BakedWaveData: {fileID: 0}
_WaveSampling: 0
_WaveResolutionMultiplier: 1
_AttenuationInShallows: 0.95
_ShallowsMaximumDepth: 1000
_CollisionSource: 2
_CollisionLayers: -1
_MaximumQueryCount: 4096
_BakedWaveData: {fileID: 0}
- rid: 162836781179600925
type: {class: DepthLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -450,10 +433,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 512
_IncludeTerrainHeight: 0
_EnableSignedDistanceFields: 1
- rid: 162836781179600926
@@ -464,8 +443,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 300
_TextureFormat: 45
_Blur: 0
_BlurIterations: 4
- rid: 162836781179600927
type: {class: FoamLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -474,8 +451,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 45
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 30
_Prewarm: 0
_Settings: {fileID: 11400000, guid: fb1aaea1e5e8d4ba6b718be97218a083, type: 2}
@@ -487,8 +462,6 @@ MonoBehaviour:
_Resolution: 512
_TextureFormatMode: 300
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_SimulationFrequency: 60
_AttenuationInShallows: 1
_Settings: {fileID: 11400000, guid: 8dea483b97d254faa99deffab2bbfd05, type: 2}
@@ -500,10 +473,6 @@ MonoBehaviour:
_Resolution: 128
_TextureFormatMode: 100
_TextureFormat: 46
_Blur: 0
_BlurIterations: 1
_QuerySource: 1
_MaximumQueryCount: 1024
- rid: 162836781179600930
type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -512,8 +481,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 6
_Blur: 1
_BlurIterations: 1
_SimulationFrequency: 60
_DynamicSoftShadows: 1
_SoftJitterExtinctionFactor: 0.75
@@ -531,8 +498,6 @@ MonoBehaviour:
_Resolution: 256
_TextureFormatMode: 100
_TextureFormat: 5
_Blur: 0
_BlurIterations: 1
_DefaultClippingState: 0
- rid: 162836781179600932
type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
@@ -542,8 +507,6 @@ MonoBehaviour:
_Resolution: 768
_TextureFormatMode: 100
_TextureFormat: 8
_Blur: 0
_BlurIterations: 1
- rid: 162836781179600933
type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
@@ -554,13 +517,13 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1
_Resolution: 256
_Overscan: 1.5
_RenderOnlySingleCamera: 0
_Sky: 0
_DisablePixelLights: 1
_DisableShadows: 1
_HDR: 1
_Stencil: 0
_AllowMSAA: 0
_QualitySettingsOverride:
_OverrideLodBias: 0
_LodBias: 0.5
@@ -579,18 +542,17 @@ MonoBehaviour:
_Debug:
_ShowHiddenObjects: 0
_DisableRecursiveRendering: 0
_ForceCompatibility: 0
_AllowMSAA: 0
- rid: 162836781179600934
type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest}
data:
_Version: 0
_Enabled: 1
_Layer: 4
_Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2}
_EnvironmentalLightingEnable: 0
_EnvironmentalLightingWeight: 1
_EnvironmentalLightingVolumeProfile: {fileID: 0}
_CameraExclusions: 6
_AllCameras: 0
_CopyWaterMaterialParametersEachFrame: 1
_FarPlaneMultiplier: 0.68
_CullLimit: 0.001
@@ -601,8 +563,6 @@ MonoBehaviour:
_DisableHeightAboveWaterOptimization: 0
_DisableArtifactCorrection: 0
_OnlyReflectionCameras: 0
_Version: 0
_AllCameras: 0
- rid: 162836781179600935
type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest}
data:
@@ -721,27 +681,24 @@ MonoBehaviour:
_Spectrum: {fileID: 11400000, guid: 30151f29a777a41f39698cb262ee599b, type: 2}
_EvaluateSpectrumAtRunTimeEveryFrame: 1
_RespectShallowWaterAttenuation: 1
_SeaLevelOnly: 0
_OverrideGlobalWindDirection: 1
_WaveDirectionHeadingAngle: -90
_OverrideGlobalWindSpeed: 0
_WindSpeed: 20
_Resolution: 128
_IncludeInDropDetailHeightBasedOnWaves: 0
_DrawSlicesInEditor: 0
_AlphaSource: 0
_OverrideGlobalWindTurbulence: 1
_WindTurbulence: 0.145
_WindAlignment: 0
_TimeLoopLength: Infinity
_OverrideCulling: 0
_MaximumVerticalDisplacement: 10
_MaximumHorizontalDisplacement: 15
_EnableBakedCollision: 0
_TimeResolution: 4
_SmallestWavelengthRequired: 2
_BakedTimeLoopLength: 32
_Version: 3
_Version: 2
references:
version: 2
RefIds:

View File

@@ -66,16 +66,12 @@ namespace WaveHarmonic.Crest.Editor
message += $"Scale: {target.CalcLodScale(i)}\n";
message += $"Texel: {2f * 2f * target.CalcLodScale(i) / target.LodResolution}\n";
message += $"Minimum Slice: {Mathf.Floor(Mathf.Log(Mathf.Max(i / baseTexelSize, 1f), 2f))}";
message += "\n\n";
if (i < target.LodLevels - 1) message += "\n\n";
}
message += $"Scale: {target.Scale}\n";
message += "\n";
if (target.Surface.Material.HasVector(WaterRenderer.ShaderIDs.s_Absorption))
{
message += $"Depth Fog Density: {target.Surface.Material.GetVector(WaterRenderer.ShaderIDs.s_Absorption)}";
message += $"\n\nDepth Fog Density: {target.Surface.Material.GetVector(WaterRenderer.ShaderIDs.s_Absorption)}";
}
EditorGUILayout.HelpBox(message, MessageType.None);

View File

@@ -71,15 +71,11 @@ namespace WaveHarmonic.Crest.Editor
{ "_Crest_NormalMapStrength", "Strength of normal map influence" },
{ "_Crest_NormalMapScale", "Base scale of multi-scale normal map texture" },
{ "_Crest_NormalMapScrollSpeed", "Speed of the normal maps scrolling" },
{ "_Crest_NormalMapTurbulenceEnabled", "Increase chance of sparkles where water is turbulent" },
{ "_Crest_NormalMapTurbulenceStrength", "Strength of the normal map influence where turbulent" },
{ "_Crest_NormalMapTurbulenceCoverage", "The threshold where turbulence triggers this effect.\n\nValues above 0.9 may be too high for calmer wave conditions, as it will trigger the effect where water is not turbulent. Furthermore, a value of one or very close one can cause a pop when weighing out waves to zero" },
{ "_Crest_AbsorptionColor", "Works as a color (ie red adds red rather than subtracts red). This value is converted to real absorption values (proportion of light getting absorbed by water in atoms per meter). Alpha channel is for density. High alpha and darker color reduces transparency" },
{ "_Crest_Scattering", "Light scattered by the water towards the viewer (in-scattered) per meter. Brighter color reduces transparency" },
{ "_Crest_Anisotropy", "The directionality of the scattering where zero means scattered in all directions. The further towards one, the less visible soft shadows will be" },
{ "_Crest_DirectTerm", "Scale direct light contribution to volume lighting" },
{ "_Crest_AmbientTerm", "Scale ambient light contribution to volume lighting" },
{ "_Crest_ShadowsAffectsAmbientFactor", "How much shadows affect ambient lighting. Typically this not required, but can help scenes with large shadowed areas" },
{ "_Crest_SSSEnabled", "Whether to to emulate light scattering through waves" },
{ "_Crest_SSSIntensity", "Direct light contribution intensity. Applied to the scattering color. This effect is best if subtle" },
{ "_Crest_SSSPinchMinimum", "Higher the value the more scattering is towards the peaks of the waves" },
@@ -97,7 +93,6 @@ namespace WaveHarmonic.Crest.Editor
{ "_Crest_PlanarReflectionsEnabled", "Dynamically rendered 'reflection plane' style reflections. Requires Reflections to be enabled on the Water Renderer" },
{ "_Crest_PlanarReflectionsIntensity", "Intensity of the planar reflections" },
{ "_Crest_PlanarReflectionsDistortion", "How much the water normal affects the planar reflection" },
{ "_Crest_PlanarReflectionsApplySmoothness", "Whether to apply smoothness to planar reflection sample via mip-map blending. Enabling will likely incur artifacts with most perturbed water" },
{ "_Crest_PlanarReflectionsRoughness", "Controls the mipmap range" },
{ "_Crest_RefractionStrength", "How strongly light is refracted when passing through water surface" },
{ "_Crest_RefractiveIndexOfWater", "Index of refraction of water - typically left at 1.333. Changing this value can increase/decrease the size of the Snell's window" },
@@ -112,16 +107,6 @@ namespace WaveHarmonic.Crest.Editor
{ "_Crest_FoamIntensityAlbedo", "Scale intensity of diffuse lighting" },
{ "_Crest_FoamSmoothness", "Smoothness of foam material" },
{ "_Crest_FoamNormalStrength", "Strength of the generated normals" },
{ "_Crest_FoamBioluminescenceEnabled", "Enables a foam-based bioluminescence. This reuses the foam sample" },
{ "_Crest_FoamBioluminescenceColor", "The color and intensity of the bioluminescence" },
{ "_Crest_FoamBioluminescenceIntensity", "The intensity of the bioluminescent foam" },
{ "_Crest_FoamBioluminescenceMaximumDepth", "The maximum water depth where bioluminescence can appear. This can be used to keep bioluminescence localized to the shoreline" },
{ "_Crest_FoamBioluminescenceSeaLevelOnly", "Only render foam bioluminescence at sea level. This will fade bioluminescence to be fully gone at 1m from sea level." },
{ "_Crest_FoamBioluminescenceGlowIntensity", "The intensity of the bioluminescent glow" },
{ "_Crest_FoamBioluminescenceGlowCoverage", "The coverage of the bioluminescent glow. Glow is based on raw foam data which makes it more present than foam" },
{ "_Crest_FoamBioluminescenceSparklesEnabled", "Whether to apply bioluminescent sparkles. This uses the green channel of the foam texture as an emissive map" },
{ "_Crest_FoamBioluminescenceSparklesIntensity", "The intensity of the bioluminescent sparkles" },
{ "_Crest_FoamBioluminescenceSparklesCoverage", "The coverage of the bioluminescent sparkles. Sparkles placement is based on raw foam data which makes it more present than foam" },
{ "_Crest_CausticsEnabled", "Approximate rays being focused/defocused on underwater surfaces" },
{ "_Crest_CausticsTexture", "Caustics texture" },
{ "_Crest_CausticsStrength", "Intensity of caustics effect" },
@@ -130,15 +115,13 @@ namespace WaveHarmonic.Crest.Editor
{ "_Crest_CausticsTextureAverage", "The 'mid' value of the caustics texture, around which the caustic texture values are scaled. Decreasing this value will reduce the caustics darkening underwater surfaces" },
{ "_Crest_CausticsFocalDepth", "The depth at which the caustics are in focus" },
{ "_Crest_CausticsDepthOfField", "The range of depths over which the caustics are in focus" },
{ "_Crest_CausticsForceDistortion", "Forces the distortion texture to be applied for above water. This can be used to distort caustics even when there is no waves" },
{ "_Crest_CausticsDistortionTexture", "Texture to distort caustics. Only applicable to underwater effect for now" },
{ "_Crest_CausticsDistortionStrength", "How much the caustics texture is distorted" },
{ "_Crest_CausticsDistortionScale", "The scale of the distortion pattern used to distort the caustics" },
{ "_Crest_CausticsMotionBlur", "How much caustics are blurred when advected by flow" },
{ "_CREST_FLOW_LOD", "Flow is horizontal motion of water. Flow must be enabled on the Water Renderer to generate flow data" },
{ "CREST_FLOW", "Flow is horizontal motion of water. Flow must be enabled on the Water Renderer to generate flow data" },
{ "_Crest_AlbedoEnabled", "Enable the Albedo simulation layer. Albedo must be enabled on the Water" },
{ "_Crest_AlbedoIgnoreFoam", "Whether Albedo renders over the top of foam or not." },
{ "_Crest_TransparencyMinimumAlpha", "The minimum alpha value for transparency. Makes water contribution to the final image stronger instead of the scene behind it" },
}
},
};

View File

@@ -1,238 +0,0 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
using UnityEditor;
using UnityEngine;
using WaveHarmonic.Crest.Editor.Settings;
namespace WaveHarmonic.Crest.Editor
{
static partial class MaterialUpgrader
{
[InitializeOnLoadMethod]
static void OnLoad()
{
EditorApplication.update += OnEditorUpdate;
}
static void OnEditorUpdate()
{
if (Time.renderedFrameCount <= 0)
{
return;
}
if (EditorApplication.isUpdating)
{
return;
}
if (ProjectSettings.Instance._MaterialVersion > 0)
{
EditorApplication.update -= OnEditorUpdate;
return;
}
UpgradeMaterials(force: false);
EditorApplication.update -= OnEditorUpdate;
}
[MenuItem("Edit/Crest/Materials/Upgrade Materials")]
static void OnMenuSelect()
{
UpgradeMaterials(force: true);
}
static void UpgradeMaterials(bool force)
{
var dirty = false;
var version = force ? 0 : ProjectSettings.Instance._MaterialVersion;
AssetDatabase.StartAssetEditing();
try
{
foreach (var guid in AssetDatabase.FindAssets("t:Material"))
{
var material = AssetDatabase.LoadAssetAtPath<Material>(AssetDatabase.GUIDToAssetPath(guid));
dirty |= UpgradeMaterial(material, version);
}
ProjectSettings.Instance._MaterialVersion = k_MaterialVersion;
ProjectSettings.Save();
if (dirty)
{
AssetDatabase.SaveAssets();
}
}
finally
{
AssetDatabase.StopAssetEditing();
}
}
}
static partial class MaterialUpgrader
{
enum SerializedType
{
Boolean,
Integer,
Float,
Vector,
Color,
Texture,
Keyword,
}
static bool TryFindBase(SerializedObject material, SerializedType type, out SerializedProperty propertyBase)
{
propertyBase = material.FindProperty("m_SavedProperties");
switch (type)
{
case SerializedType.Integer:
propertyBase = propertyBase.FindPropertyRelative("m_Ints");
return true;
case SerializedType.Boolean:
case SerializedType.Float:
propertyBase = propertyBase.FindPropertyRelative("m_Floats");
return true;
case SerializedType.Color:
case SerializedType.Vector:
propertyBase = propertyBase.FindPropertyRelative("m_Colors");
return true;
case SerializedType.Texture:
propertyBase = propertyBase.FindPropertyRelative("m_TexEnvs");
return true;
}
return false;
}
static SerializedProperty FindBase(SerializedObject material, SerializedType type)
{
if (!TryFindBase(material, type, out var root))
{
throw new System.ArgumentException($"Unknown SerializedType {type}");
}
return root;
}
static bool TryFindProperty(SerializedObject material, string name, SerializedType type, out SerializedProperty property, out int index, SerializedProperty root)
{
var isKeyword = type == SerializedType.Keyword;
property = null;
var size = root.arraySize;
for (index = 0; index < size; ++index)
{
property = root.GetArrayElementAtIndex(index);
if (isKeyword ? property.stringValue == name : property.FindPropertyRelative("first").stringValue == name)
{
break;
}
}
if (index == size)
{
return false;
}
if (!isKeyword)
{
property = property.FindPropertyRelative("second");
}
return true;
}
static bool TryFindProperty(SerializedObject material, string name, SerializedType type, out SerializedProperty property, out int index, out SerializedProperty root)
{
if (type == SerializedType.Keyword)
{
root = material.FindProperty("m_ValidKeywords");
if (TryFindProperty(material, name, type, out property, out index, root))
{
return true;
}
root = material.FindProperty("m_InvalidKeywords");
if (TryFindProperty(material, name, type, out property, out index, root))
{
return true;
}
return false;
}
root = FindBase(material, type);
return TryFindProperty(material, name, type, out property, out index, root);
}
static bool RenameFloat(SerializedObject so, Material material, string old, string @new)
{
if (!TryFindProperty(so, old, SerializedType.Float, out var oldProperty, out var oldIndex, out var parent))
{
return false;
}
var oldValue = oldProperty.floatValue;
parent.DeleteArrayElementAtIndex(oldIndex);
parent.InsertArrayElementAtIndex(0);
var newProperty = parent.GetArrayElementAtIndex(0);
newProperty.FindPropertyRelative("first").stringValue = @new;
newProperty.FindPropertyRelative("second").floatValue = oldValue;
return true;
}
static bool RenameKeyword(SerializedObject so, Material material, string old, string @new)
{
if (!TryFindProperty(so, old, SerializedType.Keyword, out var oldProperty, out var oldIndex, out var parent))
{
return false;
}
parent.DeleteArrayElementAtIndex(oldIndex);
parent.InsertArrayElementAtIndex(0);
var keyword = parent.GetArrayElementAtIndex(0);
keyword.stringValue = @new;
return true;
}
}
// Upgrades
static partial class MaterialUpgrader
{
public const int k_MaterialVersion = 1;
static bool UpgradeMaterial(Material material, int version)
{
var so = new SerializedObject(material);
var dirty = false;
// Upgrade materials.
// Version is for all materials.
if (version < 1)
{
switch (material.shader.name)
{
case "Crest/Water":
dirty |= RenameKeyword(so, material, "CREST_FLOW_ON", "_CREST_FLOW_LOD");
dirty |= RenameFloat(so, material, "CREST_FLOW", "_CREST_FLOW_LOD");
break;
}
}
if (dirty)
{
so.ApplyModifiedPropertiesWithoutUndo();
EditorUtility.SetDirty(material);
}
return dirty;
}
}
}

View File

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

View File

@@ -2,7 +2,6 @@
// Copyright © 2024 Wave Harmonic. All rights reserved.
using System.Collections.Generic;
using WaveHarmonic.Crest.Editor.Settings;
namespace WaveHarmonic.Crest.Editor
{
@@ -30,21 +29,6 @@ namespace WaveHarmonic.Crest.Editor
_ => throw new System.NotImplementedException(),
};
internal bool GetProjectSettingToggle() => PropertyName switch
{
nameof(WaterRenderer._AbsorptionLod) => ProjectSettings.Instance.CurrentPlatformSettings.AbsorptionSimulation,
nameof(WaterRenderer._AlbedoLod) => ProjectSettings.Instance.CurrentPlatformSettings.AlbedoSimulation,
nameof(WaterRenderer._AnimatedWavesLod) => true,
nameof(WaterRenderer._ClipLod) => true,
nameof(WaterRenderer._DepthLod) => true,
nameof(WaterRenderer._DynamicWavesLod) => true,
nameof(WaterRenderer._FlowLod) => true,
nameof(WaterRenderer._FoamLod) => true,
nameof(WaterRenderer._LevelLod) => true,
nameof(WaterRenderer._ScatteringLod) => ProjectSettings.Instance.CurrentPlatformSettings.ScatteringSimulation,
nameof(WaterRenderer._ShadowLod) => ProjectSettings.Instance.CurrentPlatformSettings.ShadowSimulation,
_ => throw new System.NotImplementedException(),
};
// Optional. Not all simulations will have a corresponding keyword.
internal bool HasMaterialToggle => !string.IsNullOrEmpty(MaterialProperty);
@@ -52,7 +36,7 @@ namespace WaveHarmonic.Crest.Editor
// Needed as clip surface material toggle is Alpha Clipping.
internal virtual string MaterialProperty => _MaterialProperty;
internal virtual string MaterialPropertyPath => $"{PropertyLabel} > Enabled";
internal virtual string MaterialKeyword => MaterialProperty;
internal virtual string MaterialKeyword => $"{MaterialProperty}_ON";
internal static OptionalLod Get(System.Type type)
{
@@ -110,7 +94,7 @@ namespace WaveHarmonic.Crest.Editor
{
PropertyLabel = "Flow",
PropertyName = nameof(WaterRenderer._FlowLod),
_MaterialProperty = "_CREST_FLOW_LOD",
_MaterialProperty = "CREST_FLOW",
}
},
{
@@ -126,7 +110,9 @@ namespace WaveHarmonic.Crest.Editor
{
PropertyLabel = "Water Level",
PropertyName = nameof(WaterRenderer._LevelLod),
_MaterialProperty = "_Crest_LevelEnabled",
Dependency = typeof(AnimatedWavesLod),
}
},
{
@@ -167,13 +153,7 @@ namespace WaveHarmonic.Crest.Editor
// BIRP SG has prefixes for Unity properties but other RPs do not. These prefixes
// are for serialisation only and are not used in the shader.
internal override string MaterialPropertyPath => "Alpha Clipping";
internal override string MaterialProperty => RenderPipelineHelper.RenderPipeline switch
{
RenderPipeline.Legacy => "_BUILTIN_AlphaClip",
RenderPipeline.HighDefinition => "_AlphaCutoffEnable",
RenderPipeline.Universal => "_AlphaClip",
_ => throw new System.NotImplementedException(),
};
internal override string MaterialProperty => (RenderPipelineHelper.IsLegacy ? "_BUILTIN" : "") + "_AlphaClip";
internal override string MaterialKeyword => (RenderPipelineHelper.IsLegacy ? "_BUILTIN" : "") + "_ALPHATEST_ON";
}

View File

@@ -57,10 +57,10 @@ namespace WaveHarmonic.Crest.Editor
public override void OnPreviewGUI(Rect rect, GUIStyle background)
{
var texture = (RenderTexture)OriginalTexture;
var texture = Lod.DataTexture;
var descriptor = texture.descriptor;
_TemporaryTexture = RenderTexture.GetTemporary(descriptor);
_TemporaryTexture.name = texture.name;
_TemporaryTexture.name = "Crest Preview (Temporary)";
Graphics.CopyTexture(texture, _TemporaryTexture);
if (VisualizeNegatives)
@@ -80,16 +80,15 @@ namespace WaveHarmonic.Crest.Editor
if (ForceAlpha)
{
// Set alpha to one otherwise it shows nothing when set to RGB.
if (WaterResources.Instance.Compute._Clear != null)
var clear = WaterResources.Instance.Compute._Clear;
if (clear != null)
{
var compute = WaterResources.Instance._ComputeLibrary._ClearCompute;
var wrapper = new PropertyWrapperComputeStandalone(compute._Shader, compute._KernelClearTarget);
compute.SetVariantForFormat(wrapper, _TemporaryTexture.graphicsFormat);
wrapper.SetTexture(ShaderIDs.s_Target, _TemporaryTexture);
wrapper.SetVector(ShaderIDs.s_ClearMask, Color.black);
wrapper.SetVector(ShaderIDs.s_ClearColor, Color.black);
wrapper.Dispatch
clear.SetTexture(0, ShaderIDs.s_Target, _TemporaryTexture);
clear.SetVector(ShaderIDs.s_ClearMask, Color.black);
clear.SetVector(ShaderIDs.s_ClearColor, Color.black);
clear.Dispatch
(
0,
Lod.Resolution / Lod.k_ThreadGroupSizeX,
Lod.Resolution / Lod.k_ThreadGroupSizeY,
Lod.Slices
@@ -291,16 +290,7 @@ namespace WaveHarmonic.Crest.Editor
public override GUIContent GetPreviewTitle() => new("Water Reflections");
protected override Texture OriginalTexture => (target as WaterRenderer)._Reflections._Enabled
? (target as WaterRenderer)._Reflections.ColorTexture
? (target as WaterRenderer)._Reflections.ReflectionTexture
: s_DefaultReflection?.GetValue(null) as Texture;
}
#if CREST_DEBUG
[CustomPreview(typeof(WaterRenderer))]
sealed class ReflectionDepthPreview : TexturePreview
{
public override GUIContent GetPreviewTitle() => new("Water Reflections (Depth)");
protected override Texture OriginalTexture => (target as WaterRenderer)._Reflections.DepthTexture;
}
#endif
}

View File

@@ -10,134 +10,14 @@ using UnityEngine.UIElements;
namespace WaveHarmonic.Crest.Editor.Settings
{
[System.Serializable]
class PlatformSettings
{
const string k_OverrideTooltip = "Override the feature for this platform";
[HideInInspector]
[SerializeField]
internal bool _Default;
[@Heading("Simulations", alwaysVisible: true)]
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideAlbedoSimulation;
[@Label("Albedo")]
[@DecoratedField]
[SerializeField]
internal bool _AlbedoSimulation = true;
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideAbsorptionSimulation;
[@Label("Absorption")]
[@DecoratedField]
[SerializeField]
internal bool _AbsorptionSimulation = true;
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideScatteringSimulation;
[@Label("Scattering")]
[@DecoratedField]
[SerializeField]
internal bool _ScatteringSimulation = true;
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideShadowSimulation;
[@Label("Shadow")]
[@DecoratedField]
[SerializeField]
internal bool _ShadowSimulation = true;
[@Heading("Surface Material", alwaysVisible: true)]
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideNormalMaps;
[@DecoratedField]
[SerializeField]
internal bool _NormalMaps = true;
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverridePlanarReflections;
[@DecoratedField]
[SerializeField]
internal bool _PlanarReflections = true;
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideFoamBioluminescence;
[@DecoratedField]
[SerializeField]
internal bool _FoamBioluminescence = true;
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideCausticsForceDistortion;
[@DecoratedField]
[SerializeField]
internal bool _CausticsForceDistortion = true;
[@Heading("Rendering", alwaysVisible: true)]
[Tooltip(k_OverrideTooltip)]
[@Predicated(nameof(_Default), inverted: true, hide: true)]
[@InlineToggle]
[SerializeField]
internal bool _OverrideSimpleTransparency;
[@DecoratedField]
[SerializeField]
internal bool _SimpleTransparency;
PlatformSettings Default => ProjectSettings.Instance._PlatformSettings;
public bool AlbedoSimulation => _Default || _OverrideAlbedoSimulation ? _AlbedoSimulation : Default.AlbedoSimulation;
public bool AbsorptionSimulation => _Default || _OverrideAbsorptionSimulation ? _AbsorptionSimulation : Default.AbsorptionSimulation;
public bool ScatteringSimulation => _Default || _OverrideScatteringSimulation ? _ScatteringSimulation : Default.ScatteringSimulation;
public bool ShadowSimulation => _Default || _OverrideShadowSimulation ? _ShadowSimulation : Default.ShadowSimulation;
public bool NormalMaps => _Default || _OverrideNormalMaps ? _NormalMaps : Default.NormalMaps;
public bool PlanarReflections => _Default || _OverridePlanarReflections ? _PlanarReflections : Default.PlanarReflections;
public bool FoamBioluminescence => _Default || _OverrideFoamBioluminescence ? _FoamBioluminescence : Default.FoamBioluminescence;
public bool CausticsForceDistortion => _Default || _OverrideCausticsForceDistortion ? _CausticsForceDistortion : Default.CausticsForceDistortion;
public bool SimpleTransparency => _Default || _OverrideSimpleTransparency ? _SimpleTransparency : Default.SimpleTransparency;
}
[FilePath(k_Path, FilePathAttribute.Location.ProjectFolder)]
sealed partial class ProjectSettings : ScriptableSingleton<ProjectSettings>
sealed class ProjectSettings : ScriptableSingleton<ProjectSettings>
{
[SerializeField, HideInInspector]
#pragma warning disable 414
int _Version = 0;
#pragma warning restore 414
#pragma warning disable IDE0032 // Use auto property
[@Heading("Variant Stripping", Heading.Style.Settings)]
@@ -171,86 +51,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
[@DecoratedField, SerializeField]
bool _LegacyUnderwater;
[@Space(10)]
[@PlatformTabs]
[SerializeField]
internal int _Platforms;
[@Label("Overriden Settings for Windows, Mac and Linux")]
[@Predicated(nameof(_Platforms), inverted: true, (int)BuildTargetGroup.Standalone, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsDesktop = new();
[@Label("Overriden Settings for Dedicated Server")]
[@Predicated(nameof(_Platforms), inverted: true, -2, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsServer = new();
[@Label("Overriden Settings for Android")]
[@Predicated(nameof(_Platforms), inverted: true, (int)BuildTargetGroup.Android, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsAndroid = new();
[@Label("Overriden Settings for iOS")]
[@Predicated(nameof(_Platforms), inverted: true, (int)BuildTargetGroup.iOS, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsIOS = new();
[@Label("Overriden Settings for tvOS")]
[@Predicated(nameof(_Platforms), inverted: true, (int)BuildTargetGroup.tvOS, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsTVOS = new();
[@Label("Overriden Settings for visionOS")]
[@Predicated(nameof(_Platforms), inverted: true, (int)BuildTargetGroup.VisionOS, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsVisionOS = new();
// Web has hard limitations on number of sampled textures. Set defaults with that
// in mind so the surface renders.
[@Label("Overriden Settings for Web")]
[@Predicated(nameof(_Platforms), inverted: true, (int)BuildTargetGroup.WebGL, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettingsWeb = new()
{
_OverrideAbsorptionSimulation = true,
_AbsorptionSimulation = false,
_OverrideAlbedoSimulation = true,
_AlbedoSimulation = false,
_OverrideScatteringSimulation = true,
_ScatteringSimulation = false,
_OverrideShadowSimulation = true,
_ShadowSimulation = false,
_OverrideCausticsForceDistortion = true,
_CausticsForceDistortion = false,
_OverridePlanarReflections = true,
_PlanarReflections = false,
_OverrideFoamBioluminescence = true,
_FoamBioluminescence = false,
};
// This will show if nothing else shows.
[@Label("Default Settings")]
[@Predicated(nameof(_Platforms), inverted: false, (int)BuildTargetGroup.Standalone, hide: true)]
[@Predicated(nameof(_Platforms), inverted: false, Reflected.BuildTargetGroup.k_Server, hide: true)]
[@Predicated(nameof(_Platforms), inverted: false, (int)BuildTargetGroup.Android, hide: true)]
[@Predicated(nameof(_Platforms), inverted: false, (int)BuildTargetGroup.iOS, hide: true)]
[@Predicated(nameof(_Platforms), inverted: false, (int)BuildTargetGroup.WebGL, hide: true)]
[@Predicated(nameof(_Platforms), inverted: false, (int)BuildTargetGroup.tvOS, hide: true)]
[@Predicated(nameof(_Platforms), inverted: false, (int)BuildTargetGroup.VisionOS, hide: true)]
[@Stripped(Stripped.Style.PlatformTab, indent: true)]
[SerializeField]
internal PlatformSettings _PlatformSettings = new() { _Default = true };
#pragma warning restore IDE0032 // Use auto property
internal const string k_Path = "ProjectSettings/Packages/com.waveharmonic.crest/Settings.asset";
@@ -272,24 +72,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
internal bool RenderAtmosphericScatteringWhenUnderWater => _RenderAtmosphericScatteringWhenUnderWater;
internal bool LegacyUnderwater => _LegacyUnderwater;
internal PlatformSettings CurrentPlatformSettings =>
#if PLATFORM_STANDALONE
_PlatformSettingsDesktop;
#elif PLATFORM_SERVER
_PlatformSettingsServer;
#elif PLATFORM_ANDROID
_PlatformSettingsAndroid;
#elif PLATFORM_IOS
_PlatformSettingsIOS;
#elif PLATFORM_TVOS
_PlatformSettingsTVOS;
#elif PLATFORM_VISIONOS
_PlatformSettingsVisionOS;
#else
_PlatformSettings;
#endif
internal bool _IsPlatformTabChange;
void OnEnable()
{
@@ -306,14 +88,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
[@OnChange(skipIfInactive: false)]
void OnChange(string path, object previous)
{
_IsPlatformTabChange = path == nameof(_Platforms);
if (path.StartsWithNoAlloc("_PlatformSettings"))
{
UpdateSymbols();
return;
}
switch (path)
{
case nameof(_FullPrecisionDisplacementOnHalfPrecisionPlatforms):
@@ -327,7 +101,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
void UpdateScriptingSymbols()
{
ScriptingSymbols.Set(ProjectSymbols.k_LegacyUnderwaterScriptingSymbol, _LegacyUnderwater);
ScriptingSymbols.Set(ProjectSymbols.k_SimpleTransparencyScriptingSymbol, CurrentPlatformSettings.SimpleTransparency);
}
void UpdateSymbols()
@@ -339,7 +112,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
sealed class ProjectSymbols : AssetModificationProcessor
{
public const string k_LegacyUnderwaterScriptingSymbol = "d_Crest_LegacyUnderwater";
public const string k_SimpleTransparencyScriptingSymbol = "d_Crest_SimpleTransparency";
static FileSystemWatcher s_Watcher;
@@ -370,11 +142,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
{
EditorApplication.delayCall += () =>
{
if (ProjectSettings.Instance != null && ProjectSettings.Instance._IsPlatformTabChange)
{
return;
}
// Destroy instance to reflect changes.
Helpers.Destroy(Instance);
typeof(ScriptableSingleton<ProjectSettings>)
@@ -453,17 +220,31 @@ namespace WaveHarmonic.Crest.Editor.Settings
return;
}
// Reset foldout values.
DecoratedDrawer.s_IsFoldout = false;
DecoratedDrawer.s_IsFoldoutOpen = false;
EditorGUI.BeginChangeCheck();
// Pad similar to settings header.
var style = new GUIStyle();
style.padding.left = 8;
EditorGUILayout.BeginVertical(style);
// Same label with as other settings.
EditorGUIUtility.labelWidth = 251;
EditorGUI.BeginChangeCheck();
EditorGUILayout.BeginVertical(style);
_Editor.OnInspectorGUI();
EditorGUILayout.EndVertical();
// Commit all changes. Normally settings are written when user hits save or exits
// without any undo/redo entry and dirty state. No idea how to do the same.
// SaveChanges and hasUnsavedChanges on custom editor did not work.
// Not sure if hooking into EditorSceneManager.sceneSaving is correct.
if (EditorGUI.EndChangeCheck())
{
ProjectSettings.Save();
}
GUILayout.Space(10 * 2);
@@ -475,8 +256,6 @@ namespace WaveHarmonic.Crest.Editor.Settings
AssetDatabase.ImportAsset(path);
}
}
EditorGUILayout.EndVertical();
}
[SettingsProvider]
@@ -493,43 +272,4 @@ namespace WaveHarmonic.Crest.Editor.Settings
return null;
}
}
[CustomEditor(typeof(ProjectSettings))]
class ProjectSettingsEditor : Inspector
{
protected override void OnChange()
{
base.OnChange();
// Commit all changes. Normally settings are written when user hits save or exits
// without any undo/redo entry and dirty state. No idea how to do the same.
// SaveChanges and hasUnsavedChanges on custom editor did not work.
// Not sure if hooking into EditorSceneManager.sceneSaving is correct.
ProjectSettings.Save();
}
}
partial class ProjectSettings : ISerializationCallbackReceiver
{
[SerializeField, HideInInspector]
int _Version = 0;
[SerializeField, HideInInspector]
internal int _MaterialVersion = MaterialUpgrader.k_MaterialVersion;
public void OnAfterDeserialize()
{
if (_Version == 0)
{
_MaterialVersion = 0;
}
_Version = 1;
}
public void OnBeforeSerialize()
{
}
}
}

View File

@@ -14,22 +14,22 @@
"versionDefines": [
{
"name": "com.waveharmonic.crest.cpu-queries",
"expression": "(,1.0.9)",
"expression": "(,1.0.8)",
"define": "d_UpdateCPUQueries"
},
{
"name": "com.waveharmonic.crest.paint",
"expression": "(,1.3.0)",
"expression": "(,1.2.3)",
"define": "d_UpdatePaint"
},
{
"name": "com.waveharmonic.crest.portals",
"expression": "(,1.2.9)",
"expression": "(,1.2.8)",
"define": "d_UpdatePortals"
},
{
"name": "com.waveharmonic.crest.shallow-water",
"expression": "(,1.4.0)",
"expression": "(,1.3.3)",
"define": "d_UpdateShallowWater"
},
{
@@ -39,12 +39,12 @@
},
{
"name": "com.waveharmonic.crest.splines",
"expression": "(,1.5.0)",
"expression": "(,1.4.4)",
"define": "d_UpdateSplines"
},
{
"name": "com.waveharmonic.crest.whirlpool",
"expression": "(,1.1.0)",
"expression": "(,1.0.3)",
"define": "d_UpdateWhirlpool"
}
],

View File

@@ -94,7 +94,7 @@ namespace WaveHarmonic.Crest.Editor
}
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest")]
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest")]
sealed class ShaderSettings
{
// These two are here for compute shaders.
@@ -126,191 +126,10 @@ namespace WaveHarmonic.Crest.Editor
#endif
;
// Active when build target is activated:
// https://docs.unity3d.com/6000.3/Documentation/Manual/scripting-symbol-reference.html
public static int s_CrestPlatformStandalone =
#if PLATFORM_STANDALONE
1 +
#endif
0;
public static int s_CrestPlatformServer =
#if PLATFORM_SERVER
1 +
#endif
0;
public static int s_CrestPlatformAndroid =
#if PLATFORM_ANDROID
1 +
#endif
0;
public static int s_CrestPlatformIOS =
#if PLATFORM_IOS
1 +
#endif
0;
public static int s_CrestPlatformWeb =
#if PLATFORM_WEBGL
1 +
#endif
0;
public static int s_CrestPlatformTVOS =
#if PLATFORM_TVOS
1 +
#endif
0;
public static int s_CrestPlatformVISIONOS =
#if PLATFORM_VISIONOS
1 +
#endif
0;
public static int s_CrestFullPrecisionDisplacement = ProjectSettings.Instance.FullPrecisionDisplacementOnHalfPrecisionPlatforms ? 1 : 0;
public static int s_CrestDiscardAtmosphericScattering = ProjectSettings.Instance.RenderAtmosphericScatteringWhenUnderWater ? 0 : 1;
public static int s_CrestLegacyUnderwater = ProjectSettings.Instance.LegacyUnderwater ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default")]
sealed class ShaderSettingsDefault
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettings;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone")]
sealed class ShaderSettingsStandalone
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsDesktop;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server")]
sealed class ShaderSettingsServer
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsServer;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android")]
sealed class ShaderSettingsAndroid
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsAndroid;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS")]
sealed class ShaderSettingsIOS
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsIOS;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web")]
sealed class ShaderSettingsWeb
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsWeb;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS")]
sealed class ShaderSettingsTVOS
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsTVOS;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS")]
sealed class ShaderSettingsVisionOS
{
static PlatformSettings Settings => ProjectSettings.Instance._PlatformSettingsVisionOS;
public static int s_CrestAlbedoSimulation = Settings.AlbedoSimulation ? 1 : 0;
public static int s_CrestAbsorptionSimulation = Settings.AbsorptionSimulation ? 1 : 0;
public static int s_CrestScatteringSimulation = Settings.ScatteringSimulation ? 1 : 0;
public static int s_CrestShadowSimulation = Settings.ShadowSimulation ? 1 : 0;
public static int s_CrestCausticsForceDistortion = Settings.CausticsForceDistortion ? 1 : 0;
public static int s_CrestFoamBioluminescence = Settings.FoamBioluminescence ? 1 : 0;
public static int s_CrestNormalMaps = Settings.NormalMaps ? 1 : 0;
public static int s_CrestSimpleTransparency = Settings.SimpleTransparency ? 1 : 0;
public static int s_CrestPlanarReflections = Settings.PlanarReflections ? 1 : 0;
}
}

View File

@@ -147,21 +147,6 @@ namespace WaveHarmonic.Crest
/// </summary>
sealed class Stripped : DecoratedProperty
{
public enum Style
{
None,
PlatformTab,
}
readonly bool _KeepIndent;
readonly Style _Style;
public Stripped(Style style = Style.None, bool indent = false)
{
_KeepIndent = indent;
_Style = style;
}
internal override bool NeedsControlRectangle(SerializedProperty property) => false;
internal override void OnGUI(Rect position, SerializedProperty property, GUIContent label, DecoratedDrawer drawer)
@@ -170,33 +155,11 @@ namespace WaveHarmonic.Crest
DecoratedDrawer.s_TemporaryColor = true;
DecoratedDrawer.s_PreviousColor = GUI.color;
if (_Style == Style.PlatformTab)
{
EditorGUI.indentLevel += 1;
EditorGUILayout.LabelField(label);
EditorGUI.indentLevel -= 1;
}
GUI.color = new(0, 0, 0, 0);
if (!_KeepIndent) EditorGUI.indentLevel -= 1;
EditorGUI.indentLevel -= 1;
EditorGUI.PropertyField(position, property, label, true);
if (!_KeepIndent) EditorGUI.indentLevel += 1;
if (_Style == Style.PlatformTab)
{
EditorGUILayout.Space(4);
EditorGUILayout.EndBuildTargetSelectionGrouping();
}
}
}
sealed class PlatformTabs : DecoratedProperty
{
static readonly GUIContent s_DefaultTab = new(EditorGUIUtility.IconContent("d_Settings").image, "Default");
internal override void OnGUI(Rect position, SerializedProperty property, GUIContent label, DecoratedDrawer drawer)
{
property.intValue = Editor.Reflected.EditorGUILayout.BeginBuildTargetSelectionGrouping(s_DefaultTab);
EditorGUI.indentLevel += 1;
}
}
@@ -658,15 +621,29 @@ namespace WaveHarmonic.Crest
sealed class InlineToggle : DecoratedProperty
{
// Add extra y offset. Needed for foldouts in foldouts so far.
readonly bool _Fix;
public InlineToggle(bool fix = false)
{
_Fix = fix;
}
internal override bool NeedsControlRectangle(SerializedProperty property)
{
return false;
}
internal override void OnGUI(Rect position, SerializedProperty property, GUIContent label, DecoratedDrawer drawer)
{
var r = position;
r.x -= 16f;
// Prevent click events blocking next property.
// Align with Space offset.
if (drawer.Space > 0) r.y += drawer.Space + 2f;
if (_Fix) r.y += EditorGUIUtility.singleLineHeight + 2f;
// Seems to be needed.
r.width = 16f * (1f + EditorGUI.indentLevel);
// Hide text.
r.height = EditorGUIUtility.singleLineHeight;
label.text = "";
using (new EditorGUI.PropertyScope(r, label, property))
@@ -677,9 +654,6 @@ namespace WaveHarmonic.Crest
property.boolValue = EditorGUI.Toggle(r, property.boolValue);
EditorGUI.EndProperty();
}
// Pull up next property. Extra space might be margin/padding.
GUILayout.Space(-(EditorGUIUtility.singleLineHeight + 2f));
}
}

View File

@@ -11,7 +11,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Events;
using WaveHarmonic.Crest.Attributes;
@@ -24,29 +23,19 @@ namespace WaveHarmonic.Crest.Editor
internal static bool s_HideInInspector = false;
public static bool s_IsFoldout = false;
public static bool s_IsFoldoutOpen = false;
public static bool s_IsList = false;
public static bool s_TemporaryColor;
public static Color s_PreviousColor;
// If instantiating ourselves. Avoids reflection.
public PropertyAttribute _Attribute;
public FieldInfo _Field;
PropertyAttribute Attribute => _Attribute ?? attribute;
FieldInfo Field => _Field ?? fieldInfo;
public float Space { get; private set; }
UnityEditor.Editor _Editor;
Inspector _Inspector;
List<object> _Decorators = null;
List<object> Decorators
{
get
{
// Populate list with decorators.
_Decorators ??= Field
_Decorators ??= fieldInfo
.GetCustomAttributes(typeof(Decorator), false)
.ToList();
@@ -55,7 +44,7 @@ namespace WaveHarmonic.Crest.Editor
}
List<Attributes.Validator> _Validators = null;
List<Attributes.Validator> Validators => _Validators ??= Field
List<Attributes.Validator> Validators => _Validators ??= fieldInfo
.GetCustomAttributes(typeof(Attributes.Validator), false)
.Cast<Attributes.Validator>()
.ToList();
@@ -74,39 +63,14 @@ namespace WaveHarmonic.Crest.Editor
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
var height = base.GetPropertyHeight(property, label);
if (property.isArray)
{
// Constructor caches value and this call retrieves it.
var list = ReorderableList.GetReorderableListFromSerializedProperty(property);
list ??= new ReorderableList(property.serializedObject, property);
// GetHeight does not include bottom buttons height.
height = property.isExpanded ? list.GetHeight() + list.footerHeight : height;
}
// Make original control rectangle be invisible because we always create our own. Zero still adds a little
// height which becomes noticeable once multiple properties are hidden. This could be some GUI style
// property but could not find which one.
return s_IsList ? height : -2f;
return -2f;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// Get the owning editor.
if (_Editor == null)
{
foreach (var editor in ActiveEditorTracker.sharedTracker?.activeEditors)
{
if (editor.serializedObject == property.serializedObject)
{
_Editor = editor;
_Inspector = editor as Inspector;
break;
}
}
}
// Store the original GUI state so it can be reset later.
var originalColor = GUI.color;
var originalEnabled = GUI.enabled;
@@ -142,8 +106,8 @@ namespace WaveHarmonic.Crest.Editor
attribute.Decorate(position, property, label, this);
}
var a = (DecoratedProperty)Attribute;
position = a.NeedsControlRectangle(property) && (!s_IsList || property.isArray)
var a = (DecoratedProperty)attribute;
position = a.NeedsControlRectangle(property)
? EditorGUILayout.GetControlRect(true, EditorGUI.GetPropertyHeight(property, label, true))
: position;
@@ -156,15 +120,11 @@ namespace WaveHarmonic.Crest.Editor
label = attribute.BuildLabel(label);
}
var skipChange = Field.FieldType == typeof(UnityEvent) || property.isArray;
var isExpanded = property.isExpanded;
var isUndoRedo = false;
var skipChange = fieldInfo.FieldType == typeof(UnityEvent);
if (!skipChange)
{
EditorGUI.BeginChangeCheck();
isUndoRedo = _Inspector != null && _Inspector._UndoRedo;
}
var oldValue = skipChange ? null : property.boxedValue;
@@ -175,19 +135,13 @@ namespace WaveHarmonic.Crest.Editor
Validators[index].Validate(position, property, label, this, oldValue);
}
if (!skipChange && (EditorGUI.EndChangeCheck() || isUndoRedo))
// Guard against foldouts triggering change check due to changing isExpanded.
if (!skipChange && EditorGUI.EndChangeCheck() && oldValue != property.boxedValue)
{
// Apply any changes.
if (!isUndoRedo)
{
property.serializedObject.ApplyModifiedProperties();
}
property.serializedObject.ApplyModifiedProperties();
// Guard against foldouts triggering change check due to changing isExpanded.
if (property.isExpanded == isExpanded)
{
OnChange(property, oldValue);
}
OnChange(property, oldValue);
}
for (var index = 0; index < Decorators.Count; index++)
@@ -252,7 +206,6 @@ namespace WaveHarmonic.Crest.Editor
var relativePath = string.Join(".", chunks[(i + 1)..]);
var nestedTarget = nestedProperty.managedReferenceValue;
if (nestedTarget == null) continue;
var nestedTargetType = nestedTarget.GetType();
foreach (var (method, attribute) in OnChangeHandlers)

View File

@@ -294,13 +294,7 @@ namespace WaveHarmonic.Crest.Editor
width = Mathf.Max(width, minimumWidth);
// TODO: Add option to disable this (consistent width).
if (!hasDropDown && minimumWidth > 0) width += k_ButtonDropDownWidth;
// TODO: eyeballed based on Fix button but likely specific to it.
if (centerLabel && hasDropDown)
{
style.padding.left += k_ButtonDropDownWidth / 2;
width += k_ButtonDropDownWidth / 3;
}
if (centerLabel && hasDropDown) style.padding.left += k_ButtonDropDownWidth;
if (GUILayout.Button(label, style, expandWidth ? GUILayout.ExpandWidth(true) : GUILayout.Width(width)))
{

View File

@@ -9,7 +9,6 @@ using UnityEditor;
using UnityEngine;
using WaveHarmonic.Crest.Editor.Internal;
using WaveHarmonic.Crest.Internal;
using WaveHarmonic.Crest.Internal.Compatibility;
namespace WaveHarmonic.Crest.Editor
{
@@ -26,7 +25,6 @@ namespace WaveHarmonic.Crest.Editor
readonly Dictionary<FieldInfo, object> _MaterialOwners = new();
readonly Dictionary<Material, MaterialEditor> _MaterialEditors = new();
readonly Dictionary<string, DecoratedDrawer> _Lists = new();
public override bool RequiresConstantRepaint() => TexturePreview.s_ActiveInstance?.Open == true;
@@ -40,9 +38,6 @@ namespace WaveHarmonic.Crest.Editor
{
_MaterialOwners.Clear();
Undo.undoRedoPerformed -= OnUndoRedo;
Undo.undoRedoPerformed += OnUndoRedo;
foreach (var field in s_AttachMaterialEditors)
{
var target = (object)this.target;
@@ -79,19 +74,12 @@ namespace WaveHarmonic.Crest.Editor
protected virtual void OnDisable()
{
Undo.undoRedoPerformed -= OnUndoRedo;
foreach (var (_, editor) in _MaterialEditors)
{
Helpers.Destroy(editor);
}
}
protected virtual void OnChange()
{
}
protected virtual void RenderBeforeInspectorGUI()
{
if (this.target is EditorBehaviour target && target._IsPrefabStageInstance)
@@ -111,8 +99,6 @@ namespace WaveHarmonic.Crest.Editor
serializedObject.Update();
EditorGUI.BeginChangeCheck();
using var iterator = serializedObject.GetIterator();
if (iterator.NextVisible(true))
{
@@ -154,33 +140,6 @@ namespace WaveHarmonic.Crest.Editor
using (new EditorGUI.DisabledGroupScope(property.name == "m_Script"))
#endif
{
// Handle lists as PropertyDrawer is not called on the list itself.
if (property.isArray)
{
var field = property.GetFieldInfo(out var _);
var attribute = field?.GetCustomAttribute<Attributes.DecoratedProperty>();
if (field != null && attribute != null)
{
var id = GetPropertyIdentifier(property);
if (!_Lists.ContainsKey(id))
{
_Lists[id] = new DecoratedDrawer()
{
_Attribute = attribute,
_Field = field,
};
}
DecoratedDrawer.s_IsList = true;
var label = new GUIContent(property.displayName);
_Lists[id].OnGUI(Rect.zero, property, label);
DecoratedDrawer.s_IsList = false;
continue;
}
}
// Only support top level ordering for now.
EditorGUILayout.PropertyField(property, includeChildren: true);
}
@@ -189,18 +148,11 @@ namespace WaveHarmonic.Crest.Editor
// Need to call just in case there is no decorated property.
serializedObject.ApplyModifiedProperties();
if (EditorGUI.EndChangeCheck())
{
OnChange();
}
// Restore previous in case this is a nested editor.
Current = previous;
// Fixes indented validation etc.
EditorGUI.indentLevel = 0;
_UndoRedo = false;
}
protected virtual void RenderBottomButtons()
@@ -262,45 +214,6 @@ namespace WaveHarmonic.Crest.Editor
}
}
// Reflection
partial class Inspector
{
static readonly PropertyInfo s_GUIViewCurrent = typeof(UnityEditor.Editor).Assembly.GetType("UnityEditor.GUIView").GetProperty("current", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
static readonly PropertyInfo s_GUIViewNativeHandle = typeof(UnityEditor.Editor).Assembly.GetType("UnityEditor.GUIView").GetProperty("nativeHandle", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
// Adapted from:
// https://github.com/Unity-Technologies/UnityCsReference/blob/59b03b8a0f179c0b7e038178c90b6c80b340aa9f/Editor/Mono/Inspector/ReorderableListWrapper.cs#L77-L88
static string GetPropertyIdentifier(SerializedProperty serializedProperty)
{
// Property may be disposed.
try
{
var handle = -1;
var current = s_GUIViewCurrent.GetValue(null);
if (current != null)
{
handle = ((IntPtr)s_GUIViewNativeHandle.GetValue(current)).ToInt32();
}
return serializedProperty?.propertyPath + serializedProperty.serializedObject.targetObject.GetEntityId() + handle;
}
catch (NullReferenceException)
{
return string.Empty;
}
}
}
partial class Inspector
{
internal bool _UndoRedo;
void OnUndoRedo()
{
_UndoRedo = true;
}
}
// Adapted from:
// https://gist.github.com/thebeardphantom/1ad9aee0ef8de6271fff39f1a6a3d66d
static partial class Extensions

View File

@@ -1,106 +0,0 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor.Build;
using UnityEngine;
namespace WaveHarmonic.Crest.Editor.Reflected
{
static class BuildTargetGroup
{
public const int k_Server = -2;
}
static class BuildPlatform
{
internal static readonly Type s_BuildPlatformType = Type.GetType("UnityEditor.Build.BuildPlatform,UnityEditor.CoreModule");
internal static readonly Type s_BuildPlatformArrayType = s_BuildPlatformType.MakeArrayType();
static readonly FieldInfo s_NamedBuildTargetField = s_BuildPlatformType.GetField
(
"namedBuildTarget",
BindingFlags.Instance | BindingFlags.Public
);
public static NamedBuildTarget GetNamedBuildTarget(object platform)
{
return (NamedBuildTarget)s_NamedBuildTargetField.GetValue(platform);
}
}
static class BuildPlatforms
{
static readonly Type s_BuildPlatformsType = Type.GetType("UnityEditor.Build.BuildPlatforms,UnityEditor.CoreModule");
static readonly PropertyInfo s_BuildPlatformsInstanceProperty = s_BuildPlatformsType.GetProperty("instance", BindingFlags.Static | BindingFlags.Public);
static readonly MethodInfo s_GetValidPlatformsMethod = s_BuildPlatformsType.GetMethod("GetValidPlatforms", new Type[] { });
static Array s_Platforms; // Should be safe to cache.
public static Array GetValidPlatforms()
{
if (s_Platforms == null)
{
var instance = s_BuildPlatformsInstanceProperty.GetValue(null);
// We cannot just cast to the type we want it seems.
var enumerable = ((IEnumerable<object>)s_GetValidPlatformsMethod.Invoke(instance, null)).ToList();
s_Platforms = Array.CreateInstance(BuildPlatform.s_BuildPlatformType, enumerable.Count);
for (var i = 0; i < enumerable.Count; i++)
{
s_Platforms.SetValue(enumerable[i], i);
}
}
return s_Platforms;
}
}
static class EditorGUILayout
{
static readonly MethodInfo s_BeginPlatformGroupingMethod = typeof(UnityEditor.EditorGUILayout).GetMethod
(
"BeginPlatformGrouping",
BindingFlags.Static | BindingFlags.NonPublic,
null,
new Type[]
{
BuildPlatform.s_BuildPlatformArrayType,
typeof(GUIContent),
},
null
);
static readonly object[] s_Parameters = new object[2];
public static int BeginBuildTargetSelectionGrouping(GUIContent defaultTab)
{
var platforms = BuildPlatforms.GetValidPlatforms();
s_Parameters[0] = platforms;
s_Parameters[1] = defaultTab;
var index = (int)s_BeginPlatformGroupingMethod.Invoke(null, s_Parameters);
if (index < 0)
{
// Default
return (int)UnityEditor.BuildTargetGroup.Unknown;
}
var target = BuildPlatform.GetNamedBuildTarget(platforms.GetValue(index));
if (target == NamedBuildTarget.Server)
{
// Server
return BuildTargetGroup.k_Server;
}
return (int)target.ToBuildTargetGroup();
}
}
}

View File

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

View File

@@ -10,7 +10,7 @@ namespace WaveHarmonic.Crest.Editor.Settings
{
static class ScriptingSymbols
{
internal static NamedBuildTarget CurrentNamedBuildTarget
static NamedBuildTarget CurrentNamedBuildTarget
{
get
{

View File

@@ -10,10 +10,6 @@ namespace WaveHarmonic.Crest.Editor
{
abstract class TexturePreview : ObjectPreview
{
static readonly System.Reflection.MethodInfo s_DrawPreview = typeof(ObjectPreview).GetMethod("DrawPreview", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
static readonly object[] s_DrawPreviewArguments = new object[3];
static readonly Object[] s_DrawPreviewTargets = new Object[1];
public static TexturePreview s_ActiveInstance;
public bool Open { get; private set; }
@@ -105,9 +101,6 @@ namespace WaveHarmonic.Crest.Editor
Helpers.SafeCreateRenderTexture(ref _RenderTexture, descriptor);
_RenderTexture.Create();
Object.DestroyImmediate(_Editor);
// Raises both, but no way to avoid it:
// | The targets array should not be used inside OnSceneGUI or OnPreviewGUI. Use the single target property instead.
// | The serializedObject should not be used inside OnSceneGUI or OnPreviewGUI. Use the target property directly instead.
_Editor = UnityEditor.Editor.CreateEditor(_RenderTexture);
// Reset for incompatible copy.
descriptor = _OriginalDescriptor;
@@ -128,13 +121,7 @@ namespace WaveHarmonic.Crest.Editor
Graphics.CopyTexture(Texture, _RenderTexture);
}
s_DrawPreviewTargets[0] = _Editor.target;
s_DrawPreviewArguments[0] = _Editor;
s_DrawPreviewArguments[1] = rect;
s_DrawPreviewArguments[2] = s_DrawPreviewTargets;
// Use to be _Editor.DrawPreview(rect) but spammed errors with multiple selected.
s_DrawPreview?.Invoke(null, s_DrawPreviewArguments);
_Editor.DrawPreview(rect);
}
#if CREST_DEBUG

View File

@@ -9,7 +9,6 @@ using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using WaveHarmonic.Crest.Editor;
using WaveHarmonic.Crest.Internal;
namespace WaveHarmonic.Crest.Editor
@@ -55,9 +54,9 @@ namespace WaveHarmonic.Crest.Editor
new(),
};
public delegate void ShowMessage(string message, string fixDescription, MessageType type, Object @object = null, FixValidation action = null, string property = null, Object caller = null);
public delegate void ShowMessage(string message, string fixDescription, MessageType type, Object @object = null, FixValidation action = null, string property = null);
public static void DebugLog(string message, string fixDescription, MessageType type, Object @object = null, FixValidation action = null, string property = null, Object caller = null)
public static void DebugLog(string message, string fixDescription, MessageType type, Object @object = null, FixValidation action = null, string property = null)
{
// Never log info validation to console.
if (type == MessageType.Info)
@@ -65,27 +64,22 @@ namespace WaveHarmonic.Crest.Editor
return;
}
// Always link back to the caller so developers know the origin. They can always
// use the help box "Inspect" once there to get to the object to fix. Even better,
// they can use any available fix buttons too.
var context = caller != null ? caller : @object;
message = $"<b>Crest Validation:</b> {message} {fixDescription} Click this message to highlight the problem object.";
message = $"Crest Validation: {message} {fixDescription} Click this message to highlight the problem object.";
switch (type)
{
case MessageType.Error: Debug.LogError(message, context); break;
case MessageType.Warning: Debug.LogWarning(message, context); break;
default: Debug.Log(message, context); break;
case MessageType.Error: Debug.LogError(message, @object); break;
case MessageType.Warning: Debug.LogWarning(message, @object); break;
default: Debug.Log(message, @object); break;
}
}
public static void HelpBox(string message, string fixDescription, MessageType type, Object @object = null, FixValidation action = null, string property = null, Object caller = null)
public static void HelpBox(string message, string fixDescription, MessageType type, Object @object = null, FixValidation action = null, string property = null)
{
s_Messages[(int)type].Add(new() { _Message = message, _FixDescription = fixDescription, _Object = @object, _Action = action, _PropertyPath = property });
}
public static void Suppressed(string _0, string _1, MessageType _2, Object _3 = null, FixValidation _4 = null, string _5 = null, Object _6 = null)
public static void Suppressed(string _0, string _1, MessageType _2, Object _3 = null, FixValidation _4 = null, string _5 = null)
{
}
@@ -297,24 +291,6 @@ namespace WaveHarmonic.Crest.Editor
}
}
// NOTE: Nested components do not descend from Object, but they could and this
// would work for them.
if (target is Object @object)
{
foreach (var field in TypeCache.GetFieldsWithAttribute<Validated>())
{
if (field.DeclaringType != type)
{
continue;
}
foreach (var attribute in field.GetCustomAttributes<Validated>())
{
isValid &= attribute.Validate(@object, field, messenger);
}
}
}
return isValid;
}
@@ -323,89 +299,4 @@ namespace WaveHarmonic.Crest.Editor
return ExecuteValidators(target, DebugLog);
}
}
abstract class Validated : System.Attribute
{
public abstract bool Validate(Object target, FieldInfo property, ValidatedHelper.ShowMessage messenger);
}
}
namespace WaveHarmonic.Crest
{
/// <summary>
/// Validates that field is not null.
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false)]
sealed class Required : Validated
{
public override bool Validate(Object target, FieldInfo field, ValidatedHelper.ShowMessage messenger)
{
var isValid = true;
if ((Object)field.GetValue(target) == null)
{
var typeName = EditorHelpers.Pretty(target.GetType().Name);
var fieldName = EditorHelpers.Pretty(field.Name);
messenger
(
$"<i>{fieldName}</i> is required for the <i>{typeName}</i> component to function.",
$"Please set <i>{fieldName}</i>.",
ValidatedHelper.MessageType.Error,
target
);
isValid = false;
}
return isValid;
}
}
/// <summary>
/// Shows a info message if field is null.
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false)]
sealed class Optional : Validated
{
readonly string _Message;
public Optional(string message)
{
_Message = message;
}
public override bool Validate(Object target, FieldInfo field, ValidatedHelper.ShowMessage messenger)
{
var value = field.GetValue(target);
if (value is ICollection<Object> list)
{
if (list != null && list.Count > 0)
{
return true;
}
}
else
{
if (value is Object @object && @object != null)
{
return true;
}
}
var typeName = EditorHelpers.Pretty(target.GetType().Name);
var fieldName = EditorHelpers.Pretty(field.Name);
messenger
(
$"<i>{fieldName}</i> is not set for the <i>{typeName}</i> component. " + _Message,
string.Empty,
ValidatedHelper.MessageType.Info,
target
);
return true;
}
}
}

View File

@@ -8,7 +8,6 @@ using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering.Universal;
using WaveHarmonic.Crest.Editor.Settings;
using WaveHarmonic.Crest.Internal;
using WaveHarmonic.Crest.Watercraft;
@@ -21,9 +20,6 @@ namespace WaveHarmonic.Crest.Editor
{
// HDRP sub-shader always first.
const int k_SubShaderIndexHDRP = 0;
const string k_NoneQueryProviderCollisionFloatingObjects = "The floating objects in the scene will use a flat horizontal plane.";
const string k_NoneQueryProviderFlowFloatingObjects = "The floating objects in the scene will not receive motion from flow.";
internal static WaterRenderer Water => Utility.Water;
static readonly System.Collections.Generic.List<Terrain> s_Terrains = new();
static readonly ShaderTagId s_RenderPipelineShaderTagID = new("RenderPipeline");
@@ -257,6 +253,18 @@ namespace WaveHarmonic.Crest.Editor
return isValid;
}
#if !d_Crest_LegacyUnderwater
if (target.AllCameras)
{
messenger
(
"<i>All Cameras</i> requires <i>Legacy Underwater</i> to be enabled.",
"Either disable <i>All Cameras</i> or enable <i>Project Settings > Crest > Legacy Underwater</i>.",
MessageType.Warning, water
);
}
#endif
if (target.Material != null)
{
var material = target.Material;
@@ -546,7 +554,7 @@ namespace WaveHarmonic.Crest.Editor
{
foreach (var simulation in target.Simulations)
{
ValidateSimulationAndMaterial(OptionalLod.Get(simulation.GetType()), messenger, water, target);
ValidateSimulationAndMaterial(OptionalLod.Get(simulation.GetType()), messenger, water);
}
}
@@ -560,7 +568,7 @@ namespace WaveHarmonic.Crest.Editor
);
}
if (target.Viewer == null && !target.IsRunningWithoutGraphics && !target.MultipleViewpoints)
if (target.Viewer == null && !target.IsRunningWithoutGraphics)
{
messenger
(
@@ -719,7 +727,8 @@ namespace WaveHarmonic.Crest.Editor
if (target.Clipped && water != null)
{
// Validate main material, then overriden material.
ValidateLod(OptionalLod.Get(typeof(ClipLod)), messenger, water, material: target._Material, context: target);
ValidateLod(OptionalLod.Get(typeof(ClipLod)), messenger, water);
ValidateLod(OptionalLod.Get(typeof(ClipLod)), messenger, water, material: target._Material);
if (water.ClipLod.DefaultClippingState == DefaultClippingState.NothingClipped)
{
@@ -729,8 +738,7 @@ namespace WaveHarmonic.Crest.Editor
$"The {nameof(WaterBody.Clipped)} option will have no effect.",
$"Disable {nameof(WaterBody.Clipped)} or set {nameof(ClipLod.DefaultClippingState)} to {DefaultClippingState.NothingClipped}.",
MessageType.Warning,
water,
caller: target
water
);
}
}
@@ -751,8 +759,6 @@ namespace WaveHarmonic.Crest.Editor
return isValid;
}
isValid &= ValidateProjectSettings(target, water, messenger, context);
var simulation = target.GetLod(water);
var dependentClause = ".";
@@ -781,8 +787,7 @@ namespace WaveHarmonic.Crest.Editor
simulation._Enabled = false;
}
},
$"{target.PropertyName}.{nameof(Lod._Enabled)}",
context
$"{target.PropertyName}.{nameof(Lod._Enabled)}"
);
isValid = false;
@@ -797,20 +802,20 @@ namespace WaveHarmonic.Crest.Editor
{
if (material.HasProperty(target.MaterialProperty) && material.GetFloat(target.MaterialProperty) != 1f)
{
ShowMaterialValidationMessage(target, material, messenger, context);
ShowMaterialValidationMessage(target, material, messenger);
isValid = false;
}
}
if (target.Dependency != null)
{
ValidateLod(OptionalLod.Get(target.Dependency), messenger, water, dependent, context: context);
ValidateLod(OptionalLod.Get(target.Dependency), messenger, water, dependent);
}
return isValid;
}
static bool ValidateSignedDistanceFieldsLod(ShowMessage messenger, WaterRenderer water, string feature, Object context)
static bool ValidateSignedDistanceFieldsLod(ShowMessage messenger, WaterRenderer water, string feature)
{
var isValid = true;
@@ -822,8 +827,7 @@ namespace WaveHarmonic.Crest.Editor
"Enable <i>Signed Distance Fields</i>",
MessageType.Error, water,
(_, y) => y.boolValue = true,
$"{nameof(WaterRenderer._DepthLod)}.{nameof(DepthLod._EnableSignedDistanceFields)}",
caller: context
$"{nameof(WaterRenderer._DepthLod)}.{nameof(DepthLod._EnableSignedDistanceFields)}"
);
isValid = false;
@@ -832,7 +836,7 @@ namespace WaveHarmonic.Crest.Editor
return isValid;
}
static void ShowMaterialValidationMessage(OptionalLod target, Material material, ShowMessage messenger, Object caller)
static void ShowMaterialValidationMessage(OptionalLod target, Material material, ShowMessage messenger)
{
messenger
(
@@ -843,43 +847,13 @@ namespace WaveHarmonic.Crest.Editor
);
}
static bool ValidateProjectSettings(OptionalLod target, WaterRenderer water, ShowMessage messenger, Object caller)
{
var isValid = true;
var lod = target.GetLod(water);
if (lod._Enabled && !target.GetProjectSettingToggle())
{
var platform = ScriptingSymbols.CurrentNamedBuildTarget;
messenger
(
$"<i>{target.PropertyLabel}</i> must be enabled for this platform in the project settings.",
$"Enable <i>Project Settings > Crest > Features > Default/{platform.TargetName} > {target.PropertyLabel}</i>. " +
$"It will be in either Default or {platform.TargetName}",
MessageType.Error, ProjectSettings.Instance,
caller: caller
);
isValid = false;
}
return isValid;
}
static bool ValidateSimulationAndMaterial(OptionalLod target, ShowMessage messenger, WaterRenderer water, Object caller)
static bool ValidateSimulationAndMaterial(OptionalLod target, ShowMessage messenger, WaterRenderer water)
{
if (target == null)
{
return true;
}
if (!ValidateProjectSettings(target, water, messenger, caller))
{
return false;
}
if (!target.HasMaterialToggle)
{
return true;
@@ -901,7 +875,7 @@ namespace WaveHarmonic.Crest.Editor
if (feature._Enabled)
{
ShowMaterialValidationMessage(target, water.Surface.Material, messenger, caller);
ShowMaterialValidationMessage(target, water.Surface.Material, messenger);
}
else if (messenger != DebugLog)
{
@@ -929,8 +903,7 @@ namespace WaveHarmonic.Crest.Editor
(
$"The wave spectrum is limited by the <i>Global Wind Speed</i> on the <i>Water Renderer</i> to {water.WindSpeedKPH} KPH.",
$"If you want fully developed waves, either override the wind speed on this component or increase the <i>Global Wind Speed</i>.",
MessageType.Info,
caller: target
MessageType.Info
);
}
@@ -948,7 +921,7 @@ namespace WaveHarmonic.Crest.Editor
if (Water != null)
{
isValid &= ValidateLod(OptionalLod.Get(typeof(AnimatedWavesLod)), messenger, Water, context: target);
isValid &= ValidateLod(OptionalLod.Get(typeof(AnimatedWavesLod)), messenger, Water);
}
return isValid;
@@ -962,7 +935,7 @@ namespace WaveHarmonic.Crest.Editor
// Validate require water feature.
if (Water != null)
{
isValid &= ValidateLod(OptionalLod.Get(typeof(DynamicWavesLod)), messenger, Water, context: target);
isValid &= ValidateLod(OptionalLod.Get(typeof(DynamicWavesLod)), messenger, Water);
}
return isValid;
@@ -976,19 +949,19 @@ namespace WaveHarmonic.Crest.Editor
// Validate require water feature.
if (Water != null)
{
isValid &= !target.UsesClip || ValidateLod(OptionalLod.Get(typeof(ClipLod)), messenger, Water, context: target);
isValid &= !target.UsesDisplacement || ValidateLod(OptionalLod.Get(typeof(AnimatedWavesLod)), messenger, Water, context: target);
isValid &= !target.UsesClip || ValidateLod(OptionalLod.Get(typeof(ClipLod)), messenger, Water);
isValid &= !target.UsesDisplacement || ValidateLod(OptionalLod.Get(typeof(AnimatedWavesLod)), messenger, Water);
isValid &= !target.UsesDisplacement || ValidateCollisionLayer(CollisionLayer.AfterDynamicWaves, target, messenger, "mode", target.Mode, required: true);
}
return isValid;
}
internal static void FixSetQuerySourceToCompute(SerializedObject _, SerializedProperty property)
internal static void FixSetCollisionSourceToCompute(SerializedObject _, SerializedProperty property)
{
if (Water != null)
{
property.enumValueIndex = (int)LodQuerySource.GPU;
property.enumValueIndex = (int)CollisionSource.GPU;
}
}
@@ -1005,8 +978,7 @@ namespace WaveHarmonic.Crest.Editor
}
isValid &= ValidateCollisionLayer(target.Layer, target, messenger, "layer", target.Layer, required: false);
isValid &= ValidateQuerySource(target, messenger, Water.AnimatedWavesLod, k_NoneQueryProviderCollisionFloatingObjects);
isValid &= ValidateQuerySource(target, messenger, Water.FlowLod, k_NoneQueryProviderFlowFloatingObjects);
isValid &= ValidateCollisionSource(target, messenger);
return isValid;
}
@@ -1022,8 +994,7 @@ namespace WaveHarmonic.Crest.Editor
}
isValid &= ValidateCollisionLayer(target._Layer, target, messenger, "layer", target._Layer, required: false);
isValid &= ValidateQuerySource(target, messenger, Water.AnimatedWavesLod, k_NoneQueryProviderCollisionFloatingObjects);
isValid &= ValidateQuerySource(target, messenger, Water.FlowLod, k_NoneQueryProviderFlowFloatingObjects);
isValid &= ValidateCollisionSource(target, messenger);
return isValid;
}
@@ -1168,31 +1139,7 @@ namespace WaveHarmonic.Crest.Editor
// Validate that any water feature required for this input is enabled, if any
if (Water != null)
{
isValid &= ValidateLod(OptionalLod.Get(target.GetType()), messenger, Water, context: target);
}
return isValid;
}
[Validator(typeof(LevelLodInput))]
static bool ValidateLevelLodInput(LevelLodInput target, ShowMessage messenger)
{
var isValid = true;
if (target.Mode is LodInputMode.Geometry or LodInputMode.Spline)
{
if (target.Blend is LodInputBlend.Minimum or LodInputBlend.Maximum && target.Weight < 1f)
{
messenger
(
"Weight with minimum or maximum blend modes do not always behave correctly. " +
"Any weight less than one will move the value in the simulation towards zero, rather than towards the existing value in the simulation. " +
"For example, this input with a zero weight, and with a blend mode set to maximum, will replace any negative water level instead of not doing anything.",
"", // Nothing to suggest yet, as in cases this is still valid.
MessageType.Warning,
target
);
}
isValid &= ValidateLod(OptionalLod.Get(target.GetType()), messenger, Water);
}
return isValid;
@@ -1365,8 +1312,7 @@ namespace WaveHarmonic.Crest.Editor
$"This can cause the <i>{nameof(DepthProbe)}</i> not to work. " +
$"Unity fixed this in 2022.3.23f1.",
$"If you are experiencing problems, disable depth priming or upgrade Unity.",
MessageType.Info, urpRenderer,
caller: target
MessageType.Info, urpRenderer
);
}
@@ -1380,8 +1326,7 @@ namespace WaveHarmonic.Crest.Editor
$"This can cause the <i>{nameof(DepthProbe)}</i> not to work. " +
$"Unity fixed this in 2022.3.23f1.",
$"If you are experiencing problems, disable SSAO or upgrade Unity.",
MessageType.Info, urpRenderer,
caller: target
MessageType.Info, urpRenderer
);
}
}
@@ -1404,8 +1349,7 @@ namespace WaveHarmonic.Crest.Editor
"It is not expected that a depth probe object has a Renderer component in its hierarchy." +
"The probe is typically attached to an empty GameObject. Please refer to the example content.",
"Remove the Renderer component from this object or its children.",
MessageType.Warning, renderer,
caller: target
MessageType.Warning, renderer
);
// Reporting only one renderer at a time will be enough to avoid overwhelming user and UI.
@@ -1420,11 +1364,11 @@ namespace WaveHarmonic.Crest.Editor
// Validate require water feature.
if (water != null)
{
isValid = isValid && ValidateLod(OptionalLod.Get(typeof(DepthLod)), messenger, water, context: target);
isValid = isValid && ValidateLod(OptionalLod.Get(typeof(DepthLod)), messenger, water);
if (!water._DepthLod._EnableSignedDistanceFields && target._GenerateSignedDistanceField)
{
isValid = isValid && ValidateSignedDistanceFieldsLod(messenger, water, "Generate Signed Distance Field", target);
isValid = isValid && ValidateSignedDistanceFieldsLod(messenger, water, "Generate Signed Distance Field");
}
if (water.DepthLod.IncludeTerrainHeight && Object.FindAnyObjectByType<Terrain>(FindObjectsInactive.Include) != null)
@@ -1436,8 +1380,7 @@ namespace WaveHarmonic.Crest.Editor
"But typically, if you are using a DepthProbe, it is best to capture the terrain too, as it is more accurate. " +
"One reason to use a DepthProbe together with the auto capture is for better real-time/on-demand depth capture performance.",
string.Empty,
MessageType.Info, water,
caller: target
MessageType.Info, water
);
}
}
@@ -1454,15 +1397,14 @@ namespace WaveHarmonic.Crest.Editor
if (!target._DistanceFromEdge.IsEmpty())
{
isValid = isValid && ValidateLod(OptionalLod.Get(typeof(DepthLod)), messenger, water, context: target);
isValid = isValid && ValidateSignedDistanceFieldsLod(messenger, water, "Distance From Edge", target);
isValid = isValid && ValidateLod(OptionalLod.Get(typeof(DepthLod)), messenger, water);
isValid = isValid && ValidateSignedDistanceFieldsLod(messenger, water, "Distance From Edge");
}
if (!target._DistanceFromSurface.IsEmpty())
{
isValid &= ValidateCollisionLayer(target._Layer, target, messenger, "layer", target._Layer, required: false);
isValid &= ValidateQuerySource(target, messenger, Water.AnimatedWavesLod, k_NoneQueryProviderCollisionFloatingObjects);
isValid &= ValidateQuerySource(target, messenger, Water.FlowLod, k_NoneQueryProviderFlowFloatingObjects);
isValid &= ValidateCollisionSource(target, messenger);
}
return isValid;
@@ -1517,29 +1459,34 @@ namespace WaveHarmonic.Crest.Editor
var isValid = true;
#if !d_CrestCPUQueries
if (target.QuerySource == LodQuerySource.CPU)
if (target.CollisionSource == CollisionSource.CPU)
{
messenger
(
"Collision Source is set to CPU but the <i>CPU Queries</i> package is not installed.",
"Install the <i>CPU Queries</i> package or switch to GPU queries.",
MessageType.Warning, target.Water,
FixSetQuerySourceToCompute
FixSetCollisionSourceToCompute
);
}
#endif
isValid &= ValidateQuerySource(target.Water, messenger, target, k_NoneQueryProviderCollisionFloatingObjects);
if (target.CollisionSource == CollisionSource.None)
{
messenger
(
"Collision Source in Water Renderer is set to None. The floating objects in the scene will use a flat horizontal plane.",
"Set collision source to GPU.",
MessageType.Warning, target.Water,
FixSetCollisionSourceToCompute,
$"{nameof(WaterRenderer._AnimatedWavesLod)}.{nameof(AnimatedWavesLod._CollisionSource)}"
);
}
return isValid;
}
[Validator(typeof(FlowLod))]
static bool Validate(FlowLod target, ShowMessage messenger)
{
return ValidateQuerySource(target.Water, messenger, target, k_NoneQueryProviderFlowFloatingObjects);
}
[Validator(typeof(ScatteringLod))]
static bool Validate(ScatteringLod target, ShowMessage messenger)
{
@@ -1592,8 +1539,7 @@ namespace WaveHarmonic.Crest.Editor
messenger
(
$"No water present. {nameof(CutsceneTimeProvider)} will have no effect.",
"", MessageType.Warning,
caller: target
"", MessageType.Warning
);
isValid = false;
@@ -1606,8 +1552,7 @@ namespace WaveHarmonic.Crest.Editor
(
$"No {nameof(UnityEngine.Playables.PlayableDirector)} component assigned. {nameof(CutsceneTimeProvider)} will have no effect.",
$"Add a {nameof(UnityEngine.Playables.PlayableDirector)}",
MessageType.Error,
caller: target
MessageType.Error
);
isValid = false;
@@ -1617,8 +1562,7 @@ namespace WaveHarmonic.Crest.Editor
(
$"This component requires the com.unity.modules.director built-in module to function.",
$"Enable the com.unity.modules.director built-in module.",
MessageType.Error,
caller: target
MessageType.Error
);
isValid = false;
@@ -1681,8 +1625,7 @@ namespace WaveHarmonic.Crest.Editor
(
$"{typeof(T).Name} requires a {typeof(C).Name} to be set or present on same object.",
$"Set the {typeof(C).Name} property or add a {typeof(C).Name}.",
MessageType.Error,
caller: target
MessageType.Error
);
isValid = false;
@@ -1716,10 +1659,9 @@ namespace WaveHarmonic.Crest.Editor
(
$"The {value} {label} requires the {flag} layer which is not enabled.",
fix,
required ? MessageType.Error : MessageType.Warning, Water,
required ? MessageType.Error : MessageType.Warning, messenger == DebugLog ? target : Water,
(_, y) => y.intValue = (int)(layers | flag),
$"{nameof(WaterRenderer._AnimatedWavesLod)}.{nameof(WaterRenderer._AnimatedWavesLod._CollisionLayers)}",
caller: target
$"{nameof(WaterRenderer._AnimatedWavesLod)}.{nameof(WaterRenderer._AnimatedWavesLod._CollisionLayers)}"
);
return !required;
@@ -1728,28 +1670,21 @@ namespace WaveHarmonic.Crest.Editor
return true;
}
static bool ValidateQuerySource(Object target, ShowMessage messenger, IQueryableLod<IQueryProvider> lod, string extra)
static bool ValidateCollisionSource(Object target, ShowMessage messenger)
{
if (Water == null)
{
return true;
}
if (!lod.Enabled)
{
return true;
}
if (lod.QuerySource == LodQuerySource.None)
if (Water._AnimatedWavesLod.CollisionSource == CollisionSource.None)
{
messenger
(
$"<i>{nameof(WaterRenderer)} > {lod.Name} > {nameof(lod.QuerySource)}</i> is set to <i>None</i>. {extra}",
$"Set the <i>{nameof(lod.QuerySource)}</i> to <i>{nameof(LodQuerySource.GPU)}</i> to use data.",
MessageType.Info, Water,
FixSetQuerySourceToCompute,
$"_{lod.GetType().Name}._{nameof(lod.QuerySource)}",
caller: target
"<i>Collision Source</i> on the <i>Water Renderer</i> is set to <i>None</i>. The floating objects in the scene will use a flat horizontal plane.",
"Set the <i>Collision Source</i> to <i>GPU</i> to incorporate waves into physics.",
MessageType.Warning, Water,
FixSetCollisionSourceToCompute
);
}

View File

@@ -1,8 +1,6 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#pragma exclude_renderers glcore gles3
#pragma kernel CrestVisualizeNegativeValues_Scalar
#pragma kernel CrestVisualizeNegativeValues_Array _ARRAY

View File

@@ -25,12 +25,12 @@ Material:
m_Parent: {fileID: 2100000, guid: 8ab064b6606504a55b489af2787350c2, type: 2}
m_ModifiedSerializedProperties: 26
m_ValidKeywords:
- CREST_FLOW_ON
- _ALPHATEST_ON
- _BUILTIN_ALPHATEST_ON
- _BUILTIN_AlphaClip
- _BUILTIN_SURFACE_TYPE_TRANSPARENT
- _BUILTIN_TRANSPARENT_RECEIVES_SHADOWS
- _CREST_FLOW_LOD
- _DOUBLESIDED_ON
- _ENABLE_FOG_ON_TRANSPARENT
- _SURFACE_TYPE_TRANSPARENT
@@ -56,7 +56,7 @@ Material:
m_TexEnvs: []
m_Ints: []
m_Floats:
- _CREST_FLOW_LOD: 1
- CREST_FLOW: 1
- _SrcBlend: 5
m_Colors: []
m_BuildTextureStacks: []

View File

@@ -12,25 +12,12 @@ Material:
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- d_Crest_NoMaskDepth
- d_Dithering
m_InvalidKeywords:
- CREST_CAUSTICS_ON
- CREST_FOAM_ON
- _ALPHATEST_ON
- _BUILTIN_ALPHATEST_ON
- _BUILTIN_AlphaClip
- _BUILTIN_SURFACE_TYPE_TRANSPARENT
- _DOUBLESIDED_ON
- _EMISSION
- _ENABLE_FOG_ON_TRANSPARENT
- _REFRACTION_PLANE
- _SURFACE_TYPE_TRANSPARENT
- _TRANSPARENT_WRITES_MOTION_VEC
m_LightmapFlags: 2
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 3000
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
@@ -38,11 +25,11 @@ Material:
serializedVersion: 3
m_TexEnvs:
- _Crest_CausticsDistortionTexture:
m_Texture: {fileID: 2800000, guid: 7aa3f69cfb40b429a865c45a7271c5f5, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Crest_CausticsTexture:
m_Texture: {fileID: 2800000, guid: 1407209016967410da2ae6fdd4d97fc6, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints:
@@ -51,7 +38,6 @@ Material:
- _Crest_Version: 0
m_Floats:
- CREST_FLOW: 0
- _CREST_FLOW_LOD: 0
- _Crest_AmbientTerm: 1
- _Crest_Anisotropy: 0.5
- _Crest_CausticsDepthOfField: 6
@@ -60,7 +46,6 @@ Material:
- _Crest_CausticsEnabled: 1
- _Crest_CausticsFocalDepth: 2
- _Crest_CausticsMotionBlur: 1
- _Crest_CausticsScrollSpeed: 1
- _Crest_CausticsStrength: 3.2
- _Crest_CausticsTextureAverage: 0.07
- _Crest_CausticsTextureScale: 50
@@ -69,10 +54,8 @@ Material:
- _Crest_ExtinctionMultiplier: 1
- _Crest_OutScatteringExtinctionFactor: 0.2
- _Crest_OutScatteringFactor: 0.2
- _Crest_ShadowsAffectsAmbientFactor: 0.5
- _Crest_SunBoost: 2
m_Colors:
- _Crest_AbsorptionColor: {r: 0.34162676, g: 0.6954546, b: 0.85, a: 0.1019608}
- _Crest_Scattering: {r: 0, g: 0.09803919, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -9,7 +9,6 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples")]
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Editor")]
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Ripples")]
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Waterfall")]
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.CPUQueries")]
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.CPUQueries.Editor")]
[assembly: InternalsVisibleTo("WaveHarmonic.Crest.Paint")]

View File

@@ -31,16 +31,5 @@ namespace WaveHarmonic.Crest
// Unity only supports textures up to a size of 16384, even if maxTextureSize returns a larger size.
// https://docs.unity3d.com/ScriptReference/SystemInfo-maxTextureSize.html
public const int k_MaximumTextureResolution = 16384;
public static class Symbols
{
public const string k_Refraction =
#if d_Crest_SimpleTransparency
"CREST_NOOP";
#else
"UNITY_2022_3_OR_NEWER";
#endif
}
}
}

View File

@@ -19,7 +19,6 @@ namespace WaveHarmonic.Crest
internal override Color GizmoColor => s_GizmoColor;
private protected override Color ClearColor => Color.clear;
private protected override bool NeedToReadWriteTextureData => false;
internal override bool SkipEndOfFrame => true;
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
{

View File

@@ -20,7 +20,6 @@ namespace WaveHarmonic.Crest
/// <summary>
/// The source of collisions (ie water shape).
/// </summary>
[System.Obsolete("Please use QuerySource and LodQuerySource.")]
[@GenerateDoc]
public enum CollisionSource
{
@@ -68,9 +67,13 @@ namespace WaveHarmonic.Crest
{
// NOTE: numbers must be in order for defaults to work (everything first).
/// <inheritdoc cref="Generated.CollisionLayers.Everything"/>
[Tooltip("All layers.")]
Everything = -1,
/// <inheritdoc cref="Generated.CollisionLayers.Nothing"/>
[Tooltip("No extra layers (ie single layer).")]
Nothing = 0,
Nothing,
/// <inheritdoc cref="Generated.CollisionLayers.DynamicWaves"/>
[Tooltip("Separate layer for dynamic waves.\n\nDynamic waves are normally combined together for efficiency. By enabling this layer, dynamic waves are combined and added in a separate pass.")]
@@ -79,29 +82,6 @@ namespace WaveHarmonic.Crest
/// <inheritdoc cref="Generated.CollisionLayers.Displacement"/>
[Tooltip("Extra displacement layer for visual displacement.")]
Displacement = 1 << 2,
/// <inheritdoc cref="Generated.CollisionLayers.Everything"/>
[Tooltip("All layers.")]
Everything = ~0,
}
/// <summary>
/// The wave sampling method to determine quality and performance.
/// </summary>
[@GenerateDoc]
public enum WaveSampling
{
/// <inheritdoc cref="Generated.WaveSampling.Automatic"/>
[Tooltip("Automatically chooses the other options as needed (512+ resolution needs precision).")]
Automatic,
/// <inheritdoc cref="Generated.WaveSampling.Performance"/>
[Tooltip("Reduces samples by copying waves from higher LODs to lower LODs.\n\nBest for resolutions lower than 512.")]
Performance,
/// <inheritdoc cref="Generated.WaveSampling.Precision"/>
[Tooltip("Samples directly from the wave buffers to preserve wave quality.\n\nNeeded for higher resolutions (512+). Higher LOD counts can also benefit with this enabled.")]
Precision,
}
/// <summary>
@@ -128,33 +108,14 @@ namespace WaveHarmonic.Crest
[@FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)]
public sealed partial class AnimatedWavesLod : Lod<ICollisionProvider>
{
[Tooltip("Collision layers to enable.\n\nSome layers will have overhead with CPU, GPU and memory.")]
[@Predicated(nameof(_QuerySource), inverted: true, nameof(LodQuerySource.GPU))]
[@GenerateAPI]
[@DecoratedField, SerializeField]
internal CollisionLayers _CollisionLayers = CollisionLayers.Everything;
[@Predicated(nameof(_QuerySource), true, nameof(LodQuerySource.CPU))]
[@DecoratedField, SerializeField]
internal BakedWaveData _BakedWaveData;
[@Space(10)]
[Tooltip("The wave sampling method to determine quality and performance.")]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
internal WaveSampling _WaveSampling;
[Tooltip("Shifts wavelengths to maintain quality for higher resolutions.\n\nSet this to 2 to improve wave quality. In some cases like flowing rivers, this can make a substantial difference to visual stability. We recommend doubling the Resolution on the WaterRenderer component to preserve detail after making this change.")]
[@Predicated(nameof(_WaveSampling), inverted: true, nameof(WaveSampling.Performance))]
[@Range(1f, 4f)]
[@GenerateAPI(Getter.Custom)]
[@GenerateAPI]
[SerializeField]
float _WaveResolutionMultiplier = 1f;
[@Space(10)]
[Tooltip("How much waves are dampened in shallow water.")]
[@Range(0f, 1f)]
[@GenerateAPI]
@@ -168,6 +129,30 @@ namespace WaveHarmonic.Crest
float _ShallowsMaximumDepth = 1000f;
[@Heading("Collisions")]
[Tooltip("Where to obtain water shape on CPU for physics / gameplay.")]
[@GenerateAPI(Setter.Internal)]
[@DecoratedField, SerializeField]
internal CollisionSource _CollisionSource = CollisionSource.GPU;
[Tooltip("Collision layers to enable.\n\nSome layers will have overhead with CPU, GPU and memory.")]
[@Predicated(nameof(_CollisionSource), inverted: true, nameof(CollisionSource.GPU))]
[@GenerateAPI]
[@DecoratedField, SerializeField]
internal CollisionLayers _CollisionLayers = CollisionLayers.Everything;
[Tooltip("Maximum number of wave queries that can be performed when using GPU queries.")]
[@Predicated(nameof(_CollisionSource), true, nameof(CollisionSource.GPU))]
[@GenerateAPI(Setter.None)]
[@DecoratedField, SerializeField]
int _MaximumQueryCount = QueryBase.k_DefaultMaximumQueryCount;
[@Predicated(nameof(_CollisionSource), true, nameof(CollisionSource.CPU))]
[@DecoratedField, SerializeField]
internal BakedWaveData _BakedWaveData;
const string k_DrawCombine = "Combine";
@@ -175,6 +160,7 @@ namespace WaveHarmonic.Crest
{
public static readonly int s_WaveBuffer = Shader.PropertyToID("_Crest_WaveBuffer");
public static readonly int s_DynamicWavesTarget = Shader.PropertyToID("_Crest_DynamicWavesTarget");
public static readonly int s_AnimatedWavesTarget = Shader.PropertyToID("_Crest_AnimatedWavesTarget");
public static readonly int s_AttenuationInShallows = Shader.PropertyToID("_Crest_AttenuationInShallows");
}
@@ -185,8 +171,6 @@ namespace WaveHarmonic.Crest
/// </summary>
internal static bool s_Combine = true;
WaterResources.ShapeCombineCompute _CombineShader;
internal override string ID => "AnimatedWaves";
internal override string Name => "Animated Waves";
internal override Color GizmoColor => s_GizmoColor;
@@ -203,13 +187,17 @@ namespace WaveHarmonic.Crest
_ => throw new System.NotImplementedException(),
};
internal bool PreserveWaveQuality => WaveSampling switch
{
WaveSampling.Automatic => Resolution >= 512,
WaveSampling.Performance => false,
WaveSampling.Precision => true,
_ => throw new System.NotImplementedException(),
};
ComputeShader _CombineShader;
int _KernalShapeCombine = -1;
int _KernalShapeCombine_DISABLE_COMBINE = -1;
int _KernalShapeCombine_FLOW_ON = -1;
int _KernalShapeCombine_FLOW_ON_DISABLE_COMBINE = -1;
int _KernalShapeCombine_DYNAMIC_WAVE_SIM_ON = -1;
int _KernalShapeCombine_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE = -1;
int _KernalShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON = -1;
int _KernalShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE = -1;
internal AnimatedWavesLod()
{
@@ -220,8 +208,8 @@ namespace WaveHarmonic.Crest
internal override void Initialize()
{
_CombineShader = WaterResources.Instance._ComputeLibrary._ShapeCombineCompute;
if (_CombineShader._Shader == null)
_CombineShader = WaterResources.Instance.Compute._ShapeCombine;
if (_CombineShader == null)
{
_Valid = false;
return;
@@ -230,11 +218,25 @@ namespace WaveHarmonic.Crest
base.Initialize();
}
private protected override void Allocate()
{
base.Allocate();
_KernalShapeCombine = _CombineShader.FindKernel("ShapeCombine");
_KernalShapeCombine_DISABLE_COMBINE = _CombineShader.FindKernel("ShapeCombine_DISABLE_COMBINE");
_KernalShapeCombine_FLOW_ON = _CombineShader.FindKernel("ShapeCombine_FLOW_ON");
_KernalShapeCombine_FLOW_ON_DISABLE_COMBINE = _CombineShader.FindKernel("ShapeCombine_FLOW_ON_DISABLE_COMBINE");
_KernalShapeCombine_DYNAMIC_WAVE_SIM_ON = _CombineShader.FindKernel("ShapeCombine_DYNAMIC_WAVE_SIM_ON");
_KernalShapeCombine_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE = _CombineShader.FindKernel("ShapeCombine_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE");
_KernalShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON = _CombineShader.FindKernel("ShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON");
_KernalShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE = _CombineShader.FindKernel("ShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE");
}
internal override void BuildCommandBuffer(WaterRenderer water, CommandBuffer buffer)
{
buffer.BeginSample(ID);
FlipBuffers(buffer);
FlipBuffers();
Shader.SetGlobalFloat(ShaderIDs.s_AttenuationInShallows, _AttenuationInShallows);
@@ -242,18 +244,6 @@ namespace WaveHarmonic.Crest
buffer.GetTemporaryRT(ShaderIDs.s_WaveBuffer, DataTexture.descriptor);
CoreUtils.SetRenderTarget(buffer, ShaderIDs.s_WaveBuffer, ClearFlag.Color, ClearColor);
// Custom clear because clear not working.
if (Helpers.IsWebGPU && WaterResources.Instance.Compute._Clear != null)
{
var compute = WaterResources.Instance._ComputeLibrary._ClearCompute;
var wrapper = new PropertyWrapperCompute(buffer, compute._Shader, compute._KernelClearTarget);
compute.SetVariantForFormat(wrapper, DataTexture.graphicsFormat);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, ShaderIDs.s_WaveBuffer);
wrapper.SetVector(Crest.ShaderIDs.s_ClearMask, Color.white);
wrapper.SetVector(Crest.ShaderIDs.s_ClearColor, ClearColor);
wrapper.Dispatch(Resolution / k_ThreadGroupSizeX, Resolution / k_ThreadGroupSizeY, Slices);
}
// LOD dependent data.
// Write to per-octave _WaveBuffers. Not the same as _AnimatedWaves.
// Draw any data with lod preference.
@@ -264,54 +254,54 @@ namespace WaveHarmonic.Crest
// Combine the LODs - copy results from biggest LOD down to LOD 0
{
var wrapper = new PropertyWrapperCompute
(
buffer,
_CombineShader._Shader,
PreserveWaveQuality
? _CombineShader._CopyAnimatedWavesKernel
: _CombineShader._CombineAnimatedWavesKernel
);
if (_Water._DynamicWavesLod.Enabled)
var combineShaderKernel = _KernalShapeCombine;
var combineShaderKernel_lastLOD = _KernalShapeCombine_DISABLE_COMBINE;
{
_Water._DynamicWavesLod.Bind(wrapper);
}
var isFlowOn = _Water._FlowLod.Enabled;
var isDynamicWavesOn = _Water._DynamicWavesLod.Enabled && !_CollisionLayers.HasFlag(CollisionLayers.DynamicWaves);
// Start with last LOD which does not combine.
wrapper.SetKeyword(_CombineShader._CombineKeyword, false);
wrapper.SetKeyword(_CombineShader._FlowKeyword, _Water._FlowLod.Enabled);
wrapper.SetKeyword(_CombineShader._DynamicWavesKeyword, _Water._DynamicWavesLod.Enabled && !PreserveWaveQuality && !_CollisionLayers.HasFlag(CollisionLayers.DynamicWaves));
// The per-octave wave buffers we read from.
wrapper.SetTexture(ShaderIDs.s_WaveBuffer, ShaderIDs.s_WaveBuffer);
// Set the animated waves texture where we read/write to combine the results.
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
if (PreserveWaveQuality)
{
wrapper.Dispatch(threadSize, threadSize, Slices);
}
else
{
buffer.BeginSample(k_DrawCombine);
// Combine waves.
for (var slice = lastSlice; slice >= 0; slice--)
// Set the shader kernels that we will use.
if (isFlowOn && isDynamicWavesOn)
{
wrapper.SetInteger(Lod.ShaderIDs.s_LodIndex, slice);
wrapper.Dispatch(threadSize, threadSize, 1);
if (slice == lastSlice)
{
// From here on, use combine.
wrapper.SetKeyword(_CombineShader._CombineKeyword, s_Combine);
}
combineShaderKernel = _KernalShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON;
combineShaderKernel_lastLOD = _KernalShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE;
}
else if (isFlowOn)
{
combineShaderKernel = _KernalShapeCombine_FLOW_ON;
combineShaderKernel_lastLOD = _KernalShapeCombine_FLOW_ON_DISABLE_COMBINE;
}
else if (isDynamicWavesOn)
{
combineShaderKernel = _KernalShapeCombine_DYNAMIC_WAVE_SIM_ON;
combineShaderKernel_lastLOD = _KernalShapeCombine_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE;
}
buffer.EndSample(k_DrawCombine);
}
buffer.BeginSample(k_DrawCombine);
// Combine waves.
for (var slice = lastSlice; slice >= 0; slice--)
{
var kernel = slice < lastSlice && s_Combine
? combineShaderKernel : combineShaderKernel_lastLOD;
var wrapper = new PropertyWrapperCompute(buffer, _CombineShader, kernel);
// The per-octave wave buffers we read from.
wrapper.SetTexture(ShaderIDs.s_WaveBuffer, ShaderIDs.s_WaveBuffer);
if (_Water._DynamicWavesLod.Enabled) _Water._DynamicWavesLod.Bind(wrapper);
// Set the animated waves texture where we read/write to combine the results. Use
// compute suffix to avoid collision as a file already uses the normal name.
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
wrapper.SetInteger(Lod.ShaderIDs.s_LodIndex, slice);
wrapper.Dispatch(threadSize, threadSize, 1);
}
buffer.EndSample(k_DrawCombine);
}
buffer.ReleaseTemporaryRT(ShaderIDs.s_WaveBuffer);
@@ -322,15 +312,20 @@ namespace WaveHarmonic.Crest
// Alpha channel is cleared in combine step, but if any inputs draw in post-combine
// step then alpha may have data.
if (drawn && WaterResources.Instance.Compute._Clear != null)
var clear = WaterResources.Instance.Compute._Clear;
if (drawn && clear != null)
{
var compute = WaterResources.Instance._ComputeLibrary._ClearCompute;
var wrapper = new PropertyWrapperCompute(buffer, compute._Shader, compute._KernelClearTarget);
compute.SetVariantForFormat(wrapper, DataTexture.graphicsFormat);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
wrapper.SetVector(Crest.ShaderIDs.s_ClearMask, Color.black);
wrapper.SetVector(Crest.ShaderIDs.s_ClearColor, Color.clear);
wrapper.Dispatch(Resolution / k_ThreadGroupSizeX, Resolution / k_ThreadGroupSizeY, Slices);
buffer.SetComputeTextureParam(clear, 0, Crest.ShaderIDs.s_Target, DataTexture);
buffer.SetComputeVectorParam(clear, Crest.ShaderIDs.s_ClearMask, Color.black);
buffer.SetComputeVectorParam(clear, Crest.ShaderIDs.s_ClearColor, Color.clear);
buffer.DispatchCompute
(
clear,
0,
Resolution / k_ThreadGroupSizeX,
Resolution / k_ThreadGroupSizeY,
Slices
);
}
// Pack height data into alpha channel.
@@ -360,21 +355,15 @@ namespace WaveHarmonic.Crest
}
// Transfer Dynamic Waves to Animated Waves.
if ((_CollisionLayers.HasFlag(CollisionLayers.DynamicWaves) || PreserveWaveQuality) && _Water._DynamicWavesLod.Enabled)
if (_CollisionLayers.HasFlag(CollisionLayers.DynamicWaves) && _Water._DynamicWavesLod.Enabled)
{
buffer.BeginSample(k_DrawCombine);
// Clearing not required as we overwrite enter texture.
buffer.GetTemporaryRT(ShaderIDs.s_DynamicWavesTarget, DataTexture.descriptor);
var wrapper = new PropertyWrapperCompute(buffer, _CombineShader._Shader, _CombineShader._CombineDynamicWavesKernel);
var wrapper = new PropertyWrapperCompute(buffer, _CombineShader, 9);
// Flow keyword is already set, and Dynamic Waves already bound. If binding Dynamic
// Waves becomes kernel specific (eg binding textures), then we need to rebind.
// Start with last LOD which does not combine.
wrapper.SetKeyword(_CombineShader._CombineKeyword, false);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, ShaderIDs.s_DynamicWavesTarget);
wrapper.SetTexture(ShaderIDs.s_DynamicWavesTarget, ShaderIDs.s_DynamicWavesTarget);
_Water._DynamicWavesLod.Bind(wrapper);
@@ -384,21 +373,18 @@ namespace WaveHarmonic.Crest
wrapper.SetInteger(Lod.ShaderIDs.s_LodIndex, slice);
wrapper.Dispatch(threadSize, threadSize, 1);
// Change to kernel with combine enabled.
if (slice == lastSlice)
{
// From here on, use combine.
wrapper.SetKeyword(_CombineShader._CombineKeyword, s_Combine);
wrapper = new(buffer, _CombineShader, 8);
}
}
// Copy Dynamic Waves displacement into Animated Waves.
if (WaterResources.Instance.Compute._Blit != null)
{
var compute = WaterResources.Instance._ComputeLibrary._BlitCompute;
wrapper = new(buffer, compute._Shader, 0);
compute.SetVariantForFormat(wrapper, DataTexture.graphicsFormat);
wrapper.SetTexture(Crest.ShaderIDs.s_Source, ShaderIDs.s_DynamicWavesTarget);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
wrapper = new(buffer, _CombineShader, 10);
wrapper.SetTexture(ShaderIDs.s_AnimatedWavesTarget, DataTexture);
wrapper.SetTexture(ShaderIDs.s_DynamicWavesTarget, ShaderIDs.s_DynamicWavesTarget);
wrapper.Dispatch(threadSize, threadSize, Slices);
}
@@ -407,10 +393,7 @@ namespace WaveHarmonic.Crest
// Query collisions including Dynamic Waves.
// Does not require copying the water level as they are added with zero alpha.
if (_CollisionLayers.HasFlag(CollisionLayers.DynamicWaves))
{
Provider.UpdateQueries(_Water, CollisionLayer.AfterDynamicWaves);
}
Provider.UpdateQueries(_Water, CollisionLayer.AfterDynamicWaves);
}
if (_CollisionLayers.HasFlag(CollisionLayers.Displacement))
@@ -449,20 +432,20 @@ namespace WaveHarmonic.Crest
Queryable?.CleanUp();
if (!enable || _Water.Surface.IsQuadMesh)
if (!enable)
{
return ICollisionProvider.None;
}
switch (QuerySource)
switch (_CollisionSource)
{
case LodQuerySource.None:
case CollisionSource.None:
result = ICollisionProvider.None;
break;
case LodQuerySource.GPU:
case CollisionSource.GPU:
if (_Valid && !_Water.IsRunningWithoutGraphics)
{
result = ICollisionProvider.Create(_Water);
result = new CollisionQueryWithPasses(_Water);
}
if (_Water.IsRunningWithoutGraphics)
@@ -470,7 +453,7 @@ namespace WaveHarmonic.Crest
Debug.LogError($"Crest: GPU queries not supported in headless/batch mode. To resolve, assign an Animated Wave Settings asset to the {nameof(WaterRenderer)} component and set the Collision Source to be a CPU option.");
}
break;
case LodQuerySource.CPU:
case CollisionSource.CPU:
if (_BakedWaveData != null)
{
result = _BakedWaveData.CreateCollisionProvider();
@@ -501,7 +484,6 @@ namespace WaveHarmonic.Crest
public readonly float _ViewerAltitudeLevelAlpha;
public readonly int _Slice;
public readonly int _Slices;
public readonly bool _HighQualityCombine;
public WavelengthFilter(WaterRenderer water, int slice)
{
@@ -511,7 +493,6 @@ namespace WaveHarmonic.Crest
_Minimum = _Maximum * 0.5f;
_TransitionThreshold = water.MaximumWavelength(_Slices - 1) * 0.5f;
_ViewerAltitudeLevelAlpha = water.ViewerAltitudeLevelAlpha;
_HighQualityCombine = water.AnimatedWavesLod.PreserveWaveQuality;
}
}
@@ -532,7 +513,7 @@ namespace WaveHarmonic.Crest
// If approaching end of lod chain, start smoothly transitioning any large wavelengths across last two lods
if (wavelength >= filter._TransitionThreshold)
{
if (filter._Slice == filter._Slices - 2 && !filter._HighQualityCombine)
if (filter._Slice == filter._Slices - 2)
{
return 1f - filter._ViewerAltitudeLevelAlpha;
}
@@ -548,7 +529,7 @@ namespace WaveHarmonic.Crest
return 1f;
}
return filter._HighQualityCombine ? 1f : 0f;
return 0f;
}
internal static float FilterByWavelength(WaterRenderer water, int slice, float wavelength)
@@ -569,31 +550,8 @@ namespace WaveHarmonic.Crest
{
s_Inputs.Clear();
}
}
// API
partial class AnimatedWavesLod
{
float GetWaveResolutionMultiplier()
{
return PreserveWaveQuality ? 1f : _WaveResolutionMultiplier;
}
}
partial class AnimatedWavesLod
{
[@HideInInspector]
[@System.Obsolete("Please use QuerySource instead.")]
[Tooltip("Where to obtain water shape on CPU for physics / gameplay.")]
[@GenerateAPI(Setter.Internal)]
[@DecoratedField, SerializeField]
internal CollisionSource _CollisionSource = CollisionSource.GPU;
}
#if UNITY_EDITOR
// Editor
partial class AnimatedWavesLod
{
[@OnChange]
private protected override void OnChange(string propertyPath, object previousValue)
{
@@ -602,10 +560,13 @@ namespace WaveHarmonic.Crest
switch (propertyPath)
{
case nameof(_CollisionLayers):
ResetQueryChange();
case nameof(_CollisionSource):
if (_Water == null || !_Water.isActiveAndEnabled || !Enabled) return;
Queryable?.CleanUp();
InitializeProvider(true);
break;
}
}
}
#endif
}
}

View File

@@ -50,7 +50,6 @@ namespace WaveHarmonic.Crest
private protected override Color ClearColor => _DefaultClippingState == DefaultClippingState.EverythingClipped ? Color.white : Color.black;
private protected override bool NeedToReadWriteTextureData => true;
private protected override bool RequiresClearBorder => true;
internal override bool SkipEndOfFrame => true;
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
{

View File

@@ -69,7 +69,6 @@ namespace WaveHarmonic.Crest
private protected abstract void SetShorelineColor(Color previous, Color current);
private protected Vector4 _ShorelineColorValue;
ShorelineColorInput _ShorelineColorInput;
internal override bool SkipEndOfFrame => true;
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
{

View File

@@ -12,7 +12,6 @@ namespace WaveHarmonic.Crest
/// <summary>
/// Data that gives depth of the water (height of sea level above water floor).
/// </summary>
[FilterEnum(nameof(_QuerySource), Filtered.Mode.Exclude, (int)LodQuerySource.CPU)]
[FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)]
public sealed partial class DepthLod : Lod<IDepthProvider>
{
@@ -34,12 +33,11 @@ namespace WaveHarmonic.Crest
// We want the clear color to be the mininimum terrain height (-1000m).
// Mathf.Infinity can cause problems for distance.
static readonly Color s_NullColor = new(-k_DepthBaseline, k_DepthBaseline, 0, 0);
static Color NullColor => Helpers.IsWebGPU ? new(float.MinValue, float.MaxValue, 0, 0) : s_NullColor;
internal override string ID => "Depth";
internal override string Name => "Water Depth";
internal override Color GizmoColor => s_GizmoColor;
private protected override Color ClearColor => NullColor;
private protected override Color ClearColor => s_NullColor;
private protected override bool NeedToReadWriteTextureData => true;
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
@@ -58,7 +56,7 @@ namespace WaveHarmonic.Crest
{
if (_NullTexture == null)
{
var texture = TextureArrayHelpers.CreateTexture2D(NullColor, UnityEngine.TextureFormat.RFloat);
var texture = TextureArrayHelpers.CreateTexture2D(s_NullColor, UnityEngine.TextureFormat.RFloat);
texture.name = $"_Crest_{ID}LodTemporaryDefaultTexture";
_NullTexture = TextureArrayHelpers.CreateTexture2DArray(texture, k_MaximumSlices);
_NullTexture.name = $"_Crest_{ID}LodDefaultTexture";
@@ -73,16 +71,13 @@ namespace WaveHarmonic.Crest
{
_Enabled = true;
_TextureFormat = GraphicsFormat.R16G16_SFloat;
_MaximumQueryCount = 512;
}
private protected override IDepthProvider CreateProvider(bool enable)
{
Queryable?.CleanUp();
// Depth is GPU only, and can only be queried using the compute path.
return enable && Enabled && QuerySource == LodQuerySource.GPU
? IDepthProvider.Create(_Water)
: IDepthProvider.None;
return enable && Enabled ? new DepthQuery(_Water) : IDepthProvider.None;
}
internal static readonly SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);

View File

@@ -10,7 +10,6 @@ namespace WaveHarmonic.Crest
/// <summary>
/// Simulates horizontal motion of water.
/// </summary>
[FilterEnum(nameof(_QuerySource), Filtered.Mode.Exclude, (int)LodQuerySource.CPU)]
[FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)]
public sealed partial class FlowLod : Lod<IFlowProvider>
{
@@ -35,7 +34,6 @@ namespace WaveHarmonic.Crest
{
_Resolution = 128;
_TextureFormat = GraphicsFormat.R16G16_SFloat;
_MaximumQueryCount = 1024;
}
internal override void Enable()
@@ -56,9 +54,7 @@ namespace WaveHarmonic.Crest
{
Queryable?.CleanUp();
// Flow is GPU only, and can only be queried using the compute path.
return enable && Enabled && QuerySource == LodQuerySource.GPU
? IFlowProvider.Create(_Water)
: IFlowProvider.None;
return enable && Enabled ? new FlowQuery(_Water) : IFlowProvider.None;
}
internal static readonly SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);

View File

@@ -63,35 +63,23 @@ namespace WaveHarmonic.Crest
_FollowHorizontalWaveMotion = true;
}
private protected override void Initialize()
{
base.Initialize();
_Reporter ??= new(this);
_DisplacementReporter = _Reporter;
}
private protected override void OnDisable()
{
base.OnDisable();
_DisplacementReporter = null;
}
internal override float Filter(WaterRenderer water, int slice)
{
return AnimatedWavesLod.FilterByWavelength(water, slice, _FilterByWavelength ? _OctaveWavelength : 0f);
}
bool ReportDisplacement(WaterRenderer water, ref Rect bounds, ref float horizontal, ref float vertical)
private protected override void OnUpdate(WaterRenderer water)
{
base.OnUpdate(water);
if (!Enabled)
{
return false;
return;
}
var maxDispVert = _MaximumDisplacementVertical;
// let water system know how far from the sea level this shape may displace the surface
// TODO: we need separate min/max vertical displacement to be optimal.
if (_ReportRendererBounds)
{
var range = Data.HeightRange;
@@ -101,34 +89,10 @@ namespace WaveHarmonic.Crest
maxDispVert = Mathf.Max(maxDispVert, Mathf.Abs(seaLevel - minY), Mathf.Abs(seaLevel - maxY));
}
var rect = Data.Rect;
if (bounds.Overlaps(rect, false))
if (_MaximumDisplacementHorizontal > 0f || maxDispVert > 0f)
{
horizontal += _MaximumDisplacementHorizontal;
vertical += maxDispVert;
return true;
water.ReportMaximumDisplacement(_MaximumDisplacementHorizontal, maxDispVert, 0f);
}
return false;
}
float ReportWaveDisplacement(WaterRenderer water, float displacement)
{
return displacement;
}
}
partial class AnimatedWavesLodInput
{
Reporter _Reporter;
sealed class Reporter : IReportsDisplacement, IReportWaveDisplacement
{
readonly AnimatedWavesLodInput _Input;
public Reporter(AnimatedWavesLodInput input) => _Input = input;
public bool ReportDisplacement(WaterRenderer water, ref Rect bounds, ref float horizontal, ref float vertical) => _Input.ReportDisplacement(water, ref bounds, ref horizontal, ref vertical);
public float ReportWaveDisplacement(WaterRenderer water, float displacement) => _Input.ReportWaveDisplacement(water, displacement);
}
}

View File

@@ -2,7 +2,6 @@
// Copyright © 2024 Wave Harmonic. All rights reserved.
using UnityEngine;
using WaveHarmonic.Crest.Internal;
namespace WaveHarmonic.Crest
{
@@ -39,6 +38,8 @@ namespace WaveHarmonic.Crest
private protected override bool FollowHorizontalMotion => true;
internal override LodInputMode DefaultMode => LodInputMode.Geometry;
internal Rect _Rect;
internal override void InferBlend()
{
base.InferBlend();
@@ -55,60 +56,35 @@ namespace WaveHarmonic.Crest
{
base.Initialize();
_Reporter ??= new(this);
_HeightReporter = _Reporter;
WaterChunkRenderer.HeightReporters.Add(_Reporter);
}
private protected override void OnDisable()
{
base.OnDisable();
_HeightReporter = null;
WaterChunkRenderer.HeightReporters.Remove(_Reporter);
}
bool ReportHeight(WaterRenderer water, ref Rect bounds, ref float minimum, ref float maximum)
bool ReportHeight(ref Rect bounds, ref float minimum, ref float maximum)
{
if (!Enabled)
{
return false;
}
_Rect = Data.Rect;
// These modes do not provide a height yet.
if (!Data.HasHeightRange && !_OverrideHeight)
{
return false;
}
var rect = Data.Rect;
if (bounds.Overlaps(rect, false))
if (bounds.Overlaps(_Rect, false))
{
var range = _OverrideHeight ? _HeightRange : Data.HeightRange;
range *= Weight;
// Make relative to sea level.
range.x -= water.SeaLevel;
range.y -= water.SeaLevel;
var r = new Vector2(minimum, maximum);
range = _Blend switch
{
LodInputBlend.Additive => range + r,
LodInputBlend.Minimum => Vector2.Min(range, r),
LodInputBlend.Maximum => Vector2.Max(range, r),
_ => range,
};
if (rect.Encapsulates(bounds))
{
minimum = range.x;
maximum = range.y;
}
else
{
minimum = Mathf.Min(minimum, range.x);
maximum = Mathf.Max(maximum, range.y);
}
minimum = range.x;
maximum = range.y;
return true;
}
@@ -124,8 +100,7 @@ namespace WaveHarmonic.Crest
{
readonly LevelLodInput _Input;
public Reporter(LevelLodInput input) => _Input = input;
public bool ReportHeight(WaterRenderer water, ref Rect bounds, ref float minimum, ref float maximum) =>
_Input.ReportHeight(water, ref bounds, ref minimum, ref maximum);
public bool ReportHeight(ref Rect bounds, ref float minimum, ref float maximum) => _Input.ReportHeight(ref bounds, ref minimum, ref maximum);
}
}

View File

@@ -36,10 +36,6 @@ namespace WaveHarmonic.Crest
MonoBehaviour Component { get; }
IReportsHeight HeightReporter => null;
IReportsDisplacement DisplacementReporter => null;
IReportWaveDisplacement WaveDisplacementReporter => null;
// Allow sorting within a queue. Callers can pass in things like sibling index to
// get deterministic sorting.
int Order => Queue * k_QueueMaximumSubIndex + Mathf.Min(Component.transform.GetSiblingIndex(), k_QueueMaximumSubIndex - 1);
@@ -380,16 +376,6 @@ namespace WaveHarmonic.Crest
//
#if UNITY_EDITOR
void SetMode(LodInputMode previous, LodInputMode current)
{
if (previous == current) return;
if (!isActiveAndEnabled) { ChangeMode(Mode); return; }
OnDisable();
ChangeMode(Mode);
UnityEditor.EditorTools.ToolManager.RefreshAvailableTools();
OnEnable();
}
[@OnChange(skipIfInactive: false)]
void OnChange(string propertyPath, object previousValue)
{
@@ -399,7 +385,11 @@ namespace WaveHarmonic.Crest
SetQueue((int)previousValue, _Queue);
break;
case nameof(_Mode):
SetMode((LodInputMode)previousValue, Mode);
if (!isActiveAndEnabled) { ChangeMode(Mode); break; }
OnDisable();
ChangeMode(Mode);
UnityEditor.EditorTools.ToolManager.RefreshAvailableTools();
OnEnable();
break;
case nameof(_Blend):
// TODO: Make compatible with disabled.
@@ -477,9 +467,6 @@ namespace WaveHarmonic.Crest
partial class LodInput
{
Input _Input;
private protected IReportsHeight _HeightReporter;
internal IReportsDisplacement _DisplacementReporter;
private protected IReportWaveDisplacement _WaveDisplacementReporter;
sealed class Input : ILodInput
{
@@ -491,9 +478,6 @@ namespace WaveHarmonic.Crest
public int Pass => _Input.Pass;
public Rect Rect => _Input.Rect;
public MonoBehaviour Component => _Input;
public IReportsHeight HeightReporter => _Input._HeightReporter;
public IReportsDisplacement DisplacementReporter => _Input._DisplacementReporter;
public IReportWaveDisplacement WaveDisplacementReporter => _Input._WaveDisplacementReporter;
public float Filter(WaterRenderer water, int slice) => _Input.Filter(water, slice);
public void Draw(Lod lod, CommandBuffer buffer, RenderTargetIdentifier target, int pass = -1, float weight = 1, int slice = -1) => _Input.Draw(lod, buffer, target, pass, weight, slice);
}

View File

@@ -2,15 +2,10 @@
// Copyright © 2024 Wave Harmonic. All rights reserved.
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using WaveHarmonic.Crest.Internal;
using WaveHarmonic.Crest.Utility;
#if !UNITY_6000_0_OR_NEWER
using GraphicsFormatUsage = UnityEngine.Experimental.Rendering.FormatUsage;
#endif
namespace WaveHarmonic.Crest
{
/// <summary>
@@ -363,17 +358,16 @@ namespace WaveHarmonic.Crest
return texture != null &&
texture.width != _Resolution ||
texture.height != _Resolution ||
texture.graphicsFormat != (target ? SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil) : FinalFormat);
texture.format != (target ? RenderTextureFormat.Depth : FinalFormat);
}
GraphicsFormat FinalFormat => _GenerateSignedDistanceField ? Helpers.GetCompatibleTextureFormat(GraphicsFormat.R32G32_SFloat, true) : GraphicsFormat.R32_SFloat;
RenderTextureFormat FinalFormat => _GenerateSignedDistanceField ? RenderTextureFormat.RGFloat : RenderTextureFormat.RFloat;
void MakeRT(RenderTexture texture, bool target)
{
var format = target ? SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil) : FinalFormat;
var format = target ? RenderTextureFormat.Depth : FinalFormat;
var descriptor = texture.descriptor;
descriptor.graphicsFormat = target ? GraphicsFormat.None : format;
descriptor.depthStencilFormat = target ? format : GraphicsFormat.None;
descriptor.colorFormat = format;
descriptor.width = descriptor.height = _Resolution;
descriptor.depthBufferBits = target ? 24 : 0;
descriptor.useMipMap = false;
@@ -381,11 +375,7 @@ namespace WaveHarmonic.Crest
descriptor.enableRandomWrite = !target;
texture.descriptor = descriptor;
texture.Create();
if (!target)
{
Debug.Assert(SystemInfo.IsFormatSupported(format, GraphicsFormatUsage.Sample), "Crest: The graphics device does not support the render texture format " + format.ToString());
}
Debug.Assert(SystemInfo.SupportsRenderTextureFormat(format), "Crest: The graphics device does not support the render texture format " + format.ToString());
}
bool InitObjects()
@@ -714,7 +704,7 @@ namespace WaveHarmonic.Crest
var descriptor = new RenderTextureDescriptor(_Resolution, _Resolution)
{
autoGenerateMips = false,
graphicsFormat = Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16G16_SFloat, true),
colorFormat = RenderTextureFormat.RGHalf,
useMipMap = false,
enableRandomWrite = true,
depthBufferBits = 0,

View File

@@ -16,19 +16,19 @@ namespace WaveHarmonic.Crest
[Tooltip("Whether to use the wind turbulence on this component rather than the global wind turbulence.\n\nGlobal wind turbulence comes from the Water Renderer component.")]
[@GenerateAPI]
[@InlineToggle(order = -4), SerializeField]
[@InlineToggle(order = -3), SerializeField]
bool _OverrideGlobalWindTurbulence;
[Tooltip("How turbulent/chaotic the waves are.")]
[@Predicated(nameof(_OverrideGlobalWindTurbulence), hide: true)]
[@ShowComputedProperty(nameof(WindTurbulence))]
[@Range(0, 1, order = -5)]
[@Range(0, 1, order = -4)]
[@GenerateAPI(Getter.Custom)]
[SerializeField]
float _WindTurbulence = 0.145f;
[Tooltip("How aligned the waves are with wind.")]
[@Range(0, 1, order = -6)]
[@Range(0, 1, order = -5)]
[@GenerateAPI]
[SerializeField]
float _WindAlignment;
@@ -37,7 +37,7 @@ namespace WaveHarmonic.Crest
// Generation
[Tooltip("FFT waves will loop with a period of this many seconds.")]
[@Range(4f, 128f, Range.Clamp.Minimum, order = -6)]
[@Range(4f, 128f, Range.Clamp.Minimum)]
[@GenerateAPI]
[SerializeField]
float _TimeLoopLength = Mathf.Infinity;
@@ -45,11 +45,6 @@ namespace WaveHarmonic.Crest
[Header("Culling")]
[Tooltip("Whether to override automatic culling based on heuristics.")]
[@GenerateAPI]
[SerializeField]
bool _OverrideCulling;
[Tooltip("Maximum amount the surface will be displaced vertically from sea level.\n\nIncrease this if gaps appear at bottom of screen.")]
[@GenerateAPI]
[SerializeField]
@@ -109,9 +104,8 @@ namespace WaveHarmonic.Crest
#endif
_TimeLoopLength;
// WebGPU will crash above at 128.
private protected override int MinimumResolution => 16;
private protected override int MaximumResolution => Helpers.IsWebGPU ? 64 : int.MaxValue;
private protected override int MaximumResolution => int.MaxValue;
FFTCompute _FFTCompute;
@@ -195,28 +189,13 @@ namespace WaveHarmonic.Crest
{
if (!Enabled) return;
if (_OverrideCulling)
{
// Apply weight or will cause popping due to scale change.
MaximumReportedHorizontalDisplacement = _MaximumHorizontalDisplacement * Weight;
MaximumReportedVerticalDisplacement = MaximumReportedWavesDisplacement = _MaximumVerticalDisplacement * Weight;
}
else
{
var powerLinear = 0f;
// Apply weight or will cause popping due to scale change.
MaximumReportedHorizontalDisplacement = _MaximumHorizontalDisplacement * Weight;
MaximumReportedVerticalDisplacement = MaximumReportedWavesDisplacement = _MaximumVerticalDisplacement * Weight;
for (var i = 0; i < WaveSpectrum.k_NumberOfOctaves; i++)
{
powerLinear += _ActiveSpectrum._PowerLinearScales[i];
}
// Empirical multiplier (3-5), went with 5 to be safe.
// We may be missing some more multipliers from the compute shader.
// Look there if this proves insufficient.
var wind = Mathf.Clamp01(WindSpeedKPH / 150f);
var rms = Mathf.Sqrt(powerLinear) * 5f;
MaximumReportedHorizontalDisplacement = rms * _ActiveSpectrum._Chop * Weight * wind;
MaximumReportedVerticalDisplacement = MaximumReportedWavesDisplacement = rms * Weight * wind;
if (Mode == LodInputMode.Global)
{
water.ReportMaximumDisplacement(MaximumReportedHorizontalDisplacement, MaximumReportedVerticalDisplacement, MaximumReportedVerticalDisplacement);
}
}
@@ -288,7 +267,6 @@ namespace WaveHarmonic.Crest
}
_Version = MigrateV2(_Version);
_Version = MigrateV3(_Version);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()

View File

@@ -21,12 +21,12 @@ namespace WaveHarmonic.Crest
[Tooltip("Use a swell spectrum as the default.\n\nUses a swell spectrum as default (when none is assigned), and disabled reverse waves.")]
[@GenerateAPI]
[@DecoratedField(order = -4), SerializeField]
[@DecoratedField(order = -3), SerializeField]
bool _Swell = true;
[Tooltip("The weight of the opposing, second pair of Gerstner waves.\n\nEach Gerstner wave is actually a pair of waves travelling in opposite directions (similar to FFT). This weight is applied to the wave travelling in against-wind direction. Set to zero to obtain simple single waves which are useful for shorelines waves.")]
[Predicated(nameof(_Swell), inverted: true)]
[@Range(0f, 1f, order = -5)]
[@Range(0f, 1f, order = -4)]
[@GenerateAPI(Getter.Custom)]
[SerializeField]
float _ReverseWaveWeight = 0.5f;
@@ -35,25 +35,23 @@ namespace WaveHarmonic.Crest
// Generation Settings
[Tooltip("How many wave components to generate in each octave.")]
[@Delayed(order = -5)]
[@Delayed]
[@GenerateAPI]
[SerializeField]
int _ComponentsPerOctave = 8;
[Tooltip("Change to get a different set of waves.")]
[@GenerateAPI]
[@DecoratedField(order = -6)]
[SerializeField]
int _RandomSeed = 0;
[Tooltip("Prevent data arrays from being written to so one can provide their own.")]
[@GenerateAPI]
[@DecoratedField(order = -7)]
[SerializeField]
bool _ManualGeneration;
private protected override int MinimumResolution => 8;
private protected override int MaximumResolution => int.MaxValue;
private protected override int MaximumResolution => 64;
float _WindSpeedWhenGenerated = -1f;
@@ -181,7 +179,7 @@ namespace WaveHarmonic.Crest
{
if (_WaveBuffers == null)
{
_WaveBuffers = new(Resolution, Resolution, 0, Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16G16B16A16_SFloat, randomWrite: true));
_WaveBuffers = new(_Resolution, _Resolution, 0, GraphicsFormat.R16G16B16A16_SFloat);
}
else
{
@@ -189,7 +187,7 @@ namespace WaveHarmonic.Crest
}
{
_WaveBuffers.width = _WaveBuffers.height = Resolution;
_WaveBuffers.width = _WaveBuffers.height = _Resolution;
_WaveBuffers.wrapMode = TextureWrapMode.Clamp;
_WaveBuffers.antiAliasing = 1;
_WaveBuffers.filterMode = FilterMode.Bilinear;
@@ -218,7 +216,7 @@ namespace WaveHarmonic.Crest
base.OnUpdate(water);
if (_WaveBuffers == null || Resolution != _WaveBuffers.width || _BufferCascadeParameters == null || _BufferWaveData == null)
if (_WaveBuffers == null || _Resolution != _WaveBuffers.width || _BufferCascadeParameters == null || _BufferWaveData == null)
{
InitData();
}
@@ -548,23 +546,23 @@ namespace WaveHarmonic.Crest
return;
}
MaximumReportedVerticalDisplacement = 0;
MaximumReportedHorizontalDisplacement = 0;
var ampSum = 0f;
for (var i = 0; i < _Wavelengths.Length; i++)
{
var amplitude = _Amplitudes[i];
MaximumReportedVerticalDisplacement += amplitude;
MaximumReportedHorizontalDisplacement += amplitude * _ActiveSpectrum._ChopScales[i / _ComponentsPerOctave];
ampSum += _Amplitudes[i] * _ActiveSpectrum._ChopScales[i / _ComponentsPerOctave];
}
MaximumReportedHorizontalDisplacement *= _ActiveSpectrum._Chop;
// Apply weight or will cause popping due to scale change.
MaximumReportedVerticalDisplacement *= Weight;
MaximumReportedHorizontalDisplacement *= Weight;
ampSum *= Weight;
MaximumReportedWavesDisplacement = MaximumReportedVerticalDisplacement;
MaximumReportedHorizontalDisplacement = ampSum * _ActiveSpectrum._Chop;
MaximumReportedVerticalDisplacement = ampSum;
MaximumReportedWavesDisplacement = ampSum;
if (Mode == LodInputMode.Global)
{
water.ReportMaximumDisplacement(ampSum * _ActiveSpectrum._Chop, ampSum, ampSum);
}
}
private protected override void Initialize()
@@ -646,7 +644,6 @@ namespace WaveHarmonic.Crest
}
_Version = MigrateV2(_Version);
_Version = MigrateV3(_Version);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()

View File

@@ -4,7 +4,6 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
using WaveHarmonic.Crest.Internal;
namespace WaveHarmonic.Crest
{
@@ -36,13 +35,6 @@ namespace WaveHarmonic.Crest
[SerializeField]
float _RespectShallowWaterAttenuation = 1f;
[Tooltip("Whether global waves is applied above or below sea level.\n\nWaves are faded out to avoid hard transitionds. They are fully faded by 1m from sea level.")]
[@Predicated(nameof(_Mode), inverted: true, nameof(LodInputMode.Global))]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
bool _SeaLevelOnly = true;
[Tooltip("Whether to use the wind direction on this component rather than the global wind direction.\n\nGlobal wind direction comes from the Water Renderer component.")]
[@GenerateAPI]
[@InlineToggle, SerializeField]
@@ -76,21 +68,11 @@ namespace WaveHarmonic.Crest
[Tooltip("Resolution to use for wave generation buffers.\n\nLow resolutions are more efficient but can result in noticeable patterns in the shape.")]
[@Stepped(16, 512, step: 2, power: true)]
[@GenerateAPI(Getter.Custom)]
[@GenerateAPI]
[SerializeField]
private protected int _Resolution = 128;
[@Heading("Level of Detail")]
[Tooltip("Whether the maximum possible vertical displacement is used for the Drop Detail Height Based On Waves calculation.\n\nThis setting is ignored for global waves, as they always contribute. For local waves, only enable for large areas that are treated like global waves (eg a storm).")]
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Global))]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
bool _IncludeInDropDetailHeightBasedOnWaves;
// Debug
[Tooltip("In Editor, shows the wave generation buffers on screen.")]
@@ -110,7 +92,6 @@ namespace WaveHarmonic.Crest
public static readonly int s_RespectShallowWaterAttenuation = Shader.PropertyToID("_Crest_RespectShallowWaterAttenuation");
public static readonly int s_MaximumAttenuationDepth = Shader.PropertyToID("_Crest_MaximumAttenuationDepth");
public static readonly int s_AxisX = Shader.PropertyToID("_Crest_AxisX");
public static readonly int s_SeaLevelOnly = Shader.PropertyToID("_Crest_SeaLevelOnly");
}
private protected virtual WaveSpectrum DefaultSpectrum => WindSpectrum;
@@ -155,7 +136,7 @@ namespace WaveHarmonic.Crest
/// <summary>
/// The wind speed in meters per second (MPS).
/// </summary>
/// <remarks>
/// /// <remarks>
/// Wind speed can come from this component or the <see cref="WaterRenderer"/>.
/// </remarks>
public float WindSpeedMPS => WindSpeedKPH / 3.6f;
@@ -169,15 +150,13 @@ namespace WaveHarmonic.Crest
{
base.Attach();
_Reporter ??= new(this);
_DisplacementReporter = _Reporter;
_WaveDisplacementReporter = _Reporter;
WaterChunkRenderer.DisplacementReporters.Add(_Reporter);
}
private protected override void Detach()
{
base.Detach();
_DisplacementReporter = null;
_WaveDisplacementReporter = null;
WaterChunkRenderer.DisplacementReporters.Remove(_Reporter);
}
internal override void Draw(Lod simulation, CommandBuffer buffer, RenderTargetIdentifier target, int pass = -1, float weight = 1f, int slice = -1)
@@ -210,13 +189,11 @@ namespace WaveHarmonic.Crest
// Input weight. Weight for each octave calculated in compute.
wrapper.SetFloat(LodInput.ShaderIDs.s_Weight, Weight);
wrapper.SetInteger(Crest.ShaderIDs.s_Resolution, Resolution);
var water = shape._Water;
for (var lodIdx = lodCount - 1; lodIdx >= lodCount - slice; lodIdx--)
{
_WaveBufferParameters[lodIdx] = new(-1, -2, 0, 1);
_WaveBufferParameters[lodIdx] = new(-1, -2, 0, 0);
var found = false;
var filter = new AnimatedWavesLod.WavelengthFilter(water, lodIdx);
@@ -244,11 +221,7 @@ namespace WaveHarmonic.Crest
}
// Set transitional weights.
if (!shape.PreserveWaveQuality)
{
_WaveBufferParameters[lodCount - 2].w = 1f - water.ViewerAltitudeLevelAlpha;
}
_WaveBufferParameters[lodCount - 2].w = 1f - water.ViewerAltitudeLevelAlpha;
_WaveBufferParameters[lodCount - 1].w = water.ViewerAltitudeLevelAlpha;
SetRenderParameters(water, wrapper);
@@ -270,8 +243,6 @@ namespace WaveHarmonic.Crest
if (Mode == LodInputMode.Global)
{
wrapper.SetBoolean(ShaderIDs.s_SeaLevelOnly, _SeaLevelOnly);
var threads = shape.Resolution / Lod.k_ThreadGroupSize;
wrapper.Dispatch(threads, threads, slice);
}
@@ -440,109 +411,40 @@ namespace WaveHarmonic.Crest
s_KeywordTextureBlend = WaterResources.Instance.Keywords.AnimatedWavesTransferWavesTextureBlend;
}
bool ReportDisplacement(WaterRenderer water, ref Rect bounds, ref float horizontal, ref float vertical)
bool ReportDisplacement(ref Rect bounds, ref float horizontal, ref float vertical)
{
if (!Enabled)
if (Mode == LodInputMode.Global || !Enabled)
{
return false;
}
if (Mode == LodInputMode.Global)
{
// Global is always additive.
horizontal += MaximumReportedHorizontalDisplacement;
vertical += MaximumReportedVerticalDisplacement;
return true;
}
_Rect = Data.Rect;
if (bounds.Overlaps(_Rect, false))
{
var nh = horizontal;
var nv = vertical;
switch (Blend)
{
case LodInputBlend.Off:
nh = MaximumReportedHorizontalDisplacement;
nv = MaximumReportedVerticalDisplacement;
break;
case LodInputBlend.Additive:
nh += MaximumReportedHorizontalDisplacement;
nv += MaximumReportedVerticalDisplacement;
break;
case LodInputBlend.Alpha:
case LodInputBlend.AlphaClip:
nh = Mathf.Max(nh, MaximumReportedHorizontalDisplacement);
nv = Mathf.Max(nh, MaximumReportedVerticalDisplacement);
break;
}
if (_Rect.Encapsulates(bounds))
{
horizontal = nh;
vertical = nv;
}
else
{
horizontal = Mathf.Max(horizontal, nh);
vertical = Mathf.Max(vertical, nv);
}
horizontal = MaximumReportedHorizontalDisplacement;
vertical = MaximumReportedVerticalDisplacement;
return true;
}
return false;
}
float ReportWaveDisplacement(WaterRenderer water, float displacement)
{
if (Mode == LodInputMode.Global)
{
return displacement + MaximumReportedWavesDisplacement;
}
if (!_IncludeInDropDetailHeightBasedOnWaves)
{
return displacement;
}
// TODO: use bounds to transition slowly to avoid pops.
if (_Rect.Contains(water.Position.XZ()))
{
displacement = Blend switch
{
LodInputBlend.Off => MaximumReportedWavesDisplacement,
LodInputBlend.Additive => displacement + MaximumReportedWavesDisplacement,
LodInputBlend.Alpha or LodInputBlend.AlphaClip => Mathf.Max(displacement, MaximumReportedWavesDisplacement),
_ => MaximumReportedWavesDisplacement,
};
}
return displacement;
}
float GetWaveDirectionHeadingAngle()
{
return _OverrideGlobalWindDirection || WaterRenderer.Instance == null ? _WaveDirectionHeadingAngle : WaterRenderer.Instance.WindDirection;
}
internal int GetResolution()
{
return Mathf.Clamp(_Resolution, MinimumResolution, MaximumResolution);
}
}
partial class ShapeWaves
{
Reporter _Reporter;
sealed class Reporter : IReportsDisplacement, IReportWaveDisplacement
sealed class Reporter : IReportsDisplacement
{
readonly ShapeWaves _Input;
public Reporter(ShapeWaves input) => _Input = input;
public bool ReportDisplacement(WaterRenderer water, ref Rect bounds, ref float horizontal, ref float vertical) => _Input.ReportDisplacement(water, ref bounds, ref horizontal, ref vertical);
public float ReportWaveDisplacement(WaterRenderer water, float displacement) => _Input.ReportWaveDisplacement(water, displacement);
public bool ReportDisplacement(ref Rect bounds, ref float horizontal, ref float vertical) => _Input.ReportDisplacement(ref bounds, ref horizontal, ref vertical);
}
}
@@ -612,17 +514,6 @@ namespace WaveHarmonic.Crest
return version;
}
private protected int MigrateV3(int version)
{
if (version < 3)
{
_SeaLevelOnly = false;
version = 3;
}
return version;
}
}
#if UNITY_EDITOR

View File

@@ -45,7 +45,7 @@ namespace WaveHarmonic.Crest
wrapper.SetVector(ShaderIDs.s_TextureSize, transform.lossyScale.XZ());
wrapper.SetVector(ShaderIDs.s_TexturePosition, transform.position.XZ());
wrapper.SetVector(ShaderIDs.s_TextureRotation, rotation);
wrapper.SetVector(ShaderIDs.s_TextureResolution, new(_Texture.width, _Texture.height));
wrapper.SetVector(ShaderIDs.s_Resolution, new(_Texture.width, _Texture.height));
wrapper.SetVector(ShaderIDs.s_Multiplier, _Multiplier);
wrapper.SetFloat(ShaderIDs.s_FeatherWidth, _Input.FeatherWidth);
wrapper.SetTexture(ShaderIDs.s_Texture, _Texture);

View File

@@ -41,7 +41,6 @@ namespace WaveHarmonic.Crest
_OverrideResolution = false;
_TextureFormatMode = LodTextureFormatMode.Automatic;
_TextureFormat = GraphicsFormat.R16_SFloat;
_BlurIterations = 4;
}
internal static readonly SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);

View File

@@ -1,20 +1,19 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using WaveHarmonic.Crest.Internal;
using WaveHarmonic.Crest.Utility;
#if !UNITY_6000_0_OR_NEWER
#if !UNITY_2023_2_OR_NEWER
using GraphicsFormatUsage = UnityEngine.Experimental.Rendering.FormatUsage;
#endif
namespace WaveHarmonic.Crest
{
using Inputs = Utility.SortedList<int, ILodInput>;
using Inputs = SortedList<int, ILodInput>;
/// <summary>
/// Texture format preset.
@@ -53,7 +52,7 @@ namespace WaveHarmonic.Crest
[Tooltip("Whether to override the resolution.\n\nIf not enabled, then the simulation will use the resolution defined on the Water Renderer.")]
[@Predicated(typeof(AnimatedWavesLod), inverted: true, hide: true)]
[@GenerateAPI(Setter.Dirty)]
[@InlineToggle, SerializeField]
[@InlineToggle(fix: true), SerializeField]
internal bool _OverrideResolution = true;
[Tooltip("The resolution of the simulation data.\n\nSet higher for sharper results at the cost of higher memory usage.")]
@@ -78,28 +77,12 @@ namespace WaveHarmonic.Crest
[@DecoratedField, SerializeField]
internal GraphicsFormat _TextureFormat;
[@Space(10)]
[Tooltip("Blurs the output.\n\nEnable if blurring is desired or intolerable artifacts are present.\nThe blur is optimized to only run on inner LODs and at lower scales.")]
[@Predicated(typeof(AnimatedWavesLod), inverted: true, hide: true)]
[@Predicated(typeof(DynamicWavesLod), inverted: true, hide: true)]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
private protected bool _Blur;
[Tooltip("Number of blur iterations.\n\nBlur iterations are optimized to only run maximum iterations on the inner LODs.")]
[@Predicated(typeof(AnimatedWavesLod), inverted: true, hide: true)]
[@Predicated(typeof(DynamicWavesLod), inverted: true, hide: true)]
[@Predicated(nameof(_Blur))]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
private protected int _BlurIterations = 1;
// NOTE: This MUST match the value in Constants.hlsl, as it
// determines the size of the texture arrays in the shaders.
internal const int k_MaximumSlices = 15;
// NOTE: these MUST match the values in Constants.hlsl
// 64 recommended as a good common minimum: https://www.reddit.com/r/GraphicsProgramming/comments/aeyfkh/for_compute_shaders_is_there_an_ideal_numthreads/
internal const int k_ThreadGroupSize = 8;
internal const int k_ThreadGroupSizeX = k_ThreadGroupSize;
internal const int k_ThreadGroupSizeY = k_ThreadGroupSize;
@@ -108,7 +91,6 @@ namespace WaveHarmonic.Crest
{
public static readonly int s_LodIndex = Shader.PropertyToID("_Crest_LodIndex");
public static readonly int s_LodChange = Shader.PropertyToID("_Crest_LodChange");
public static readonly int s_TemporaryBlurLodTexture = Shader.PropertyToID("_Crest_TemporaryBlurLodTexture");
}
// Used for creating shader property names etc.
@@ -162,9 +144,6 @@ namespace WaveHarmonic.Crest
// Always use linear filtering.
GraphicsFormatUsage.Linear;
private protected virtual bool Persistent => BufferCount > 1;
internal virtual bool SkipEndOfFrame => false;
private protected BufferedData<RenderTexture> _Targets;
internal RenderTexture DataTexture => _Targets.Current;
internal RenderTexture GetDataTexture(int frameDelta) => _Targets.Previous(frameDelta);
@@ -223,7 +202,7 @@ namespace WaveHarmonic.Crest
return result;
}
private protected void FlipBuffers(CommandBuffer commands)
private protected void FlipBuffers()
{
if (_ReAllocateTexture)
{
@@ -239,9 +218,7 @@ namespace WaveHarmonic.Crest
_SamplingParameters.Flip();
}
UpdateSamplingParameters(commands);
commands.SetGlobalTexture(_TextureShaderID, DataTexture);
UpdateSamplingParameters();
}
private protected void Clear(RenderTexture target)
@@ -249,12 +226,21 @@ namespace WaveHarmonic.Crest
Helpers.ClearRenderTexture(target, ClearColor, depth: false);
}
/// <summary>
/// Clears persistent LOD data. Some simulations have persistent data which can linger for a little while after
/// being disabled. This will manually clear that data.
/// </summary>
internal virtual void ClearLodData()
{
// Empty.
}
private protected virtual bool AlwaysClear => false;
// Only works with input-only data (ie no simulation steps).
internal virtual void BuildCommandBuffer(WaterRenderer water, CommandBuffer buffer)
{
FlipBuffers(buffer);
FlipBuffers();
buffer.BeginSample(ID);
@@ -262,18 +248,6 @@ namespace WaveHarmonic.Crest
{
CoreUtils.SetRenderTarget(buffer, DataTexture, ClearFlag.Color, ClearColor);
// Custom clear because clear not working.
if (Helpers.IsWebGPU && WaterResources.Instance.Compute._Clear != null)
{
var compute = WaterResources.Instance._ComputeLibrary._ClearCompute;
var wrapper = new PropertyWrapperCompute(buffer, compute._Shader, compute._KernelClearTarget);
compute.SetVariantForFormat(wrapper, CompatibleTextureFormat);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
wrapper.SetVector(Crest.ShaderIDs.s_ClearMask, Color.white);
wrapper.SetVector(Crest.ShaderIDs.s_ClearColor, ClearColor);
wrapper.Dispatch(Resolution / k_ThreadGroupSizeX, Resolution / k_ThreadGroupSizeY, Slices);
}
_TargetsToClear--;
}
@@ -285,8 +259,6 @@ namespace WaveHarmonic.Crest
_TargetsToClear = _Targets.Size;
}
TryBlur(buffer);
if (RequiresClearBorder)
{
ClearBorder(buffer);
@@ -382,18 +354,14 @@ namespace WaveHarmonic.Crest
{
var size = Resolution / 8;
var compute = WaterResources.Instance._ComputeLibrary._ClearCompute;
var wrapper = new PropertyWrapperCompute(buffer, compute._Shader, compute._KernelClearTargetBoundaryX);
// Only need to be done once.
compute.SetVariantForFormat(wrapper, DataTexture.graphicsFormat);
var wrapper = new PropertyWrapperCompute(buffer, WaterResources.Instance.Compute._Clear, 1);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
wrapper.SetVector(Crest.ShaderIDs.s_ClearColor, ClearColor);
wrapper.SetInteger(Crest.ShaderIDs.s_Resolution, Resolution);
wrapper.SetInteger(Crest.ShaderIDs.s_TargetSlice, Slices - 1);
wrapper.Dispatch(size, 1, 1);
wrapper = new(buffer, compute._Shader, compute._KernelClearTargetBoundaryY);
wrapper = new PropertyWrapperCompute(buffer, WaterResources.Instance.Compute._Clear, 2);
wrapper.SetTexture(Crest.ShaderIDs.s_Target, DataTexture);
wrapper.SetVector(Crest.ShaderIDs.s_ClearColor, ClearColor);
wrapper.SetInteger(Crest.ShaderIDs.s_Resolution, Resolution);
@@ -401,7 +369,7 @@ namespace WaveHarmonic.Crest
wrapper.Dispatch(1, size, 1);
}
void UpdateSamplingParameters(CommandBuffer commands, bool initialize = false)
void UpdateSamplingParameters(bool initialize = false)
{
var position = _Water.Position;
var resolution = _Enabled ? Resolution : TextureArrayHelpers.k_SmallTextureSize;
@@ -412,7 +380,7 @@ namespace WaveHarmonic.Crest
for (var slice = 0; slice < levels; slice++)
{
// Find snap period.
var texel = 2f * 2f * _Water.CascadeData.Current[slice].x / resolution;
var texel = 2f * 2f * _Water._CascadeData.Current[slice].x / resolution;
// Snap so that shape texels are stationary.
var snapped = position - new Vector3(Mathf.Repeat(position.x, texel), 0, Mathf.Repeat(position.z, texel));
@@ -424,20 +392,11 @@ namespace WaveHarmonic.Crest
_ViewMatrices[slice] = WaterRenderer.CalculateViewMatrixFromSnappedPositionRHS(snapped);
}
if (!initialize)
if (initialize)
{
commands.SetGlobalVector(_SamplingParametersShaderID, new(levels, resolution, 1f / resolution, 0));
commands.SetGlobalVectorArray(_SamplingParametersCascadeShaderID, parameters);
if (BufferCount > 1)
{
commands.SetGlobalVectorArray(_SamplingParametersCascadeSourceShaderID, _SamplingParameters.Previous(1));
}
return;
Shader.SetGlobalVector(_SamplingParametersShaderID, new(levels, resolution, 1f / resolution, 0));
}
Shader.SetGlobalVector(_SamplingParametersShaderID, new(levels, resolution, 1f / resolution, 0));
Shader.SetGlobalVectorArray(_SamplingParametersCascadeShaderID, parameters);
if (BufferCount > 1)
@@ -521,50 +480,6 @@ namespace WaveHarmonic.Crest
return -1;
}
// Blurs the output if enabled.
private protected void TryBlur(CommandBuffer commands)
{
if (!_Blur || _Water.Scale >= 32)
{
return;
}
var rt = DataTexture;
var compute = WaterResources.Instance._ComputeLibrary._BlurCompute;
var horizontal = new PropertyWrapperCompute(commands, compute._Shader, compute._KernelHorizontal);
var vertical = new PropertyWrapperCompute(commands, compute._Shader, compute._KernelVertical);
var temporary = ShaderIDs.s_TemporaryBlurLodTexture;
commands.GetTemporaryRT(temporary, rt.descriptor);
commands.CopyTexture(rt, temporary);
// Applies to both.
compute.SetVariantForFormat(horizontal, rt.graphicsFormat);
horizontal.SetInteger(Crest.ShaderIDs.s_Resolution, rt.width);
horizontal.SetTexture(Crest.ShaderIDs.s_Source, temporary);
horizontal.SetTexture(Crest.ShaderIDs.s_Target, rt);
vertical.SetTexture(Crest.ShaderIDs.s_Source, rt);
vertical.SetTexture(Crest.ShaderIDs.s_Target, temporary);
var x = rt.width / 8;
var y = rt.height / 8;
// Skip outer LODs.
var z = Mathf.Min(rt.volumeDepth, 4);
for (var i = 0; i < _BlurIterations; i++)
{
// Limit number of iterations for outer LODs.
horizontal.Dispatch(x, y, Mathf.Max(z - i, 1));
vertical.Dispatch(x, y, Mathf.Max(z - i, 1));
}
commands.CopyTexture(temporary, rt);
commands.ReleaseTemporaryRT(temporary);
}
/// <summary>
/// Bind data needed to load or compute from this simulation.
/// </summary>
@@ -621,7 +536,7 @@ namespace WaveHarmonic.Crest
// For safety. Disable to see if we are sampling outside of LOD chain.
_SamplingParameters.RunLambda(x => System.Array.Fill(x, Vector4.zero));
UpdateSamplingParameters(null, initialize: true);
UpdateSamplingParameters(initialize: true);
}
internal virtual void Enable()
@@ -643,17 +558,6 @@ namespace WaveHarmonic.Crest
if (x != null) x.Release();
Helpers.Destroy(x);
});
foreach (var data in _AdditionalCameraData.Values)
{
data._Targets?.RunLambda(x =>
{
if (x != null) x.Release();
Helpers.Destroy(x);
});
}
_AdditionalCameraData.Clear();
}
internal virtual void AfterExecute()
@@ -663,13 +567,6 @@ namespace WaveHarmonic.Crest
private protected virtual void Allocate()
{
// Use per-camera data.
if (_Water.SeparateViewpoint && Persistent)
{
_ReAllocateTexture = false;
return;
}
_Targets = new(BufferCount, CreateLodDataTextures);
_Targets.RunLambda(Clear);
@@ -717,19 +614,9 @@ namespace WaveHarmonic.Crest
texture.Create();
});
foreach (var data in _AdditionalCameraData.Values)
{
data._Targets.RunLambda(texture =>
{
texture.Release();
texture.descriptor = descriptor;
texture.Create();
});
}
_ReAllocateTexture = false;
UpdateSamplingParameters(null, initialize: true);
UpdateSamplingParameters(initialize: true);
}
#if UNITY_EDITOR
@@ -752,70 +639,6 @@ namespace WaveHarmonic.Crest
#endif
}
partial class Lod
{
class AdditionalCameraData
{
public BufferedData<RenderTexture> _Targets;
public BufferedData<Vector4[]> _SamplingParameters;
}
readonly Dictionary<Camera, AdditionalCameraData> _AdditionalCameraData = new();
internal virtual void LoadCameraData(Camera camera)
{
Queryable?.Initialize(_Water);
// For non-persistent sims, we do not need to store per camera data.
if (!_Water.SeparateViewpoint || !Persistent)
{
return;
}
AdditionalCameraData data;
if (!_AdditionalCameraData.ContainsKey(camera))
{
data = new()
{
_Targets = new(BufferCount, CreateLodDataTextures),
_SamplingParameters = new(BufferCount, () => new Vector4[k_MaximumSlices]),
};
data._Targets.RunLambda(Clear);
_AdditionalCameraData.Add(camera, data);
}
else
{
data = _AdditionalCameraData[camera];
}
_Targets = data._Targets;
_SamplingParameters = data._SamplingParameters;
}
internal virtual void StoreCameraData(Camera camera)
{
}
internal void RemoveCameraData(Camera camera)
{
if (_AdditionalCameraData.ContainsKey(camera))
{
var acd = _AdditionalCameraData[camera];
acd._Targets.RunLambda(x =>
{
if (x != null) x.Release();
Helpers.Destroy(x);
});
_AdditionalCameraData.Remove(camera);
}
}
}
// API
partial class Lod
{
@@ -834,64 +657,17 @@ namespace WaveHarmonic.Crest
}
}
interface IQueryableLod<out T> where T : IQueryProvider
{
string Name { get; }
bool Enabled { get; }
WaterRenderer Water { get; }
int MaximumQueryCount { get; }
LodQuerySource QuerySource { get; }
}
/// <summary>
/// The source of collisions (ie water shape).
/// </summary>
[@GenerateDoc]
public enum LodQuerySource
{
/// <inheritdoc cref="Generated.LodQuerySource.None"/>
[Tooltip("No query source.")]
None,
/// <inheritdoc cref="Generated.LodQuerySource.GPU"/>
[Tooltip("Uses AsyncGPUReadback to retrieve data from GPU to CPU.\n\nThis is the most optimal approach.")]
GPU,
/// <inheritdoc cref="Generated.LodQuerySource.CPU"/>
[Tooltip("Computes data entirely on the CPU.")]
CPU,
}
/// <summary>
/// Base type for simulations with a provider.
/// </summary>
/// <typeparam name="T">The query provider.</typeparam>
[System.Serializable]
public abstract partial class Lod<T> : Lod, IQueryableLod<T> where T : IQueryProvider
public abstract class Lod<T> : Lod where T : IQueryProvider
{
[@Space(10)]
[Tooltip("Where to obtain water data on CPU for physics / gameplay.")]
[@GenerateAPI(Setter.Internal)]
[@Filtered]
[SerializeField]
private protected LodQuerySource _QuerySource = LodQuerySource.GPU;
[Tooltip("Maximum number of queries that can be performed when using GPU queries.")]
[@Predicated(nameof(_QuerySource), true, nameof(LodQuerySource.GPU))]
[@GenerateAPI(Setter.None)]
[@DecoratedField]
[SerializeField]
private protected int _MaximumQueryCount = QueryBase.k_DefaultMaximumQueryCount;
/// <summary>
/// Provides data from the GPU to CPU.
/// </summary>
public T Provider { get; set; }
WaterRenderer IQueryableLod<T>.Water => Water;
string IQueryableLod<T>.Name => Name;
private protected abstract T CreateProvider(bool enable);
internal override void SetGlobals(bool enable)
@@ -913,30 +689,4 @@ namespace WaveHarmonic.Crest
Queryable?.SendReadBack(_Water);
}
}
#if UNITY_EDITOR
partial class Lod<T>
{
private protected void ResetQueryChange()
{
if (_Water == null || !_Water.isActiveAndEnabled || !Enabled) return;
Queryable?.CleanUp();
InitializeProvider(true);
}
[@OnChange]
private protected override void OnChange(string path, object previous)
{
base.OnChange(path, previous);
switch (path)
{
case nameof(_QuerySource):
case nameof(_MaximumQueryCount):
ResetQueryChange();
break;
}
}
}
#endif
}

View File

@@ -43,8 +43,6 @@ namespace WaveHarmonic.Crest
private protected abstract ComputeShader SimulationShader { get; }
private protected abstract void GetSubstepData(float timeToSimulate, out int substeps, out float delta);
private protected override bool Persistent => true;
internal override void Initialize()
{
if (SimulationShader == null)
@@ -58,13 +56,19 @@ namespace WaveHarmonic.Crest
_NeedsPrewarmingThisStep = true;
}
internal override void ClearLodData()
{
base.ClearLodData();
_Targets.RunLambda(x => Clear(x));
}
internal override void BuildCommandBuffer(WaterRenderer water, CommandBuffer buffer)
{
buffer.BeginSample(ID);
if (!SkipFlipBuffers)
{
FlipBuffers(buffer);
FlipBuffers();
}
var slices = water.LodLevels;
@@ -137,7 +141,7 @@ namespace WaveHarmonic.Crest
// places.
wrapper.SetFloat(Lod.ShaderIDs.s_LodChange, isFirstStep ? _Water.ScaleDifferencePower2 : 0);
wrapper.SetVectorArray(WaterRenderer.ShaderIDs.s_CascadeDataSource, _Water.CascadeData.Previous(frame));
wrapper.SetVectorArray(WaterRenderer.ShaderIDs.s_CascadeDataSource, _Water._CascadeData.Previous(frame));
wrapper.SetVectorArray(_SamplingParametersCascadeSourceShaderID, _SamplingParameters.Previous(frame));
SetAdditionalSimulationParameters(wrapper);
@@ -170,8 +174,6 @@ namespace WaveHarmonic.Crest
// Set the target texture as to make sure we catch the 'pong' each frame.
Shader.SetGlobalTexture(_TextureShaderID, DataTexture);
TryBlur(buffer);
buffer.EndSample(ID);
}
@@ -183,58 +185,4 @@ namespace WaveHarmonic.Crest
}
}
partial class PersistentLod
{
class AdditionalCameraData
{
public float _TimeToSimulate;
public float _PreviousSubstepDeltaTime;
}
readonly System.Collections.Generic.Dictionary<Camera, AdditionalCameraData> _AdditionalCameraData = new();
internal override void LoadCameraData(Camera camera)
{
base.LoadCameraData(camera);
if (!_Water.SeparateViewpoint)
{
return;
}
AdditionalCameraData data;
if (!_AdditionalCameraData.ContainsKey(camera))
{
data = new()
{
_TimeToSimulate = _TimeToSimulate,
_PreviousSubstepDeltaTime = _PreviousSubstepDeltaTime,
};
_AdditionalCameraData.Add(camera, data);
}
else
{
data = _AdditionalCameraData[camera];
}
_TimeToSimulate = data._TimeToSimulate;
_PreviousSubstepDeltaTime = data._PreviousSubstepDeltaTime;
}
internal override void StoreCameraData(Camera camera)
{
base.StoreCameraData(camera);
if (!_Water.SeparateViewpoint)
{
return;
}
_AdditionalCameraData[camera]._TimeToSimulate = _TimeToSimulate;
_AdditionalCameraData[camera]._PreviousSubstepDeltaTime = _PreviousSubstepDeltaTime;
}
}
}

View File

@@ -38,17 +38,12 @@ namespace WaveHarmonic.Crest
internal static NoneProvider None { get; } = new();
internal static ICollisionProvider Create(WaterRenderer water)
{
return water.MultipleViewpoints ? new CollisionQueryPerCamera(water) : new CollisionQueryWithPasses(water);
}
/// <summary>
/// Gives a flat, still water.
/// </summary>
internal sealed class NoneProvider : ICollisionProvider
{
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result0, Vector3[] result1, Vector3[] result2, CollisionLayer _3 = CollisionLayer.Everything, Vector3? _4 = null)
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result0, Vector3[] result1, Vector3[] result2, CollisionLayer _3 = CollisionLayer.Everything)
{
if (result0 != null) System.Array.Fill(result0, Vector3.zero);
if (result1 != null) System.Array.Fill(result1, Vector3.up);
@@ -56,7 +51,7 @@ namespace WaveHarmonic.Crest
return 0;
}
public int Query(int _0, float _1, Vector3[] _2, float[] result0, Vector3[] result1, Vector3[] result2, CollisionLayer _3 = CollisionLayer.Everything, Vector3? _4 = null)
public int Query(int _0, float _1, Vector3[] _2, float[] result0, Vector3[] result1, Vector3[] result2, CollisionLayer _3 = CollisionLayer.Everything)
{
if (result0 != null) System.Array.Fill(result0, WaterRenderer.Instance.SeaLevel);
if (result1 != null) System.Array.Fill(result1, Vector3.up);
@@ -71,12 +66,12 @@ namespace WaveHarmonic.Crest
/// <param name="heights">Resulting heights (displacement Y + sea level) at the query positions. Pass null if this information is not required.</param>
/// <param name="normals">Resulting normals at the query positions. Pass null if this information is not required.</param>
/// <param name="velocities">Resulting velocities at the query positions. Pass null if this information is not required.</param>
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int, Vector3?)" />
int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null);
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int)" />
int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything);
/// <param name="displacements">Resulting displacement vectors at the query positions. Add sea level to Y to get world space height.</param>
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int, Vector3?)" />
/// <inheritdoc cref="Query(int, float, Vector3[], float[], Vector3[], Vector3[], CollisionLayer, Vector3?)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null);
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int)" />
/// <inheritdoc cref="Query(int, float, Vector3[], float[], Vector3[], Vector3[], CollisionLayer)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything);
}
}

View File

@@ -2,7 +2,6 @@
// Copyright © 2024 Wave Harmonic. All rights reserved.
using UnityEngine;
using WaveHarmonic.Crest.Internal;
namespace WaveHarmonic.Crest
{
@@ -11,10 +10,10 @@ namespace WaveHarmonic.Crest
/// </summary>
sealed class CollisionQuery : QueryBase, ICollisionProvider
{
public CollisionQuery(WaterRenderer water) : base(water.AnimatedWavesLod) { }
public CollisionQuery(WaterRenderer water) : base(water) { }
protected override int Kernel => 0;
public int Query(int ownerHash, float minSpatialLength, Vector3[] queryPoints, Vector3[] resultDisplacements, Vector3[] resultNormals, Vector3[] resultVelocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null)
public int Query(int ownerHash, float minSpatialLength, Vector3[] queryPoints, Vector3[] resultDisplacements, Vector3[] resultNormals, Vector3[] resultVelocities, CollisionLayer layer = CollisionLayer.Everything)
{
var result = (int)QueryStatus.OK;
@@ -36,7 +35,7 @@ namespace WaveHarmonic.Crest
return result;
}
public int Query(int ownerHash, float minimumSpatialLength, Vector3[] queryPoints, float[] resultHeights, Vector3[] resultNormals, Vector3[] resultVelocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null)
public int Query(int ownerHash, float minimumSpatialLength, Vector3[] queryPoints, float[] resultHeights, Vector3[] resultNormals, Vector3[] resultVelocities, CollisionLayer layer = CollisionLayer.Everything)
{
var result = (int)QueryStatus.OK;
@@ -59,102 +58,6 @@ namespace WaveHarmonic.Crest
}
}
sealed class CollisionQueryPerCamera : QueryPerCamera<CollisionQueryWithPasses>, ICollisionProvider
{
public CollisionQueryPerCamera() : base(WaterRenderer.Instance) { }
public CollisionQueryPerCamera(WaterRenderer water) : base(water) { }
public int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null)
{
if (_Water._InCameraLoop)
{
return _Providers[_Water.CurrentCamera].Query(hash, minimumLength, points, heights, normals, velocities, layer, center);
}
var lastStatus = -1;
var lastDistance = Mathf.Infinity;
var newCenter = FindCenter(points, center);
foreach (var provider in _Providers)
{
var camera = provider.Key;
if (!_Water.ShouldExecuteQueries(camera))
{
continue;
}
var distance = (newCenter - camera.transform.position.XZ()).sqrMagnitude;
if (lastStatus == (int)QueryBase.QueryStatus.OK && lastDistance < distance)
{
continue;
}
var status = provider.Value.Query(hash, minimumLength, points, heights, normals, velocities, layer, center);
if (lastStatus < 0 || status == (int)QueryBase.QueryStatus.OK)
{
lastStatus = status;
lastDistance = distance;
}
}
return lastStatus;
}
public int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null)
{
if (_Water._InCameraLoop)
{
return _Providers[_Water.CurrentCamera].Query(hash, minimumLength, points, displacements, normals, velocities, layer, center);
}
var lastStatus = -1;
var lastDistance = Mathf.Infinity;
var newCenter = FindCenter(points, center);
foreach (var provider in _Providers)
{
var camera = provider.Key;
if (!_Water.ShouldExecuteQueries(camera))
{
continue;
}
var distance = (newCenter - camera.transform.position.XZ()).sqrMagnitude;
if (lastStatus == (int)QueryBase.QueryStatus.OK && lastDistance < distance)
{
continue;
}
var status = provider.Value.Query(hash, minimumLength, points, displacements, normals, velocities, layer, center);
if (lastStatus < 0 || status == (int)QueryBase.QueryStatus.OK)
{
lastStatus = status;
lastDistance = distance;
}
}
return lastStatus;
}
public void SendReadBack(WaterRenderer water, CollisionLayers layers)
{
_Providers[water.CurrentCamera].SendReadBack(water, layers);
}
public void UpdateQueries(WaterRenderer water, CollisionLayer layer)
{
_Providers[water.CurrentCamera].UpdateQueries(water, layer);
}
}
sealed class CollisionQueryWithPasses : ICollisionProvider, IQueryable
{
readonly CollisionQuery _AnimatedWaves;
@@ -166,14 +69,6 @@ namespace WaveHarmonic.Crest
public int RequestCount => _AnimatedWaves.RequestCount + _DynamicWaves.RequestCount + _Displacement.RequestCount;
public int QueryCount => _AnimatedWaves.QueryCount + _DynamicWaves.QueryCount + _Displacement.QueryCount;
public CollisionQueryWithPasses()
{
_Water = WaterRenderer.Instance;
_AnimatedWaves = new(_Water);
_DynamicWaves = new(_Water);
_Displacement = new(_Water);
}
public CollisionQueryWithPasses(WaterRenderer water)
{
_Water = water;
@@ -212,12 +107,12 @@ namespace WaveHarmonic.Crest
return _AnimatedWaves;
}
public int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null)
public int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything)
{
return GetProvider(layer).Query(hash, minimumLength, points, heights, normals, velocities);
}
public int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null)
public int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything)
{
return GetProvider(layer).Query(hash, minimumLength, points, displacements, normals, velocities);
}
@@ -256,55 +151,13 @@ namespace WaveHarmonic.Crest
_DynamicWaves.CleanUp();
_Displacement.CleanUp();
}
public void Initialize(WaterRenderer water)
{
}
}
// These are required because of collision layer.
static partial class Extensions
{
public static void UpdateQueries(this ICollisionProvider self, WaterRenderer water, CollisionLayer layer)
{
if (self is CollisionQueryPerCamera a)
{
a.UpdateQueries(water, layer);
}
else if (self is CollisionQueryWithPasses b)
{
b.UpdateQueries(water, layer);
}
else if (self is ICollisionProvider.NoneProvider c)
{
}
else
{
Debug.LogError("Crest: no valid query provider. Report this to developers!");
}
}
public static void UpdateQueries(this ICollisionProvider self, WaterRenderer water, CollisionLayer layer) => (self as CollisionQueryWithPasses)?.UpdateQueries(water, layer);
public static void UpdateQueries(this ICollisionProvider self, WaterRenderer water) => (self as IQueryable)?.UpdateQueries(water);
public static void SendReadBack(this ICollisionProvider self, WaterRenderer water, CollisionLayers layer)
{
if (self is CollisionQueryPerCamera a)
{
a.SendReadBack(water, layer);
}
else if (self is CollisionQueryWithPasses b)
{
b.SendReadBack(water, layer);
}
else if (self is ICollisionProvider.NoneProvider c)
{
}
else
{
Debug.LogError("Crest: no valid query provider. Report this to developers!");
}
}
public static void SendReadBack(this ICollisionProvider self, WaterRenderer water, CollisionLayers layer) => (self as CollisionQueryWithPasses)?.SendReadBack(water, layer);
public static void CleanUp(this ICollisionProvider self) => (self as IQueryable)?.CleanUp();
}
}

View File

@@ -59,9 +59,7 @@ namespace WaveHarmonic.Crest
{
distance = -1f;
var id = GetHashCode();
Validate(allowMultipleCallsPerFrame: false, id);
Validate(allowMultipleCallsPerFrame: false);
var water = WaterRenderer.Instance;
var provider = water == null ? null : water.AnimatedWavesLod.Provider;
@@ -72,7 +70,7 @@ namespace WaveHarmonic.Crest
_QueryPosition[i] = origin + i * _RayStepSize * direction;
}
var status = provider.Query(id, _MinimumLength, _QueryPosition, _QueryResult, null, null, layer);
var status = provider.Query(GetHashCode(), _MinimumLength, _QueryPosition, _QueryResult, null, null, layer);
if (!provider.RetrieveSucceeded(status))
{

View File

@@ -15,14 +15,9 @@ namespace WaveHarmonic.Crest
{
internal static NoneProvider None { get; } = new();
internal static IDepthProvider Create(WaterRenderer water)
{
return water.MultipleViewpoints ? new DepthQueryPerCamera(water) : new DepthQuery(water);
}
internal sealed class NoneProvider : IDepthProvider
{
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result, Vector3? _3 = null)
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result)
{
if (result != null) System.Array.Clear(result, 0, result.Length);
return 0;
@@ -33,7 +28,7 @@ namespace WaveHarmonic.Crest
/// Query water depth data at a set of points.
/// </summary>
/// <param name="results">Water depth and distance to shoreline (XY respectively). Both are signed.</param>
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int, Vector3?)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results, Vector3? center = null);
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results);
}
}

View File

@@ -5,15 +5,14 @@ using UnityEngine;
namespace WaveHarmonic.Crest
{
sealed class DepthQuery : QueryBaseSimple, IDepthProvider
sealed class DepthQuery : QueryBase, IDepthProvider
{
public DepthQuery() : base(WaterRenderer.Instance.DepthLod) { }
public DepthQuery(WaterRenderer water) : base(water.DepthLod) { }
public DepthQuery(WaterRenderer water) : base(water) { }
protected override int Kernel => 2;
public override int Query(int hash, float minimumSpatialLength, Vector3[] queries, Vector3[] results, Vector3? center = null)
public override int Query(int hash, float minimumSpatialLength, Vector3[] queries, Vector3[] results)
{
var id = base.Query(hash, minimumSpatialLength, queries, results, center);
var id = base.Query(hash, minimumSpatialLength, queries, results);
// Infinity will become NaN. Convert back to infinity.
// Negative infinity should not happen.
@@ -28,9 +27,4 @@ namespace WaveHarmonic.Crest
return id;
}
}
sealed class DepthQueryPerCamera : QueryPerCameraSimple<DepthQuery>, IDepthProvider
{
public DepthQueryPerCamera(WaterRenderer water) : base(water) { }
}
}

View File

@@ -15,17 +15,12 @@ namespace WaveHarmonic.Crest
{
internal static NoneProvider None { get; } = new();
internal static IFlowProvider Create(WaterRenderer water)
{
return water.MultipleViewpoints ? new FlowQueryPerCamera(water) : new FlowQuery(water);
}
/// <summary>
/// Gives a stationary water (no horizontal flow).
/// </summary>
internal sealed class NoneProvider : IFlowProvider
{
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result, Vector3? _3 = null)
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result)
{
if (result != null) System.Array.Clear(result, 0, result.Length);
return 0;
@@ -36,7 +31,7 @@ namespace WaveHarmonic.Crest
/// Query water flow data (horizontal motion) at a set of points.
/// </summary>
/// <param name="results">Water surface flow velocities at the query positions.</param>
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int, Vector3?)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results, Vector3? center = null);
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results);
}
}

View File

@@ -6,15 +6,9 @@ namespace WaveHarmonic.Crest
/// <summary>
/// Samples horizontal motion of water volume
/// </summary>
sealed class FlowQuery : QueryBaseSimple, IFlowProvider
sealed class FlowQuery : QueryBase, IFlowProvider
{
public FlowQuery() : base(WaterRenderer.Instance.FlowLod) { }
public FlowQuery(WaterRenderer water) : base(water.FlowLod) { }
public FlowQuery(WaterRenderer water) : base(water) { }
protected override int Kernel => 1;
}
sealed class FlowQueryPerCamera : QueryPerCameraSimple<FlowQuery>, IFlowProvider
{
public FlowQueryPerCamera(WaterRenderer water) : base(water) { }
}
}

View File

@@ -9,7 +9,6 @@ using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Rendering;
using WaveHarmonic.Crest.Internal;
namespace WaveHarmonic.Crest
{
@@ -23,9 +22,8 @@ namespace WaveHarmonic.Crest
/// <param name="minimumLength">The minimum spatial length of the object, such as the width of a boat. Useful for filtering out detail when not needed. Set to zero to get full available detail.</param>
/// <param name="points">The world space points that will be queried.</param>
/// <param name="layer">The layer this query targets.</param>
/// <param name="center">The center of all the query positions. Used to choose the closest query provider.</param>
/// <returns>The status of the query.</returns>
internal static int Query(int hash, float minimumLength, Vector3[] points, int layer, Vector3? center) => throw new System.NotImplementedException("Crest: this method is for documentation reuse only. Do not invoke.");
internal static int Query(int hash, float minimumLength, Vector3[] points, int layer) => 0;
/// <summary>
/// Check if the query results could be retrieved successfully using the return code
@@ -47,12 +45,6 @@ namespace WaveHarmonic.Crest
void UpdateQueries(WaterRenderer water);
void SendReadBack(WaterRenderer water);
void CleanUp();
void Initialize(WaterRenderer water);
}
interface IQueryableSimple : IQueryable
{
int Query(int hash, float minimumLength, Vector3[] queries, Vector3[] results, Vector3? center);
}
/// <summary>
@@ -72,7 +64,6 @@ namespace WaveHarmonic.Crest
const int k_NormalAdditionalQueryCount = 2;
readonly WaterRenderer _Water;
readonly IQueryableLod<IQueryProvider> _Lod;
readonly PropertyWrapperCompute _Wrapper;
@@ -94,8 +85,8 @@ namespace WaveHarmonic.Crest
internal const int k_DefaultMaximumQueryCount = 4096;
readonly int _MaximumQueryCount;
readonly Vector3[] _QueryPositionXZ_MinimumGridSize;
readonly int _MaximumQueryCount = k_DefaultMaximumQueryCount;
readonly Vector3[] _QueryPositionXZ_MinimumGridSize = new Vector3[k_DefaultMaximumQueryCount];
/// <summary>
/// Holds information about all query points. Maps from unique hash code to position in point array.
@@ -262,15 +253,17 @@ namespace WaveHarmonic.Crest
InvalidDtForVelocity = 16,
}
public QueryBase(IQueryableLod<IQueryProvider> lod)
public QueryBase(WaterRenderer water)
{
_Water = lod.Water;
_Lod = lod;
_Water = water;
_DataArrivedAction = new(DataArrived);
_MaximumQueryCount = lod.MaximumQueryCount;
_QueryPositionXZ_MinimumGridSize = new Vector3[_MaximumQueryCount];
if (_MaximumQueryCount != water._AnimatedWavesLod.MaximumQueryCount)
{
_MaximumQueryCount = water._AnimatedWavesLod.MaximumQueryCount;
_QueryPositionXZ_MinimumGridSize = new Vector3[_MaximumQueryCount];
}
_ComputeBufferQueries = new(_MaximumQueryCount, 12, ComputeBufferType.Default);
_ComputeBufferResults = new(_MaximumQueryCount, 12, ComputeBufferType.Default);
@@ -284,13 +277,7 @@ namespace WaveHarmonic.Crest
Debug.LogError($"Crest: Could not load Query compute shader");
return;
}
_Wrapper = new(_Water.SimulationBuffer, shader, Kernel);
}
void LogMaximumQueryCountExceededError()
{
Debug.LogError($"Crest: Maximum query count ({_MaximumQueryCount}) exceeded, increase the <i>{nameof(WaterRenderer)} > Simulations > {_Lod.Name} > {nameof(_Lod.MaximumQueryCount)}</i> to support a higher number of queries.", _Water);
_Wrapper = new(water.SimulationBuffer, shader, Kernel);
}
/// <summary>
@@ -301,7 +288,7 @@ namespace WaveHarmonic.Crest
{
if (queryPoints.Length + _SegmentRegistrarRingBuffer.Current._QueryCount > _MaximumQueryCount)
{
LogMaximumQueryCountExceededError();
Debug.LogError($"Crest: Max query count ({_MaximumQueryCount}) exceeded, increase the max query count in the Animated Waves Settings to support a higher number of queries.");
return false;
}
@@ -361,7 +348,7 @@ namespace WaveHarmonic.Crest
if (countPts + segment.x > _QueryPositionXZ_MinimumGridSize.Length)
{
LogMaximumQueryCountExceededError();
Debug.LogError("Crest: Too many wave height queries. Increase Max Query Count in the Animated Waves Settings.");
return false;
}
@@ -631,23 +618,7 @@ namespace WaveHarmonic.Crest
_SegmentRegistrarRingBuffer.ClearAll();
}
public virtual void Initialize(WaterRenderer water)
{
}
public int ResultGuidCount => _ResultSegments != null ? _ResultSegments.Count : 0;
public int RequestCount => _Requests != null ? _Requests.Count : 0;
public int QueryCount => _SegmentRegistrarRingBuffer != null ? _SegmentRegistrarRingBuffer.Current._QueryCount : 0;
}
abstract class QueryBaseSimple : QueryBase, IQueryableSimple
{
protected QueryBaseSimple(IQueryableLod<IQueryProvider> lod) : base(lod) { }
public virtual int Query(int ownerHash, float minSpatialLength, Vector3[] queryPoints, Vector3[] results, Vector3? center)
public virtual int Query(int ownerHash, float minSpatialLength, Vector3[] queryPoints, Vector3[] results)
{
var result = (int)QueryStatus.OK;
@@ -663,159 +634,12 @@ namespace WaveHarmonic.Crest
return result;
}
}
abstract class QueryPerCamera<T> : IQueryable where T : IQueryable, new()
{
internal readonly WaterRenderer _Water;
internal readonly Dictionary<Camera, T> _Providers = new();
public int ResultGuidCount => _ResultSegments != null ? _ResultSegments.Count : 0;
public QueryPerCamera(WaterRenderer water)
{
_Water = water;
Initialize(water);
}
public int RequestCount => _Requests != null ? _Requests.Count : 0;
public int ResultGuidCount
{
get
{
var total = 0;
foreach (var (camera, provider) in _Providers)
{
if (_Water.ShouldExecuteQueries(camera)) total += provider.ResultGuidCount;
}
return total;
}
}
public int RequestCount
{
get
{
var total = 0;
foreach (var (camera, provider) in _Providers)
{
if (_Water.ShouldExecuteQueries(camera)) total += provider.RequestCount;
}
return total;
}
}
public int QueryCount
{
get
{
var total = 0;
foreach (var (camera, provider) in _Providers)
{
if (_Water.ShouldExecuteQueries(camera)) total += provider.QueryCount;
}
return total;
}
}
public void CleanUp()
{
foreach (var provider in _Providers.Values)
{
provider?.CleanUp();
}
}
public void Initialize(WaterRenderer water)
{
var camera = water.CurrentCamera;
if (camera == null)
{
camera = water.Viewer;
}
if (camera == null)
{
return;
}
if (!_Providers.ContainsKey(camera))
{
// Cannot use parameters. We could use System.Activator.CreateInstance to get
// around that, but instead we just use WaterRenderer.Instance.
_Providers.Add(camera, new());
}
}
public void SendReadBack(WaterRenderer water)
{
_Providers[water.CurrentCamera].SendReadBack(water);
}
public void UpdateQueries(WaterRenderer water)
{
_Providers[water.CurrentCamera].UpdateQueries(water);
}
public Vector2 FindCenter(Vector3[] queries, Vector3? center)
{
if (center != null)
{
return ((Vector3)center).XZ();
}
// Calculate center if none provided.
var sum = Vector2.zero;
foreach (var point in queries)
{
sum += point.XZ();
}
return new(sum.x / queries.Length, sum.y / queries.Length);
}
}
abstract class QueryPerCameraSimple<T> : QueryPerCamera<T>, IQueryableSimple where T : IQueryableSimple, new()
{
protected QueryPerCameraSimple(WaterRenderer water) : base(water) { }
public int Query(int id, float length, Vector3[] queries, Vector3[] results, Vector3? center = null)
{
if (_Water._InCameraLoop)
{
return _Providers[_Water.CurrentCamera].Query(id, length, queries, results, center);
}
var lastStatus = -1;
var lastDistance = Mathf.Infinity;
var newCenter = FindCenter(queries, center);
foreach (var provider in _Providers)
{
var camera = provider.Key;
if (!_Water.ShouldExecuteQueries(camera))
{
continue;
}
var distance = (newCenter - camera.transform.position.XZ()).sqrMagnitude;
if (lastStatus == (int)QueryBase.QueryStatus.OK && lastDistance < distance)
{
continue;
}
var status = provider.Value.Query(id, length, queries, results, center);
if (lastStatus < 0 || status == (int)QueryBase.QueryStatus.OK)
{
lastStatus = status;
lastDistance = distance;
}
}
return lastStatus;
}
public int QueryCount => _SegmentRegistrarRingBuffer != null ? _SegmentRegistrarRingBuffer.Current._QueryCount : 0;
}
static partial class Extensions

View File

@@ -40,13 +40,6 @@ namespace WaveHarmonic.Crest
[@DecoratedField, SerializeField]
QuerySource _Source;
[Tooltip("The viewer as the source of the queries.\n\nOnly needs to be set if using multiple viewpoints on the Water Renderer.")]
[@Predicated(nameof(_Source), inverted: false, nameof(QuerySource.Viewer), hide: true)]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
Camera _Viewer;
[Tooltip(ICollisionProvider.k_LayerTooltip)]
[@GenerateAPI]
[@DecoratedField, SerializeField]
@@ -181,11 +174,6 @@ namespace WaveHarmonic.Crest
var distance = water.ViewerHeightAboveWater;
if (water.MultipleViewpoints && (_Viewer == null || !water.GetViewerHeightAboveWater(_Viewer, out distance)))
{
return;
}
if (_Source == QuerySource.Transform)
{
if (!_SampleHeightHelper.SampleHeight(transform.position, out var height, minimumLength: 2f * _MinimumWavelength, _Layer)) return;
@@ -245,11 +233,6 @@ namespace WaveHarmonic.Crest
var distance = water.ViewerDistanceToShoreline;
if (water.MultipleViewpoints && (_Viewer == null || !water.GetViewerDistanceToShoreline(_Viewer, out distance)))
{
return;
}
if (_Source == QuerySource.Transform)
{
if (!_SampleDepthHelper.SampleDistanceToWaterEdge(transform.position, out distance))

View File

@@ -1,7 +1,6 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
using System.Collections.Generic;
using UnityEngine;
// Linter does not support mixing inheritdoc plus defining own parameters.
@@ -21,7 +20,7 @@ namespace WaveHarmonic.Crest.Internal
private protected readonly Vector3[] _QueryPosition;
private protected readonly Vector3[] _QueryResult;
readonly Dictionary<int, int> _LastFrame = new();
int _LastFrame = -1;
private protected SampleHelper(int queryCount = 1)
{
@@ -30,29 +29,15 @@ namespace WaveHarmonic.Crest.Internal
}
[System.Diagnostics.Conditional("UNITY_EDITOR")]
private protected void Validate(bool allowMultipleCallsPerFrame, int id)
private protected void Validate(bool allowMultipleCallsPerFrame)
{
if (!_LastFrame.ContainsKey(id))
{
_LastFrame.Add(id, -1);
}
#if UNITY_EDITOR
// Prevent false positives spamming the console.
if (!UnityEditor.EditorApplication.isFocused || (Application.isPlaying && UnityEditor.EditorApplication.isPaused))
{
_LastFrame[id] = Time.frameCount;
return;
}
#endif
if (!Time.inFixedTimeStep && !allowMultipleCallsPerFrame && _LastFrame[id] == Time.frameCount)
if (Application.isPlaying && !Time.inFixedTimeStep && !allowMultipleCallsPerFrame && _LastFrame == Time.frameCount)
{
var type = GetType().Name;
Debug.LogWarning($"Crest: {type} sample called multiple times in one frame which is not expected. Each {type} object services a single sample per frame. To perform multiple queries, create multiple {type} objects or use the query provider API directly.");
}
_LastFrame[id] = Time.frameCount;
_LastFrame = Time.frameCount;
}
// The first method is there just to get inheritdoc to work as it does not like
@@ -118,7 +103,7 @@ namespace WaveHarmonic.Crest
var isVelocity = (options & QueryOptions.Velocity) == QueryOptions.Velocity;
var isNormal = (options & QueryOptions.Normal) == QueryOptions.Normal;
Validate(allowMultipleCallsPerFrame, id);
Validate(allowMultipleCallsPerFrame);
_QueryPosition[0] = position;
@@ -130,8 +115,7 @@ namespace WaveHarmonic.Crest
_QueryResult,
isNormal ? _QueryResultNormal : null,
isVelocity ? _QueryResultVelocity : null,
layer,
position
layer
);
if (!provider.RetrieveSucceeded(status))
@@ -250,13 +234,11 @@ namespace WaveHarmonic.Crest
return false;
}
var id = GetHashCode();
Validate(false, id);
Validate(false);
_QueryPosition[0] = position;
var status = flowProvider.Query(id, minimumLength, _QueryPosition, _QueryResult, position);
var status = flowProvider.Query(GetHashCode(), minimumLength, _QueryPosition, _QueryResult);
if (!flowProvider.RetrieveSucceeded(status))
{
@@ -277,25 +259,25 @@ namespace WaveHarmonic.Crest
/// </summary>
public sealed class SampleDepthHelper : Internal.SampleHelper
{
internal bool Sample(int id, Vector3 position, out Vector2 result, bool allowMultipleCallsPerFrame = false)
bool Sample(Vector3 position, out Vector2 result)
{
var water = WaterRenderer.Instance;
var depthProvider = water == null ? null : water.DepthLod.Provider;
if (depthProvider == null)
{
result = new(Mathf.Infinity, Mathf.Infinity);
result = Vector2.zero;
return false;
}
Validate(allowMultipleCallsPerFrame, id);
Validate(false);
_QueryPosition[0] = position;
var status = depthProvider.Query(id, minimumLength: 0, _QueryPosition, _QueryResult, position);
var status = depthProvider.Query(GetHashCode(), minimumLength: 0, _QueryPosition, _QueryResult);
if (!depthProvider.RetrieveSucceeded(status))
{
result = new(Mathf.Infinity, Mathf.Infinity);
result = Vector2.zero;
return false;
}
@@ -303,18 +285,13 @@ namespace WaveHarmonic.Crest
return true;
}
bool Sample(Vector3 position, out Vector2 result)
{
return Sample(GetHashCode(), position, out result);
}
/// <summary>
/// Sample both the water depth and water edge distance.
/// </summary>
/// <param name="depth">Filled by the water depth at the query position.</param>
/// <param name="distance">Filled by the distance to water edge at the query position.</param>
/// <inheritdoc cref="Internal.SampleHelper.Sample" />
internal bool Sample(Vector3 position, out float depth, out float distance)
bool Sample(Vector3 position, out float depth, out float distance)
{
var success = Sample(position, out var result);
depth = result.x;
@@ -335,12 +312,7 @@ namespace WaveHarmonic.Crest
/// <inheritdoc cref="Sample(Vector3, out float, out float)"/>
public bool SampleDistanceToWaterEdge(Vector3 position, out float distance)
{
return SampleDistanceToWaterEdge(GetHashCode(), position, out distance);
}
internal bool SampleDistanceToWaterEdge(int id, Vector3 position, out float distance)
{
var success = Sample(id, position, out var result);
var success = Sample(position, out var result);
distance = result.y;
return success;
}

View File

@@ -24,6 +24,13 @@ namespace WaveHarmonic.Crest
return;
}
#if UNITY_EDITOR
if (!WaterRenderer.IsWithinEditorUpdate)
{
return;
}
#endif
var camera = context.hdCamera.camera;
// Custom passes execute for every camera. We only support one camera for now.

View File

@@ -45,7 +45,6 @@ namespace WaveHarmonic.Crest
}
}
#if URP_COMPATIBILITY_MODE
[System.Obsolete]
public override void Execute(ScriptableRenderContext context, ref RenderingData data)
{
@@ -55,7 +54,6 @@ namespace WaveHarmonic.Crest
context.ExecuteCommandBuffer(buffer);
CommandBufferPool.Release(buffer);
}
#endif
}
}

View File

@@ -41,6 +41,13 @@ namespace WaveHarmonic.Crest
return;
}
#if UNITY_EDITOR
if (!WaterRenderer.IsWithinEditorUpdate)
{
return;
}
#endif
// Only sample shadows for the main camera.
if (!ReferenceEquals(water.Viewer, camera))
{

View File

@@ -30,6 +30,12 @@ namespace WaveHarmonic.Crest
CopyShadowMapBuffer?.Clear();
return;
}
if (!WaterRenderer.IsWithinEditorUpdate)
{
CopyShadowMapBuffer?.Clear();
return;
}
#endif
var water = _Water;
@@ -44,12 +50,7 @@ namespace WaveHarmonic.Crest
return;
}
if (_Water.Reflections.ReflectionCamera == camera)
{
return;
}
if (CopyShadowMapBuffer != null)
if (camera == water.Viewer && CopyShadowMapBuffer != null)
{
if (_Light != null)
{
@@ -82,15 +83,36 @@ namespace WaveHarmonic.Crest
CopyShadowMapBuffer?.Clear();
return;
}
if (!WaterRenderer.IsWithinEditorUpdate)
{
CopyShadowMapBuffer?.Clear();
return;
}
#endif
// CBs added to a light are executed for every camera, but the LOD data is only
// supports a single camera. Removing the CB after the camera renders restricts the
// CB to one camera. Careful of recursive rendering for planar reflections, as it
// executes a camera within this camera's frame.
if (_Light != null && CopyShadowMapBuffer != null)
var water = _Water;
if (water == null)
{
_Light.RemoveCommandBuffer(LightEvent.BeforeScreenspaceMask, CopyShadowMapBuffer);
return;
}
if (!WaterRenderer.ShouldRender(camera, water.Surface.Layer))
{
return;
}
if (camera == water.Viewer)
{
// CBs added to a light are executed for every camera, but the LOD data is only
// supports a single camera. Removing the CB after the camera renders restricts the
// CB to one camera. Careful of recursive rendering for planar reflections, as it
// executes a camera within this camera's frame.
if (_Light != null && CopyShadowMapBuffer != null)
{
_Light.RemoveCommandBuffer(LightEvent.BeforeScreenspaceMask, CopyShadowMapBuffer);
}
}
}
}

View File

@@ -96,7 +96,6 @@ namespace WaveHarmonic.Crest
private protected override Color ClearColor => Color.black;
private protected override bool NeedToReadWriteTextureData => true;
internal override int BufferCount => 2;
internal override bool SkipEndOfFrame => true;
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
{
@@ -151,9 +150,17 @@ namespace WaveHarmonic.Crest
#if d_UnityURP
var asset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
// TODO: Support single casacades as it is possible.
if (asset && asset.shadowCascadeCount < 2)
{
Debug.LogError("Crest shadowing requires shadow cascades to be enabled on the pipeline asset.", asset);
_Valid = false;
return;
}
if (asset.mainLightRenderingMode == LightRenderingMode.Disabled)
{
Debug.LogWarning("Crest: Main Light must be enabled to enable water shadowing.", _Water);
Debug.LogError("Crest: Main Light must be enabled to enable water shadowing.", _Water);
_Valid = false;
return;
}
@@ -164,7 +171,7 @@ namespace WaveHarmonic.Crest
if (isShadowsDisabled)
{
Debug.LogWarning("Crest: Shadows must be enabled in the quality settings to enable water shadowing.", _Water);
Debug.LogError("Crest: Shadows must be enabled in the quality settings to enable water shadowing.", _Water);
_Valid = false;
return;
}
@@ -229,6 +236,8 @@ namespace WaveHarmonic.Crest
{
base.Allocate();
_Targets.RunLambda(buffer => Clear(buffer));
{
_RenderMaterial = new PropertyWrapperMaterial[Slices];
var shader = WaterResources.Instance.Shaders._UpdateShadow;
@@ -254,6 +263,12 @@ namespace WaveHarmonic.Crest
}
}
internal override void ClearLodData()
{
base.ClearLodData();
_Targets.RunLambda(buffer => Clear(buffer));
}
/// <summary>
/// Validates the primary light.
/// </summary>
@@ -294,7 +309,7 @@ namespace WaveHarmonic.Crest
{
if (_Error != Error.IncorrectLightType)
{
Debug.LogWarning("Crest: Primary light must be of type Directional.", _Light);
Debug.LogError("Crest: Primary light must be of type Directional.", _Light);
_Error = Error.IncorrectLightType;
}
return false;
@@ -383,7 +398,7 @@ namespace WaveHarmonic.Crest
CopyShadowMapBuffer ??= new() { name = WaterRenderer.k_DrawLodData };
CopyShadowMapBuffer.Clear();
FlipBuffers(buffer);
FlipBuffers();
// clear the shadow collection. it will be overwritten with shadow values IF the shadows render,
// which only happens if there are (nontransparent) shadow receivers around. this is only reliable
@@ -506,7 +521,6 @@ namespace WaveHarmonic.Crest
{
_Enabled = true;
_TextureFormat = GraphicsFormat.R8G8_UNorm;
_Blur = true;
}
internal static SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);

View File

@@ -23,9 +23,13 @@ namespace WaveHarmonic.Crest
/// <summary>
/// Where to obtain water shape on CPU for physics / gameplay.
/// </summary>
[System.Obsolete("Please use QuerySource instead.")]
public CollisionSource CollisionSource { get => _CollisionSource; internal set => _CollisionSource = value; }
/// <summary>
/// Maximum number of wave queries that can be performed when using GPU queries.
/// </summary>
public int MaximumQueryCount => _MaximumQueryCount;
/// <summary>
/// Any water deeper than this will receive full wave strength.
/// </summary>
@@ -40,12 +44,7 @@ namespace WaveHarmonic.Crest
/// <remarks>
/// Set this to 2 to improve wave quality. In some cases like flowing rivers, this can make a substantial difference to visual stability. We recommend doubling the Resolution on the WaterRenderer component to preserve detail after making this change.
/// </remarks>
public float WaveResolutionMultiplier { get => GetWaveResolutionMultiplier(); set => _WaveResolutionMultiplier = value; }
/// <summary>
/// The wave sampling method to determine quality and performance.
/// </summary>
public WaveSampling WaveSampling { get => _WaveSampling; set => _WaveSampling = value; }
public float WaveResolutionMultiplier { get => _WaveResolutionMultiplier; set => _WaveResolutionMultiplier = value; }
}
}
@@ -662,23 +661,6 @@ namespace WaveHarmonic.Crest
{
partial class Lod
{
/// <summary>
/// Blurs the output.
/// </summary>
/// <remarks>
/// Enable if blurring is desired or intolerable artifacts are present.
/// The blur is optimized to only run on inner LODs and at lower scales.
/// </remarks>
public bool Blur { get => _Blur; set => _Blur = value; }
/// <summary>
/// Number of blur iterations.
/// </summary>
/// <remarks>
/// Blur iterations are optimized to only run maximum iterations on the inner LODs.
/// </remarks>
public int BlurIterations { get => _BlurIterations; set => _BlurIterations = value; }
/// <summary>
/// Whether the simulation is enabled.
/// </summary>
@@ -715,22 +697,6 @@ namespace WaveHarmonic.Crest
}
}
namespace WaveHarmonic.Crest
{
partial class Lod<T>
{
/// <summary>
/// Maximum number of queries that can be performed when using GPU queries.
/// </summary>
public int MaximumQueryCount => _MaximumQueryCount;
/// <summary>
/// Where to obtain water data on CPU for physics / gameplay.
/// </summary>
public LodQuerySource QuerySource { get => _QuerySource; internal set => _QuerySource = value; }
}
}
namespace WaveHarmonic.Crest
{
partial class LodInput
@@ -786,14 +752,6 @@ namespace WaveHarmonic.Crest
{
partial class Meniscus
{
/// <summary>
/// Rules to exclude cameras from rendering the meniscus.
/// </summary>
/// <remarks>
/// These are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.
/// </remarks>
public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; }
/// <summary>
/// Whether the meniscus is enabled.
/// </summary>
@@ -984,14 +942,6 @@ namespace WaveHarmonic.Crest
/// "Viewer" will reuse queries already performed by the Water Renderer
/// </remarks>
public QuerySource Source { get => _Source; set => _Source = value; }
/// <summary>
/// The viewer as the source of the queries.
/// </summary>
/// <remarks>
/// Only needs to be set if using multiple viewpoints on the Water Renderer.
/// </remarks>
public UnityEngine.Camera Viewer { get => _Viewer; set => _Viewer = value; }
}
}
@@ -1092,11 +1042,6 @@ namespace WaveHarmonic.Crest
/// </remarks>
public float MaximumVerticalDisplacement { get => _MaximumVerticalDisplacement; set => _MaximumVerticalDisplacement = value; }
/// <summary>
/// Whether to override automatic culling based on heuristics.
/// </summary>
public bool OverrideCulling { get => _OverrideCulling; set => _OverrideCulling = value; }
/// <summary>
/// Whether to use the wind turbulence on this component rather than the global wind turbulence.
/// </summary>
@@ -1171,14 +1116,6 @@ namespace WaveHarmonic.Crest
/// </remarks>
public bool EvaluateSpectrumAtRunTimeEveryFrame { get => _EvaluateSpectrumAtRunTimeEveryFrame; set => _EvaluateSpectrumAtRunTimeEveryFrame = value; }
/// <summary>
/// Whether the maximum possible vertical displacement is used for the Drop Detail Height Based On Waves calculation.
/// </summary>
/// <remarks>
/// This setting is ignored for global waves, as they always contribute. For local waves, only enable for large areas that are treated like global waves (eg a storm).
/// </remarks>
public bool IncludeInDropDetailHeightBasedOnWaves { get => _IncludeInDropDetailHeightBasedOnWaves; set => _IncludeInDropDetailHeightBasedOnWaves = value; }
/// <summary>
/// Whether to use the wind direction on this component rather than the global wind direction.
/// </summary>
@@ -1201,7 +1138,7 @@ namespace WaveHarmonic.Crest
/// <remarks>
/// Low resolutions are more efficient but can result in noticeable patterns in the shape.
/// </remarks>
public int Resolution { get => GetResolution(); set => _Resolution = value; }
public int Resolution { get => _Resolution; set => _Resolution = value; }
/// <summary>
/// How much these waves respect the shallow water attenuation.
@@ -1211,14 +1148,6 @@ namespace WaveHarmonic.Crest
/// </remarks>
public float RespectShallowWaterAttenuation { get => _RespectShallowWaterAttenuation; set => _RespectShallowWaterAttenuation = value; }
/// <summary>
/// Whether global waves is applied above or below sea level.
/// </summary>
/// <remarks>
/// Waves are faded out to avoid hard transitionds. They are fully faded by 1m from sea level.
/// </remarks>
public bool SeaLevelOnly { get => _SeaLevelOnly; set => _SeaLevelOnly = value; }
/// <summary>
/// The spectrum that defines the water surface shape.
/// </summary>
@@ -1344,14 +1273,6 @@ namespace WaveHarmonic.Crest
/// </remarks>
public bool AllowRenderQueueSorting { get => _AllowRenderQueueSorting; set => _AllowRenderQueueSorting = value; }
/// <summary>
/// Rules to exclude cameras from surface rendering.
/// </summary>
/// <remarks>
/// These are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.
/// </remarks>
public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; }
/// <summary>
/// Have the water surface cast shadows for albedo (both foam and custom).
/// </summary>
@@ -1430,17 +1351,8 @@ namespace WaveHarmonic.Crest
/// <remarks>
/// If disabled, then additionally ignore any camera that is not the view camera or our reflection camera. It will require managing culling masks of all cameras.
/// </remarks>
[System.Obsolete("Please use Camera Exclusion instead.")]
public bool AllCameras { get => _AllCameras; set => _AllCameras = value; }
/// <summary>
/// Rules to exclude cameras from rendering underwater.
/// </summary>
/// <remarks>
/// These are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.
/// </remarks>
public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; }
/// <summary>
/// Copying parameters each frame ensures underwater appearance stays consistent with the water surface.
/// </summary>
@@ -1594,7 +1506,6 @@ namespace WaveHarmonic.Crest
/// <summary>
/// Whether to allow MSAA.
/// </summary>
[System.Obsolete("MSAA for the planar reflection camera is no longer supported. This setting will be ignored.")]
public bool AllowMSAA { get => _AllowMSAA; set => _AllowMSAA = value; }
/// <summary>
@@ -1661,14 +1572,6 @@ namespace WaveHarmonic.Crest
/// </summary>
public float NonObliqueNearSurfaceThreshold { get => _NonObliqueNearSurfaceThreshold; set => _NonObliqueNearSurfaceThreshold = value; }
/// <summary>
/// Overscan amount to capture off-screen content.
/// </summary>
/// <remarks>
/// Renders the reflections at a larger viewport size to capture off-screen content when the surface reflects off-screen. This avoids a category of artifacts - especially when looking down. This can be expensive, as the value is a multiplier to the capture size.
/// </remarks>
public float Overscan { get => _Overscan; set => _Overscan = value; }
/// <summary>
/// Overrides global quality settings.
/// </summary>
@@ -1746,14 +1649,6 @@ namespace WaveHarmonic.Crest
/// </remarks>
public UnityEngine.Camera Viewer { get => GetViewer(); set => _Camera = value; }
/// <summary>
/// Rules to exclude cameras from being a center-of-detail.
/// </summary>
/// <remarks>
/// These are exclusion rules, so for all cameras, select Nothing.
/// </remarks>
public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; }
/// <summary>
/// Have the water surface cast shadows for albedo (both foam and custom).
/// </summary>
@@ -1773,14 +1668,6 @@ namespace WaveHarmonic.Crest
/// </summary>
public ClipLod ClipLod => _ClipLod;
/// <summary>
/// The background rendering mode when a camera does not render.
/// </summary>
/// <remarks>
/// When switching between multiple cameras, simulations will not progress for cameras which do not render for that frame. This setting tells the system when it should continue to progress the simulations.
/// </remarks>
public WaterDataBackgroundMode DataBackgroundMode { get => _DataBackgroundMode; set => _DataBackgroundMode = value; }
/// <summary>
/// Water depth information used for shallow water, shoreline foam, wave attenuation, among others.
/// </summary>

View File

@@ -29,6 +29,11 @@ namespace WaveHarmonic.Crest.Generated
{
enum CollisionLayers
{
/// <summary>
/// All layers.
/// </summary>
Everything,
/// <summary>
/// No extra layers (ie single layer).
/// </summary>
@@ -46,11 +51,6 @@ namespace WaveHarmonic.Crest.Generated
/// Extra displacement layer for visual displacement.
/// </summary>
Displacement,
/// <summary>
/// All layers.
/// </summary>
Everything,
}
}
@@ -288,31 +288,6 @@ namespace WaveHarmonic.Crest.Generated
}
namespace WaveHarmonic.Crest.Generated
{
enum LodQuerySource
{
/// <summary>
/// No query source.
/// </summary>
None,
/// <summary>
/// Uses AsyncGPUReadback to retrieve data from GPU to CPU.
/// </summary>
/// <remarks>
/// This is the most optimal approach.
/// </remarks>
GPU,
/// <summary>
/// Computes data entirely on the CPU.
/// </summary>
CPU,
}
}
namespace WaveHarmonic.Crest.Generated
{
enum LodTextureFormatMode
@@ -410,68 +385,6 @@ namespace WaveHarmonic.Crest.Generated
}
namespace WaveHarmonic.Crest.Generated
{
enum WaterCameraExclusion
{
/// <summary>
/// No exclusion rules applied.
/// </summary>
Nothing,
/// <summary>
/// Exclude hidden cameras.
/// </summary>
/// <remarks>
/// Does not affect reflection cameras, as they are typically always hidden. Use the Reflection flag for them.
/// </remarks>
Hidden,
/// <summary>
/// Exclude reflection cameras.
/// </summary>
Reflection,
/// <summary>
/// Exclude cameras not tagged as MainCamera.
/// </summary>
NonMainCamera,
/// <summary>
/// Apply all exclusion rules.
/// </summary>
Everything,
}
}
namespace WaveHarmonic.Crest.Generated
{
enum WaterDataBackgroundMode
{
/// <summary>
/// Always progress simulations in the background when camera does not render.
/// </summary>
Always,
/// <summary>
/// Progress simulations in the background when camera is inactive (ie !isActiveAndEnabled).
/// </summary>
Inactive,
/// <summary>
/// Progress simulations in the background when camera is disabled (ie !enabled).
/// </summary>
Disabled,
/// <summary>
/// Never progress simulations in the background.
/// </summary>
Never,
}
}
namespace WaveHarmonic.Crest.Generated
{
enum WaterInjectionPoint
@@ -538,31 +451,3 @@ namespace WaveHarmonic.Crest.Generated
Clip,
}
}
namespace WaveHarmonic.Crest.Generated
{
enum WaveSampling
{
/// <summary>
/// Automatically chooses the other options as needed (512+ resolution needs precision).
/// </summary>
Automatic,
/// <summary>
/// Reduces samples by copying waves from higher LODs to lower LODs.
/// </summary>
/// <remarks>
/// Best for resolutions lower than 512.
/// </remarks>
Performance,
/// <summary>
/// Samples directly from the wave buffers to preserve wave quality.
/// </summary>
/// <remarks>
/// Needed for higher resolutions (512+). Higher LOD counts can also benefit with this enabled.
/// </remarks>
Precision,
}
}

View File

@@ -108,9 +108,7 @@ namespace WaveHarmonic.Crest
[UnityEngine.Space(10)]
[Tooltip("Query points for buoyancy.\n\nOnly applicable to Probes model.")]
[@Predicated(nameof(_Model), true, nameof(FloatingObjectModel.Probes), hide: true)]
[@GenerateAPI]
[@DecoratedField]
[SerializeField]
internal FloatingObjectProbe[] _Probes = new FloatingObjectProbe[] { };

View File

@@ -85,10 +85,7 @@ namespace WaveHarmonic.Crest
});
}
}
#endif
#if URP_COMPATIBILITY_MODE
#if UNITY_6000_0_OR_NEWER
[System.Obsolete]
#endif
public override void Execute(ScriptableRenderContext context, ref RenderingData data)
@@ -99,7 +96,6 @@ namespace WaveHarmonic.Crest
context.ExecuteCommandBuffer(buffer);
CommandBufferPool.Release(buffer);
}
#endif
}
}
}

View File

@@ -21,7 +21,6 @@ namespace WaveHarmonic.Crest
public static MaskRenderer Instantiate(WaterRenderer water)
{
#pragma warning disable format
#if d_UnityHDRP
if (RenderPipelineHelper.IsHighDefinition)
{
@@ -41,7 +40,6 @@ namespace WaveHarmonic.Crest
{
return new MaskRendererBIRP(water);
}
#pragma warning restore format
}
// For PortalRenderer.
@@ -237,7 +235,7 @@ namespace WaveHarmonic.Crest
slices: TextureXR.slices,
dimension: TextureXR.dimension,
depthBufferBits: DepthBits.None,
colorFormat: Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16_SFloat, randomWrite: true),
colorFormat: GraphicsFormat.R16_SFloat,
enableRandomWrite: true,
useDynamicScale: true,
name: k_MaskColor
@@ -253,7 +251,7 @@ namespace WaveHarmonic.Crest
scaleFactor: Vector2.one,
slices: TextureXR.slices,
dimension: TextureXR.dimension,
depthBufferBits: Rendering.GetDefaultDepthBufferBits(),
depthBufferBits: Helpers.k_DepthBits,
colorFormat: GraphicsFormat.None,
enableRandomWrite: false,
useDynamicScale: true,
@@ -279,7 +277,7 @@ namespace WaveHarmonic.Crest
if (_Inputs.HasFlag(MaskInput.Depth))
{
descriptor.graphicsFormat = GraphicsFormat.None;
descriptor.depthBufferBits = (int)Rendering.GetDefaultDepthBufferBits();
descriptor.depthBufferBits = Helpers.k_DepthBufferBits;
if (RenderPipelineCompatibilityHelper.ReAllocateIfNeeded(ref _DepthRTH, descriptor, name: k_MaskDepth))
{
@@ -290,8 +288,7 @@ namespace WaveHarmonic.Crest
if (_Inputs.HasFlag(MaskInput.Color))
{
// NOTE: Intel iGPU for Metal and DirectX both had issues with R16 (2021.11.18).
descriptor.graphicsFormat = Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16_SFloat, randomWrite: true);
descriptor.depthStencilFormat = GraphicsFormat.None;
descriptor.graphicsFormat = GraphicsFormat.R16_SFloat;
descriptor.depthBufferBits = 0;
descriptor.enableRandomWrite = true;

View File

@@ -100,10 +100,7 @@ namespace WaveHarmonic.Crest
});
}
}
#endif
#if URP_COMPATIBILITY_MODE
#if UNITY_6000_0_OR_NEWER
[System.Obsolete]
#endif
public override void Execute(ScriptableRenderContext context, ref RenderingData data)
@@ -113,7 +110,6 @@ namespace WaveHarmonic.Crest
context.ExecuteCommandBuffer(buffer);
CommandBufferPool.Release(buffer);
}
#endif
}
}
}

View File

@@ -33,14 +33,6 @@ namespace WaveHarmonic.Crest
internal Material _Material;
[@Heading("Advanced")]
[Tooltip("Rules to exclude cameras from rendering the meniscus.\n\nThese are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.")]
[@DecoratedField]
[@GenerateAPI]
[SerializeField]
WaterCameraExclusion _CameraExclusions = WaterCameraExclusion.Hidden | WaterCameraExclusion.Reflection;
WaterRenderer _Water;
internal MeniscusRenderer Renderer { get; private set; }
@@ -84,7 +76,6 @@ namespace WaveHarmonic.Crest
return;
}
#pragma warning disable format
#if d_UnityHDRP
if (RenderPipelineHelper.IsHighDefinition)
{
@@ -105,7 +96,6 @@ namespace WaveHarmonic.Crest
{
Renderer ??= new MeniscusRendererBIRP(water, this);
}
#pragma warning restore format
}
}
@@ -141,6 +131,11 @@ namespace WaveHarmonic.Crest
private protected readonly WaterRenderer _Water;
internal readonly Meniscus _Meniscus;
static partial class ShaderIDs
{
public static readonly int s_HorizonNormal = Shader.PropertyToID("_Crest_HorizonNormal");
}
public abstract void OnBeginCameraRendering(Camera camera);
public abstract void OnEndCameraRendering(Camera camera);
@@ -179,18 +174,18 @@ namespace WaveHarmonic.Crest
return false;
}
// Meniscus is a product of the water surface.
if (!_Water.Surface.Enabled)
{
return false;
}
if (camera.cameraType is not CameraType.Game and not CameraType.SceneView)
{
return false;
}
if (!WaterRenderer.ShouldRender(camera, _Meniscus.Layer, _Meniscus._CameraExclusions))
{
return false;
}
// Meniscus depends on both the surface and volume.
if (!_Water.Surface.ShouldRender(camera) || !_Water.Underwater.ShouldRender(camera))
if (!WaterRenderer.ShouldRender(camera, _Meniscus.Layer))
{
return false;
}
@@ -216,6 +211,13 @@ namespace WaveHarmonic.Crest
internal void Execute<T>(Camera camera, T commands) where T : ICommandWrapper
{
// Project water normal onto camera plane.
_Meniscus.Material.SetVector(ShaderIDs.s_HorizonNormal, new Vector2
(
Vector3.Dot(Vector3.up, camera.transform.right),
Vector3.Dot(Vector3.up, camera.transform.up)
));
var isFullScreenRequired = true;
var isMasked = false;
var passOffset = 1;

View File

@@ -22,7 +22,6 @@ namespace WaveHarmonic.Crest
public static int s_WaterLineSnappedPosition = Shader.PropertyToID("_Crest_WaterLineSnappedPosition");
public static int s_WaterLineResolution = Shader.PropertyToID("_Crest_WaterLineResolution");
public static int s_WaterLineTexel = Shader.PropertyToID("_Crest_WaterLineTexel");
public static int s_WaterLineFlatWater = Shader.PropertyToID("_Crest_WaterLineFlatWater");
}
RenderTexture _HeightRT;
@@ -51,13 +50,6 @@ namespace WaveHarmonic.Crest
internal void UpdateDisplacedSurfaceData(Camera camera)
{
Helpers.SetGlobalBoolean(ShaderIDs.s_WaterLineFlatWater, IsQuadMesh);
if (IsQuadMesh)
{
return;
}
// World size of the texture. Formula should effectively cover the camera.
var size = 1f + (camera.nearClipPlane * 2f);
@@ -92,11 +84,9 @@ namespace WaveHarmonic.Crest
BindDisplacedSurfaceData(wrapper);
var lod = (int)Builder.PatchType.Interior;
var mpb = PerCascadeMPB[lod];
var mpb = _PerCascadeMPB.Current[lod];
var viewpoint = _Water.Viewpoint;
if (viewpoint == null || (viewpoint != camera.transform && Vector3.Distance(viewpoint.position, camera.transform.position) > 0.01f))
if (_Water.Viewpoint != camera.transform && Vector3.Distance(_Water.Viewpoint.position, camera.transform.position) > 0.01f)
{
foreach (var chunk in _Water.Surface.Chunks)
{

View File

@@ -27,9 +27,6 @@ namespace WaveHarmonic.Crest
case nameof(_Layer):
SetLayer((int)previous, _Layer);
break;
case nameof(_MeshType):
_Water.Rebuild();
break;
case nameof(_ChunkTemplate):
// We have to rebuild, as we instantiate entire GO. If we restricted it to just a
// MeshRenderer, then we could just replace those.

View File

@@ -68,7 +68,7 @@ namespace WaveHarmonic.Crest
}
// Our reflections do not need them.
if (camera == _Water.Reflections.ReflectionCamera)
if (camera == WaterReflections.CurrentCamera)
{
return;
}
@@ -114,7 +114,6 @@ namespace WaveHarmonic.Crest
var rld = new RendererListDesc(_ShaderTagID, context.cullingResults, camera)
{
layerMask = 1 << _Water.Surface.Layer,
// Required to set the pass. Use shader to keep WB material overrides.
overrideShader = _Water.Surface.Material.shader,
overrideShaderPassIndex = _Water.Surface.Material.FindPass("Forward"),
renderQueueRange = RenderQueueRange.transparent,

View File

@@ -22,7 +22,6 @@ namespace WaveHarmonic.Crest
}
CommandBuffer _DrawWaterSurfaceBuffer;
MaterialPropertyBlock _QuadMeshMPB;
void OnBeginCameraRenderingLegacy(Camera camera)
{
@@ -41,6 +40,8 @@ namespace WaveHarmonic.Crest
return;
}
camera.depthTextureMode |= DepthTextureMode.Depth;
_DrawWaterSurfaceBuffer ??= new() { name = WaterRenderer.k_DrawWater };
_DrawWaterSurfaceBuffer.Clear();
@@ -110,15 +111,6 @@ namespace WaveHarmonic.Crest
// Always enabled.
commands.SetShaderKeyword("LIGHTPROBE_SH", true);
if (IsQuadMesh)
{
_QuadMeshMPB ??= new();
new PropertyWrapperMPB(_QuadMeshMPB).SetSHCoefficients(Root.position);
Render(camera, commands, Material, pass: 0, mpb: _QuadMeshMPB);
commands.EndSample(k_DrawWaterSurface);
return;
}
UpdateChunkVisibility(camera);
foreach (var chunk in Chunks)
@@ -145,7 +137,9 @@ namespace WaveHarmonic.Crest
chunk.Bind();
}
commands.DrawRenderer(chunk.Rend, renderer.sharedMaterial, 0, 0);
var mpb = new PropertyWrapperMPB(chunk._MaterialPropertyBlock);
mpb.SetSHCoefficients(chunk.transform.position);
commands.DrawMesh(chunk._Mesh, chunk.transform.localToWorldMatrix, renderer.sharedMaterial, 0, 0, chunk._MaterialPropertyBlock);
}
commands.EndSample(k_DrawWaterSurface);

View File

@@ -1,7 +1,6 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#if UNITY_EDITOR
#if d_UnityHDRP
using UnityEngine;
@@ -57,7 +56,7 @@ namespace WaveHarmonic.Crest
return;
}
if (camera.cameraType != CameraType.SceneView || (_Water.SingleViewpoint && camera != _Water.Viewer))
if (camera.cameraType != CameraType.SceneView || camera != _Water.Viewer)
{
return;
}
@@ -69,4 +68,3 @@ namespace WaveHarmonic.Crest
}
#endif // d_UnityHDRP
#endif

View File

@@ -1,8 +1,6 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#if UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;
@@ -14,7 +12,7 @@ namespace WaveHarmonic.Crest
void OnPreRenderWaterLevelDepthTexture(Camera camera)
{
if (camera.cameraType != CameraType.SceneView || (_Water.SingleViewpoint && camera != _Water.Viewer))
if (camera.cameraType != CameraType.SceneView || camera != _Water.Viewer)
{
return;
}
@@ -40,5 +38,3 @@ namespace WaveHarmonic.Crest
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More