diff --git a/Assets/AssetCaches.asset b/Assets/AssetCaches.asset index 46e95d475..ec686c9c8 100644 --- a/Assets/AssetCaches.asset +++ b/Assets/AssetCaches.asset @@ -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 diff --git a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Diffusion Profiles/DefaultSettingsVolumeProfile.asset b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Diffusion Profiles/DefaultSettingsVolumeProfile.asset index 727d27f48..3a3b423b7 100644 --- a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Diffusion Profiles/DefaultSettingsVolumeProfile.asset +++ b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Diffusion Profiles/DefaultSettingsVolumeProfile.asset @@ -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 diff --git a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/2019_3 Lighting Profile HD.asset b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/2019_3 Lighting Profile HD.asset index bbbcd1cf0..1604c2be3 100644 --- a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/2019_3 Lighting Profile HD.asset +++ b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/2019_3 Lighting Profile HD.asset @@ -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} diff --git a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default HDRP Lighting Profile.asset b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default HDRP Lighting Profile.asset index 70dfc6651..a2349a8bd 100644 --- a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default HDRP Lighting Profile.asset +++ b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default HDRP Lighting Profile.asset @@ -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} diff --git a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default PW Sky HDRP Profile.asset b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default PW Sky HDRP Profile.asset index 626e31e42..70d460337 100644 --- a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default PW Sky HDRP Profile.asset +++ b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Gaia Default PW Sky HDRP Profile.asset @@ -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} diff --git a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Ortho Bake Volume Profile.asset b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Ortho Bake Volume Profile.asset index d6b5af92a..2cd053131 100644 --- a/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Ortho Bake Volume Profile.asset +++ b/Assets/Procedural Worlds/Packages - Install/Gaia/Settings/High Definition Pipeline/Lighting Profiles/Ortho Bake Volume Profile.asset @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatScene.prefab b/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatScene.prefab index 18a3d3c00..e2c22122a 100644 --- a/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatScene.prefab +++ b/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatScene.prefab @@ -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} diff --git a/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatsScene.prefab b/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatsScene.prefab index 1b17f2f43..884ef5fd6 100644 --- a/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatsScene.prefab +++ b/Assets/Samples/Crest/5.4.2/Boats/Prefabs/Boats_BoatsScene.prefab @@ -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} diff --git a/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_TransparentPrimitive.mat b/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_TransparentPrimitive.mat index 9303a4491..db3248fb2 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_TransparentPrimitive.mat +++ b/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_TransparentPrimitive.mat @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_Water.mat b/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_Water.mat index 4b78655ec..d777414b0 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_Water.mat +++ b/Assets/Samples/Crest/5.4.2/Examples/Materials/Examples_Water.mat @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Examples_Scenes.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Examples_Scenes.prefab index 0644711c9..03c3ebd93 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Examples_Scenes.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Examples_Scenes.prefab @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_Albedo.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_Albedo.prefab index 609af550b..cccaec131 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_Albedo.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_Albedo.prefab @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AnimatedObjectWaterInteraction.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AnimatedObjectWaterInteraction.prefab index e8bf39849..409153a75 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AnimatedObjectWaterInteraction.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AnimatedObjectWaterInteraction.prefab @@ -178,7 +178,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _Version: 0 - _WorldSpace: 0 _Axis: {x: 0, y: 0, z: 1} _Amplitude: 10 _Frequency: 1 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromShorelineDistance.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromShorelineDistance.prefab index 5a9d59dbe..e28b77a68 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromShorelineDistance.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromShorelineDistance.prefab @@ -168,7 +168,6 @@ MonoBehaviour: m_EditorClassIdentifier: _Version: 0 _Source: 0 - _Viewer: {fileID: 0} _Layer: 0 _MinimumWavelength: 1 _DistanceFromSurfaceSigned: 0 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromSurfaceDistance.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromSurfaceDistance.prefab index ca1d17bbc..99308efbc 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromSurfaceDistance.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_AudioFromSurfaceDistance.prefab @@ -121,7 +121,6 @@ MonoBehaviour: m_EditorClassIdentifier: _Version: 0 _Source: 0 - _Viewer: {fileID: 0} _Layer: 0 _MinimumWavelength: 1 _DistanceFromSurfaceSigned: 0 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_ComplexObjectWaterInteraction.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_ComplexObjectWaterInteraction.prefab index d44c4674c..73b2d0666 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_ComplexObjectWaterInteraction.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_ComplexObjectWaterInteraction.prefab @@ -628,7 +628,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _Version: 0 - _WorldSpace: 0 _Axis: {x: 0, y: 1, z: 0} _Amplitude: 0 _Frequency: 1 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_FloatingObjects.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_FloatingObjects.prefab index e712867a8..2f96e132e 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_FloatingObjects.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_FloatingObjects.prefab @@ -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} diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_OverrideGlobalWaves.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_OverrideGlobalWaves.prefab index d7a042d44..e78afeda2 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_OverrideGlobalWaves.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_OverrideGlobalWaves.prefab @@ -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: diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_TrochoidalWaves.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_TrochoidalWaves.prefab index 7ab395889..cd14769e6 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_TrochoidalWaves.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_TrochoidalWaves.prefab @@ -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: diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveComparison.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveComparison.prefab index af84a8ba3..163512eed 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveComparison.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveComparison.prefab @@ -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: diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveParticle.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveParticle.prefab index 1b6423096..88146da3c 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveParticle.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WaveParticle.prefab @@ -140,7 +140,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _Version: 0 - _WorldSpace: 0 _Axis: {x: 1, y: 0, z: 1} _Amplitude: 15 _Frequency: 1 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WavePatch.prefab b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WavePatch.prefab index 68369f907..76134212f 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WavePatch.prefab +++ b/Assets/Samples/Crest/5.4.2/Examples/Prefabs/Scenes/Examples_WavePatch.prefab @@ -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: diff --git a/Assets/Samples/Crest/5.4.2/Examples/Scenes/Examples.unity b/Assets/Samples/Crest/5.4.2/Examples/Scenes/Examples.unity index 7f5d32fc1..8d30d77e2 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Scenes/Examples.unity +++ b/Assets/Samples/Crest/5.4.2/Examples/Scenes/Examples.unity @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Examples/Scripts/ExamplesController.cs b/Assets/Samples/Crest/5.4.2/Examples/Scripts/ExamplesController.cs index 4ec33f889..3ef936915 100644 --- a/Assets/Samples/Crest/5.4.2/Examples/Scripts/ExamplesController.cs +++ b/Assets/Samples/Crest/5.4.2/Examples/Scripts/ExamplesController.cs @@ -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 _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(); } diff --git a/Assets/Samples/Crest/5.4.2/Main/Materials/Main_Water.mat b/Assets/Samples/Crest/5.4.2/Main/Materials/Main_Water.mat index 16bbe9ccb..92791d67a 100644 --- a/Assets/Samples/Crest/5.4.2/Main/Materials/Main_Water.mat +++ b/Assets/Samples/Crest/5.4.2/Main/Materials/Main_Water.mat @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Main/Prefabs/Main_Scene.prefab b/Assets/Samples/Crest/5.4.2/Main/Prefabs/Main_Scene.prefab index 81d319940..ab059e4ab 100644 --- a/Assets/Samples/Crest/5.4.2/Main/Prefabs/Main_Scene.prefab +++ b/Assets/Samples/Crest/5.4.2/Main/Prefabs/Main_Scene.prefab @@ -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: diff --git a/Assets/Samples/Crest/5.4.2/Ripples/Scenes/Ripples.unity b/Assets/Samples/Crest/5.4.2/Ripples/Scenes/Ripples.unity index e89c52752..0b9995719 100644 --- a/Assets/Samples/Crest/5.4.2/Ripples/Scenes/Ripples.unity +++ b/Assets/Samples/Crest/5.4.2/Ripples/Scenes/Ripples.unity @@ -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: diff --git a/Assets/Samples/Crest/5.4.2/Wakes/Materials/Wakes_Water.mat b/Assets/Samples/Crest/5.4.2/Wakes/Materials/Wakes_Water.mat index 45aa3ab8a..6629f7201 100644 --- a/Assets/Samples/Crest/5.4.2/Wakes/Materials/Wakes_Water.mat +++ b/Assets/Samples/Crest/5.4.2/Wakes/Materials/Wakes_Water.mat @@ -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 diff --git a/Assets/Samples/Crest/5.4.2/Wakes/Prefabs/Wakes_Scene.prefab b/Assets/Samples/Crest/5.4.2/Wakes/Prefabs/Wakes_Scene.prefab index cef7a298e..37146bccf 100644 --- a/Assets/Samples/Crest/5.4.2/Wakes/Prefabs/Wakes_Scene.prefab +++ b/Assets/Samples/Crest/5.4.2/Wakes/Prefabs/Wakes_Scene.prefab @@ -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: diff --git a/Packages/com.waveharmonic.crest/Documentation~/API.pdf b/Packages/com.waveharmonic.crest/Documentation~/API.pdf index 25fd2c190..a2cee0112 100644 Binary files a/Packages/com.waveharmonic.crest/Documentation~/API.pdf and b/Packages/com.waveharmonic.crest/Documentation~/API.pdf differ diff --git a/Packages/com.waveharmonic.crest/Documentation~/Manual.pdf b/Packages/com.waveharmonic.crest/Documentation~/Manual.pdf index 56b423b7d..a3cd4cb39 100644 Binary files a/Packages/com.waveharmonic.crest/Documentation~/Manual.pdf and b/Packages/com.waveharmonic.crest/Documentation~/Manual.pdf differ diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Editors.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Editors.cs index bf7bc2b62..03f19beaf 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Editors.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Editors.cs @@ -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); diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialTooltips.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialTooltips.cs index 39ff31560..38eebcb7d 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialTooltips.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialTooltips.cs @@ -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" }, } }, }; diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialUpgrader.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialUpgrader.cs deleted file mode 100644 index 4126769b1..000000000 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialUpgrader.cs +++ /dev/null @@ -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(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; - } - } -} diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialUpgrader.cs.meta b/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialUpgrader.cs.meta deleted file mode 100644 index aa4aa41ef..000000000 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/MaterialUpgrader.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c96ae7831f600451a8b0c5326b10ac54 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/OptionalLod.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/OptionalLod.cs index f30dddc7f..dbe48190e 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/OptionalLod.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/OptionalLod.cs @@ -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"; } diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Previews.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Previews.cs index e6afc1f08..ef39fdb18 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Previews.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Previews.cs @@ -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 } diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/ProjectSettings.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/ProjectSettings.cs index e27ef2a79..7697c5737 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/ProjectSettings.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/ProjectSettings.cs @@ -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 + sealed class ProjectSettings : ScriptableSingleton { + [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) @@ -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() - { - - } - } } diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Requirements/WaveHarmonic.Crest.Editor.Requirements.asmdef b/Packages/com.waveharmonic.crest/Editor/Scripts/Requirements/WaveHarmonic.Crest.Editor.Requirements.asmdef index 5207eeba9..74ef8cfd2 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Requirements/WaveHarmonic.Crest.Editor.Requirements.asmdef +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Requirements/WaveHarmonic.Crest.Editor.Requirements.asmdef @@ -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" } ], diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/ShaderSettings.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/ShaderSettings.cs index ba94bff1d..6c37e2566 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/ShaderSettings.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/ShaderSettings.cs @@ -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; - } } diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Attributes/Attributes.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Attributes/Attributes.cs index 2280859f8..ea7139604 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Attributes/Attributes.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Attributes/Attributes.cs @@ -147,21 +147,6 @@ namespace WaveHarmonic.Crest /// 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)); } } diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/DecoratedDrawer.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/DecoratedDrawer.cs index 6da90d054..48088bb08 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/DecoratedDrawer.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/DecoratedDrawer.cs @@ -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 _Decorators = null; List Decorators { get { // Populate list with decorators. - _Decorators ??= Field + _Decorators ??= fieldInfo .GetCustomAttributes(typeof(Decorator), false) .ToList(); @@ -55,7 +44,7 @@ namespace WaveHarmonic.Crest.Editor } List _Validators = null; - List Validators => _Validators ??= Field + List Validators => _Validators ??= fieldInfo .GetCustomAttributes(typeof(Attributes.Validator), false) .Cast() .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) diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Helpers.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Helpers.cs index 07559da23..7464fbd5d 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Helpers.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Helpers.cs @@ -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))) { diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Inspector.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Inspector.cs index 4d03c9465..c8a6eaf78 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Inspector.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Inspector.cs @@ -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 _MaterialOwners = new(); readonly Dictionary _MaterialEditors = new(); - readonly Dictionary _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(); - - 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 diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Reflected.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Reflected.cs deleted file mode 100644 index 9f54ca1b9..000000000 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Reflected.cs +++ /dev/null @@ -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)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(); - } - } -} diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Reflected.cs.meta b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Reflected.cs.meta deleted file mode 100644 index 20782f2b0..000000000 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Reflected.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cd362a01f52cc4002857e9f549c641be -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/ScriptingSymbols.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/ScriptingSymbols.cs index 44aedce19..f904cef78 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/ScriptingSymbols.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/ScriptingSymbols.cs @@ -10,7 +10,7 @@ namespace WaveHarmonic.Crest.Editor.Settings { static class ScriptingSymbols { - internal static NamedBuildTarget CurrentNamedBuildTarget + static NamedBuildTarget CurrentNamedBuildTarget { get { diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/TexturePreview.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/TexturePreview.cs index 9e23247c8..4abbc215f 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/TexturePreview.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/TexturePreview.cs @@ -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 diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Validation.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Validation.cs index 6b6524601..3220fa210 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Validation.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Utility/Shared/Validation.cs @@ -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 = $"Crest Validation: {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()) - { - if (field.DeclaringType != type) - { - continue; - } - - foreach (var attribute in field.GetCustomAttributes()) - { - 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 -{ - /// - /// Validates that field is not null. - /// - [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 - ( - $"{fieldName} is required for the {typeName} component to function.", - $"Please set {fieldName}.", - ValidatedHelper.MessageType.Error, - target - ); - - isValid = false; - } - - return isValid; - } - } - - /// - /// Shows a info message if field is null. - /// - [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 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 - ( - $"{fieldName} is not set for the {typeName} component. " + _Message, - string.Empty, - ValidatedHelper.MessageType.Info, - target - ); - - return true; - } - } } diff --git a/Packages/com.waveharmonic.crest/Editor/Scripts/Validators.cs b/Packages/com.waveharmonic.crest/Editor/Scripts/Validators.cs index fe603283d..c16869d59 100644 --- a/Packages/com.waveharmonic.crest/Editor/Scripts/Validators.cs +++ b/Packages/com.waveharmonic.crest/Editor/Scripts/Validators.cs @@ -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 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 + ( + "All Cameras requires Legacy Underwater to be enabled.", + "Either disable All Cameras or enable Project Settings > Crest > Legacy Underwater.", + 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 Signed Distance Fields", 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 - ( - $"{target.PropertyLabel} must be enabled for this platform in the project settings.", - $"Enable Project Settings > Crest > Features > Default/{platform.TargetName} > {target.PropertyLabel}. " + - $"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 Global Wind Speed on the Water Renderer to {water.WindSpeedKPH} KPH.", $"If you want fully developed waves, either override the wind speed on this component or increase the Global Wind Speed.", - 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 {nameof(DepthProbe)} 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 {nameof(DepthProbe)} 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(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 CPU Queries package is not installed.", "Install the CPU Queries 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 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 ( - $"{nameof(WaterRenderer)} > {lod.Name} > {nameof(lod.QuerySource)} is set to None. {extra}", - $"Set the {nameof(lod.QuerySource)} to {nameof(LodQuerySource.GPU)} to use data.", - MessageType.Info, Water, - FixSetQuerySourceToCompute, - $"_{lod.GetType().Name}._{nameof(lod.QuerySource)}", - caller: target + "Collision Source on the Water Renderer is set to None. The floating objects in the scene will use a flat horizontal plane.", + "Set the Collision Source to GPU to incorporate waves into physics.", + MessageType.Warning, Water, + FixSetCollisionSourceToCompute ); } diff --git a/Packages/com.waveharmonic.crest/Editor/Shaders/VisualizeNegativeValues.compute b/Packages/com.waveharmonic.crest/Editor/Shaders/VisualizeNegativeValues.compute index ac84c48e8..1c7ca254a 100644 --- a/Packages/com.waveharmonic.crest/Editor/Shaders/VisualizeNegativeValues.compute +++ b/Packages/com.waveharmonic.crest/Editor/Shaders/VisualizeNegativeValues.compute @@ -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 diff --git a/Packages/com.waveharmonic.crest/Runtime/Materials/Water (Flow).mat b/Packages/com.waveharmonic.crest/Runtime/Materials/Water (Flow).mat index 6788aee75..d3ba6b877 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Materials/Water (Flow).mat +++ b/Packages/com.waveharmonic.crest/Runtime/Materials/Water (Flow).mat @@ -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: [] diff --git a/Packages/com.waveharmonic.crest/Runtime/Materials/Water Volume.mat b/Packages/com.waveharmonic.crest/Runtime/Materials/Water Volume.mat index 157ea619a..794c9d29a 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Materials/Water Volume.mat +++ b/Packages/com.waveharmonic.crest/Runtime/Materials/Water Volume.mat @@ -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 diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Assembly.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Assembly.cs index 3e7c062eb..7b51a8998 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Assembly.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Assembly.cs @@ -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")] diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Constants.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Constants.cs index 84b6a3480..c32e32fdc 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Constants.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Constants.cs @@ -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 - } - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AlbedoLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AlbedoLod.cs index b16b8e9d1..a6510b944 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AlbedoLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AlbedoLod.cs @@ -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 { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AnimatedWavesLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AnimatedWavesLod.cs index afbfcc74e..d93462789 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AnimatedWavesLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/AnimatedWavesLod.cs @@ -20,7 +20,6 @@ namespace WaveHarmonic.Crest /// /// The source of collisions (ie water shape). /// - [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). + /// + [Tooltip("All layers.")] + Everything = -1, + /// [Tooltip("No extra layers (ie single layer).")] - Nothing = 0, + Nothing, /// [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 /// [Tooltip("Extra displacement layer for visual displacement.")] Displacement = 1 << 2, - - /// - [Tooltip("All layers.")] - Everything = ~0, - } - - /// - /// The wave sampling method to determine quality and performance. - /// - [@GenerateDoc] - public enum WaveSampling - { - /// - [Tooltip("Automatically chooses the other options as needed (512+ resolution needs precision).")] - Automatic, - - /// - [Tooltip("Reduces samples by copying waves from higher LODs to lower LODs.\n\nBest for resolutions lower than 512.")] - Performance, - - /// - [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, } /// @@ -128,33 +108,14 @@ namespace WaveHarmonic.Crest [@FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)] public sealed partial class AnimatedWavesLod : Lod { - [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 /// 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 + } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ClipLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ClipLod.cs index 781a39d7f..45babc546 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ClipLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ClipLod.cs @@ -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 { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ColorLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ColorLod.cs index 777bb33dc..1d0a965cb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ColorLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ColorLod.cs @@ -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 { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/DepthLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/DepthLod.cs index d8cb6f428..87a7f47cb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/DepthLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/DepthLod.cs @@ -12,7 +12,6 @@ namespace WaveHarmonic.Crest /// /// Data that gives depth of the water (height of sea level above water floor). /// - [FilterEnum(nameof(_QuerySource), Filtered.Mode.Exclude, (int)LodQuerySource.CPU)] [FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)] public sealed partial class DepthLod : Lod { @@ -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 s_Inputs = new(Helpers.DuplicateComparison); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/FlowLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/FlowLod.cs index 83f4fd6c2..cff9f4824 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/FlowLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/FlowLod.cs @@ -10,7 +10,6 @@ namespace WaveHarmonic.Crest /// /// Simulates horizontal motion of water. /// - [FilterEnum(nameof(_QuerySource), Filtered.Mode.Exclude, (int)LodQuerySource.CPU)] [FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)] public sealed partial class FlowLod : Lod { @@ -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 s_Inputs = new(Helpers.DuplicateComparison); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/AnimatedWavesLodInput.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/AnimatedWavesLodInput.cs index 7190b6aa7..da2b9a89e 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/AnimatedWavesLodInput.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/AnimatedWavesLodInput.cs @@ -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); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LevelLodInput.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LevelLodInput.cs index ed68d67d3..68995c1b5 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LevelLodInput.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LevelLodInput.cs @@ -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); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LodInput.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LodInput.cs index dde9bbb64..621ecf8d3 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LodInput.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/LodInput.cs @@ -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); } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Probe/DepthProbe.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Probe/DepthProbe.cs index d2018e0d8..c541ec527 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Probe/DepthProbe.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Probe/DepthProbe.cs @@ -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 { /// @@ -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, diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeFFT.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeFFT.cs index 8a15e45b4..1cbed8353 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeFFT.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeFFT.cs @@ -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() diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeGerstner.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeGerstner.cs index a58d063ab..de3179a85 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeGerstner.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeGerstner.cs @@ -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() diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeWaves.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeWaves.cs index e7167e9cf..38a952124 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeWaves.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/Shape/ShapeWaves.cs @@ -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 /// /// The wind speed in meters per second (MPS). /// - /// + /// /// /// Wind speed can come from this component or the . /// 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 diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/TextureLodInputData.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/TextureLodInputData.cs index 7b0788832..e225608a4 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/TextureLodInputData.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Input/TextureLodInputData.cs @@ -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); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/LevelLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/LevelLod.cs index 0fb37732a..80ef07eb6 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/LevelLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/LevelLod.cs @@ -41,7 +41,6 @@ namespace WaveHarmonic.Crest _OverrideResolution = false; _TextureFormatMode = LodTextureFormatMode.Automatic; _TextureFormat = GraphicsFormat.R16_SFloat; - _BlurIterations = 4; } internal static readonly SortedList s_Inputs = new(Helpers.DuplicateComparison); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Lod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Lod.cs index 5510aba54..6608109ec 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Lod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Lod.cs @@ -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; + using Inputs = SortedList; /// /// 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 _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); } + /// + /// 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. + /// + 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); - } - /// /// Bind data needed to load or compute from this simulation. /// @@ -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 _Targets; - public BufferedData _SamplingParameters; - } - - readonly Dictionary _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 where T : IQueryProvider - { - string Name { get; } - bool Enabled { get; } - WaterRenderer Water { get; } - int MaximumQueryCount { get; } - LodQuerySource QuerySource { get; } - } - - /// - /// The source of collisions (ie water shape). - /// - [@GenerateDoc] - public enum LodQuerySource - { - /// - [Tooltip("No query source.")] - None, - - /// - [Tooltip("Uses AsyncGPUReadback to retrieve data from GPU to CPU.\n\nThis is the most optimal approach.")] - GPU, - - /// - [Tooltip("Computes data entirely on the CPU.")] - CPU, - } - /// /// Base type for simulations with a provider. /// /// The query provider. [System.Serializable] - public abstract partial class Lod : Lod, IQueryableLod where T : IQueryProvider + public abstract class Lod : 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; - /// /// Provides data from the GPU to CPU. /// public T Provider { get; set; } - - WaterRenderer IQueryableLod.Water => Water; - string IQueryableLod.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 - { - 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 } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/PersistentLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/PersistentLod.cs index ff5135fd9..74b1083fc 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/PersistentLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/PersistentLod.cs @@ -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 _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; - } - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionProvider.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionProvider.cs index 79f878146..e5ba95825 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionProvider.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionProvider.cs @@ -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); - } - /// /// Gives a flat, still water. /// 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 /// Resulting heights (displacement Y + sea level) at the query positions. Pass null if this information is not required. /// Resulting normals at the query positions. Pass null if this information is not required. /// Resulting velocities at the query positions. Pass null if this information is not required. - /// - int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null); + /// + int Query(int hash, float minimumLength, Vector3[] points, float[] heights, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything); /// Resulting displacement vectors at the query positions. Add sea level to Y to get world space height. - /// - /// - int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything, Vector3? center = null); + /// + /// + int Query(int hash, float minimumLength, Vector3[] points, Vector3[] displacements, Vector3[] normals, Vector3[] velocities, CollisionLayer layer = CollisionLayer.Everything); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionQuery.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionQuery.cs index 4f69ecc28..d8f4dfa6d 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionQuery.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/CollisionQuery.cs @@ -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 /// 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, 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(); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/RayTraceHelper.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/RayTraceHelper.cs index 5edfb3d80..28b23f318 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/RayTraceHelper.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Collision/RayTraceHelper.cs @@ -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)) { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthProvider.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthProvider.cs index 826be2226..acaa35535 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthProvider.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthProvider.cs @@ -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. /// /// Water depth and distance to shoreline (XY respectively). Both are signed. - /// - int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results, Vector3? center = null); + /// + int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthQuery.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthQuery.cs index 0dbf6a384..aaf71d6c1 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthQuery.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Depth/DepthQuery.cs @@ -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, IDepthProvider - { - public DepthQueryPerCamera(WaterRenderer water) : base(water) { } - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowProvider.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowProvider.cs index e32468a82..ac3e4df91 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowProvider.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowProvider.cs @@ -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); - } - /// /// Gives a stationary water (no horizontal flow). /// 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. /// /// Water surface flow velocities at the query positions. - /// - int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results, Vector3? center = null); + /// + int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowQuery.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowQuery.cs index 51c06af1a..36ffacebd 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowQuery.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Flow/FlowQuery.cs @@ -6,15 +6,9 @@ namespace WaveHarmonic.Crest /// /// Samples horizontal motion of water volume /// - 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, IFlowProvider - { - public FlowQueryPerCamera(WaterRenderer water) : base(water) { } - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Query.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Query.cs index 0500023d7..f2f85bead 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Query.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/Query.cs @@ -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 /// 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. /// The world space points that will be queried. /// The layer this query targets. - /// The center of all the query positions. Used to choose the closest query provider. /// The status of the query. - 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; /// /// 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); } /// @@ -72,7 +64,6 @@ namespace WaveHarmonic.Crest const int k_NormalAdditionalQueryCount = 2; readonly WaterRenderer _Water; - readonly IQueryableLod _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]; /// /// 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 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 {nameof(WaterRenderer)} > Simulations > {_Lod.Name} > {nameof(_Lod.MaximumQueryCount)} to support a higher number of queries.", _Water); + _Wrapper = new(water.SimulationBuffer, shader, Kernel); } /// @@ -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 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 : IQueryable where T : IQueryable, new() - { - internal readonly WaterRenderer _Water; - internal readonly Dictionary _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 : QueryPerCamera, 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 diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/QueryEvents.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/QueryEvents.cs index 64f564b61..504b3e154 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/QueryEvents.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/QueryEvents.cs @@ -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)) diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/SamplingHelpers.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/SamplingHelpers.cs index d60aa015b..efff75dd7 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/SamplingHelpers.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/Query/SamplingHelpers.cs @@ -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 _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 /// 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); - } - /// /// Sample both the water depth and water edge distance. /// /// Filled by the water depth at the query position. /// Filled by the distance to water edge at the query position. /// - 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 /// 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; } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsHDRP.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsHDRP.cs index 2b7f581c1..ca0e427d3 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsHDRP.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsHDRP.cs @@ -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. diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.RenderGraph.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.RenderGraph.cs index f7bea2548..de8c6757e 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.RenderGraph.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.RenderGraph.cs @@ -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 } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.cs index edd930022..7bae8db40 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/SampleShadowsURP.cs @@ -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)) { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.Legacy.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.Legacy.cs index 6dc79c201..ecab8beec 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.Legacy.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.Legacy.cs @@ -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); + } } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.cs index 856d0dc5a..71e0a1ffb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Data/ShadowLod.cs @@ -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)); + } + /// /// Validates the primary light. /// @@ -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 s_Inputs = new(Helpers.DuplicateComparison); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/API.Generated.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/API.Generated.cs index 79a4573e4..01b907897 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/API.Generated.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/API.Generated.cs @@ -23,9 +23,13 @@ namespace WaveHarmonic.Crest /// /// Where to obtain water shape on CPU for physics / gameplay. /// - [System.Obsolete("Please use QuerySource instead.")] public CollisionSource CollisionSource { get => _CollisionSource; internal set => _CollisionSource = value; } + /// + /// Maximum number of wave queries that can be performed when using GPU queries. + /// + public int MaximumQueryCount => _MaximumQueryCount; + /// /// Any water deeper than this will receive full wave strength. /// @@ -40,12 +44,7 @@ namespace WaveHarmonic.Crest /// /// 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. /// - public float WaveResolutionMultiplier { get => GetWaveResolutionMultiplier(); set => _WaveResolutionMultiplier = value; } - - /// - /// The wave sampling method to determine quality and performance. - /// - 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 { - /// - /// Blurs the output. - /// - /// - /// Enable if blurring is desired or intolerable artifacts are present. - /// The blur is optimized to only run on inner LODs and at lower scales. - /// - public bool Blur { get => _Blur; set => _Blur = value; } - - /// - /// Number of blur iterations. - /// - /// - /// Blur iterations are optimized to only run maximum iterations on the inner LODs. - /// - public int BlurIterations { get => _BlurIterations; set => _BlurIterations = value; } - /// /// Whether the simulation is enabled. /// @@ -715,22 +697,6 @@ namespace WaveHarmonic.Crest } } -namespace WaveHarmonic.Crest -{ - partial class Lod - { - /// - /// Maximum number of queries that can be performed when using GPU queries. - /// - public int MaximumQueryCount => _MaximumQueryCount; - - /// - /// Where to obtain water data on CPU for physics / gameplay. - /// - 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 { - /// - /// Rules to exclude cameras from rendering the meniscus. - /// - /// - /// These are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules. - /// - public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; } - /// /// Whether the meniscus is enabled. /// @@ -984,14 +942,6 @@ namespace WaveHarmonic.Crest /// "Viewer" will reuse queries already performed by the Water Renderer /// public QuerySource Source { get => _Source; set => _Source = value; } - - /// - /// The viewer as the source of the queries. - /// - /// - /// Only needs to be set if using multiple viewpoints on the Water Renderer. - /// - public UnityEngine.Camera Viewer { get => _Viewer; set => _Viewer = value; } } } @@ -1092,11 +1042,6 @@ namespace WaveHarmonic.Crest /// public float MaximumVerticalDisplacement { get => _MaximumVerticalDisplacement; set => _MaximumVerticalDisplacement = value; } - /// - /// Whether to override automatic culling based on heuristics. - /// - public bool OverrideCulling { get => _OverrideCulling; set => _OverrideCulling = value; } - /// /// Whether to use the wind turbulence on this component rather than the global wind turbulence. /// @@ -1171,14 +1116,6 @@ namespace WaveHarmonic.Crest /// public bool EvaluateSpectrumAtRunTimeEveryFrame { get => _EvaluateSpectrumAtRunTimeEveryFrame; set => _EvaluateSpectrumAtRunTimeEveryFrame = value; } - /// - /// Whether the maximum possible vertical displacement is used for the Drop Detail Height Based On Waves calculation. - /// - /// - /// 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). - /// - public bool IncludeInDropDetailHeightBasedOnWaves { get => _IncludeInDropDetailHeightBasedOnWaves; set => _IncludeInDropDetailHeightBasedOnWaves = value; } - /// /// Whether to use the wind direction on this component rather than the global wind direction. /// @@ -1201,7 +1138,7 @@ namespace WaveHarmonic.Crest /// /// Low resolutions are more efficient but can result in noticeable patterns in the shape. /// - public int Resolution { get => GetResolution(); set => _Resolution = value; } + public int Resolution { get => _Resolution; set => _Resolution = value; } /// /// How much these waves respect the shallow water attenuation. @@ -1211,14 +1148,6 @@ namespace WaveHarmonic.Crest /// public float RespectShallowWaterAttenuation { get => _RespectShallowWaterAttenuation; set => _RespectShallowWaterAttenuation = value; } - /// - /// Whether global waves is applied above or below sea level. - /// - /// - /// Waves are faded out to avoid hard transitionds. They are fully faded by 1m from sea level. - /// - public bool SeaLevelOnly { get => _SeaLevelOnly; set => _SeaLevelOnly = value; } - /// /// The spectrum that defines the water surface shape. /// @@ -1344,14 +1273,6 @@ namespace WaveHarmonic.Crest /// public bool AllowRenderQueueSorting { get => _AllowRenderQueueSorting; set => _AllowRenderQueueSorting = value; } - /// - /// Rules to exclude cameras from surface rendering. - /// - /// - /// These are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules. - /// - public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; } - /// /// Have the water surface cast shadows for albedo (both foam and custom). /// @@ -1430,17 +1351,8 @@ namespace WaveHarmonic.Crest /// /// 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. /// - [System.Obsolete("Please use Camera Exclusion instead.")] public bool AllCameras { get => _AllCameras; set => _AllCameras = value; } - /// - /// Rules to exclude cameras from rendering underwater. - /// - /// - /// These are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules. - /// - public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; } - /// /// Copying parameters each frame ensures underwater appearance stays consistent with the water surface. /// @@ -1594,7 +1506,6 @@ namespace WaveHarmonic.Crest /// /// Whether to allow MSAA. /// - [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; } /// @@ -1661,14 +1572,6 @@ namespace WaveHarmonic.Crest /// public float NonObliqueNearSurfaceThreshold { get => _NonObliqueNearSurfaceThreshold; set => _NonObliqueNearSurfaceThreshold = value; } - /// - /// Overscan amount to capture off-screen content. - /// - /// - /// 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. - /// - public float Overscan { get => _Overscan; set => _Overscan = value; } - /// /// Overrides global quality settings. /// @@ -1746,14 +1649,6 @@ namespace WaveHarmonic.Crest /// public UnityEngine.Camera Viewer { get => GetViewer(); set => _Camera = value; } - /// - /// Rules to exclude cameras from being a center-of-detail. - /// - /// - /// These are exclusion rules, so for all cameras, select Nothing. - /// - public WaterCameraExclusion CameraExclusions { get => _CameraExclusions; set => _CameraExclusions = value; } - /// /// Have the water surface cast shadows for albedo (both foam and custom). /// @@ -1773,14 +1668,6 @@ namespace WaveHarmonic.Crest /// public ClipLod ClipLod => _ClipLod; - /// - /// The background rendering mode when a camera does not render. - /// - /// - /// 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. - /// - public WaterDataBackgroundMode DataBackgroundMode { get => _DataBackgroundMode; set => _DataBackgroundMode = value; } - /// /// Water depth information used for shallow water, shoreline foam, wave attenuation, among others. /// diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/Documentation.Generated.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/Documentation.Generated.cs index 598779422..cb31f4f00 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/Documentation.Generated.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Generated/Documentation.Generated.cs @@ -29,6 +29,11 @@ namespace WaveHarmonic.Crest.Generated { enum CollisionLayers { + /// + /// All layers. + /// + Everything, + /// /// No extra layers (ie single layer). /// @@ -46,11 +51,6 @@ namespace WaveHarmonic.Crest.Generated /// Extra displacement layer for visual displacement. /// Displacement, - - /// - /// All layers. - /// - Everything, } } @@ -288,31 +288,6 @@ namespace WaveHarmonic.Crest.Generated } -namespace WaveHarmonic.Crest.Generated -{ - enum LodQuerySource - { - /// - /// No query source. - /// - None, - - /// - /// Uses AsyncGPUReadback to retrieve data from GPU to CPU. - /// - /// - /// This is the most optimal approach. - /// - GPU, - - /// - /// Computes data entirely on the CPU. - /// - CPU, - } -} - - namespace WaveHarmonic.Crest.Generated { enum LodTextureFormatMode @@ -410,68 +385,6 @@ namespace WaveHarmonic.Crest.Generated } -namespace WaveHarmonic.Crest.Generated -{ - enum WaterCameraExclusion - { - /// - /// No exclusion rules applied. - /// - Nothing, - - /// - /// Exclude hidden cameras. - /// - /// - /// Does not affect reflection cameras, as they are typically always hidden. Use the Reflection flag for them. - /// - Hidden, - - /// - /// Exclude reflection cameras. - /// - Reflection, - - /// - /// Exclude cameras not tagged as MainCamera. - /// - NonMainCamera, - - /// - /// Apply all exclusion rules. - /// - Everything, - } -} - - -namespace WaveHarmonic.Crest.Generated -{ - enum WaterDataBackgroundMode - { - /// - /// Always progress simulations in the background when camera does not render. - /// - Always, - - /// - /// Progress simulations in the background when camera is inactive (ie !isActiveAndEnabled). - /// - Inactive, - - /// - /// Progress simulations in the background when camera is disabled (ie !enabled). - /// - Disabled, - - /// - /// Never progress simulations in the background. - /// - Never, - } -} - - namespace WaveHarmonic.Crest.Generated { enum WaterInjectionPoint @@ -538,31 +451,3 @@ namespace WaveHarmonic.Crest.Generated Clip, } } - - -namespace WaveHarmonic.Crest.Generated -{ - enum WaveSampling - { - /// - /// Automatically chooses the other options as needed (512+ resolution needs precision). - /// - Automatic, - - /// - /// Reduces samples by copying waves from higher LODs to lower LODs. - /// - /// - /// Best for resolutions lower than 512. - /// - Performance, - - /// - /// Samples directly from the wave buffers to preserve wave quality. - /// - /// - /// Needed for higher resolutions (512+). Higher LOD counts can also benefit with this enabled. - /// - Precision, - } -} diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Interaction/FloatingObject.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Interaction/FloatingObject.cs index 931ac21ef..87cbaffa1 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Interaction/FloatingObject.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Interaction/FloatingObject.cs @@ -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[] { }; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.Universal.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.Universal.cs index a4edc549c..8d5fcf4f0 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.Universal.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.Universal.cs @@ -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 } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.cs index 1024e67c6..4f6c36ec7 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Mask/MaskRenderer.cs @@ -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; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.Universal.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.Universal.cs index a830cefda..152b56b9a 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.Universal.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.Universal.cs @@ -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 } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.cs index db2a7b0f0..eb5d94713 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Meniscus/Meniscus.cs @@ -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(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; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Displaced.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Displaced.cs index 6ec34adf5..e04bdd91c 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Displaced.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Displaced.cs @@ -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) { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Editor.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Editor.cs index 740093c7a..eee19dcd4 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Editor.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Editor.cs @@ -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. diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.HighDefinition.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.HighDefinition.cs index a3437a081..34cad4e02 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.HighDefinition.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.HighDefinition.cs @@ -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, diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Legacy.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Legacy.cs index 74695356c..80ecbd838 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Legacy.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Legacy.cs @@ -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); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.HighDefinition.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.HighDefinition.cs index ae1bd4f59..0fd2f3848 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.HighDefinition.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.HighDefinition.cs @@ -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 diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Legacy.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Legacy.cs index a72a2fa5a..0b4529075 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Legacy.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Legacy.cs @@ -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 diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Universal.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Universal.cs index f3a529de0..d48fcd3de 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Universal.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.Universal.cs @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#if UNITY_EDITOR - #if d_UnityURP using UnityEngine; @@ -39,7 +37,7 @@ namespace WaveHarmonic.Crest return; } - if (camera.cameraType != CameraType.SceneView || (_Water.SingleViewpoint && camera != _Water.Viewer)) + if (camera.cameraType != CameraType.SceneView || camera != _Water.Viewer) { return; } @@ -71,10 +69,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) @@ -84,10 +79,8 @@ namespace WaveHarmonic.Crest context.ExecuteCommandBuffer(buffer); CommandBufferPool.Release(buffer); } -#endif } } } #endif // d_UnityURP -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.cs index f41c2d74d..e2db06a3b 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.LevelDepthTexture.cs @@ -1,9 +1,8 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#if UNITY_EDITOR +// FIXME: Broken for BIRP on MacOS. Either platform specific problem or bug in Unity. -using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; @@ -12,38 +11,16 @@ namespace WaveHarmonic.Crest partial class SurfaceRenderer { RenderTexture _WaterLevelDepthTexture; - internal RenderTexture WaterLevelDepthTexture { get; private set; } + internal RenderTexture WaterLevelDepthTexture => _WaterLevelDepthTexture; RenderTargetIdentifier _WaterLevelDepthTarget; Material _WaterLevelDepthMaterial; - internal RenderTexture GetWaterLevelDepthTexture(Camera camera) - { - // Do not use SeparateViewpoint here, as this is called outside the camera loop. - if (_Water.SingleViewpoint) - { - return WaterLevelDepthTexture; - } - else if (_PerCameraLevelDepthTexture.ContainsKey(camera)) - { - return _PerCameraLevelDepthTexture[camera]; - } - - return null; - } - const string k_WaterLevelDepthTextureName = "Crest Water Level Depth Texture"; void ExecuteWaterLevelDepthTexture(Camera camera, CommandBuffer buffer) { - if (_Water.SingleViewpoint && _WaterLevelDepthTexture == null) - { - _WaterLevelDepthTexture = new(0, 0, 0); - WaterLevelDepthTexture = _WaterLevelDepthTexture; - } - - LoadCameraDataLDT(camera); - - WaterLevelDepthTexture.name = k_WaterLevelDepthTextureName; + Helpers.CreateRenderTargetTextureReference(ref _WaterLevelDepthTexture, ref _WaterLevelDepthTarget); + _WaterLevelDepthTexture.name = k_WaterLevelDepthTextureName; if (_WaterLevelDepthMaterial == null) { @@ -64,19 +41,11 @@ namespace WaveHarmonic.Crest // Depth texture. // Always release to handle screen size changes. - WaterLevelDepthTexture.Release(); + _WaterLevelDepthTexture.Release(); descriptor.graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.R32_SFloat; descriptor.depthBufferBits = 0; - WaterLevelDepthTexture.descriptor = descriptor; - WaterLevelDepthTexture.Create(); - - _WaterLevelDepthTarget = new - ( - WaterLevelDepthTexture, - mipLevel: 0, - CubemapFace.Unknown, - depthSlice: -1 // Bind all XR slices. - ); + Helpers.SafeCreateRenderTexture(ref _WaterLevelDepthTexture, descriptor); + _WaterLevelDepthTexture.Create(); // Convert. Helpers.Blit(buffer, _WaterLevelDepthTarget, Rendering.BIRP.UtilityMaterial, (int)Rendering.BIRP.UtilityPass.Copy); @@ -112,48 +81,4 @@ namespace WaveHarmonic.Crest #endif } } - - // Multiple Viewpoints - // Technically, this should always store an RT per camera, as it is screen-space. - // But having it opt-in is not a bad idea. - partial class SurfaceRenderer - { - internal Dictionary _PerCameraLevelDepthTexture = new(); - - void LoadCameraDataLDT(Camera camera) - { - if (_Water.SingleViewpoint) - { - return; - } - - if (!_PerCameraLevelDepthTexture.ContainsKey(camera)) - { - var descriptor = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight) - { - graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None, - depthBufferBits = 32, - }; - - WaterLevelDepthTexture = new(descriptor); - _PerCameraLevelDepthTexture.Add(camera, WaterLevelDepthTexture); - } - else - { - WaterLevelDepthTexture = _PerCameraLevelDepthTexture[camera]; - } - } - - internal void RemoveCameraDataLDT(Camera camera) - { - if (_PerCameraLevelDepthTexture.ContainsKey(camera)) - { - _PerCameraLevelDepthTexture[camera].Release(); - Helpers.Destroy(_PerCameraLevelDepthTexture[camera]); - _PerCameraLevelDepthTexture.Remove(camera); - } - } - } } - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Universal.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Universal.cs index d1ad47885..023398fbd 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Universal.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.Universal.cs @@ -24,7 +24,9 @@ namespace WaveHarmonic.Crest { _Water = water; renderPassEvent = RenderPassEvent.BeforeRenderingTransparents; - ConfigureInput(ScriptableRenderPassInput.None); + + // Copy color happens between "after skybox" and "before transparency". + ConfigureInput(ScriptableRenderPassInput.Color | ScriptableRenderPassInput.Depth); } public static void Enable(WaterRenderer water) @@ -56,14 +58,12 @@ namespace WaveHarmonic.Crest } // Our reflections do not need them. - if (camera == _Water.Reflections.ReflectionCamera) + if (camera == WaterReflections.CurrentCamera) { return; } - var material = _Water.Surface.Material; - - if (material == null) + if (Instance._Water.Surface.Material == null) { return; } @@ -73,15 +73,6 @@ namespace WaveHarmonic.Crest return; } - { - // Copy color happens between "after skybox" and "before transparency". - var pass = ScriptableRenderPassInput.Color | ScriptableRenderPassInput.Depth; -#if d_Crest_SimpleTransparency - pass = ScriptableRenderPassInput.None; -#endif - ConfigureInput(pass); - } - camera.GetUniversalAdditionalCameraData().scriptableRenderer.EnqueuePass(Instance); } @@ -122,7 +113,6 @@ namespace WaveHarmonic.Crest var rld = new RendererListDesc(_ShaderTagID, renderingData.cullResults, cameraData.camera) { layerMask = 1 << _Water.Surface.Layer, - // Required to set the pass. Use shader to keep WB material overrides. overrideShader = _Water.Surface.Material.shader, overrideShaderPassIndex = 0, // UniversalForward renderQueueRange = RenderQueueRange.transparent, @@ -139,10 +129,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 renderingData) @@ -157,7 +144,6 @@ namespace WaveHarmonic.Crest var rld = new RendererListDesc(_ShaderTagID, renderingData.cullResults, renderingData.cameraData.camera) { layerMask = 1 << _Water.Surface.Layer, - // Required to set the pass. Use shader to keep WB material overrides. overrideShader = _Water.Surface.Material.shader, overrideShaderPassIndex = 0, // UniversalForward renderQueueRange = RenderQueueRange.transparent, @@ -170,7 +156,6 @@ namespace WaveHarmonic.Crest context.ExecuteCommandBuffer(buffer); CommandBufferPool.Release(buffer); } -#endif } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.cs index 5e1b58150..26f446692 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/SurfaceRenderer.cs @@ -5,19 +5,10 @@ using System.Buffers; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; -using WaveHarmonic.Crest.Internal; +using WaveHarmonic.Crest.Utility; namespace WaveHarmonic.Crest { - enum WaterMeshType - { - [Tooltip("Chunks implemented as a clip-map.")] - Chunks, - - [Tooltip("A single quad.\n\nOptimal for demanding platforms like mobile. Displacement will only contribute to normals.")] - Quad, - } - /// /// Renders the water surface. /// @@ -36,12 +27,6 @@ namespace WaveHarmonic.Crest [@DecoratedField, SerializeField] internal bool _Enabled = true; - [@Label("Mesh")] - [Tooltip("The meshing solution for the water surface.")] - [@DecoratedField] - [@SerializeField] - WaterMeshType _MeshType; - [Tooltip("The water chunk renderers will have this layer.")] [@Layer] [@GenerateAPI] @@ -89,12 +74,6 @@ namespace WaveHarmonic.Crest [@Heading("Advanced")] - [Tooltip("Rules to exclude cameras from surface rendering.\n\nThese are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.")] - [@DecoratedField] - [@GenerateAPI] - [SerializeField] - internal WaterCameraExclusion _CameraExclusions = WaterCameraExclusion.Hidden | WaterCameraExclusion.Reflection; - [Tooltip("How to handle self-intersections of the water surface.\n\nThey can be caused by choppy waves which can cause a flipped underwater effect. When not using the portals/volumes, this fix is only applied when within 2 metres of the water surface. Automatic will disable the fix if portals/volumes are used which is the recommend setting.")] [@DecoratedField, SerializeField] internal SurfaceSelfIntersectionFixMode _SurfaceSelfIntersectionFixMode = SurfaceSelfIntersectionFixMode.Automatic; @@ -143,8 +122,8 @@ namespace WaveHarmonic.Crest // Level of Detail // - readonly MaterialPropertyBlock[] _PerCascadeMPB = new MaterialPropertyBlock[Lod.k_MaximumSlices]; - internal MaterialPropertyBlock[] PerCascadeMPB { get; private set; } + // Extra frame is for motion vectors. + internal BufferedData _PerCascadeMPB = new(2, () => new MaterialPropertyBlock[Lod.k_MaximumSlices]); // We are computing these values to be optimal based on the base mesh vertex density. float _LodAlphaBlackPointFade; @@ -176,7 +155,6 @@ namespace WaveHarmonic.Crest internal Material _MotionVectorMaterial; internal Material AboveOrBelowSurfaceMaterial => _VolumeMaterial == null ? _Material : _VolumeMaterial; - internal bool IsQuadMesh => _MeshType == WaterMeshType.Quad; // @@ -222,23 +200,8 @@ namespace WaveHarmonic.Crest public static readonly int s_ChunkGeometryGridWidth = Shader.PropertyToID("_Crest_ChunkGeometryGridWidth"); public static readonly int s_ChunkFarNormalsWeight = Shader.PropertyToID("_Crest_ChunkFarNormalsWeight"); public static readonly int s_ChunkNormalScrollSpeed = Shader.PropertyToID("_Crest_ChunkNormalScrollSpeed"); - public static readonly int s_NormalMapParameters = Shader.PropertyToID("_Crest_NormalMapParameters"); - } - - bool _ForceRenderingOff; - - internal bool ForceRenderingOff - { - get => _ForceRenderingOff; - set - { - _ForceRenderingOff = value; - - if (_Enabled) - { - Root.gameObject.SetActive(!_ForceRenderingOff && !IsQuadMesh); - } - } + public static readonly int s_ChunkMeshScaleAlphaSource = Shader.PropertyToID("_Crest_ChunkMeshScaleAlphaSource"); + public static readonly int s_ChunkGeometryGridWidthSource = Shader.PropertyToID("_Crest_ChunkGeometryGridWidthSource"); } internal void Initialize() @@ -248,10 +211,19 @@ namespace WaveHarmonic.Crest Root.position = _Water.Position; Root.localScale = new(_Water.Scale, 1f, _Water.Scale); - // Populate MPBs with defaults. Protects against null exceptions etc. - PerCascadeMPB = _PerCascadeMPB; - NormalMapParameters = _NormalMapParameters; - InitializeProperties(); + // Populate MPBs with defaults. + for (var index = 0; index < _Water.LodLevels; index++) + { + for (var frame = 0; frame < 2; frame++) + { + var mpb = new MaterialPropertyBlock(); + mpb.SetInteger(Lod.ShaderIDs.s_LodIndex, index); + mpb.SetFloat(ShaderIDs.s_ChunkFarNormalsWeight, 1f); + mpb.SetFloat(ShaderIDs.s_ChunkMeshScaleAlpha, 0f); + mpb.SetFloat(ShaderIDs.s_ChunkMeshScaleAlphaSource, 0f); + _PerCascadeMPB.Previous(frame)[index] = mpb; + } + } // Resolution is 4 tiles across. var baseMeshDensity = _Water.LodResolution * 0.25f / _Water._GeometryDownSampleFactor; @@ -325,11 +297,6 @@ namespace WaveHarmonic.Crest return; } - if (IsQuadMesh) - { - return; - } - GeometryUtility.CalculateFrustumPlanes(camera, _CameraFrustumPlanes); foreach (var chunk in Chunks) @@ -380,43 +347,20 @@ namespace WaveHarmonic.Crest _Rebuild = false; } - internal void DisableChunks() + internal void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { - foreach (var chunk in Chunks) + if (!WaterRenderer.ShouldRender(camera, Layer)) { - if (chunk.Rend != null) chunk.Rend.enabled = false; - } - } - - internal bool ShouldRender(Camera camera) - { - if (!_Enabled) - { - return false; - } - - if (!WaterRenderer.ShouldRender(camera, Layer, _CameraExclusions)) - { - return false; + return; } // Our planar reflection camera must never render the surface. - if (camera == _Water.Reflections.ReflectionCamera) + if (camera == WaterReflections.CurrentCamera) { - return false; + return; } if (Material == null) - { - return false; - } - - return true; - } - - internal void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) - { - if (!ShouldRender(camera)) { return; } @@ -424,7 +368,7 @@ namespace WaveHarmonic.Crest WritePerCameraMaterialParameters(camera); // Motion Vectors. - if (ShouldRenderMotionVectors(camera) && QueueMotionVectors) + if (ShouldRenderMotionVectors(camera) && _QueueMotionVectors) { UpdateChunkVisibility(camera); @@ -434,7 +378,6 @@ namespace WaveHarmonic.Crest } } -#pragma warning disable format #if d_UnityURP if (RenderPipelineHelper.IsUniversal) { @@ -450,26 +393,19 @@ namespace WaveHarmonic.Crest { OnBeginCameraRenderingLegacy(camera); } -#pragma warning restore format } internal void OnEndCameraRendering(Camera camera) { _DoneChunkVisibility = false; - // Restore in case exclusion culling ran. - foreach (var chunk in Chunks) - { - if (chunk.Rend != null && !chunk._Culled) chunk.Rend.enabled = true; - } - if (!WaterRenderer.ShouldRender(camera, Layer)) { return; } // Our planar reflection camera must never render the surface. - if (camera == _Water.Reflections.ReflectionCamera) + if (camera == WaterReflections.CurrentCamera) { return; } @@ -480,20 +416,6 @@ namespace WaveHarmonic.Crest } } - void InitializeProperties() - { - System.Array.Fill(NormalMapParameters, new Vector4(0, 0, 1, 0)); - - // Populate MPBs with defaults. - for (var index = 0; index < PerCascadeMPB.Length; index++) - { - var block = new MaterialPropertyBlock(); - block.SetInteger(Lod.ShaderIDs.s_LodIndex, index); - block.SetFloat(ShaderIDs.s_ChunkFarNormalsWeight, 1f); - PerCascadeMPB[index] = block; - } - } - void WritePerCameraMaterialParameters(Camera camera) { if (Material == null) @@ -520,16 +442,14 @@ namespace WaveHarmonic.Crest var value = _SurfaceSelfIntersectionFixMode switch { SurfaceSelfIntersectionFixMode.On => - !_Water._PerCameraHeightReady - ? ForceFacing.None - : height < -2f + height < -2f ? ForceFacing.BelowWater : height > 2f ? ForceFacing.AboveWater : ForceFacing.None, // Skip for portals as it is possible to see both sides of the surface at any position. SurfaceSelfIntersectionFixMode.Automatic => - _Water.Portaled || !_Water._PerCameraHeightReady + _Water.Portaled ? ForceFacing.None : height < -2f ? ForceFacing.BelowWater @@ -551,27 +471,12 @@ namespace WaveHarmonic.Crest Rebuild(); } - if (_ForceRenderingOff) - { - return; - } - - LoadCameraData(_Water.CurrentCamera); - Root.position = _Water.Position; Root.localScale = new(_Water.Scale, 1f, _Water.Scale); - Root.gameObject.SetActive(!IsQuadMesh); - Material.SetKeyword(new(Material.shader, "_CREST_CUSTOM_MESH"), IsQuadMesh); - + _PerCascadeMPB.Flip(); WritePerCascadeInstanceData(); - if (IsQuadMesh) - { - LateUpdateQuadMesh(); - return; - } - foreach (var chunk in Chunks) { chunk.UpdateMeshBounds(_Water, this); @@ -601,48 +506,60 @@ namespace WaveHarmonic.Crest { var levels = _Water.LodLevels; var texel = _Water.LodResolution * 0.25f / _Water._GeometryDownSampleFactor; + var mpbsCurrent = _PerCascadeMPB.Current; + var mpbsPrevious = _PerCascadeMPB.Previous(1); // LOD 0 { + var mpb = mpbsCurrent[0]; + + if (_Water.WriteMotionVectors) + { + // NOTE: it may be more optimal to store in an array than fetching from MPB. + mpb.SetFloat(ShaderIDs.s_ChunkMeshScaleAlphaSource, mpbsPrevious[0].GetFloat(ShaderIDs.s_ChunkMeshScaleAlpha)); + } + // Blend LOD 0 shape in/out to avoid pop, if scale could increase. - PerCascadeMPB[0].SetFloat(ShaderIDs.s_ChunkMeshScaleAlpha, _Water.ScaleCouldIncrease ? _Water.ViewerAltitudeLevelAlpha : 0f); + mpb.SetFloat(ShaderIDs.s_ChunkMeshScaleAlpha, _Water.ScaleCouldIncrease ? _Water.ViewerAltitudeLevelAlpha : 0f); } // LOD N { + var mpb = mpbsCurrent[levels - 1]; + // Blend furthest normals scale in/out to avoid pop, if scale could reduce. - var weight = _Water.ScaleCouldDecrease ? _Water.ViewerAltitudeLevelAlpha : 1f; - PerCascadeMPB[levels - 1].SetFloat(ShaderIDs.s_ChunkFarNormalsWeight, weight); - NormalMapParameters[levels - 1] = new(0, 0, weight, 0); + mpb.SetFloat(ShaderIDs.s_ChunkFarNormalsWeight, _Water.ScaleCouldDecrease ? _Water.ViewerAltitudeLevelAlpha : 1f); } for (var index = 0; index < levels; index++) { - var mpb = PerCascadeMPB[index]; + var mpbCurrent = mpbsCurrent[index]; + var mpbPrevious = mpbsPrevious[index]; // geometry data // compute grid size of geometry. take the long way to get there - make sure we land exactly on a power of two // and not inherit any of the lossy-ness from lossyScale. - var scale = _Water.CascadeData.Current[index].x; + var scale = _Water._CascadeData.Current[index].x; var width = scale / texel; - mpb.SetFloat(ShaderIDs.s_ChunkGeometryGridWidth, width); + if (_Water.WriteMotionVectors) + { + // NOTE: it may be more optimal to store in an array than fetching from MPB. + mpbPrevious.SetFloat(ShaderIDs.s_ChunkGeometryGridWidthSource, mpbCurrent.GetFloat(ShaderIDs.s_ChunkGeometryGridWidth)); + } + + mpbCurrent.SetFloat(ShaderIDs.s_ChunkGeometryGridWidth, width); var mul = 1.875f; // fudge 1 var pow = 1.4f; // fudge 2 var texelWidth = width / _Water._GeometryDownSampleFactor; - var speed = new Vector2 + mpbCurrent.SetVector(ShaderIDs.s_ChunkNormalScrollSpeed, new ( Mathf.Pow(Mathf.Log(1f + 2f * texelWidth) * mul, pow), - Mathf.Pow(Mathf.Log(1f + 4f * texelWidth) * mul, pow) - ); - - mpb.SetVector(ShaderIDs.s_ChunkNormalScrollSpeed, speed); - - var normals = NormalMapParameters[index]; - normals.x = speed.x; - normals.y = speed.y; - NormalMapParameters[index] = normals; + Mathf.Pow(Mathf.Log(1f + 4f * texelWidth) * mul, pow), + 0, + 0 + )); } } @@ -732,7 +649,7 @@ namespace WaveHarmonic.Crest _CanSkipCulling = WaterBody.WaterBodies.Count == 0; } - internal void Render(Camera camera, CommandBuffer buffer, Material material = null, int pass = 0, bool culled = false, MaterialPropertyBlock mpb = null) + internal void Render(Camera camera, CommandBuffer buffer, Material material = null, int pass = 0, bool culled = false) { var noMaterial = material == null; @@ -741,12 +658,6 @@ namespace WaveHarmonic.Crest return; } - if (IsQuadMesh) - { - buffer.DrawMesh(Helpers.QuadMesh, Matrix4x4.TRS(Root.position, Quaternion.Euler(90f, 0, 0), new(10000, 10000, 1)), noMaterial ? Material : material, 0, shaderPass: pass, mpb); - return; - } - UpdateChunkVisibility(camera); // Spends approx 0.2-0.3ms here on 2018 Dell XPS 15. @@ -841,7 +752,6 @@ namespace WaveHarmonic.Crest partial class SurfaceRenderer { bool _QueueMotionVectors; - bool QueueMotionVectors => _QueueMotionVectors && !IsQuadMesh; bool ShouldRenderMotionVectors(Camera camera) { @@ -907,7 +817,7 @@ namespace WaveHarmonic.Crest void UpdateMotionVectorsMaterial(Material surface, ref Material motion) { - if (!QueueMotionVectors) + if (!_QueueMotionVectors) { return; } @@ -945,80 +855,4 @@ namespace WaveHarmonic.Crest motion.SetFloat(ShaderIDs.s_BuiltShadowCasterZTest, 1); // ZTest Never } } - - partial class SurfaceRenderer - { - internal Dictionary _PerCameraPerCascadeMPB = new(); - internal Dictionary _PerCameraNormalMapParameters = new(); - - void LoadCameraData(Camera camera) - { - if (!_Water.SeparateViewpoint) - { - return; - } - - if (!_PerCameraPerCascadeMPB.ContainsKey(camera)) - { - PerCascadeMPB = new MaterialPropertyBlock[Lod.k_MaximumSlices]; - _PerCameraPerCascadeMPB.Add(camera, PerCascadeMPB); - NormalMapParameters = new Vector4[Lod.k_MaximumSlices]; - _PerCameraNormalMapParameters.Add(camera, NormalMapParameters); - InitializeProperties(); - } - else - { - PerCascadeMPB = _PerCameraPerCascadeMPB[camera]; - NormalMapParameters = _PerCameraNormalMapParameters[camera]; - } - } - - internal void RemoveCameraData(Camera camera) - { - if (_PerCameraPerCascadeMPB.ContainsKey(camera)) - { - _PerCameraPerCascadeMPB.Remove(camera); - _PerCameraNormalMapParameters.Remove(camera); - } - -#if UNITY_EDITOR - RemoveCameraDataLDT(camera); -#endif - } - } - - // Quad - partial class SurfaceRenderer - { - readonly Vector4[] _NormalMapParameters = new Vector4[Lod.k_MaximumSlices]; - Vector4[] NormalMapParameters { get; set; } - - void LateUpdateQuadMesh() - { - Shader.SetGlobalVectorArray(ShaderIDs.s_NormalMapParameters, NormalMapParameters); - - var scale = new Vector3(10000 * _Water.Scale, 10000 * _Water.Scale, 1); - var bounds = Helpers.QuadMesh.bounds; - bounds.Expand(scale); - Graphics.RenderMesh - ( - new() - { - motionVectorMode = MotionVectorGenerationMode.Camera, - material = Material, - worldBounds = Root.TransformBounds(bounds), - layer = Layer, - shadowCastingMode = CastShadows ? ShadowCastingMode.On : ShadowCastingMode.Off, - lightProbeUsage = LightProbeUsage.Off, - reflectionProbeUsage = ReflectionProbeUsage.BlendProbesAndSkybox, - renderingLayerMask = (uint)Layer, - }, - Helpers.QuadMesh, - submeshIndex: 0, - Matrix4x4.TRS(Root.position, Quaternion.Euler(90f, 0, 0), scale) - ); - - UpdateMaterial(_Material, ref _MotionVectorMaterial); - } - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterChunkRenderer.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterChunkRenderer.cs index 7ea75c7b0..3162ffeed 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterChunkRenderer.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterChunkRenderer.cs @@ -9,12 +9,12 @@ namespace WaveHarmonic.Crest { interface IReportsHeight { - bool ReportHeight(WaterRenderer water, ref Rect bounds, ref float minimum, ref float maximum); + bool ReportHeight(ref Rect bounds, ref float minimum, ref float maximum); } interface IReportsDisplacement { - bool ReportDisplacement(WaterRenderer water, ref Rect bounds, ref float horizontal, ref float vertical); + bool ReportDisplacement(ref Rect bounds, ref float horizontal, ref float vertical); } /// @@ -24,7 +24,7 @@ namespace WaveHarmonic.Crest [AddComponentMenu("")] #endif [@ExecuteDuringEditMode] - sealed partial class WaterChunkRenderer : ManagedBehaviour + sealed class WaterChunkRenderer : ManagedBehaviour { [SerializeField] internal bool _DrawRenderBounds = false; @@ -61,6 +61,8 @@ namespace WaveHarmonic.Crest int _LodIndex = -1; + public static List HeightReporters { get; } = new(); + public static List DisplacementReporters { get; } = new(); // There is a 1-frame delay with Initialized in edit mode due to setting // enableInEditMode in EditorApplication.update. This only really affect this @@ -73,12 +75,6 @@ namespace WaveHarmonic.Crest _Mesh = mesh; _PreviousObjectToWorld = _CurrentObjectToWorld = transform.localToWorldMatrix; _Transform = transform; - WaterRenderer.s_OnLoadCameraData -= LoadCameraData; - WaterRenderer.s_OnLoadCameraData += LoadCameraData; - WaterRenderer.s_OnStoreCameraData -= StoreCameraData; - WaterRenderer.s_OnStoreCameraData += StoreCameraData; - WaterRenderer.s_OnRemoveCameraData -= RemoveCameraData; - WaterRenderer.s_OnRemoveCameraData += RemoveCameraData; } private protected override void OnStart() @@ -148,7 +144,6 @@ namespace WaveHarmonic.Crest matProps = _MaterialPropertyBlock, worldBounds = Rend.bounds, layer = surface.Layer, - renderingLayerMask = (uint)surface.Layer, receiveShadows = false, shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off, lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off, @@ -189,10 +184,11 @@ namespace WaveHarmonic.Crest }; } + // Used by the water mask system if we need to render the water mask in situations + // where the water itself doesn't need to be rendered or has otherwise been disabled internal void Bind() { - _MaterialPropertyBlock = _Water.Surface.PerCascadeMPB[_LodIndex]; - new PropertyWrapperMPB(_MaterialPropertyBlock).SetSHCoefficients(_Transform.position); + _MaterialPropertyBlock = _Water.Surface._PerCascadeMPB.Current[_LodIndex]; Rend.SetPropertyBlock(_MaterialPropertyBlock); _WaterDataHasBeenBound = true; @@ -238,12 +234,21 @@ namespace WaveHarmonic.Crest var scale = transform.lossyScale; var rotation = transform.rotation; + var boundsPadding = _Water.MaximumHorizontalDisplacement; + var expandXZ = boundsPadding / scale.x; + var boundsY = _Water.MaximumVerticalDisplacement; + // Extend the kinematic bounds slightly to give room for dynamic waves. if (_Water._DynamicWavesLod.Enabled) { - extents.y += 5f; + boundsY += 5f; } + // Extend bounds by global waves. + extents.x += expandXZ; + extents.y += boundsY; + extents.z += expandXZ; + // Get XZ bounds. Doing this manually bypasses updating render bounds call. Rect rect; { @@ -263,15 +268,23 @@ namespace WaveHarmonic.Crest var totalHorizontal = 0f; var totalVertical = 0f; - foreach (var (key, input) in AnimatedWavesLod.s_Inputs) + foreach (var reporter in DisplacementReporters) { - input.DisplacementReporter?.ReportDisplacement(_Water, ref rect, ref totalHorizontal, ref totalVertical); + var horizontal = 0f; + var vertical = 0f; + if (reporter.ReportDisplacement(ref rect, ref horizontal, ref vertical)) + { + totalHorizontal += horizontal; + totalVertical += vertical; + } } - var expandXZ = totalHorizontal / scale.x; + boundsPadding = totalHorizontal; + expandXZ = boundsPadding / scale.x; + boundsY = totalVertical; extents.x += expandXZ; - extents.y += totalVertical; + extents.y += boundsY; extents.z += expandXZ; } @@ -280,59 +293,37 @@ namespace WaveHarmonic.Crest var minimumWaterLevelBounds = 0f; var maximumWaterLevelBounds = 0f; - foreach (var (key, input) in LevelLod.s_Inputs) + foreach (var reporter in HeightReporters) { - input.HeightReporter?.ReportHeight(_Water, ref rect, ref minimumWaterLevelBounds, ref maximumWaterLevelBounds); + var minimum = 0f; + var maximum = 0f; + if (reporter.ReportHeight(ref rect, ref minimum, ref maximum)) + { + minimumWaterLevelBounds = Mathf.Max(minimumWaterLevelBounds, Mathf.Abs(Mathf.Min(minimum, _Water.SeaLevel) - _Water.SeaLevel)); + maximumWaterLevelBounds = Mathf.Max(maximumWaterLevelBounds, Mathf.Abs(Mathf.Max(maximum, _Water.SeaLevel) - _Water.SeaLevel)); + } } - extents.y += Mathf.Abs((minimumWaterLevelBounds - maximumWaterLevelBounds) * 0.5f); + minimumWaterLevelBounds *= 0.5f; + maximumWaterLevelBounds *= 0.5f; + + boundsY = minimumWaterLevelBounds + maximumWaterLevelBounds; + extents.y += boundsY; bounds.extents = extents; - var offset = Mathf.Lerp(minimumWaterLevelBounds, maximumWaterLevelBounds, 0.5f); + var offset = maximumWaterLevelBounds - minimumWaterLevelBounds; center.y += offset; bounds.center = center; } return bounds; } - } - partial class WaterChunkRenderer - { - class AdditionalCameraData + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] + static void InitStatics() { - public Matrix4x4 _CurrentObjectToWorld; - public Matrix4x4 _PreviousObjectToWorld; - } - - readonly Dictionary _CameraData = new(); - AdditionalCameraData _AdditionalCameraData; - - void LoadCameraData(Camera camera) - { - if (!_CameraData.ContainsKey(camera)) - { - _CameraData[camera] = new(); - } - - _AdditionalCameraData = _CameraData[camera]; - _CurrentObjectToWorld = _AdditionalCameraData._CurrentObjectToWorld; - _PreviousObjectToWorld = _AdditionalCameraData._PreviousObjectToWorld; - } - - void StoreCameraData(Camera camera) - { - if (_AdditionalCameraData == null) return; - _AdditionalCameraData._CurrentObjectToWorld = _CurrentObjectToWorld; - _AdditionalCameraData._PreviousObjectToWorld = _PreviousObjectToWorld; - } - - void RemoveCameraData(Camera camera) - { - if (_CameraData.ContainsKey(camera)) - { - _CameraData.Remove(camera); - } + HeightReporters.Clear(); + DisplacementReporters.Clear(); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.Universal.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.Universal.cs deleted file mode 100644 index 08e0300eb..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.Universal.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#if d_UnityURP -#if UNITY_6000_0_OR_NEWER - -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.RenderGraphModule; -using UnityEngine.Rendering.Universal; - -namespace WaveHarmonic.Crest -{ - partial class WaterReflections - { - CopyDepthRenderPass _CopyTargetsRenderPass; - - void CaptureTargetDepth(ScriptableRenderContext context, Camera camera) - { - if (camera != ReflectionCamera) - { - return; - } - - if (!RenderPipelineHelper.IsUniversal) - { - return; - } - -#if URP_COMPATIBILITY_MODE -#if !UNITY_6000_4_OR_NEWER - if (GraphicsSettings.GetRenderPipelineSettings().enableRenderCompatibilityMode) - { - return; - } -#endif -#endif - - _CopyTargetsRenderPass ??= new(this); - var renderer = camera.GetUniversalAdditionalCameraData().scriptableRenderer; - renderer.EnqueuePass(_CopyTargetsRenderPass); - } - - sealed class CopyDepthRenderPass : ScriptableRenderPass - { - readonly WaterReflections _Renderer; - RTHandle _Wrapper; - - class CopyPassData - { - public TextureHandle _Source; - public TextureHandle _Target; - public int _Slice; - } - - public CopyDepthRenderPass(WaterReflections renderer) - { - _Renderer = renderer; - renderPassEvent = RenderPassEvent.AfterRendering; - } - - public void Dispose() - { - _Wrapper?.Release(); - _Wrapper = null; - } - - public override void RecordRenderGraph(RenderGraph graph, ContextContainer frame) - { - var resources = frame.Get(); - - var source = resources.cameraDepth; - - if (!source.IsValid()) - { - return; - } - - // Create a wrapper. Does not appear to be anything heavy in here. - _Wrapper ??= RTHandles.Alloc(_Renderer._DepthTexture); - _Wrapper.SetRenderTexture(_Renderer._DepthTexture); - - var texture = graph.ImportTexture(_Wrapper); - - using var builder = graph.AddUnsafePass("Crest.CopyDepth", out var data); - - data._Source = source; - data._Target = graph.ImportTexture(_Wrapper); - data._Slice = _Renderer._ActiveSlice; - - builder.UseTexture(data._Source, AccessFlags.Read); - builder.UseTexture(data._Target, AccessFlags.Write); - - // Unity's AddCopyPass cannot handle this it seems. - builder.SetRenderFunc((CopyPassData data, UnsafeGraphContext context) => - { - RTHandle source = data._Source; - RTHandle target = data._Target; - - // Just in case. Planar Reflections will work mostly without it. - if (source.rt == null) - { - return; - } - - if (source.rt.graphicsFormat == target.rt.graphicsFormat && source.rt.depthStencilFormat == target.rt.depthStencilFormat) - { - context.cmd.m_WrappedCommandBuffer.CopyTexture(source.rt, 0, 0, target.rt, data._Slice, 0); - } - }); - } - } - } -} - -#endif -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.Universal.cs.meta b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.Universal.cs.meta deleted file mode 100644 index 417bfc037..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.Universal.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 79f370973399f49f38382da0814a25cb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 205 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.cs index 5198382b5..e0cc8bdbf 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Surface/WaterReflections.cs @@ -10,7 +10,6 @@ using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.Rendering.Universal; -using WaveHarmonic.Crest.Internal; namespace WaveHarmonic.Crest { @@ -70,12 +69,6 @@ namespace WaveHarmonic.Crest [@Delayed, SerializeField] int _Resolution = 256; - [Tooltip("Overscan amount to capture off-screen content.\n\nRenders 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.")] - [@Range(1, 2)] - [@GenerateAPI] - [SerializeField] - float _Overscan = 1.5f; - [Tooltip("Whether to render to the viewer camera only.\n\nWhen disabled, reflections will render for all cameras rendering the water layer, which currently this prevents Refresh Rate from working. Enabling will unlock the Refresh Rate heading.")] [@GenerateAPI] [@DecoratedField, SerializeField] @@ -110,6 +103,11 @@ namespace WaveHarmonic.Crest [@DecoratedField, SerializeField] bool _Stencil = false; + [Tooltip("Whether to allow MSAA.")] + [@GenerateAPI] + [@DecoratedField, SerializeField] + bool _AllowMSAA = false; + [@Space(10)] [Tooltip("Overrides global quality settings.")] @@ -191,12 +189,6 @@ namespace WaveHarmonic.Crest [Tooltip("Rendering reflections per-camera requires recursive rendering. Check this toggle if experiencing issues. The other downside without it is a one-frame delay.")] [@DecoratedField, SerializeField] internal bool _DisableRecursiveRendering; - - [Tooltip("Whether to create a context more compatible for planar reflections camera. Try enabling this if you are getting exceptions.")] - [@Predicated(RenderPipeline.Universal, hide: true)] - [@DecoratedField] - [SerializeField] - internal bool _ForceCompatibility; } @@ -208,81 +200,55 @@ namespace WaveHarmonic.Crest static class ShaderIDs { - public static int s_ReflectionColorTexture = Shader.PropertyToID("_Crest_ReflectionColorTexture"); - public static int s_ReflectionDepthTexture = Shader.PropertyToID("_Crest_ReflectionDepthTexture"); + public static int s_ReflectionTexture = Shader.PropertyToID("_Crest_ReflectionTexture"); public static int s_ReflectionPositionNormal = Shader.PropertyToID("_Crest_ReflectionPositionNormal"); - public static readonly int s_ReflectionMatrixIVP = Shader.PropertyToID("_Crest_ReflectionMatrixIVP"); - public static readonly int s_ReflectionMatrixV = Shader.PropertyToID("_Crest_ReflectionMatrixV"); - public static readonly int s_Crest_ReflectionOverscan = Shader.PropertyToID("_Crest_ReflectionOverscan"); - - public static readonly int s_PlanarReflectionsApplySmoothness = Shader.PropertyToID("_Crest_PlanarReflectionsApplySmoothness"); } + // Checked in underwater to filter cameras. + internal static Camera CurrentCamera { get; private set; } + internal WaterRenderer _Water; internal UnderwaterRenderer _UnderWater; - bool _ApplySmoothness; - - RenderTexture _ColorTexture; - RenderTexture _DepthTexture; - internal RenderTexture ColorTexture => _ColorTexture; - internal RenderTexture DepthTexture => _DepthTexture; + RenderTexture _ReflectionTexture; + internal RenderTexture ReflectionTexture => _ReflectionTexture; readonly Vector4[] _ReflectionPositionNormal = new Vector4[2]; - readonly Matrix4x4[] _ReflectionMatrixIVP = new Matrix4x4[2]; - readonly Matrix4x4[] _ReflectionMatrixV = new Matrix4x4[2]; - - internal int _ActiveSlice; Camera _CameraViewpoint; Skybox _CameraViewpointSkybox; Camera _CameraReflections; Skybox _CameraReflectionsSkybox; - internal Camera ReflectionCamera => _CameraReflections; int RefreshPerFrames => _RenderOnlySingleCamera ? _RefreshPerFrames : 1; long _LastRefreshOnFrame = -1; - internal bool SupportsRecursiveRendering => _Water.SupportsRecursiveRendering && !_Debug._DisableRecursiveRendering; + internal bool SupportsRecursiveRendering => +#if !UNITY_6000_0_OR_NEWER + // HDRP cannot recursive render for 2022. + !RenderPipelineHelper.IsHighDefinition && +#endif + !_Debug._DisableRecursiveRendering; readonly float[] _CullDistances = new float[32]; - Texture _CameraDepthTexture; - /// /// Invoked when the reflection camera is created. /// public static Action OnCameraAdded { get; set; } - bool RequireTemporaryTargets => -#if UNITY_6000_0_OR_NEWER && d_UnityURP - // As of Unity 6 we can write directly to a slice for URP. - !RenderPipelineHelper.IsUniversal && -#endif - true; - internal void OnEnable() { - // We initialized here previously to fix the first frame being black, but could not - // replicate anymore. + _CameraViewpoint = _Water.Viewer; + _CameraViewpointSkybox = _CameraViewpoint.GetComponent(); -#if d_UnityURP -#if UNITY_6000_0_OR_NEWER - RenderPipelineManager.beginCameraRendering -= CaptureTargetDepth; - RenderPipelineManager.beginCameraRendering += CaptureTargetDepth; -#endif -#endif + // This is called also called every frame, but was required here as there was a + // black reflection for a frame without this earlier setup call. + CreateWaterObjects(_CameraViewpoint); } internal void OnDisable() { - Shader.SetGlobalTexture(ShaderIDs.s_ReflectionColorTexture, Texture2D.blackTexture); - Shader.SetGlobalTexture(ShaderIDs.s_ReflectionDepthTexture, Texture2D.blackTexture); - -#if d_UnityURP -#if UNITY_6000_0_OR_NEWER - RenderPipelineManager.beginCameraRendering -= CaptureTargetDepth; -#endif -#endif + Shader.SetGlobalTexture(ShaderIDs.s_ReflectionTexture, Texture2D.blackTexture); } internal void OnDestroy() @@ -293,18 +259,11 @@ namespace WaveHarmonic.Crest _CameraReflections = null; } - if (_ColorTexture) + if (_ReflectionTexture) { - _ColorTexture.Release(); - Helpers.Destroy(_ColorTexture); - _ColorTexture = null; - } - - if (_DepthTexture) - { - _DepthTexture.Release(); - Helpers.Destroy(_DepthTexture); - _DepthTexture = null; + _ReflectionTexture.Release(); + Helpers.Destroy(_ReflectionTexture); + _ReflectionTexture = null; } } @@ -319,7 +278,7 @@ namespace WaveHarmonic.Crest // This method could be executed twice: once by the camera rendering the surface, // and once again by the planar reflection camera. For the latter, we do not want // to proceed or infinite recursion. For safety. - if (camera == _CameraReflections) + if (camera == CurrentCamera) { return false; } @@ -355,46 +314,18 @@ namespace WaveHarmonic.Crest if (camera == _CameraViewpoint) { // TODO: Emit an event instead so WBs can listen. - Shader.SetGlobalTexture(ShaderIDs.s_ReflectionColorTexture, _ColorTexture); - Shader.SetGlobalTexture(ShaderIDs.s_ReflectionDepthTexture, _DepthTexture); + Shader.SetGlobalTexture(ShaderIDs.s_ReflectionTexture, _ReflectionTexture); } } internal void OnEndCameraRendering(Camera camera) { - if (camera == ReflectionCamera) - { - // Appears to be the only reasonable way to get camera depth separately for SRPs. - _CameraDepthTexture = Shader.GetGlobalTexture(Crest.ShaderIDs.Unity.s_CameraDepthTexture); - } - if (!ShouldRender(camera)) { return; } - Shader.SetGlobalTexture(ShaderIDs.s_ReflectionColorTexture, Texture2D.blackTexture); - } - - internal void LateUpdate() - { - // Check if enabled for at least one material every frame. - _ApplySmoothness = false; - - CheckSurfaceMaterial(_Water.Surface.Material); - - foreach (var wb in WaterBody.WaterBodies) - { - CheckSurfaceMaterial(wb._Material); - } - - if (SupportsRecursiveRendering) - { - return; - } - - // Passing a struct. - LateUpdate(new()); + Shader.SetGlobalTexture(ShaderIDs.s_ReflectionTexture, Texture2D.blackTexture); } internal void LateUpdate(ScriptableRenderContext context) @@ -445,18 +376,19 @@ namespace WaveHarmonic.Crest UpdateCameraModes(); ForceDistanceCulling(_FarClipPlane); + _CameraReflections.targetTexture = _ReflectionTexture; + // TODO: Do not do this every frame. if (_Mode != WaterReflectionSide.Both) { - Helpers.ClearRenderTexture(_ColorTexture, Color.clear, depth: true); - Helpers.ClearRenderTexture(_DepthTexture, Color.clear, depth: true); + Helpers.ClearRenderTexture(_ReflectionTexture, Color.clear, depth: false); } - var isActive = _Water.Surface.Root.gameObject.activeSelf; - // We do not want the water plane when rendering planar reflections. _Water.Surface.Root.gameObject.SetActive(false); + CurrentCamera = _CameraReflections; + // Optionally disable pixel lights for reflection/refraction var oldPixelLightCount = QualitySettings.pixelLightCount; if (_DisablePixelLights) @@ -504,7 +436,8 @@ namespace WaveHarmonic.Crest _QualitySettingsOverride.Restore(); - _Water.Surface.Root.gameObject.SetActive(isActive); + CurrentCamera = null; + _Water.Surface.Root.gameObject.SetActive(true); // Remember this frame as last refreshed. _LastRefreshOnFrame = Time.renderedFrameCount; @@ -513,60 +446,41 @@ namespace WaveHarmonic.Crest void Render(ScriptableRenderContext context) { - var colorTarget = _ColorTexture; - var depthTarget = _DepthTexture; - - if (RequireTemporaryTargets) - { - var descriptor = _ColorTexture.descriptor; - descriptor.dimension = TextureDimension.Tex2D; - descriptor.volumeDepth = 1; - descriptor.useMipMap = false; - // No need to clear, as camera clears using the skybox. - colorTarget = RenderTexture.GetTemporary(descriptor); - - if (RenderPipelineHelper.IsLegacy) - { - descriptor = _DepthTexture.descriptor; - descriptor.dimension = TextureDimension.Tex2D; - descriptor.volumeDepth = 1; - descriptor.useMipMap = false; - // No need to clear, as camera clears using the skybox. - depthTarget = RenderTexture.GetTemporary(descriptor); - } - } - - if (RenderPipelineHelper.IsLegacy) - { - // Not documented, but does not work for SRPs. - _CameraReflections.SetTargetBuffers(colorTarget.colorBuffer, depthTarget.depthBuffer); - } - else - { - _CameraReflections.targetTexture = colorTarget; - } +#if UNITY_6000_0_OR_NEWER && d_UnityURP + _CameraReflections.targetTexture = _ReflectionTexture; +#else + var descriptor = _ReflectionTexture.descriptor; + descriptor.dimension = TextureDimension.Tex2D; + descriptor.volumeDepth = 1; + descriptor.useMipMap = false; + // No need to clear, as camera clears using the skybox. + var target = RenderTexture.GetTemporary(descriptor); + _CameraReflections.targetTexture = target; +#endif if (_Mode != WaterReflectionSide.Below) { + _ReflectionPositionNormal[0] = ComputeHorizonPositionAndNormal(_CameraReflections, _Water.SeaLevel, 0.05f, false); + if (_UnderWater._Enabled) { // Disable underwater layer. It is the only way to exclude probes. _CameraReflections.cullingMask = _Layers & ~(1 << _UnderWater.Layer); } - _ActiveSlice = 0; - RenderCamera(context, _CameraReflections, Vector3.up, false, 0); - CopyTargets(colorTarget, depthTarget, 0); - - _ReflectionPositionNormal[0] = ComputeHorizonPositionAndNormal(_CameraReflections, _Water.SeaLevel, 0.05f, false); +#if !(UNITY_6000_0_OR_NEWER && d_UnityURP) + Graphics.CopyTexture(target, 0, 0, _ReflectionTexture, 0, 0); +#endif _CameraReflections.ResetProjectionMatrix(); } if (_Mode != WaterReflectionSide.Above) { + _ReflectionPositionNormal[1] = ComputeHorizonPositionAndNormal(_CameraReflections, _Water.SeaLevel, -0.05f, true); + if (_UnderWater._Enabled) { // Enable underwater layer. @@ -575,32 +489,22 @@ namespace WaveHarmonic.Crest _CameraReflections.depthTextureMode = DepthTextureMode.Depth; } - _ActiveSlice = 1; - RenderCamera(context, _CameraReflections, Vector3.down, _NonObliqueNearSurface, 1); - CopyTargets(colorTarget, depthTarget, 1); - - _ReflectionPositionNormal[1] = ComputeHorizonPositionAndNormal(_CameraReflections, _Water.SeaLevel, -0.05f, true); +#if !(UNITY_6000_0_OR_NEWER && d_UnityURP) + Graphics.CopyTexture(target, 0, 0, _ReflectionTexture, 1, 0); +#endif _CameraReflections.ResetProjectionMatrix(); } - if (RequireTemporaryTargets) - { - RenderTexture.ReleaseTemporary(colorTarget); - if (RenderPipelineHelper.IsLegacy) RenderTexture.ReleaseTemporary(depthTarget); - } +#if !(UNITY_6000_0_OR_NEWER && d_UnityURP) + RenderTexture.ReleaseTemporary(target); +#endif - if (_ApplySmoothness) - { - // We are only using mip-maps if applying smoothness/roughness. - _ColorTexture.GenerateMips(); - } + _ReflectionTexture.GenerateMips(); Shader.SetGlobalVectorArray(ShaderIDs.s_ReflectionPositionNormal, _ReflectionPositionNormal); - Shader.SetGlobalMatrixArray(ShaderIDs.s_ReflectionMatrixIVP, _ReflectionMatrixIVP); - Shader.SetGlobalMatrixArray(ShaderIDs.s_ReflectionMatrixV, _ReflectionMatrixV); } void RenderCamera(ScriptableRenderContext context, Camera camera, Vector3 planeNormal, bool nonObliqueNearSurface, int slice) @@ -613,9 +517,10 @@ namespace WaveHarmonic.Crest var viewpoint = _CameraViewpoint.transform; if (offset == 0f && viewpoint.position.y == planePosition.y) { - // Minor offset to prevent "Screen position out of view frustum". Needs to scale - // with distance from center. - offset = viewpoint.position.magnitude >= 15000f ? 0.01f : 0.001f; + // Minor offset to prevent "Screen position out of view frustum". Smallest number + // to work with both above and below. Smallest number to work with both above and + // below. Could be BIRP only. + offset = 0.00001f; } } @@ -634,12 +539,7 @@ namespace WaveHarmonic.Crest if (_UseObliqueMatrix && (!nonObliqueNearSurface || Mathf.Abs(_CameraViewpoint.transform.position.y - planePosition.y) > _NonObliqueNearSurfaceThreshold)) { - var matrix = _CameraViewpoint.CalculateObliqueMatrix(clipPlane); - // Overscan. - var overscan = 1f - (_Overscan - 1f) * 0.5f; - matrix[0, 0] *= overscan; - matrix[1, 1] *= overscan; - camera.projectionMatrix = matrix; + camera.projectionMatrix = _CameraViewpoint.CalculateObliqueMatrix(clipPlane); } // Set custom culling matrix from the current camera @@ -650,12 +550,9 @@ namespace WaveHarmonic.Crest camera.transform.eulerAngles = new(-euler.x, euler.y, euler.z); camera.cullingMatrix = camera.projectionMatrix * camera.worldToCameraMatrix; - _ReflectionMatrixV[slice] = camera.worldToCameraMatrix; - _ReflectionMatrixIVP[slice] = (GL.GetGPUProjectionMatrix(camera.projectionMatrix, true) * camera.worldToCameraMatrix).inverse; - if (SupportsRecursiveRendering) { - Helpers.RenderCamera(camera, context, slice, _Debug._ForceCompatibility); + Helpers.RenderCamera(camera, context, slice); } else { @@ -663,35 +560,6 @@ namespace WaveHarmonic.Crest } } - void CopyTargets(Texture color, Texture depth, int slice) - { - if (RequireTemporaryTargets) - { - Graphics.CopyTexture(color, 0, 0, 0, 0, _Resolution, _Resolution, _ColorTexture, slice, 0, 0, 0); - } - - if (!RenderPipelineHelper.IsLegacy) - { - depth = _CameraDepthTexture; - } - - if (Rendering.IsRenderGraph) - { - return; - } - - // This can change between depth and R32 based on settings. - if (depth != null && depth.graphicsFormat != _DepthTexture.graphicsFormat) - { - RecreateDepth(depth); - } - - if (depth != null && depth.width >= _Resolution) - { - Graphics.CopyTexture(depth, 0, 0, 0, 0, _Resolution, _Resolution, _DepthTexture, slice, 0, 0, 0); - } - } - /// /// Limit render distance for reflection camera for first 32 layers /// @@ -755,101 +623,38 @@ namespace WaveHarmonic.Crest _CameraReflections.orthographic = _CameraViewpoint.orthographic; _CameraReflections.fieldOfView = _CameraViewpoint.fieldOfView; _CameraReflections.orthographicSize = _CameraViewpoint.orthographicSize; - _CameraReflections.allowMSAA = false; + _CameraReflections.allowMSAA = _AllowMSAA; _CameraReflections.aspect = _CameraViewpoint.aspect; _CameraReflections.useOcclusionCulling = !_DisableOcclusionCulling && _CameraViewpoint.useOcclusionCulling; _CameraReflections.depthTextureMode = _CameraViewpoint.depthTextureMode; - - // Overscan - { - _CameraReflections.usePhysicalProperties = _Overscan > 1f; - - var baseSensor = new Vector2(36f, 24f); - var focal = (baseSensor.y * 0.5f) / Mathf.Tan(_CameraViewpoint.fieldOfView * 0.5f * Mathf.Deg2Rad); - - var overscan = 1f - (_Overscan - 1f) * 0.5f; - _CameraReflections.sensorSize = baseSensor / overscan; - _CameraReflections.focalLength = focal; - - Shader.SetGlobalFloat(ShaderIDs.s_Crest_ReflectionOverscan, overscan); - } - } - - void RecreateDepth(Texture depth) - { - if (_DepthTexture != null && _DepthTexture.IsCreated()) - { - _DepthTexture.Release(); - _DepthTexture.descriptor = depth.GetDescriptor(); - } - else - { - _DepthTexture = new(depth.GetDescriptor()); - } - - _DepthTexture.name = "_Crest_ReflectionDepth"; - _DepthTexture.width = _DepthTexture.height = _Resolution; - _DepthTexture.isPowerOfTwo = true; - _DepthTexture.useMipMap = false; - _DepthTexture.autoGenerateMips = false; - _DepthTexture.filterMode = FilterMode.Point; - _DepthTexture.volumeDepth = 2; - _DepthTexture.dimension = TextureDimension.Tex2DArray; - _DepthTexture.Create(); } // On-demand create any objects we need for water void CreateWaterObjects(Camera currentCamera) { - // We cannot exclude stencil for URP, as the depth texture format always has it. - var colorFormat = Rendering.GetDefaultColorFormat(_HDR); - var depthFormat = Rendering.GetDefaultDepthFormat(_Stencil || RenderPipelineHelper.IsUniversal); + var format = _HDR ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32; + var stencil = _Stencil ? 24 : 16; // Reflection render texture - if (!_ColorTexture || _ColorTexture.width != _Resolution || _ColorTexture.graphicsFormat != colorFormat || _ColorTexture.depthStencilFormat != depthFormat) + if (!_ReflectionTexture || _ReflectionTexture.width != _Resolution || _ReflectionTexture.format != format || _ReflectionTexture.depth != stencil) { - if (_ColorTexture) + if (_ReflectionTexture) { - Helpers.Destroy(_ColorTexture); - Helpers.Destroy(_DepthTexture); + Helpers.Destroy(_ReflectionTexture); } - var descriptor = new RenderTextureDescriptor(_Resolution, _Resolution) + Debug.Assert(SystemInfo.SupportsRenderTextureFormat(format), "Crest: The graphics device does not support the render texture format " + format.ToString()); + _ReflectionTexture = new(_Resolution, _Resolution, stencil, format) { + name = "_Crest_WaterReflection", + isPowerOfTwo = true, dimension = TextureDimension.Tex2DArray, volumeDepth = 2, - depthStencilFormat = depthFormat, - msaaSamples = 1, - }; - - _ColorTexture = new(descriptor) - { - name = "_Crest_ReflectionColor", - graphicsFormat = colorFormat, - isPowerOfTwo = true, useMipMap = true, autoGenerateMips = false, filterMode = FilterMode.Trilinear, }; - _ColorTexture.Create(); - - _DepthTexture = new(descriptor) - { - name = "_Crest_ReflectionDepth", - graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None, - isPowerOfTwo = true, - useMipMap = false, - autoGenerateMips = false, - filterMode = FilterMode.Point, - }; - - if (RenderPipelineHelper.IsHighDefinition) - { - _DepthTexture.graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.R32_SFloat; - _DepthTexture.depthStencilFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None; - } - - _DepthTexture.Create(); + _ReflectionTexture.Create(); } // Camera for reflection @@ -886,8 +691,8 @@ namespace WaveHarmonic.Crest { var additionalCameraData = _CameraReflections.gameObject.AddComponent(); additionalCameraData.renderShadows = !_DisableShadows; - additionalCameraData.requiresColorTexture = _Mode != WaterReflectionSide.Above; // or incur assertions - additionalCameraData.requiresDepthTexture = true; + additionalCameraData.requiresColorTexture = false; + additionalCameraData.requiresDepthTexture = false; } #endif OnCameraAdded?.Invoke(_CameraReflections); @@ -1059,19 +864,6 @@ namespace WaveHarmonic.Crest return new(position.x, position.y, normal.x, normal.y); } - void CheckSurfaceMaterial(Material material) - { - if (material == null) - { - return; - } - - if (!_ApplySmoothness) - { - _ApplySmoothness = material.GetBoolean(ShaderIDs.s_PlanarReflectionsApplySmoothness); - } - } - void SetEnabled(bool previous, bool current) { if (previous == current) return; @@ -1092,15 +884,4 @@ namespace WaveHarmonic.Crest } #endif } - - partial class WaterReflections - { - // MSAA would require separate textures to resolve to. Not worth the expense. - [HideInInspector] - [Obsolete("MSAA for the planar reflection camera is no longer supported. This setting will be ignored.")] - [Tooltip("Whether to allow MSAA.")] - [@GenerateAPI] - [@DecoratedField, SerializeField] - bool _AllowMSAA; - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Time/DefaultTimeProvider.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Time/DefaultTimeProvider.cs index 9d4ff402a..cac6bf3a6 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Time/DefaultTimeProvider.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Time/DefaultTimeProvider.cs @@ -8,7 +8,44 @@ namespace WaveHarmonic.Crest /// sealed class DefaultTimeProvider : ITimeProvider { - public float Time => UnityEngine.Time.time; - public float Delta => UnityEngine.Time.deltaTime; + public float Time + { + get + { +#if UNITY_EDITOR + if (UnityEngine.Application.isPlaying) + { + return UnityEngine.Time.time; + } + else + { + return WaterRenderer.EditorTime; + } +#else + return UnityEngine.Time.time; +#endif + } + } + + public float Delta + { + get + { +#if UNITY_EDITOR + if (UnityEngine.Application.isPlaying) + { + return UnityEngine.Time.deltaTime; + } + else + { + return WaterRenderer.EditorDeltaTime; + } +#else + return UnityEngine.Time.deltaTime; +#endif + ; + } + + } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Uniforms.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Uniforms.cs index 6510d5785..710bb7fef 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Uniforms.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Uniforms.cs @@ -21,7 +21,6 @@ namespace WaveHarmonic.Crest public static readonly int s_TextureSize = Shader.PropertyToID("_Crest_TextureSize"); public static readonly int s_TexturePosition = Shader.PropertyToID("_Crest_TexturePosition"); public static readonly int s_TextureRotation = Shader.PropertyToID("_Crest_TextureRotation"); - public static readonly int s_TextureResolution = Shader.PropertyToID("_Crest_TextureResolution"); public static readonly int s_Multiplier = Shader.PropertyToID("_Crest_Multiplier"); public static readonly int s_FeatherWidth = Shader.PropertyToID("_Crest_FeatherWidth"); public static readonly int s_NegativeValues = Shader.PropertyToID("_Crest_NegativeValues"); diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Assembly.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Assembly.cs index 3fcd89e3c..17f172bd5 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Assembly.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Assembly.cs @@ -10,7 +10,6 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Editor")] [assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Examples")] [assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Ripples")] -[assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Waterfall")] [assembly: InternalsVisibleTo("WaveHarmonic.Crest.Samples.Submarine")] [assembly: InternalsVisibleTo("WaveHarmonic.Crest.CPUQueries")] [assembly: InternalsVisibleTo("WaveHarmonic.Crest.CPUQueries.Editor")] diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Component/Attributes.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Component/Attributes.cs index e198e502d..ca555c14d 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Component/Attributes.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Component/Attributes.cs @@ -103,11 +103,7 @@ namespace WaveHarmonic.Crest sealed class Layer : Decorator { } [Conditional(Symbols.k_UnityEditor)] - sealed class Stripped : Decorator - { - public enum Style { None, PlatformTab, } - public Stripped(Style style = Style.None, bool indent = false) { } - } + sealed class Stripped : Decorator { } [Conditional(Symbols.k_UnityEditor)] sealed class Delayed : Decorator { } @@ -115,12 +111,6 @@ namespace WaveHarmonic.Crest [Conditional(Symbols.k_UnityEditor)] sealed class Disabled : Decorator { } - [Conditional(Symbols.k_UnityEditor)] - sealed class Required : Attribute { } - - [Conditional(Symbols.k_UnityEditor)] - sealed class PlatformTabs : Attribute { } - [Conditional(Symbols.k_UnityEditor)] sealed class AttachMaterialEditor : Attribute { @@ -163,25 +153,25 @@ namespace WaveHarmonic.Crest { [Flags] public enum Clamp { None = 0, Minimum = 1, Maximum = 2, Both = Minimum | Maximum } - public Range(float minimum, float maximum, Clamp clamp = Clamp.Both, float scale = 1f, bool delayed = false, int step = 0, bool power = false) { } + public Range(float minimum, float maximum, Clamp clamp = Clamp.Both, float scale = 1f, bool delayed = false, int step = 0, bool power = false) {} } [Conditional(Symbols.k_UnityEditor)] sealed class Minimum : Decorator { - public Minimum(float minimum) { } + public Minimum(float minimum) {} } [Conditional(Symbols.k_UnityEditor)] sealed class Maximum : Decorator { - public Maximum(float maximum) { } + public Maximum(float maximum) {} } [Conditional(Symbols.k_UnityEditor)] sealed class WarnIfAbove : Decorator { - public WarnIfAbove(float maximum) { } + public WarnIfAbove(float maximum) {} } [Conditional(Symbols.k_UnityEditor)] diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Helpers.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Helpers.cs index 3ee6357fb..e6037e6bf 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Helpers.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Helpers.cs @@ -10,7 +10,7 @@ using UnityEngine.Rendering.HighDefinition; using UnityEngine.Rendering.Universal; using WaveHarmonic.Crest.Internal; -#if !UNITY_6000_0_OR_NEWER +#if !UNITY_2023_2_OR_NEWER using GraphicsFormatUsage = UnityEngine.Experimental.Rendering.FormatUsage; #endif @@ -21,6 +21,18 @@ namespace WaveHarmonic.Crest /// static partial class Helpers { + // Adapted from: + // Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +#if UNITY_SWITCH || UNITY_ANDROID || UNITY_EMBEDDED_LINUX || UNITY_QNX + internal const GraphicsFormat k_DepthStencilFormat = GraphicsFormat.D24_UNorm_S8_UInt; + internal const int k_DepthBufferBits = 24; + internal const DepthBits k_DepthBits = DepthBits.Depth24; +#else + internal const GraphicsFormat k_DepthStencilFormat = GraphicsFormat.D32_SFloat_S8_UInt; + internal const int k_DepthBufferBits = 32; + internal const DepthBits k_DepthBits = DepthBits.Depth32; +#endif + public static class ShaderIDs { public static readonly int s_MainTexture = Shader.PropertyToID("_Utility_MainTexture"); @@ -362,14 +374,6 @@ namespace WaveHarmonic.Crest return mask == (mask | (1 << layer)); } - // https://docs.unity3d.com/6000.3/Documentation/Manual/WebGPU-limitations.html - public static bool IsWebGPU => -#if UNITY_6000_0_OR_NEWER - SystemInfo.graphicsDeviceType is GraphicsDeviceType.WebGPU; -#else - false; -#endif - // R16G16B16A16_SFloat appears to be the most compatible format. // https://docs.unity3d.com/Manual/class-TextureImporterOverride.html#texture-compression-support-platforms // https://learn.microsoft.com/en-us/windows/win32/direct3d12/typed-unordered-access-view-loads#supported-formats-and-api-calls @@ -382,16 +386,6 @@ namespace WaveHarmonic.Crest && SystemInfo.SupportsRandomWriteOnRenderTextureFormat(rtFormat); } - static GraphicsFormat GetWebGPUTextureFormat(GraphicsFormat format) - { - // WebGPU is very limited in format usage - especially read-write. - return GraphicsFormatUtility.GetComponentCount(format) switch - { - 1 => GraphicsFormat.R32_SFloat, - _ => GraphicsFormat.R32G32B32A32_SFloat, - }; - } - internal static GraphicsFormat GetCompatibleTextureFormat(GraphicsFormat format, GraphicsFormatUsage usage, string label, bool randomWrite = false) { var result = SystemInfo.GetCompatibleFormat(format, usage); @@ -428,26 +422,9 @@ namespace WaveHarmonic.Crest result = s_FallbackGraphicsFormat; } - if (randomWrite && IsWebGPU) - { - // Pass the requested format otherwise GetCompatibleFormat may change the component - // count which we need to pick the right format. - result = GetWebGPUTextureFormat(format); - } - return result; } - public static GraphicsFormat GetCompatibleTextureFormat(GraphicsFormat format, bool randomWrite) - { - if (randomWrite && IsWebGPU) - { - format = GetWebGPUTextureFormat(format); - } - - return format; - } - public static void SetGlobalKeyword(string keyword, bool enabled) { if (enabled) @@ -783,58 +760,6 @@ namespace WaveHarmonic.Crest return false; } - internal static void UniversalRenderCamera(ScriptableRenderContext context, Camera camera, int slice) - { -#if UNITY_6000_0_OR_NEWER - // SingleCameraRequest does not render the full camera stack, thus should exclude - // overlays which is likely desirable. Alternative approach worth investigating: - // https://docs.unity3d.com/6000.0/Documentation/Manual/urp/User-Render-Requests.html - // Setting destination silences a warning if Opaque Texture enabled. - s_RenderSingleCameraRequest.destination = camera.targetTexture; - s_RenderSingleCameraRequest.slice = slice; - UnityEngine.Rendering.RenderPipeline.SubmitRenderRequest(camera, s_RenderSingleCameraRequest); -#else -#pragma warning disable CS0618 // Type or member is obsolete - UniversalRenderPipeline.RenderSingleCamera(context, camera); -#pragma warning restore CS0618 // Type or member is obsolete -#endif - } - - internal static void UniversalRenderCamera(ScriptableRenderContext context, Camera camera, int slice, bool noRenderFeatures) - { - // Get this every time as it could change. - var renderers = (ScriptableRendererData[])s_RenderDataListField.GetValue(UniversalRenderPipeline.asset); - var renderer = (UniversalRendererData)renderers[GetRendererIndex(camera)]; - - // On Unity 6.3, got exceptions if this was auto with SSAO enabled. - var safe = !noRenderFeatures && renderer.intermediateTextureMode == IntermediateTextureMode.Always; - - if (!safe) - { - foreach (var feature in renderer.rendererFeatures) - { - // Null exception reported here. Might be null due to missing render features - if (feature == null) continue; - s_RenderFeatureActiveStates.Add(feature.isActive); - feature.SetActive(false); - } - } - - UniversalRenderCamera(context, camera, slice); - - if (!safe) - { - var index = 0; - foreach (var feature in renderer.rendererFeatures) - { - if (feature == null) continue; - feature.SetActive(s_RenderFeatureActiveStates[index++]); - } - - s_RenderFeatureActiveStates.Clear(); - } - } - internal static void RenderCameraWithoutCustomPasses(Camera camera) { // Get this every time as it could change. @@ -866,12 +791,24 @@ namespace WaveHarmonic.Crest static readonly UnityEngine.Rendering.RenderPipeline.StandardRequest s_RenderStandardRequest = new(); - public static void RenderCamera(Camera camera, ScriptableRenderContext context, int slice, bool noRenderFeatures = false) + public static void RenderCamera(Camera camera, ScriptableRenderContext context, int slice) { #if d_UnityURP if (RenderPipelineHelper.IsUniversal) { - UniversalRenderCamera(context, camera, slice, noRenderFeatures); +#if UNITY_6000_0_OR_NEWER + // SingleCameraRequest does not render the full camera stack, thus should exclude + // overlays which is likely desirable. Alternative approach worth investigating: + // https://docs.unity3d.com/6000.0/Documentation/Manual/urp/User-Render-Requests.html + // Setting destination silences a warning if Opaque Texture enabled. + s_RenderSingleCameraRequest.destination = camera.targetTexture; + s_RenderSingleCameraRequest.slice = slice; + UnityEngine.Rendering.RenderPipeline.SubmitRenderRequest(camera, s_RenderSingleCameraRequest); +#else +#pragma warning disable CS0618 // Type or member is obsolete + UniversalRenderPipeline.RenderSingleCamera(context, camera); +#pragma warning restore CS0618 // Type or member is obsolete +#endif return; } #endif @@ -1175,33 +1112,6 @@ namespace WaveHarmonic.Crest { return @event.GetPersistentEventCount() == 0; } - - public static bool Encapsulates(this Rect r1, Rect r2) - { - return r1.Contains(r2.min) && r1.Contains(r2.max); - } - } - - namespace Compatibility - { - static partial class Extensions - { -#if !UNITY_6000_3_OR_NEWER - internal static int GetEntityId(this Object @this) - { - return @this.GetInstanceID(); - } -#endif - - internal static ulong GetRawSceneHandle(this UnityEngine.SceneManagement.Scene @this) - { -#if UNITY_6000_4_OR_NEWER - return @this.handle.GetRawData(); -#else - return (ulong)@this.handle; -#endif - } - } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/PropertyWrapper.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/PropertyWrapper.cs index 6ac6bba6a..6d6a83c50 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/PropertyWrapper.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/PropertyWrapper.cs @@ -23,11 +23,6 @@ namespace WaveHarmonic.Crest void SetBlock(); } - interface IPropertyWrapperVariants : IPropertyWrapper - { - void SetKeyword(in LocalKeyword keyword, bool value); - } - static class PropertyWrapperConstants { internal const string k_NoShaderMessage = "Cannot create required material because shader {0} could not be found or loaded." @@ -77,7 +72,7 @@ namespace WaveHarmonic.Crest } [System.Serializable] - readonly struct PropertyWrapperMaterial : IPropertyWrapperVariants + readonly struct PropertyWrapperMaterial : IPropertyWrapper { public Material Material { get; } @@ -129,7 +124,7 @@ namespace WaveHarmonic.Crest } [System.Serializable] - readonly struct PropertyWrapperCompute : IPropertyWrapperVariants + readonly struct PropertyWrapperCompute : IPropertyWrapper { readonly CommandBuffer _Buffer; readonly ComputeShader _Shader; @@ -162,7 +157,7 @@ namespace WaveHarmonic.Crest } [System.Serializable] - readonly struct PropertyWrapperComputeStandalone : IPropertyWrapperVariants + readonly struct PropertyWrapperComputeStandalone : IPropertyWrapper { readonly ComputeShader _Shader; readonly int _Kernel; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderGraphUtility.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderGraphUtility.cs index 0e7bce1c0..7c9309bd8 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderGraphUtility.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderGraphUtility.cs @@ -61,7 +61,6 @@ namespace WaveHarmonic.Crest cameraData = frameData.Get(); renderingData = frameData.Get(); -#if URP_COMPATIBILITY_MODE if (builder == null) { #pragma warning disable CS0618 // Type or member is obsolete @@ -70,7 +69,6 @@ namespace WaveHarmonic.Crest #pragma warning restore CS0618 // Type or member is obsolete } else -#endif { colorTargetHandle = resources.activeColorTexture; depthTargetHandle = resources.activeDepthTexture; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderPipelineCompatibilityHelper.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderPipelineCompatibilityHelper.cs index b58682a57..1607bb72a 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderPipelineCompatibilityHelper.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/RenderPipelineCompatibilityHelper.cs @@ -93,7 +93,6 @@ namespace WaveHarmonic.Crest return false; } - // Modified from: // https://github.com/Unity-Technologies/Graphics/blob/19ec161f3f752db865597374b3ad1b3eaf110097/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs#L697-L729 /// @@ -109,8 +108,7 @@ namespace WaveHarmonic.Crest /// Bias applied to mipmaps during filtering. /// Name of the RTHandle. /// If the RTHandle should be re-allocated - public static bool ReAllocateIfNeeded - ( + public static bool ReAllocateIfNeeded( ref RTHandle handle, Vector2 scaleFactor, in RenderTextureDescriptor descriptor, @@ -119,28 +117,50 @@ namespace WaveHarmonic.Crest bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, - string name = "" - ) + string name = "") { - // Only HDRP seems to use this? - if (RenderPipelineHelper.IsHighDefinition) + var usingConstantScale = handle != null && handle.useScaling && handle.scaleFactor == scaleFactor; + if (!usingConstantScale || RTHandleNeedsReAlloc(handle, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name, true)) { - var usingConstantScale = handle != null && handle.useScaling && handle.scaleFactor == scaleFactor; - if (!usingConstantScale || RTHandleNeedsReAlloc(handle, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name, true)) - { - handle?.Release(); - handle = RTHandles.Alloc(scaleFactor, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name); - return true; - } + handle?.Release(); + handle = RTHandles.Alloc(scaleFactor, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name); + return true; } - else + return false; + } + + // https://github.com/Unity-Technologies/Graphics/blob/19ec161f3f752db865597374b3ad1b3eaf110097/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs#L731-L764 + + /// + /// Re-allocate dynamically resized RTHandle if it is not allocated or doesn't match the descriptor + /// + /// RTHandle to check (can be null) + /// Function used for the RTHandle size computation. + /// Descriptor for the RTHandle to match + /// Filtering mode of the RTHandle. + /// Addressing mode of the RTHandle. + /// Set to true if the depth buffer should be used as a shadow map. + /// Anisotropic filtering level. + /// Bias applied to mipmaps during filtering. + /// Name of the RTHandle. + /// If an allocation was done + public static bool ReAllocateIfNeeded( + ref RTHandle handle, + ScaleFunc scaleFunc, + in RenderTextureDescriptor descriptor, + FilterMode filterMode = FilterMode.Point, + TextureWrapMode wrapMode = TextureWrapMode.Repeat, + bool isShadowMap = false, + int anisoLevel = 1, + float mipMapBias = 0, + string name = "") + { + var usingScaleFunction = handle != null && handle.useScaling && handle.scaleFactor == Vector2.zero; + if (!usingScaleFunction || RTHandleNeedsReAlloc(handle, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name, true)) { - if (RTHandleNeedsReAlloc(handle, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name, false)) - { - handle?.Release(); - handle = RTHandles.Alloc(descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name); - return true; - } + handle?.Release(); + handle = RTHandles.Alloc(scaleFunc, descriptor, filterMode, wrapMode, isShadowMap, anisoLevel, mipMapBias, name); + return true; } return false; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/Rendering.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/Rendering.cs index b4ff8f006..2ace7ffc7 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/Rendering.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/Rendering/Rendering.cs @@ -5,91 +5,14 @@ #define _XR_ENABLED #endif -using System.Runtime.CompilerServices; using UnityEngine; using UnityEngine.Experimental.Rendering; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; using UnityEngine.XR; namespace WaveHarmonic.Crest { static partial class Rendering { - // Taken from Unity 6.5: - // Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs - - /// - /// Return the GraphicsFormat of DepthStencil RenderTarget preferred for the current platform. - /// - /// The GraphicsFormat of DepthStencil RenderTarget preferred for the current platform. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GraphicsFormat GetDefaultDepthStencilFormat() - { -#if UNITY_SWITCH || UNITY_SWITCH2 || UNITY_EMBEDDED_LINUX || UNITY_QNX || UNITY_ANDROID - return GraphicsFormat.D24_UNorm_S8_UInt; -#else - return GraphicsFormat.D32_SFloat_S8_UInt; -#endif - } - - // Taken from Unity 6.5: - // Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs - - /// - /// Return the GraphicsFormat of Depth-only RenderTarget preferred for the current platform. - /// - /// The GraphicsFormat of Depth-only RenderTarget preferred for the current platform. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GraphicsFormat GetDefaultDepthOnlyFormat() - { -#if UNITY_SWITCH || UNITY_SWITCH2 || UNITY_EMBEDDED_LINUX || UNITY_QNX || UNITY_ANDROID - return GraphicsFormatUtility.GetDepthStencilFormat(24, 0); // returns GraphicsFormat.D24_UNorm when hardware supports it -#else - return GraphicsFormat.D32_SFloat; -#endif - } - - // Taken from Unity 6.5: - // Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs - - /// - /// Return the number of DepthStencil RenderTarget depth bits preferred for the current platform. - /// - /// The number of DepthStencil RenderTarget depth bits preferred for the current platform. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static DepthBits GetDefaultDepthBufferBits() - { -#if UNITY_SWITCH || UNITY_SWITCH2 || UNITY_EMBEDDED_LINUX || UNITY_QNX || UNITY_ANDROID - return DepthBits.Depth24; -#else - return DepthBits.Depth32; -#endif - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GraphicsFormat GetDefaultColorFormat(bool hdr) - { - return SystemInfo.GetGraphicsFormat(hdr ? DefaultFormat.HDR : DefaultFormat.LDR); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GraphicsFormat GetDefaultDepthFormat(bool stencil) - { - return stencil ? GetDefaultDepthStencilFormat() : GetDefaultDepthOnlyFormat(); - } - - // URP_COMPATIBILITY_MODE = URP + UE < 6.4 - public static bool IsRenderGraph => RenderPipelineHelper.IsUniversal -#if URP_COMPATIBILITY_MODE -#if !UNITY_6000_0_OR_NEWER - && false -#else - && !GraphicsSettings.GetRenderPipelineSettings().enableRenderCompatibilityMode -#endif -#endif - ; - public static partial class BIRP { static partial class ShaderIDs diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/WaveHarmonic.Crest.Shared.asmdef b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/WaveHarmonic.Crest.Shared.asmdef index c955ccdfc..25d16ebf4 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/WaveHarmonic.Crest.Shared.asmdef +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Utility/Shared/WaveHarmonic.Crest.Shared.asmdef @@ -35,11 +35,6 @@ "name": "com.unity.render-pipelines.universal", "expression": "", "define": "d_UnityURP" - }, - { - "name": "com.unity.render-pipelines.universal", - "expression": "(,17.3.0)", - "define": "URP_COMPATIBILITY_MODE" } ], "noEngineReferences": false diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPass.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPass.cs index b0393c512..89f157fd3 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPass.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPass.cs @@ -20,9 +20,6 @@ namespace WaveHarmonic.Crest readonly System.Action _CopyColorTexture; readonly System.Action _SetRenderTargetToBackBuffers; - bool _AllocatedColor; - GraphicsFormat _GraphicsFormat; - public UnderwaterEffectPass(UnderwaterRenderer renderer) { _Renderer = renderer; @@ -43,8 +40,6 @@ namespace WaveHarmonic.Crest public void Allocate(GraphicsFormat format) { - _GraphicsFormat = format; - if (_Renderer.RenderBeforeTransparency && !_Renderer._NeedsColorTexture) { return; @@ -62,8 +57,6 @@ namespace WaveHarmonic.Crest wrapMode: TextureWrapMode.Clamp, name: "_Crest_UnderwaterCameraColorTexture" ); - - _AllocatedColor = true; } public void ReAllocate(RenderTextureDescriptor descriptor) @@ -92,11 +85,6 @@ namespace WaveHarmonic.Crest if (!_Renderer.RenderBeforeTransparency || _Renderer._NeedsColorTexture) { - if (!_AllocatedColor) - { - Allocate(_GraphicsFormat); - } - buffer.SetGlobalTexture(UnderwaterRenderer.ShaderIDs.s_CameraColorTexture, _ColorTexture); } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPassURP.RenderGraph.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPassURP.RenderGraph.cs index 07a213e18..209547f94 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPassURP.RenderGraph.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterEffectPassURP.RenderGraph.cs @@ -30,7 +30,6 @@ namespace WaveHarmonic.Crest } } -#if URP_COMPATIBILITY_MODE [System.Obsolete] public override void OnCameraSetup(CommandBuffer buffer, ref RenderingData data) { @@ -47,7 +46,6 @@ namespace WaveHarmonic.Crest context.ExecuteCommandBuffer(buffer); CommandBufferPool.Release(buffer); } -#endif } partial class CopyDepthBufferPassURP @@ -65,7 +63,6 @@ namespace WaveHarmonic.Crest var resources = frameData.Get(); cameraData = frameData.Get(); -#if URP_COMPATIBILITY_MODE if (builder == null) { #pragma warning disable CS0618 // Type or member is obsolete @@ -74,7 +71,6 @@ namespace WaveHarmonic.Crest #pragma warning restore CS0618 // Type or member is obsolete } else -#endif { // We need reset render targets to these before the next pass, but we do not read // or write to the color target. @@ -103,7 +99,6 @@ namespace WaveHarmonic.Crest } } -#if URP_COMPATIBILITY_MODE [System.Obsolete] public override void OnCameraSetup(CommandBuffer buffer, ref RenderingData data) { @@ -120,7 +115,6 @@ namespace WaveHarmonic.Crest context.ExecuteCommandBuffer(buffer); CommandBufferPool.Release(buffer); } -#endif } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Effect.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Effect.cs index 7dfc00f43..eb704d8fd 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Effect.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Effect.cs @@ -140,7 +140,7 @@ namespace WaveHarmonic.Crest if (UseStencilBuffer) { descriptor.colorFormat = RenderTextureFormat.Depth; - descriptor.depthBufferBits = (int)Rendering.GetDefaultDepthBufferBits(); + descriptor.depthBufferBits = (int)Helpers.k_DepthBits; // bindMS is necessary in this case for depth. descriptor.SetMSAASamples(camera); descriptor.bindMS = descriptor.msaaSamples > 1; @@ -272,9 +272,9 @@ namespace WaveHarmonic.Crest if (camera.cameraType != CameraType.Reflection) { // Skip work if camera is far enough below the surface. - var forceFullShader = !_MaskRead || (_Water._PerCameraHeightReady && _Water._ViewerHeightAboveWaterPerCamera < -8f && !Portaled); + var forceFullShader = !_Water.Surface.Enabled || (_Water._ViewerHeightAboveWaterPerCamera < -8f && !Portaled); _VolumeMaterial.SetKeyword("d_Crest_NoMaskColor", forceFullShader); - _VolumeMaterial.SetKeyword("d_Crest_NoMaskDepth", !_MaskRead || RenderBeforeTransparency); + _VolumeMaterial.SetKeyword("d_Crest_NoMaskDepth", !_Water.Surface.Enabled || RenderBeforeTransparency); } // Compute ambient lighting SH. diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.EnvironmentalLighting.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.EnvironmentalLighting.cs index c26ce3390..7795641eb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.EnvironmentalLighting.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.EnvironmentalLighting.cs @@ -87,7 +87,7 @@ namespace WaveHarmonic.Crest #if UNITY_EDITOR // Only repaint, otherwise changes might persist. - if (Event.current?.type != EventType.Repaint) + if (Event.current.type != EventType.Repaint) { return; } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Mask.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Mask.cs index aeaa4b7e7..088fcf0d4 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Mask.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.Mask.cs @@ -91,14 +91,12 @@ namespace WaveHarmonic.Crest } // Portals have their own fitted to the portal bounds. else -#pragma warning disable format #if d_CrestPortals if (!Portaled || _Water.Portals.RequiresFullScreenMask) #endif { RenderLineMask(commands, camera, mask.ColorRT.descriptor, mask._ColorRTI); } -#pragma warning restore format } internal void RenderLineMask(CommandBuffer buffer, Camera camera, RenderTextureDescriptor descriptor, RenderTargetIdentifier target) @@ -201,12 +199,12 @@ namespace WaveHarmonic.Crest MaskRenderer.MaskInput MaskRenderer.IMaskProvider.Allocate() { - return UseLegacyMask || UseStencilBuffer ? MaskRenderer.MaskInput.Both : MaskRenderer.MaskInput.Color; + return MaskRenderer.MaskInput.Both; } MaskRenderer.MaskInput MaskRenderer.IMaskReceiver.Allocate() { - return UseLegacyMask || UseStencilBuffer ? MaskRenderer.MaskInput.Both : MaskRenderer.MaskInput.Color; + return MaskRenderer.MaskInput.Both; } MaskRenderer.MaskInput MaskRenderer.IMaskProvider.Write(Camera camera) @@ -217,7 +215,7 @@ namespace WaveHarmonic.Crest _DoneMaskRead = true; } - return _MaskRead ? (UseLegacyMask || UseStencilBuffer ? MaskRenderer.MaskInput.Both : MaskRenderer.MaskInput.Color) : MaskRenderer.MaskInput.None; + return _MaskRead ? _Water.Surface.Enabled ? MaskRenderer.MaskInput.Both : MaskRenderer.MaskInput.Color : MaskRenderer.MaskInput.None; } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.cs index 305937613..461a03eab 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Volume/UnderwaterRenderer.cs @@ -13,6 +13,11 @@ namespace WaveHarmonic.Crest [System.Serializable] public sealed partial class UnderwaterRenderer { + [SerializeField, HideInInspector] +#pragma warning disable 414 + int _Version = 0; +#pragma warning restore 414 + internal const float k_CullLimitMinimum = 0.000001f; internal const float k_CullLimitMaximum = 0.01f; @@ -67,11 +72,10 @@ namespace WaveHarmonic.Crest [@Heading("Advanced")] - [Tooltip("Rules to exclude cameras from rendering underwater.\n\nThese are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.")] - [@DecoratedField] + [Tooltip("Whether to execute for all cameras.\n\nIf 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.")] [@GenerateAPI] - [SerializeField] - internal WaterCameraExclusion _CameraExclusions = WaterCameraExclusion.Hidden | WaterCameraExclusion.Reflection; + [@DecoratedField, SerializeField] + bool _AllCameras; [Tooltip("Copying parameters each frame ensures underwater appearance stays consistent with the water surface.\n\nHas a small overhead so should be disabled if not needed.")] [@GenerateAPI] @@ -128,7 +132,7 @@ namespace WaveHarmonic.Crest internal bool RenderBeforeTransparency => false; #else // Legacy mask works except for negative volumes. Not officially supported. - internal bool UseLegacyMask => false; + internal bool UseLegacyMask => _AllCameras; internal bool RenderBeforeTransparency => true; #endif @@ -249,11 +253,6 @@ namespace WaveHarmonic.Crest _HorizonMaskMaterial = null; } - internal bool ShouldRender(Camera camera) - { - return ShouldRender(camera, Pass.Effect); - } - internal bool ShouldRender(Camera camera, Pass pass) { if (!_Enabled || _Material == null) @@ -272,7 +271,7 @@ namespace WaveHarmonic.Crest } // Skip entire mask pass if possible. - if (pass == Pass.Mask && !_Water.Surface.ShouldRender(camera)) + if (pass == Pass.Mask && !_Water.Surface.Enabled) { return false; } @@ -291,23 +290,29 @@ namespace WaveHarmonic.Crest } #endif - if (_Debug._OnlyReflectionCameras && camera.cameraType != CameraType.Reflection) + var isReflectionCamera = camera.cameraType == CameraType.Reflection; + + // Mask or culling is not needed for reflections. + if (isReflectionCamera && pass != Pass.Effect) { return false; } - var isPlanarReflectionCamera = camera == _Water.Reflections.ReflectionCamera; + if (_Debug._OnlyReflectionCameras && !isReflectionCamera) + { + return false; + } // Option to exclude cameras that is not the view camera or our reflection camera. // Otherwise, filtering depends on the camera's culling mask which is not always // accessible like with the global "Reflection Probes Camera". But whether those // cameras triggering camera events is a bug is TBD as it is intermittent. - if (camera != _Water.Reflections.ReflectionCamera && !WaterRenderer.ShouldRender(camera, _CameraExclusions)) + if (!_AllCameras && camera != _Water.GetViewer(includeSceneCamera: false) && camera.cameraType != CameraType.SceneView && camera != WaterReflections.CurrentCamera) { return false; } - if (!_Debug._DisableHeightAboveWaterOptimization && !Portaled && _Water.Surface.ShouldRender(camera)) + if (!_Debug._DisableHeightAboveWaterOptimization && !Portaled) { _Water.UpdatePerCameraHeight(camera); _ViewerWaterHeight = _Water._ViewerHeightAboveWaterPerCamera; @@ -340,11 +345,6 @@ namespace WaveHarmonic.Crest OnBeginCameraRendering(camera); #if UNITY_EDITOR - if (_VolumeMaterial == null) - { - return; - } - // Populated by this point. if (_VolumeMaterial.shader != WaterResources.Instance.Shaders._UnderwaterEffect) { @@ -352,7 +352,6 @@ namespace WaveHarmonic.Crest } #endif -#pragma warning disable format #if d_UnityURP if (RenderPipelineHelper.IsUniversal) { @@ -372,7 +371,6 @@ namespace WaveHarmonic.Crest { OnBeforeLegacyRender(camera); } -#pragma warning restore format } internal void OnBeginCameraRendering(Camera camera) @@ -382,6 +380,12 @@ namespace WaveHarmonic.Crest return; } + // Only one camera supported due to LOD center dependency. + if (!UseLegacyMask && ShouldRender(camera, Pass.Mask) && camera == _Water.Viewer) + { + _Water.Surface.UpdateDisplacedSurfaceData(camera); + } + #if d_UnityHDRP if (RenderPipelineHelper.IsHighDefinition) { @@ -462,13 +466,6 @@ namespace WaveHarmonic.Crest UpdateEnvironmentalLighting(camera, extinction, _ViewerWaterHeight); } - // Only relevant to cameras rendering the surface from here. - if (!_Water.Surface.ShouldRender(camera)) - { - return; - } - - // Redo culling. Culling is per camera. But chunks are shared. if (Portaled || _ViewerWaterHeight > -5f) { RevertCulling(); @@ -510,28 +507,6 @@ namespace WaveHarmonic.Crest } } - internal void ExecuteHeightField(Camera camera) - { - if (UseLegacyMask) - { - return; - } - -#if d_CrestPortals - if (Portaled && !_Water.Portals.RequiresFullScreenMask) - { - return; - } -#endif - - if (!ShouldRender(camera, Pass.Mask)) - { - return; - } - - _Water.Surface.UpdateDisplacedSurfaceData(camera); - } - void SetEnabled(bool previous, bool current) { if (previous == current) return; @@ -562,21 +537,4 @@ namespace WaveHarmonic.Crest } #endif } - - // Obsolete / Migration - partial class UnderwaterRenderer - { - [SerializeField, HideInInspector] -#pragma warning disable 414 - int _Version = 0; -#pragma warning restore 414 - - // No migration as default value for new control is far more effective than this toggle. - [System.Obsolete("Please use Camera Exclusion instead.")] - [Tooltip("Whether to execute for all cameras.\n\nIf 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.")] - [@GenerateAPI] - [@DecoratedField, SerializeField] - [HideInInspector] - bool _AllCameras; - } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterCamera.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterCamera.cs deleted file mode 100644 index 1e1b93a12..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterCamera.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -using UnityEngine; -using WaveHarmonic.Crest.Internal; - -namespace WaveHarmonic.Crest -{ - /// - /// Marks a camera to render water regardless of exclusions. - /// - /// - /// This is only necessary when using . - /// - [AddComponentMenu(Constants.k_MenuPrefixScripts + "Water Camera")] - public sealed class WaterCamera : ManagedBehaviour - { - - } -} diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterCamera.cs.meta b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterCamera.cs.meta deleted file mode 100644 index 2810b2a99..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterCamera.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 719569e3358694628a8edfc67eb3ab83 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Editor.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Editor.cs index 282eb5cba..60350b53f 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Editor.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Editor.cs @@ -17,7 +17,19 @@ namespace WaveHarmonic.Crest internal const string k_ProxyShader = "Hidden/Crest/Editor/WaterProxy"; internal GameObject _ProxyPlane; private protected override bool CanRunInEditMode => !_ShowWaterProxyPlane; + + + internal static float EditorTime { get; set; } + internal static float EditorDeltaTime { get; set; } + static int s_EditorFrames = 0; + + // Useful for rate limiting processes called outside of RunUpdate like camera events. + static int s_EditorFramesSinceUpdate = 0; + static int EditorFramesSinceUpdate => Application.isPlaying ? 0 : s_EditorFramesSinceUpdate; + internal static bool IsWithinEditorUpdate => EditorFramesSinceUpdate == 0; + internal bool IsSceneViewActive { get; set; } + int _LastFrameSceneCamera; private protected override void Reset() @@ -45,9 +57,37 @@ namespace WaveHarmonic.Crest } } + static void EditorUpdate() + { + // Do not execute when editor is not active to conserve power and prevent possible leaks. + if (!UnityEditorInternal.InternalEditorUtility.isApplicationActive) + { + return; + } + + s_EditorFramesSinceUpdate++; + + if (Instance == null) return; + + if (!Application.isPlaying) + { + if ((Time.time - EditorTime) >= (1f / Mathf.Clamp(Instance._EditModeFrameRate, 0.01f, 120f))) + { + s_EditorFrames++; + s_EditorFramesSinceUpdate = 0; + + EditorDeltaTime = Time.time - EditorTime; + EditorTime = Time.time; + + Instance.RunUpdate(); + } + } + } + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void OnDomainReload() { + s_EditorFramesSinceUpdate = 0; AfterRuntimeLoad(); } @@ -62,10 +102,6 @@ namespace WaveHarmonic.Crest { switch (path) { - case nameof(_MultipleViewpoints): - case nameof(_EditorMultipleViewpoints): - Rebuild(); - break; case nameof(_ExtentsSizeMultiplier): case nameof(_GeometryDownSampleFactor): Surface._Rebuild = true; diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.HighDefinition.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.HighDefinition.cs index ae03c6dba..bfe9c4b95 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.HighDefinition.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.HighDefinition.cs @@ -229,7 +229,7 @@ namespace WaveHarmonic.Crest } // Our reflections do not need them. - if (camera == _Water.Reflections.ReflectionCamera) + if (camera == WaterReflections.CurrentCamera) { return; } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Legacy.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Legacy.cs index 214f7b860..5bf33e026 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Legacy.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Legacy.cs @@ -18,6 +18,11 @@ namespace WaveHarmonic.Crest public static readonly int s_ScreenSpaceShadowTexture = Shader.PropertyToID("_Crest_ScreenSpaceShadowTexture"); public static readonly int s_TemporaryDepthTexture = Shader.PropertyToID("_Crest_TemporaryDepthTexture"); public static readonly int s_PrimaryLightHasCookie = Shader.PropertyToID("g_Crest_PrimaryLightHasCookie"); + + public static class Unity + { + public static readonly int s_CameraOpaqueTexture = Shader.PropertyToID("_CameraOpaqueTexture"); + } } bool _DoneMatrices; @@ -32,11 +37,7 @@ namespace WaveHarmonic.Crest ? Rendering.BIRP.FrameBufferFormatOverride.HDR : Rendering.BIRP.FrameBufferFormatOverride.LDR; -#if UNITY_EDITOR - [UnityEditor.InitializeOnLoadMethod] -#else [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] -#endif static void InitializeOnLoad() { // Fixes error on first frame. @@ -98,11 +99,10 @@ namespace WaveHarmonic.Crest } } - Shader.SetGlobalTexture(Crest.ShaderIDs.Unity.s_CameraOpaqueTexture, Texture2D.grayTexture); + Shader.SetGlobalTexture(ShaderIDs.Unity.s_CameraOpaqueTexture, Texture2D.grayTexture); } // Needs to be separate, as it needs to run after the water volume pass. - [System.Diagnostics.Conditional(Constants.Symbols.k_Refraction)] void OnLegacyCopyPass(Camera camera) { if (!ShouldRender(camera, Surface.Layer)) @@ -110,20 +110,18 @@ namespace WaveHarmonic.Crest return; } - var material = Surface.Material; - - if (material == null) + if (Surface.Material == null) { return; } - if (!SurfaceRenderer.IsTransparent(material)) + if (!SurfaceRenderer.IsTransparent(Surface.Material)) { return; } // Our reflections do not need them. - if (camera == _Reflections.ReflectionCamera) + if (camera == WaterReflections.CurrentCamera) { return; } @@ -178,7 +176,7 @@ namespace WaveHarmonic.Crest partial class WaterRenderer { bool _DoneCameraOpaqueTexture; - RTHandle _CameraOpaqueTexture; + RenderTexture _CameraOpaqueTexture; CommandBuffer _CameraOpaqueTextureCommands; internal void UpdateCameraOpaqueTexture(Camera camera, CommandBuffer commands) @@ -194,7 +192,6 @@ namespace WaveHarmonic.Crest commands.EndSample(k_DrawCopyColor); } - [System.Diagnostics.Conditional(Constants.Symbols.k_Refraction)] internal void OnBeginCameraOpaqueTexture(Camera camera) { if (_DoneCameraOpaqueTexture) @@ -202,20 +199,28 @@ namespace WaveHarmonic.Crest return; } - camera.depthTextureMode |= DepthTextureMode.Depth; - var descriptor = Rendering.BIRP.GetCameraTargetDescriptor(camera, FrameBufferFormatOverride); - // Required, or depth/stencil format will be chosen. - descriptor.depthStencilFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None; - // Occurred in a build and caused a black screen. if (descriptor.width <= 0) { return; } - RenderPipelineCompatibilityHelper.ReAllocateIfNeeded(ref _CameraOpaqueTexture, descriptor); + if (_CameraOpaqueTexture == null) + { + _CameraOpaqueTexture = new(descriptor) + { + name = "_CameraOpaqueTexture", + }; + } + else + { + _CameraOpaqueTexture.Release(); + _CameraOpaqueTexture.descriptor = descriptor; + } + + _CameraOpaqueTexture.Create(); _CameraOpaqueTextureCommands ??= new() { diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Migration.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Migration.cs index 6bd2baf22..b011c44a3 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Migration.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Migration.cs @@ -9,7 +9,7 @@ namespace WaveHarmonic.Crest { [SerializeField, HideInInspector] #pragma warning disable 414 - int _Version = 2; + int _Version = 1; #pragma warning restore 414 /// @@ -33,15 +33,6 @@ namespace WaveHarmonic.Crest _Version = 1; } - - if (_Version < 2) - { -#pragma warning disable CS0618 // Type or member is obsolete - AnimatedWavesLod.QuerySource = (LodQuerySource)Mathf.Max(0, (int)AnimatedWavesLod.CollisionSource - 1); -#pragma warning restore CS0618 // Type or member is obsolete - - _Version = 2; - } } /// diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.SerializedFields.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.SerializedFields.cs index ad061f898..88b93a1dd 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.SerializedFields.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.SerializedFields.cs @@ -29,57 +29,6 @@ namespace WaveHarmonic.Crest BeforeTransparent, } - /// - /// Rules to exclude cameras. - /// - [@GenerateDoc] - [System.Flags] - public enum WaterCameraExclusion - { - /// - [Tooltip("No exclusion rules applied.")] - Nothing = 0, - - /// - [Tooltip("Exclude hidden cameras.\n\nDoes not affect reflection cameras, as they are typically always hidden. Use the Reflection flag for them.")] - Hidden = 1 << 1, - - /// - [Tooltip("Exclude reflection cameras.")] - Reflection = 1 << 2, - - /// - [Tooltip("Exclude cameras not tagged as MainCamera.")] - NonMainCamera = 1 << 3, - - /// - [Tooltip("Apply all exclusion rules.")] - Everything = ~0, - } - - /// - /// The background processing mode for when cameras do not render. - /// - [@GenerateDoc] - public enum WaterDataBackgroundMode - { - /// - [Tooltip("Always progress simulations in the background when camera does not render.")] - Always, - - /// - [Tooltip("Progress simulations in the background when camera is inactive (ie !isActiveAndEnabled).")] - Inactive, - - /// - [Tooltip("Progress simulations in the background when camera is disabled (ie !enabled).")] - Disabled, - - /// - [Tooltip("Never progress simulations in the background.")] - Never, - } - partial class WaterRenderer { internal const float k_MaximumWindSpeedKPH = 150f; @@ -279,36 +228,13 @@ namespace WaveHarmonic.Crest [SerializeField] internal float _ExtentsSizeMultiplier = 100f; - [@Heading("Center of Detail", alwaysEnabled: true)] - - [Tooltip("Whether to support multiple center-of-detail (per camera).")] -#if !UNITY_6000_0_OR_NEWER - [@Predicated(RenderPipeline.HighDefinition, inverted: true, hide: true)] -#endif - [@DecoratedField] - [SerializeField] - bool _MultipleViewpoints; + [@Heading("Center of Detail")] [Tooltip("The viewpoint which drives the water detail - the center of the LOD system.\n\nSetting this is optional. Defaults to the camera.")] - [@Predicated(nameof(_MultipleViewpoints), inverted: true)] [@GenerateAPI(Getter.Custom)] [@DecoratedField, SerializeField] Transform _Viewpoint; - [Tooltip("Rules to exclude cameras from being a center-of-detail.\n\nThese are exclusion rules, so for all cameras, select Nothing.")] - [@Predicated(nameof(_MultipleViewpoints))] - [@DecoratedField] - [@GenerateAPI] - [SerializeField] - WaterCameraExclusion _CameraExclusions = WaterCameraExclusion.Everything; - - [Tooltip("The background rendering mode when a camera does not render.\n\nWhen 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.")] - [@Predicated(nameof(_MultipleViewpoints))] - [@GenerateAPI] - [@DecoratedField] - [SerializeField] - internal WaterDataBackgroundMode _DataBackgroundMode = WaterDataBackgroundMode.Never; - [@Label("Displacement Correction")] [Tooltip("Keep the center of detail from drifting from the viewpoint.\n\nLarge horizontal displacement can displace the center of detail. This uses queries to keep the center of detail aligned.")] [@GenerateAPI] @@ -445,20 +371,17 @@ namespace WaveHarmonic.Crest [@DecoratedField, SerializeField] internal bool _ShowWaterProxyPlane; + [Tooltip("Sets the update rate of the water system when in edit mode.\n\nCan be reduced to save power.")] + [@Range(0f, 120f, Range.Clamp.Minimum)] + [SerializeField] + float _EditModeFrameRate = 30f; + [Tooltip("Move water with Scene view camera if Scene window is focused.")] [@Predicated(nameof(_ShowWaterProxyPlane), true)] [@DecoratedField, SerializeField] internal bool _FollowSceneCamera = true; - [Tooltip("Each scene view will have its own viewpoint.")] -#if !UNITY_6000_0_OR_NEWER - [@Predicated(RenderPipeline.HighDefinition, inverted: true, hide: true)] -#endif - [@DecoratedField] - [SerializeField] - bool _EditorMultipleViewpoints = true; - - [Tooltip("Whether height queries are enabled in edit mode.\n\nQueries force enable \"Always Refresh\" scene view option.")] + [Tooltip("Whether height queries are enabled in edit mode.")] [@DecoratedField, SerializeField] internal bool _HeightQueries = true; #pragma warning restore 414 @@ -474,15 +397,6 @@ namespace WaveHarmonic.Crest { [@Space(10)] -#if !CREST_DEBUG - [HideInInspector] -#endif - [Tooltip("Simulates cameras not rendering.")] - [@DecoratedField, SerializeField] - public bool _SimulatePaused; - - [@Space(10)] - [Tooltip("Attach debug GUI that adds some controls and allows to visualize the water data.")] [@DecoratedField, SerializeField] public bool _AttachDebugGUI; @@ -515,39 +429,24 @@ namespace WaveHarmonic.Crest #if !CREST_DEBUG [HideInInspector] #endif - [Tooltip("Log scale changes to the console.")] + [Tooltip("Water will not move with viewpoint.")] [@DecoratedField, SerializeField] public bool _LogScaleChange; #if !CREST_DEBUG [HideInInspector] #endif - [Tooltip("Pause the editor when the scale changes.")] + [Tooltip("Water will not move with viewpoint.")] [@DecoratedField, SerializeField] public bool _PauseOnScaleChange; #if !CREST_DEBUG [HideInInspector] #endif - [Tooltip("Ignore waves when calculation scale.")] + [Tooltip("Water will not move with viewpoint.")] [@DecoratedField, SerializeField] public bool _IgnoreWavesForScaleChange; -#if !CREST_DEBUG - [HideInInspector] -#endif - [@InlineToggle] - [SerializeField] - public bool _OverrideScale; - -#if !CREST_DEBUG - [HideInInspector] -#endif - [@Predicated(nameof(_OverrideScale))] - [@Range(1, 256, Range.Clamp.Minimum, power: true, step: 2)] - [SerializeField] - public int _ScaleOverride; - [@Heading("Server")] [Tooltip("Emulate running on a client without a GPU. Equivalent to running standalone with -nographics argument.")] diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Universal.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Universal.cs index f8dd656a4..3280db98e 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Universal.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.Universal.cs @@ -3,6 +3,10 @@ #if d_UnityURP +#if !UNITY_6000_3_OR_NEWER +#define URP_COMPATIBILITY_MODE +#endif + using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; @@ -75,7 +79,6 @@ namespace WaveHarmonic.Crest Instance = new(water); } - [System.Diagnostics.Conditional(Constants.Symbols.k_Refraction)] internal void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { var water = _Water; @@ -86,7 +89,7 @@ namespace WaveHarmonic.Crest } // Our reflections do not need them. - if (camera == _Water.Reflections.ReflectionCamera) + if (camera == WaterReflections.CurrentCamera) { return; } @@ -97,15 +100,13 @@ namespace WaveHarmonic.Crest return; } - var material = water.Surface.Material; - - if (material == null) + if (water.Surface.Material == null) { return; } // TODO: Could also check RenderType. Which is better? - if (!SurfaceRenderer.IsTransparent(material)) + if (!SurfaceRenderer.IsTransparent(water.Surface.Material)) { return; } @@ -118,18 +119,14 @@ namespace WaveHarmonic.Crest // Needed for OnCameraSetup. renderer.EnqueuePass(this); -#if URP_COMPATIBILITY_MODE #if UNITY_6000_0_OR_NEWER -#if !UNITY_6000_4_OR_NEWER // Copy depth pass does not support RG directly. if (GraphicsSettings.GetRenderPipelineSettings().enableRenderCompatibilityMode) -#endif #endif { if (water.WriteToColorTexture) renderer.EnqueuePass(_CopyColorPass); if (water.WriteToDepthTexture) renderer.EnqueuePass(_CopyDepthPass); } -#endif } #if UNITY_6000_0_OR_NEWER @@ -146,16 +143,11 @@ namespace WaveHarmonic.Crest if (_Water.WriteToDepthTexture) { // Whether we a writing to color or depth format. -#if !UNITY_6000_5_OR_NEWER _CopyDepthPass.CopyToDepth = descriptor.colorFormat == UnityEngine.Experimental.Rendering.GraphicsFormat.None; -#endif _CopyDepthPass.Render(graph, frame, resources.cameraDepthTexture, resources.cameraDepth); } } -#endif -#if URP_COMPATIBILITY_MODE -#if UNITY_6000_0_OR_NEWER [System.Obsolete] #endif public override void OnCameraSetup(CommandBuffer buffer, ref RenderingData data) @@ -174,6 +166,7 @@ namespace WaveHarmonic.Crest queue.Remove(_CopyColorPass); } +#if URP_COMPATIBILITY_MODE // Also check internal RT because it can be null on Vulkan for some reason. if (renderer.cameraDepthTargetHandle?.rt != null && renderer.m_DepthTexture?.rt != null) { @@ -183,6 +176,7 @@ namespace WaveHarmonic.Crest _CopyDepthPass.Setup(renderer.cameraDepthTargetHandle, renderer.m_DepthTexture); } else +#endif { var queue = s_ActiveRenderPassQueue.GetValue(renderer) as List; queue.Remove(_CopyDepthPass); @@ -196,7 +190,6 @@ namespace WaveHarmonic.Crest { // Blank } -#endif // URP_COMPATIBILITY_MODE } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.cs index 862a1690d..be3ba8393 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterRenderer.cs @@ -11,14 +11,6 @@ using WaveHarmonic.Crest.Utility; namespace WaveHarmonic.Crest { - interface IReportWaveDisplacement - { - /// - /// Vertical displacement which affects scale via DropDetailHeightBasedOnWaves. - /// - float ReportWaveDisplacement(WaterRenderer water, float displacement); - } - /// /// The main script for the water system. /// @@ -44,10 +36,6 @@ namespace WaveHarmonic.Crest public static readonly int s_MeshScaleLerp = Shader.PropertyToID("g_Crest_MeshScaleLerp"); public static readonly int s_LodCount = Shader.PropertyToID("g_Crest_LodCount"); - public static readonly int s_WaterDepthAtViewer = Shader.PropertyToID("g_Crest_WaterDepthAtViewer"); - public static readonly int s_MaximumVerticalDisplacement = Shader.PropertyToID("g_Crest_MaximumVerticalDisplacement"); - public static readonly int s_HorizonNormal = Shader.PropertyToID("g_Crest_HorizonNormal"); - // Shader Properties public static readonly int s_AbsorptionColor = Shader.PropertyToID("_Crest_AbsorptionColor"); public static readonly int s_Absorption = Shader.PropertyToID("_Crest_Absorption"); @@ -75,23 +63,12 @@ namespace WaveHarmonic.Crest Transform GetViewpoint() { - if (MultipleViewpoints) - { - return CurrentCamera == null ? null : CurrentCamera.transform; - } - #if UNITY_EDITOR - if (EditorMultipleViewpoints && CurrentCamera != null && CurrentCamera.cameraType == CameraType.SceneView) - { - return CurrentCamera.transform; - } - - if (!EditorMultipleViewpoints && !Application.isPlaying && _FollowSceneCamera && SceneView.lastActiveSceneView != null && IsSceneViewActive) + if (!Application.isPlaying && _FollowSceneCamera && SceneView.lastActiveSceneView != null && IsSceneViewActive) { return SceneView.lastActiveSceneView.camera.transform; } #endif - if (_Viewpoint != null) { return _Viewpoint; @@ -108,20 +85,10 @@ namespace WaveHarmonic.Crest return null; } - internal Camera GetViewer(bool includeSceneCamera = true, bool initial = false) + internal Camera GetViewer(bool includeSceneCamera = true) { - if (!initial && MultipleViewpoints) - { - return CurrentCamera; - } - #if UNITY_EDITOR - if (!initial && EditorMultipleViewpoints && includeSceneCamera && CurrentCamera != null && CurrentCamera.cameraType == CameraType.SceneView) - { - return CurrentCamera; - } - - if ((initial || !EditorMultipleViewpoints) && includeSceneCamera && !Application.isPlaying && _FollowSceneCamera && SceneView.lastActiveSceneView != null && IsSceneViewActive) + if (includeSceneCamera && !Application.isPlaying && _FollowSceneCamera && SceneView.lastActiveSceneView != null && IsSceneViewActive) { return SceneView.lastActiveSceneView.camera; } @@ -136,10 +103,8 @@ namespace WaveHarmonic.Crest return Camera.main; } - /// - /// The current viewer (center of detail). - /// - internal Camera CurrentCamera { get; private set; } + // Cache the ViewCamera property for internal use. + Camera _ViewCameraCached; readonly SampleCollisionHelper _CenterOfDetailDisplacementCorrectionHelper = new(); @@ -316,7 +281,6 @@ namespace WaveHarmonic.Crest // Flags bool _DonePerCameraHeight; - internal bool _PerCameraHeightReady; bool GetWriteMotionVectors() => #if !UNITY_6000_0_OR_NEWER @@ -362,65 +326,6 @@ namespace WaveHarmonic.Crest return true; } - internal static bool ShouldRender(Camera camera, WaterCameraExclusion exclusion) - { - if (camera.cameraType == CameraType.SceneView) - { - return true; - } - - if (camera.TryGetComponent(out var wc) && wc.isActiveAndEnabled) - { - return true; - } - - var exclude = - // Reflection cameras are all typically hidden. We have a separate flag for them. - (exclusion.HasFlag(WaterCameraExclusion.Hidden) && camera.hideFlags.HasFlag(HideFlags.HideInHierarchy) && camera.cameraType != CameraType.Reflection) || - (exclusion.HasFlag(WaterCameraExclusion.Reflection) && camera.cameraType == CameraType.Reflection) || - (exclusion.HasFlag(WaterCameraExclusion.NonMainCamera) && !camera.CompareTag("MainCamera")); - - return !exclude; - } - - internal static bool ShouldRender(Camera camera, int layer, WaterCameraExclusion exclusion) - { - if (!ShouldRender(camera, layer)) - { - return false; - } - - if (!ShouldRender(camera, exclusion)) - { - return false; - } - - return true; - } - - bool ShouldExecute(Camera camera, int layer, WaterCameraExclusion exclusion) - { - if (SingleViewpoint) - { - return false; - } - -#if UNITY_EDITOR - // Editor Multiple Viewpoints is for scene view and viewer only. - if (!MultipleViewpoints && camera.cameraType != CameraType.SceneView && camera != GetViewer(false)) - { - return false; - } -#endif - - if (!ShouldRender(camera, layer, exclusion)) - { - return false; - } - - return true; - } - // // Material @@ -515,25 +420,35 @@ namespace WaveHarmonic.Crest /// /// The frame count for Crest. /// - public static int FrameCount => Time.frameCount; + public static int FrameCount + { + get + { +#if UNITY_EDITOR + if (!Application.isPlaying) + { + return s_EditorFrames; + } + else +#endif + { + return Time.frameCount; + } + } + } // // Level of Detail // - internal static System.Action s_OnBeforeBuildCommandBuffer; - internal const string k_DrawLodData = "Crest.LodData"; internal CommandBuffer SimulationBuffer { get; private set; } // Scale, Weight, MaximumWaveLength, Unused - BufferedData _CascadeData; - internal BufferedData CascadeData { get; private set; } + internal BufferedData _CascadeData; - // NOTE: hardcoded for now. There is typically at least one persistent simulation, and - // they never go beyond two frames. - internal int BufferSize => 2; + internal int BufferSize { get; private set; } internal float MaximumWavelength(int slice) { @@ -574,6 +489,32 @@ namespace WaveHarmonic.Crest internal int ScaleDifferencePower2 { get; private set; } + // + // Displacement Reporting + // + + /// + /// User shape inputs can report in how far they might displace the shape horizontally and vertically. The max value is + /// saved here. Later the bounding boxes for the water tiles will be expanded to account for this potential displacement. + /// + internal void ReportMaximumDisplacement(float horizontal, float vertical, float verticalFromWaves) + { + MaximumHorizontalDisplacement += horizontal; + MaximumVerticalDisplacement += vertical; + _MaximumVerticalDisplacementFromWaves += verticalFromWaves; + } + + float _MaximumVerticalDisplacementFromWaves = 0f; + /// + /// The maximum horizontal distance that the shape scripts are displacing the shape. + /// + internal float MaximumHorizontalDisplacement { get; private set; } + /// + /// The maximum height that the shape scripts are displacing the shape. + /// + internal float MaximumVerticalDisplacement { get; private set; } + + // // Query Providers // @@ -606,7 +547,7 @@ namespace WaveHarmonic.Crest _SetUpFor = RenderPipelineHelper.RenderPipeline; _IsFirstFrameSinceEnabled = true; - CurrentCamera = GetViewer(initial: true); + _ViewCameraCached = Viewer; // Recompiled in play mode. if (_Mask == null) @@ -702,7 +643,18 @@ namespace WaveHarmonic.Crest simulation.Initialize(); } - CascadeData = _CascadeData = new(BufferSize, () => new Vector4[Lod.k_MaximumSlices + 1]); + // TODO: Have a BufferCount which will be the run-time buffer size or prune data. + // NOTE: Hardcode minimum (2) to avoid breaking server builds and LodData* toggles. + // Gather the buffer size for shared data. + BufferSize = 2; + foreach (var simulation in Simulations) + { + if (!simulation.Enabled) continue; + BufferSize = Mathf.Max(BufferSize, simulation.BufferCount); + } + + // The extra LOD accounts for reading off the cascade (eg CurrentIndex + LodChange + 1). + _CascadeData = new(BufferSize, () => new Vector4[Lod.k_MaximumSlices + 1]); _ProjectionMatrix = new Matrix4x4[LodLevels]; @@ -713,6 +665,15 @@ namespace WaveHarmonic.Crest _GeneratedSettingsHash = CalculateSettingsHash(); + // Prevent MVs from popping on first frame. + if (!_Debug._DisableFollowViewpoint && _ViewCameraCached != null) + { + LateUpdatePosition(); + LateUpdateScale(); + } + + WritePerFrameMaterialParams(); + if (Surface.Enabled) { Surface.Initialize(); @@ -763,9 +724,13 @@ namespace WaveHarmonic.Crest #endif #endif - // Queries keeps LateUpdate running regardless of editor settings. If queries - // stops, then the water will pause. - RunUpdate(); +#if UNITY_EDITOR + // Don't run immediately if in edit mode - need to count editor frames so this is run through EditorUpdate() + if (Application.isPlaying) +#endif + { + RunUpdate(); + } } @@ -777,11 +742,13 @@ namespace WaveHarmonic.Crest { base.Enable(); - // For running the system in the background and fallbacks. - if (!SingleViewpoint && !RunningWithoutGraphics) - { - _EndOfFrame = StartCoroutine(UpdateSkippedCameras()); - } +#if UNITY_EDITOR + EditorTime = Time.time; + EditorDeltaTime = 0; + + EditorApplication.update -= EditorUpdate; + EditorApplication.update += EditorUpdate; +#endif // Needs to be first or will get assertions etc. Unity bug likely. RenderPipelineManager.activeRenderPipelineTypeChanged -= OnActiveRenderPipelineTypeChanged; @@ -892,19 +859,12 @@ namespace WaveHarmonic.Crest void OnBeginCameraRendering(Camera camera) { -#if CREST_DEBUG - if (_Debug._SimulatePaused) - { - return; - } -#endif - if (_SetUpFor != RenderPipelineHelper.RenderPipeline) { return; } - if (!_Initialized) + if (!_Initialized || _IsFirstFrameSinceEnabled) { return; } @@ -917,20 +877,13 @@ namespace WaveHarmonic.Crest // OnBeginCameraRendering or OnPreCull void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { -#if CREST_DEBUG - if (_Debug._SimulatePaused) - { - return; - } -#endif - // Guard against being called before the RP change events are raised. if (_SetUpFor != RenderPipelineHelper.RenderPipeline) { return; } - if (!_Initialized) + if (!_Initialized || _IsFirstFrameSinceEnabled) { return; } @@ -944,27 +897,8 @@ namespace WaveHarmonic.Crest return; } - var noSurface = !Surface.Enabled || !ShouldRender(camera, Surface.Layer, Surface._CameraExclusions); - var noVolume = !Underwater.Enabled || !ShouldRender(camera, Underwater.Layer, Underwater._CameraExclusions); - - // MainCamera is a requirement. Guard against this. - if ((!noSurface || !noVolume) && GetViewer(initial: true) == null) - { - noSurface = noVolume = true; - } - - if (noSurface) - { - // For exclusion rules. Redundant in some cases. - Surface.ForceRenderingOff = true; - } - - // Ensure TIRs render. - // TODO: do this check properly, as easy as this is. - if (camera == Reflections.ReflectionCamera && Underwater.Enabled && Helpers.MaskIncludesLayer(camera.cullingMask, Underwater.Layer)) - { - noVolume = false; - } + var noSurface = !Surface.Enabled || !Helpers.MaskIncludesLayer(camera.cullingMask, Surface.Layer); + var noVolume = !Underwater.Enabled || !Helpers.MaskIncludesLayer(camera.cullingMask, Underwater.Layer); // Nothing to render to this camera. if (noSurface && noVolume) @@ -972,27 +906,6 @@ namespace WaveHarmonic.Crest return; } - _HasAnyViewerRendered = true; - - if (ShouldExecute(camera, Surface.Layer, _CameraExclusions)) - { - if (!_Cameras.Contains(camera)) - { - _Cameras.Add(camera); - } - - _SeparateViewpoint = true; - - RunUpdate(camera); - } - - // Project water normal onto camera plane. - Shader.SetGlobalVector(ShaderIDs.s_HorizonNormal, new Vector2 - ( - Vector3.Dot(Vector3.up, camera.transform.right), - Vector3.Dot(Vector3.up, camera.transform.up) - )); - // Must render first so that we do not overwrite work below for game camera. // Reflections only make sense with an active surface. if (_Reflections._Enabled && Surface.Enabled) @@ -1000,19 +913,12 @@ namespace WaveHarmonic.Crest _Reflections.OnBeginCameraRendering(context, camera); } - // Must render before the mask, but cannot execute in the mask pass. - if (Underwater.Enabled) - { - Underwater.ExecuteHeightField(camera); - } - if (_Mask.Enabled) { _Mask.OnBeginCameraRendering(camera); } // Water lighting etc. -#pragma warning disable format #if d_UnityHDRP if (RenderPipelineHelper.IsHighDefinition) { @@ -1025,7 +931,6 @@ namespace WaveHarmonic.Crest { OnBeginCameraRenderingLegacy(camera); } -#pragma warning restore format // Always execute before surface, as order is only important when rendering volume // before surface. @@ -1047,7 +952,6 @@ namespace WaveHarmonic.Crest Surface.OnBeginCameraRendering(context, camera); } -#pragma warning disable format #if d_UnityURP // Always execute after surface. if (RenderPipelineHelper.IsUniversal) @@ -1061,7 +965,6 @@ namespace WaveHarmonic.Crest { OnLegacyCopyPass(camera); } -#pragma warning restore format // Execute after copy pass in case refraction. if (Meniscus.Enabled) @@ -1077,37 +980,17 @@ namespace WaveHarmonic.Crest void OnEndCameraRendering(Camera camera) { -#if CREST_DEBUG - if (_Debug._SimulatePaused) - { - return; - } -#endif - OnEndCameraRendering(_Context, camera); } void OnEndCameraRendering(ScriptableRenderContext context, Camera camera) { -#if CREST_DEBUG - if (_Debug._SimulatePaused) - { - return; - } -#endif - _DonePerCameraHeight = false; - _PerCameraHeightReady = false; #if d_UnityHDRP _DoneHighDefinitionLighting = false; #endif - if (Reflections.ReflectionCamera != camera) - { - Surface.ForceRenderingOff = false; - } - if (RenderPipelineHelper.IsLegacy) { OnEndCameraRenderingLegacy(camera); @@ -1149,13 +1032,6 @@ namespace WaveHarmonic.Crest _Portals.OnEndCameraRendering(camera); } #endif - - if (camera == CurrentCamera) - { - _SeparateViewpoint = false; - _InCameraLoop = false; - CurrentCamera = null; - } } internal void UpdatePerCameraHeight(Camera camera) @@ -1165,23 +1041,10 @@ namespace WaveHarmonic.Crest return; } - // We have already sampled this height. - if ((MultipleViewpoints || camera == Viewer) && ShouldExecuteQueries(camera)) - { - _ViewerHeightAboveWaterPerCamera = ViewerHeightAboveWater; - _PerCameraHeightReady = true; - _DonePerCameraHeight = true; - return; - } - - // This will be 1-frame behind. We allow multiple calls because the camera may - // render multiple times per frame. One case is the scene camera when focus is - // gained or using the frame debugger. + // This will be 1-frame behind. var viewpoint = camera.transform.position; - _PerCameraHeightReady |= _SampleHeightHelperPerCamera.SampleHeight(System.HashCode.Combine(_SampleHeightHelperPerCamera, camera), viewpoint, out var height, allowMultipleCallsPerFrame: true); + _SampleHeightHelperPerCamera.SampleHeight(System.HashCode.Combine(GetHashCode(), camera.GetHashCode()), viewpoint, out var height, allowMultipleCallsPerFrame: true); _ViewerHeightAboveWaterPerCamera = viewpoint.y - height; - // Planar camera mirrors current camera, but treat at same location. - if (camera == Reflections.ReflectionCamera) _ViewerHeightAboveWaterPerCamera = -_ViewerHeightAboveWaterPerCamera; _DonePerCameraHeight = true; } @@ -1213,7 +1076,7 @@ namespace WaveHarmonic.Crest { if (!RunningWithoutGraphics) { - if (Application.platform == RuntimePlatform.WebGLPlayer && !Helpers.IsWebGPU) + if (Application.platform == RuntimePlatform.WebGLPlayer) { Debug.LogError("Crest: Crest does not support WebGL backends.", this); return false; @@ -1261,6 +1124,8 @@ namespace WaveHarmonic.Crest void RunUpdate() { + s_RunUpdateMarker.Begin(this); + // Rebuild if needed. Needs to run in builds (for MVs at the very least). if (CalculateSettingsHash() != _GeneratedSettingsHash) { @@ -1272,125 +1137,89 @@ namespace WaveHarmonic.Crest // All we need for servers. BroadcastUpdate(); Position = new(0f, transform.position.y, 0f); + base.LateUpdate(); } else { + _ViewCameraCached = Viewer; + + // Reset displacement reporting values. + // This is written to in Update, and read in LateUpdate (chunk) and LateUpdateScale. + MaximumHorizontalDisplacement = MaximumVerticalDisplacement = _MaximumVerticalDisplacementFromWaves = 0f; + BroadcastUpdate(); - if (SingleViewpoint) + if (!_Debug._DisableFollowViewpoint && _ViewCameraCached != null) { - RunUpdate(Viewer); + LateUpdatePosition(); + LateUpdateViewerHeight(); + LateUpdateScale(); } else { - if (FallBackRequired) + Position = new(0f, transform.position.y, 0f); + } + + // Set global shader params + Shader.SetGlobalFloat(ShaderIDs.s_Time, CurrentTime); + Shader.SetGlobalFloat(ShaderIDs.s_LodCount, LodLevels); + + // Needs updated transform values like scale. + WritePerFrameMaterialParams(); + + // Construct the command buffer and attach it to the camera so that it will be executed in the render. + { + SimulationBuffer.Clear(); + + foreach (var simulation in Simulations) { - _SeparateViewpoint = true; - RunUpdate(GetViewer(initial: true)); - _SeparateViewpoint = false; + if (!simulation.Enabled) continue; + simulation.BuildCommandBuffer(this, SimulationBuffer); } - PruneCameraData(); + // This will execute at the beginning of the frame before the graphics queue. + Graphics.ExecuteCommandBuffer(SimulationBuffer); - _HasAnyViewpointExecuted = false; - _HasAnyViewerRendered = false; + foreach (var simulation in Simulations) + { + if (!simulation.Enabled) continue; + simulation.AfterExecute(); + } + } + + base.LateUpdate(); + + // Call after LateUpdate so chunk bounds are updated. + if (Surface.Enabled) + { + Surface.LateUpdate(); + } + + if (_Reflections._Enabled && !_Reflections.SupportsRecursiveRendering) + { + _Reflections.LateUpdate(_Context); } } - // This use to execute after the system command buffer, after all properties had - // been updated. But none of the calls used any of that data. - base.LateUpdate(); - // Run queries at end of update. For CollProviderBakedFFT calling this kicks off // collision processing job, and the next call to Query() will force a complete, and // we don't want that to happen until they've had a chance to run, so schedule them // late. - if (AnimatedWavesLod.QuerySource == LodQuerySource.CPU) + if (AnimatedWavesLod.CollisionSource == CollisionSource.CPU) { AnimatedWavesLod.Provider?.UpdateQueries(this); } - } - - void RunUpdate(Camera camera) - { - if (camera == _Reflections.ReflectionCamera) - { - return; - } - - // Only set to a camera which is a center of detail. - CurrentCamera = camera; - - s_RunUpdateMarker.Begin(this); - - LoadCameraData(camera); - - if (!_Debug._DisableFollowViewpoint && CurrentCamera != null) - { - LateUpdatePosition(); - LateUpdateViewerHeight(); - LateUpdateScale(); - } - else - { - Position = new(0f, transform.position.y, 0f); - } - - // Set global shader params - Shader.SetGlobalFloat(ShaderIDs.s_Time, CurrentTime); - Shader.SetGlobalFloat(ShaderIDs.s_LodCount, LodLevels); - - // Construct the command buffer and attach it to the camera so that it will be executed in the render. - { - SimulationBuffer.Clear(); - - // Needs updated transform values like scale. - WritePerFrameMaterialParams(SimulationBuffer); - - s_OnBeforeBuildCommandBuffer?.Invoke(this, camera); - - foreach (var simulation in Simulations) - { - if (!simulation.Enabled) continue; - if (_IsEndOfFrame && simulation.SkipEndOfFrame) continue; - simulation.BuildCommandBuffer(this, SimulationBuffer); - } - - // This will execute at the beginning of the frame before the graphics queue. - Graphics.ExecuteCommandBuffer(SimulationBuffer); - - foreach (var simulation in Simulations) - { - if (!simulation.Enabled) continue; - if (_IsEndOfFrame && simulation.SkipEndOfFrame) continue; - simulation.AfterExecute(); - } - } - - // Call after LateUpdate so chunk bounds are updated. - if (Surface.Enabled) - { - Surface.LateUpdate(); - } - - if (_Reflections._Enabled) - { - _Reflections.LateUpdate(); - } _IsFirstFrameSinceEnabled = false; - _HasAnyViewpointExecuted = true; - - StoreCameraData(camera); s_RunUpdateMarker.End(); } - void WritePerFrameMaterialParams(CommandBuffer commands) + void WritePerFrameMaterialParams() { - CascadeData.Flip(); + _CascadeData.Flip(); - var current = CascadeData.Current; + var current = _CascadeData.Current; // Update rendering parameters. { @@ -1402,25 +1231,23 @@ namespace WaveHarmonic.Crest current[slice] = new Vector4(scale, 1f, MaximumWavelength(scale), 0f); _ProjectionMatrix[slice] = Matrix4x4.Ortho(-2f * scale, 2f * scale, -2f * scale, 2f * scale, 1f, k_RenderAboveSeaLevel + k_RenderBelowSeaLevel); - if (slice == 0) commands.SetGlobalFloat(ShaderIDs.s_Scale, scale); + if (slice == 0) Shader.SetGlobalFloat(ShaderIDs.s_Scale, scale); } // Duplicate last element so that things can safely read off the end of the cascades current[levels] = current[levels - 1].XNZW(0f); } - commands.SetGlobalVectorArray(ShaderIDs.s_CascadeData, current); - commands.SetGlobalVectorArray(ShaderIDs.s_CascadeDataSource, CascadeData.Previous(1)); + Shader.SetGlobalVectorArray(ShaderIDs.s_CascadeData, current); + Shader.SetGlobalVectorArray(ShaderIDs.s_CascadeDataSource, _CascadeData.Previous(1)); } void LateUpdatePosition() { var position = Viewpoint.position; - var hash = System.HashCode.Combine(_CenterOfDetailDisplacementCorrectionHelper, Viewpoint); - // This will cause artifacts in motion vectors debug view, but are likely negligible. - if (_CenterOfDetailDisplacementCorrection && _CenterOfDetailDisplacementCorrectionHelper.SampleDisplacement(hash, position, out var displacement, allowMultipleCallsPerFrame: true)) + if (_CenterOfDetailDisplacementCorrection && _CenterOfDetailDisplacementCorrectionHelper.SampleDisplacement(position, out var displacement)) { position = new(position.x - displacement.x, position.y, position.z - displacement.z); } @@ -1451,46 +1278,20 @@ namespace WaveHarmonic.Crest { var viewerHeight = _ViewpointHeightAboveWaterSmooth; - // Drop Detail Height Based On Waves. - { - var displacement = 0f; - - foreach (var (_, input) in AnimatedWavesLod.s_Inputs) - { - if (input.WaveDisplacementReporter == null) - { - continue; - } - - displacement = input.WaveDisplacementReporter.ReportWaveDisplacement(this, displacement); - } - - // Reach maximum detail at slightly below sea level. this should combat cases where visual range can be lost - // when water height is low and camera is suspended in air. i tried a scheme where it was based on difference - // to water height but this does help with the problem of horizontal range getting limited at bad times. - viewerHeight += displacement * _DropDetailHeightBasedOnWaves; - - Shader.SetGlobalFloat(ShaderIDs.s_MaximumVerticalDisplacement, displacement); - } + // Reach maximum detail at slightly below sea level. this should combat cases where visual range can be lost + // when water height is low and camera is suspended in air. i tried a scheme where it was based on difference + // to water height but this does help with the problem of horizontal range getting limited at bad times. + viewerHeight += _MaximumVerticalDisplacementFromWaves * _DropDetailHeightBasedOnWaves; var camDistance = Mathf.Abs(viewerHeight); // offset level of detail to keep max detail in a band near the surface camDistance = Mathf.Max(camDistance - 4f, 0f); - var range = _ScaleRange; - -#if CREST_DEBUG - if (_Debug._OverrideScale) - { - range = Vector2.one * _Debug._ScaleOverride; - } -#endif - // scale water mesh based on camera distance to sea level, to keep uniform detail. var level = camDistance; - level = Mathf.Max(level, range.x); - if (range.y < Mathf.Infinity) level = Mathf.Min(level, 1.99f * range.y); + level = Mathf.Max(level, _ScaleRange.x); + if (_ScaleRange.y < Mathf.Infinity) level = Mathf.Min(level, 1.99f * _ScaleRange.y); var l2 = Mathf.Log(level) / Mathf.Log(2f); var l2f = Mathf.Floor(l2); @@ -1531,18 +1332,16 @@ namespace WaveHarmonic.Crest { var viewpoint = Viewpoint; - var viewpointHashCode = System.HashCode.Combine(_SampleHeightHelper, viewpoint); - - _SampleHeightHelper.SampleHeight(viewpointHashCode, viewpoint.position, out var waterHeight, allowMultipleCallsPerFrame: true); + _SampleHeightHelper.SampleHeight(viewpoint.position, out var waterHeight); ViewerHeightAboveWater = ViewpointHeightAboveWater = viewpoint.position.y - waterHeight; var viewerHeightAboveWaterOrTerrain = ViewpointHeightAboveWater; - if (viewpoint != CurrentCamera.transform) + if (viewpoint != _ViewCameraCached.transform) { - var viewer = CurrentCamera.transform; + var viewer = _ViewCameraCached.transform; // Reuse sampler. Combine hash codes to avoid pontential conflict. - _SampleHeightHelper.SampleHeight(System.HashCode.Combine(_SampleHeightHelper, viewer), viewpoint.position, out waterHeight, allowMultipleCallsPerFrame: true); + _SampleHeightHelper.SampleHeight(System.HashCode.Combine(GetHashCode(), viewer.GetHashCode()), viewpoint.position, out waterHeight, allowMultipleCallsPerFrame: true); ViewerHeightAboveWater = viewer.position.y - waterHeight; } @@ -1609,7 +1408,7 @@ namespace WaveHarmonic.Crest ( _ViewpointHeightAboveWaterSmooth, viewerHeightAboveWaterOrTerrain, - _TeleportTimerForHeightQueries > 0f || !(_ForceScaleChangeSmoothing || (LevelLod.Enabled && !_SampleTerrainHeightForScale)) ? 1f : 0.01f + _TeleportTimerForHeightQueries > 0f || !(_ForceScaleChangeSmoothing || (LevelLod.Enabled && !_SampleTerrainHeightForScale)) ? 1f : 0.05f ); #if CREST_DEBUG @@ -1619,9 +1418,8 @@ namespace WaveHarmonic.Crest } #endif - _SampleDepthHelper.Sample(System.HashCode.Combine(_SampleDepthHelper, CurrentCamera), CurrentCamera.transform.position, out var result, allowMultipleCallsPerFrame: true); - ViewerDistanceToShoreline = result.y; - Shader.SetGlobalFloat(ShaderIDs.s_WaterDepthAtViewer, result.x); + _SampleDepthHelper.SampleDistanceToWaterEdge(_ViewCameraCached.transform.position, out var distance); + ViewerDistanceToShoreline = distance; } void Destroy() @@ -1651,19 +1449,11 @@ namespace WaveHarmonic.Crest Container = null; } - _Cameras.Clear(); - _PerCameraData.Clear(); - _Initialized = false; } private protected override void Disable() { - if (_EndOfFrame != null) - { - StopCoroutine(_EndOfFrame); - } - foreach (var simulation in Simulations) { simulation.SetGlobals(enable: false); @@ -1677,6 +1467,10 @@ namespace WaveHarmonic.Crest OnEndCameraRenderingLegacy(Viewer); } +#if UNITY_EDITOR + EditorApplication.update -= EditorUpdate; +#endif + Camera.onPreCull -= OnBeginCameraRendering; Camera.onPostRender -= OnEndCameraRendering; @@ -1730,351 +1524,18 @@ namespace WaveHarmonic.Crest } } #endif - } - - // Per Camera Data. - partial class WaterRenderer - { - class PerCameraData - { - // Historic - public bool _RenderedThisFrame; - public bool _ExecutedThisFrame; - public float _Scale = 1f; - public Vector3 _Position; - public Vector3 _OldViewpointPosition; - public float _ViewpointHeightAboveWaterSmooth; - public bool _IsFirstFrameSinceEnabled = true; - public BufferedData _CascadeData; - - // Non-Historic (for external access) - public float _ViewerHeightAboveWater; - public float _ViewerDistanceToShoreline; - } - - internal static System.Action s_OnLoadCameraData; - internal static System.Action s_OnStoreCameraData; - internal static System.Action s_OnRemoveCameraData; - - readonly List _Cameras = new(); - PerCameraData _CurrentPerCameraData; - readonly Dictionary _PerCameraData = new(); - Coroutine _EndOfFrame; - bool _IsEndOfFrame; - internal bool _InCameraLoop; - - // Fallback Flags - // If a camera is rendering the surface and/or volume, then it needs a viewpoint to - // have executed or there will be NaNs and possibly null exceptions. - bool _HasAnyViewpointExecuted; - bool _HasAnyViewerRendered; - bool FallBackRequired => _HasAnyViewerRendered && !_HasAnyViewpointExecuted; - - // Set when we execute for the current camera. - // We need this flag due to camera exclusions. - bool _SeparateViewpoint; - - internal bool SeparateViewpoint => _SeparateViewpoint && !SingleViewpoint; - internal bool SingleViewpoint => !MultipleViewpoints && !EditorMultipleViewpoints; - - internal bool SupportsRecursiveRendering => -#if !UNITY_6000_0_OR_NEWER - // HDRP cannot recursive render for 2022. - !RenderPipelineHelper.IsHighDefinition && -#endif - true; - - bool EditorMultipleViewpoints => -#if UNITY_EDITOR - (_EditorMultipleViewpoints && SupportsRecursiveRendering) || -#endif - false; - - internal bool MultipleViewpoints => _MultipleViewpoints && SupportsRecursiveRendering; - - bool ShouldExecuteSkippedFrame(Camera camera) - { - if (!MultipleViewpoints) - { - return false; - } - - if (_DataBackgroundMode == WaterDataBackgroundMode.Never) - { - return false; - } - - // Always execute for the scene camera. - if (camera.cameraType == CameraType.SceneView) - { - return true; - } - - if (_DataBackgroundMode == WaterDataBackgroundMode.Always) - { - return true; - } - - if (_DataBackgroundMode == WaterDataBackgroundMode.Inactive && camera.isActiveAndEnabled) - { - return true; - } - - if (_DataBackgroundMode == WaterDataBackgroundMode.Disabled && !camera.enabled) - { - return true; - } - - return false; - } - - internal bool ShouldExecuteQueries(Camera camera) - { - return camera != null && _PerCameraData.ContainsKey(camera) && _PerCameraData[camera]._ExecutedThisFrame; - } - - System.Collections.IEnumerator UpdateSkippedCameras() - { - while (true) - { - yield return Helpers.WaitForEndOfFrame; - - if (SingleViewpoint) - { - // This should not happen, as enumerator not registered. - continue; - } - - _IsEndOfFrame = true; - - _HasAnyViewpointExecuted = false; - - foreach (var camera in _Cameras) - { - if (camera == null) continue; - if (!_PerCameraData.ContainsKey(camera)) continue; - - var data = _PerCameraData[camera]; - - data._ExecutedThisFrame = data._RenderedThisFrame; - - _HasAnyViewpointExecuted |= data._RenderedThisFrame; - - if (!data._RenderedThisFrame && ShouldExecuteSkippedFrame(camera)) - { - RunUpdate(camera); - } - - data._RenderedThisFrame = false; - } - - _IsEndOfFrame = false; - } - } - - void LoadCameraData(Camera camera) - { - if (SingleViewpoint) - { - return; - } - - if (camera == null) - { - return; - } - - if (!_PerCameraData.ContainsKey(camera)) - { - _PerCameraData.Add(camera, new() - { - // The extra LOD accounts for reading off the cascade (eg CurrentIndex + LodChange + 1). - _CascadeData = new(BufferSize, () => new Vector4[Lod.k_MaximumSlices + 1]), - }); - } - - _CurrentPerCameraData = _PerCameraData[camera]; - - CascadeData = _CurrentPerCameraData._CascadeData; - Scale = _CurrentPerCameraData._Scale; - Position = _CurrentPerCameraData._Position; - _OldViewpointPosition = _CurrentPerCameraData._OldViewpointPosition; - _ViewpointHeightAboveWaterSmooth = _CurrentPerCameraData._ViewpointHeightAboveWaterSmooth; - _IsFirstFrameSinceEnabled = _CurrentPerCameraData._IsFirstFrameSinceEnabled; - - foreach (var simulation in Simulations) - { - if (!simulation.Enabled) continue; - simulation.LoadCameraData(camera); - } - - _CurrentPerCameraData._RenderedThisFrame = true; - _CurrentPerCameraData._ExecutedThisFrame = true; - - // We are in the camera loop AND there is additional camera data. - _InCameraLoop = true; - - s_OnLoadCameraData?.Invoke(camera); - } - - void StoreCameraData(Camera camera) - { - if (SingleViewpoint) - { - return; - } - - _CurrentPerCameraData._Scale = Scale; - _CurrentPerCameraData._Position = Position; - _CurrentPerCameraData._OldViewpointPosition = _OldViewpointPosition; - _CurrentPerCameraData._ViewpointHeightAboveWaterSmooth = _ViewpointHeightAboveWaterSmooth; - _CurrentPerCameraData._IsFirstFrameSinceEnabled = _IsFirstFrameSinceEnabled; - _CurrentPerCameraData._ViewerHeightAboveWater = ViewerHeightAboveWater; - _CurrentPerCameraData._ViewerDistanceToShoreline = ViewerDistanceToShoreline; - - foreach (var simulation in Simulations) - { - if (!simulation.Enabled) continue; - simulation.StoreCameraData(camera); - } - - s_OnStoreCameraData?.Invoke(camera); - } /// - /// Cleans up data for a particular camera if no longer rendering water. + /// 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. /// - /// The camera to clean up data for. - void RemoveCameraData(Camera camera) + void ClearLodData() { - // NOTE: Handles all camera data. Add more as needed! - - Surface.RemoveCameraData(camera); - - foreach (var lods in Simulations) + foreach (var simulation in Simulations) { - lods.RemoveCameraData(camera); + if (!simulation.Enabled) continue; + simulation.ClearLodData(); } - - if (_PerCameraData.ContainsKey(camera)) - { - _PerCameraData.Remove(camera); - } - - s_OnRemoveCameraData?.Invoke(camera); - } - - void PruneCameraData() - { - var length = _Cameras.Count; - for (var i = length - 1; i >= 0; i--) - { - var camera = _Cameras[i]; - - // Check against surface rendering and whether we executed, as if we did not, then - // the data is no longer synced anyway. - if (camera == null || !ShouldRender(camera, Surface._Layer, _CameraExclusions) || !_PerCameraData[camera]._ExecutedThisFrame) - { - // Do not prune the fallback camera! - if (FallBackRequired && GetViewer(initial: true) == camera) - { - continue; - } - - RemoveCameraData(camera); - _Cameras.RemoveAt(i); - } - } - - // Load single camera data to prevent null exceptions. - if (_Cameras.Count <= 0) - { - CascadeData = _CascadeData; - } - } - - internal bool GetViewerHeightAboveWater(Camera camera, out float height) - { - height = SeaLevel; - - if (!MultipleViewpoints) - { - height = ViewerHeightAboveWater; - return true; - } - - if (!_PerCameraData.ContainsKey(camera)) - { - return false; - } - - height = _PerCameraData[camera]._ViewerHeightAboveWater; - return true; - } - - internal bool GetViewerDistanceToShoreline(Camera camera, out float distance) - { - distance = SeaLevel; - - if (!MultipleViewpoints) - { - distance = ViewerDistanceToShoreline; - return true; - } - - if (!_PerCameraData.ContainsKey(camera)) - { - return false; - } - - distance = _PerCameraData[camera]._ViewerDistanceToShoreline; - return true; - } - - internal Transform GetClosestViewpoint(Vector3 position) - { - if (!MultipleViewpoints) - { - return Viewpoint; - } - - var furthest = Mathf.Infinity; - Camera result = null; - - foreach (var camera in _Cameras) - { - if (camera == null) - { - continue; - } - - var distance = Mathf.Abs((camera.transform.position - position).sqrMagnitude); - - if (distance < furthest) - { - result = camera; - furthest = distance; - } - } - - if (result == null) - { - return null; - } - - return result.transform; - } - - internal bool IsClosestViewpoint(Vector3 position) - { - if (!MultipleViewpoints) - { - return true; - } - - var viewpoint = Viewpoint; - - return viewpoint == GetClosestViewpoint(position); } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.Definitions.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.Definitions.cs deleted file mode 100644 index 8a4ea22d5..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.Definitions.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -using UnityEngine; -using UnityEngine.Experimental.Rendering; -using UnityEngine.Rendering; - -namespace WaveHarmonic.Crest -{ - partial class WaterResources - { - public ComputeLibrary _ComputeLibrary; - - public sealed class ComputeLibrary - { - public BlitCompute _BlitCompute; - public BlurCompute _BlurCompute; - public ClearCompute _ClearCompute; - public ShapeCombineCompute _ShapeCombineCompute; - public ComputeLibrary(WaterResources resources) - { - _BlitCompute = new(resources.Compute._Blit); - _BlurCompute = new(resources.Compute._Blur); - _ClearCompute = new(resources.Compute._Clear); - _ShapeCombineCompute = new(resources.Compute._ShapeCombine); - } - } - - public abstract class UtilityCompute - { - public readonly ComputeShader _Shader; - public readonly LocalKeyword _Float1Keyword; - public readonly LocalKeyword _Float2Keyword; - public readonly LocalKeyword _Float3Keyword; - public readonly LocalKeyword _Float4Keyword; - - public UtilityCompute(ComputeShader shader) - { - _Shader = shader; - - var keywords = shader.keywordSpace; - _Float1Keyword = keywords.FindKeyword("d_Float1"); - _Float2Keyword = keywords.FindKeyword("d_Float2"); - _Float3Keyword = keywords.FindKeyword("d_Float3"); - _Float4Keyword = keywords.FindKeyword("d_Float4"); - } - - public void SetVariantForFormat(T wrapper, GraphicsFormat format) where T : IPropertyWrapperVariants - { - var count = GraphicsFormatUtility.GetComponentCount(format); - wrapper.SetKeyword(_Float1Keyword, count == 1); - wrapper.SetKeyword(_Float2Keyword, count == 2); - wrapper.SetKeyword(_Float3Keyword, count == 3); - wrapper.SetKeyword(_Float4Keyword, count == 4); - } - } - - public sealed class ClearCompute : UtilityCompute - { - public readonly int _KernelClearTarget; - public readonly int _KernelClearTargetBoundaryX; - public readonly int _KernelClearTargetBoundaryY; - - public ClearCompute(ComputeShader shader) : base(shader) - { - // Using FindKernel can fail if upgrading Crest, and is quite tricky to get right. - _KernelClearTarget = 0; - _KernelClearTargetBoundaryX = 1; - _KernelClearTargetBoundaryY = 2; - } - } - - public sealed class BlitCompute : UtilityCompute - { - public readonly int _KernelAdd; - - public BlitCompute(ComputeShader shader) : base(shader) - { - _KernelAdd = 0; - } - } - - public sealed class BlurCompute : UtilityCompute - { - public readonly int _KernelHorizontal; - public readonly int _KernelVertical; - - public BlurCompute(ComputeShader shader) : base(shader) - { - _KernelHorizontal = 0; - _KernelVertical = 1; - } - } - - public sealed class ShapeCombineCompute - { - public readonly ComputeShader _Shader; - public readonly LocalKeyword _CombineKeyword; - public readonly LocalKeyword _DynamicWavesKeyword; - public readonly LocalKeyword _FlowKeyword; - public readonly int _CopyAnimatedWavesKernel; - public readonly int _CombineAnimatedWavesKernel; - public readonly int _CombineDynamicWavesKernel; - - public ShapeCombineCompute(ComputeShader shader) - { - _Shader = shader; - - var keywords = shader.keywordSpace; - _CombineKeyword = keywords.FindKeyword("d_Combine"); - _DynamicWavesKeyword = keywords.FindKeyword("d_DynamicWaves"); - _FlowKeyword = keywords.FindKeyword("d_Flow"); - - _CombineAnimatedWavesKernel = 0; - _CopyAnimatedWavesKernel = 1; - _CombineDynamicWavesKernel = 2; - } - } - } -} diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.Definitions.cs.meta b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.Definitions.cs.meta deleted file mode 100644 index 19af47af3..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.Definitions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dcf1e593838654a4193ec161a5f37702 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.cs index d2052668f..b70d64458 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaterResources.cs @@ -13,7 +13,7 @@ namespace WaveHarmonic.Crest [ExecuteAlways, Utility.FilePath("Packages/com.waveharmonic.crest/Runtime/Settings/Resources.asset")] [@HelpURL("Manual/Scripting.html#resources")] - sealed partial class WaterResources : Utility.ScriptableSingleton + sealed class WaterResources : Utility.ScriptableSingleton { [Serializable] public sealed class ShaderResources @@ -88,8 +88,6 @@ namespace WaveHarmonic.Crest public ComputeShader _Whirlpool; public ComputeShader _Clear; - public ComputeShader _Blit; - public ComputeShader _Blur; } #pragma warning disable IDE0032 // Use auto property @@ -177,14 +175,8 @@ namespace WaveHarmonic.Crest #if !CREST_DEBUG hideFlags = HideFlags.NotEditable; #endif - - Initialize(); - } - - void Initialize() - { Keywords.Initialize(this); - _ComputeLibrary = new(this); + AfterEnabled?.Invoke(); } @@ -207,7 +199,7 @@ namespace WaveHarmonic.Crest if (path.StartsWith("Packages/com.waveharmonic.crest") && path.EndsWith(".compute")) { // Unity loses these if the compute shader is recompiled. - Instance.Initialize(); + Instance.Keywords.Initialize(Instance); } } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaveHarmonic.Crest.asmdef b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaveHarmonic.Crest.asmdef index 4e407db25..1ac204578 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/WaveHarmonic.Crest.asmdef +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/WaveHarmonic.Crest.asmdef @@ -56,11 +56,6 @@ "expression": "", "define": "d_UnityURP" }, - { - "name": "com.unity.render-pipelines.universal", - "expression": "(,17.3.0)", - "define": "URP_COMPATIBILITY_MODE" - }, { "name": "com.waveharmonic.crest.paint", "expression": "", diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/FFTCompute.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/FFTCompute.cs index bb6b6d6a5..10ce19661 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/FFTCompute.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/FFTCompute.cs @@ -42,9 +42,8 @@ namespace WaveHarmonic.Crest float _GenerationTime = -1f; - // WebGPU claims it does but does not. static readonly bool s_SupportsRandomWriteRGFloat = - !Helpers.IsWebGPU && SystemInfo.SupportsRandomWriteOnRenderTextureFormat(RenderTextureFormat.RGFloat); + SystemInfo.SupportsRandomWriteOnRenderTextureFormat(RenderTextureFormat.RGFloat); public static class ShaderIDs { @@ -208,7 +207,7 @@ namespace WaveHarmonic.Crest rtd.enableRandomWrite = true; rtd.depthBufferBits = 0; rtd.volumeDepth = k_CascadeCount; - rtd.graphicsFormat = GraphicsFormat.R32G32B32A32_SFloat; + rtd.colorFormat = RenderTextureFormat.ARGBFloat; rtd.msaaSamples = 1; Helpers.SafeCreateRenderTexture(ref _SpectrumInitial, rtd); @@ -216,7 +215,7 @@ namespace WaveHarmonic.Crest _SpectrumInitial.Create(); // Raw wave data buffer - WaveBuffers = new(resolution, resolution, 0, Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16G16B16A16_SFloat, randomWrite: true)) + WaveBuffers = new(resolution, resolution, 0, GraphicsFormat.R16G16B16A16_SFloat) { wrapMode = TextureWrapMode.Repeat, antiAliasing = 1, @@ -264,7 +263,7 @@ namespace WaveHarmonic.Crest offset <<= 1; } - var texture = new Texture2D(resolution, Mathf.RoundToInt(Mathf.Log(resolution, 2)), TextureFormat.RGFloat, false, true); + var texture = new Texture2D(resolution, Mathf.RoundToInt(Mathf.Log(resolution, 2)), TextureFormat.RGBAFloat, false, true); texture.SetPixels(colors); texture.Apply(); s_ButterflyTextures.Add(resolution, texture); @@ -301,7 +300,7 @@ namespace WaveHarmonic.Crest if (s_SupportsRandomWriteRGFloat) { - descriptor.graphicsFormat = GraphicsFormat.R32G32_SFloat; + descriptor.colorFormat = RenderTextureFormat.RGFloat; } // No need to clear as overwritten. diff --git a/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/WaveSpectrum.cs b/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/WaveSpectrum.cs index 94aee13bc..8943cc586 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/WaveSpectrum.cs +++ b/Packages/com.waveharmonic.crest/Runtime/Scripts/Waves/WaveSpectrum.cs @@ -67,8 +67,6 @@ namespace WaveHarmonic.Crest internal SpectrumModel _Model; #pragma warning restore 414 - internal float[] _PowerLinearScales = new float[k_NumberOfOctaves]; - internal enum SpectrumModel { None, @@ -223,7 +221,6 @@ namespace WaveHarmonic.Crest // we store power on logarithmic scale. this does not include 0, we represent 0 as min value pow = Mathf.Max(pow, Mathf.Pow(10f, s_MinimumPowerLog)); - _PowerLinearScales[octave] = pow; _PowerLogarithmicScales[octave] = Mathf.Log10(pow); } } @@ -282,7 +279,6 @@ namespace WaveHarmonic.Crest { var power = _PowerDisabled[i] ? 0f : Mathf.Pow(10f, _PowerLogarithmicScales[i]); power *= _Multiplier * _Multiplier; - _PowerLinearScales[i] = power; _ScratchData[i] = power * Color.white; } diff --git a/Packages/com.waveharmonic.crest/Runtime/Settings/Resources.asset b/Packages/com.waveharmonic.crest/Runtime/Settings/Resources.asset index 4dffa60b3..bc9c7caa8 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Settings/Resources.asset +++ b/Packages/com.waveharmonic.crest/Runtime/Settings/Resources.asset @@ -71,5 +71,3 @@ MonoBehaviour: _UpdateSWS: {fileID: 7200000, guid: 0af900407c415484e8b1482da8ec3881, type: 3} _Whirlpool: {fileID: 7200000, guid: db903c2d7a8274434aa5eef6aa5218f2, type: 3} _Clear: {fileID: 7200000, guid: 2641e78378c244c2e8ac89563a8ec9af, type: 3} - _Blit: {fileID: 7200000, guid: d18c1734c0d4d4e7b9a09a5da1ad1b2c, type: 3} - _Blur: {fileID: 7200000, guid: 5a49c73b133c743caa1d82459943eabf, type: 3} diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AbsorptionTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AbsorptionTexture.compute index 1e213b2d8..875c9c10e 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AbsorptionTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AbsorptionTexture.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #include "HLSLSupport.cginc" diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AnimatedWavesGenerate.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AnimatedWavesGenerate.compute index 48a0a548b..d966891a2 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AnimatedWavesGenerate.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/AnimatedWavesGenerate.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestTransferWaves #pragma multi_compile_local __ d_Texture d_TextureBlend @@ -13,7 +11,6 @@ #include "HLSLSupport.cginc" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Filtering.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Constants.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" @@ -35,8 +32,6 @@ float _Crest_RespectShallowWaterAttenuation; float _Crest_MaximumAttenuationDepth; float _Crest_WaveResolutionMultiplier; float _Crest_TransitionalWavelengthThreshold; -uint _Crest_Resolution; -bool _Crest_SeaLevelOnly; // Texture #if d_Texture @@ -65,8 +60,6 @@ void TransferWaves(uint3 id) const uint last = parameters.y; const half transition = parameters.w; - const uint2 resolution = uint2(_Crest_Resolution, _Crest_Resolution); - #if !d_TextureBlend // Additive only. All wavelengths filtered out for this LOD so nothing to do. if (parameters.x < 0 || parameters.y < 0) @@ -161,12 +154,11 @@ void TransferWaves(uint3 id) axisZ1.x = -axisX1.y; axisZ1.y = axisX1.x; } #else - const float2 positionWaves = float2(dot(positionWS, _Crest_AxisX), dot(positionWS, float2(-_Crest_AxisX.y, _Crest_AxisX.x))); #endif // d_Texture - const half level = Cascade::MakeLevel(slice0).SampleLevel(positionWS); - const half depth = Cascade::MakeDepth(slice0).SampleSignedDepthFromSeaLevel(positionWS) + level; + const half depth = Cascade::MakeDepth(slice0).SampleSignedDepthFromSeaLevel(positionWS) + + Cascade::MakeLevel(slice0).SampleLevel(positionWS); half3 _displacement = 0.0; @@ -225,8 +217,8 @@ void TransferWaves(uint3 id) const float2 uv1 = float2(dot(positionScaledWS, axisX1), dot(positionScaledWS, axisZ1)); // Sample displacement, rotate into frame. - const float3 displacement0 = Utility::SampleBicubicRepeat(_Crest_WaveBuffer, uv0, resolution, waveBufferIndex).xyz; - const float3 displacement1 = Utility::SampleBicubicRepeat(_Crest_WaveBuffer, uv1, resolution, waveBufferIndex).xyz; + float3 displacement0 = _Crest_WaveBuffer.SampleLevel(sampler_Crest_linear_repeat, float3(uv0, waveBufferIndex), 0).xyz; + float3 displacement1 = _Crest_WaveBuffer.SampleLevel(sampler_Crest_linear_repeat, float3(uv1, waveBufferIndex), 0).xyz; float3 displacement = lerp(displacement0, displacement1, t); displacement.xz = displacement.x * axis + displacement.z * float2(-axis.y, axis.x); @@ -235,9 +227,7 @@ void TransferWaves(uint3 id) #else // !d_Texture // Sample displacement, rotate into frame defined by global wind direction. - // Hardware bilinear produces small noise artifacts. Custom bilinear solves that, - // but we still get texel artifacts that show up in normals, so use bicubic. - float3 displacement = Utility::SampleBicubicRepeat(_Crest_WaveBuffer, positionWaves / waveBufferSize, resolution, waveBufferIndex).xyz; + half3 displacement = _Crest_WaveBuffer.SampleLevel(sampler_Crest_linear_repeat, float3(positionWaves / waveBufferSize, waveBufferIndex), 0).xyz; displacement.xz = displacement.x * _Crest_AxisX + displacement.z * float2(-_Crest_AxisX.y, _Crest_AxisX.x); _displacement += displacement * weight; #endif // d_Texture @@ -249,13 +239,6 @@ void TransferWaves(uint3 id) _Crest_Target[id] *= 1.0 - saturate(alpha); #endif -#if !d_Texture - if (_Crest_SeaLevelOnly) - { - _displacement *= saturate(1.0 - abs(level)); - } -#endif - // Always write full alpha so textures show up in previews. _Crest_Target[id] += float4(_displacement, 1.0); } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipPrimitive.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipPrimitive.compute index 48177d288..a6bb0a490 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipPrimitive.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipPrimitive.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #pragma multi_compile_local d_Sphere d_Cube d_Rectangle diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipTexture.compute index 5e4b30f19..3a25bfe9b 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ClipTexture.compute @@ -3,8 +3,6 @@ // Adds clipping from a provided texture. Used by Painted and Texture input modes. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #include "HLSLSupport.cginc" diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthProbe.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthProbe.compute index c00301e24..041882bb1 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthProbe.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthProbe.compute @@ -6,8 +6,6 @@ // afterwards. It is converted to world-space in another shader before writing into // the LOD data. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestCopy #pragma kernel CrestFill @@ -19,7 +17,7 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" Texture2D _CamDepthBuffer; -RWTexture2D _Crest_Target; +RWTexture2D _Crest_Target; #if d_Crest_BackFaceInclusion Texture2D _Crest_CameraDepthBufferBackfaces; diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthTexture.compute index cbb32ce80..e1076e044 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/DepthTexture.compute @@ -5,8 +5,6 @@ // from an ODC, then they are in object-space and are converted to world-space as // the LOD data stores world-space height. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #pragma multi_compile_local __ d_CrestSDF @@ -24,14 +22,14 @@ #if d_CrestSDF #undef m_CrestType -#define m_CrestType m_Float2 +#define m_CrestType float2 #endif Texture2D _Crest_Texture; RWTexture2DArray _Crest_Target; CBUFFER_START(CrestInputTexture) -m_CrestType _Crest_Multiplier; +float2 _Crest_Multiplier; float2 _Crest_TextureSize; float2 _Crest_TexturePosition; float2 _Crest_TextureRotation; diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FlowTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FlowTexture.compute index 4cd3151ca..72fe8af50 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FlowTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FlowTexture.compute @@ -3,8 +3,6 @@ // Adds flow from a provided texture. Used by Painted and Texture input modes. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #include "HLSLSupport.cginc" @@ -17,7 +15,7 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl" Texture2D _Crest_Texture; -RWTexture2DArray _Crest_Target; +RWTexture2DArray _Crest_Target; CBUFFER_START(CrestPerMaterial) int _Crest_Blend; @@ -64,8 +62,7 @@ void Execute(uint3 id) } const float2 target = _Crest_Target[id]; - const float2 result = Blend(_Crest_Blend, weight, 1.0, source, target); - _Crest_Target[id] = m_Float2FromFloat2(result); + _Crest_Target[id] = Blend(_Crest_Blend, weight, 1.0, source, target); } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FoamTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FoamTexture.compute index 10f185d49..e92268b28 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FoamTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/FoamTexture.compute @@ -3,8 +3,6 @@ // Adds foam from a provided texture. Used by Painted and Texture input modes. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #include "HLSLSupport.cginc" diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/JumpFloodSDF.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/JumpFloodSDF.compute index 639ae5c6d..679d2fa46 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/JumpFloodSDF.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/JumpFloodSDF.compute @@ -4,8 +4,6 @@ // An implementation of the Jump Flood algorithm by Rong and Tan // Source: https://www.comp.nus.edu.sg/~tants/jfa.html -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestInitialize #pragma kernel CrestExecute #pragma kernel CrestApply @@ -29,13 +27,13 @@ float _Crest_WaterLevel; CBUFFER_END // Holds scene depth for initialization. -Texture2D _Crest_Source; -RWTexture2D _Crest_Target; +Texture2D _Crest_Source; +RWTexture2D _Crest_Target; // Setting this to zero means that geometry at exactly the origin won't be handled // gracefully - but it would only affect a single-pixel in the worst-case and would // doubtfully be noticable anyway. Use infinity instead. -#define m_CrestUninitializedPosition m_Float2Constructor(m_Crest_PositiveInfinity, m_Crest_PositiveInfinity) +#define m_CrestUninitializedPosition float2(m_Crest_PositiveInfinity, m_Crest_PositiveInfinity) #if d_Crest_Inverted #define m_DepthCheck depth > 0.0 @@ -68,7 +66,7 @@ void Initialize(const uint3 id) depth += lerp(Cascade::MakeLevel(slice0).SampleLevel(position), Cascade::MakeLevel(slice1).SampleLevel(position), alpha); #endif - _Crest_Target[id.xy] = m_DepthCheck ? m_Float2FromFloat2(position) : m_CrestUninitializedPosition; + _Crest_Target[id.xy] = m_DepthCheck ? position : m_CrestUninitializedPosition; } void Execute(const uint3 id) @@ -113,7 +111,7 @@ void Execute(const uint3 id) } } - _Crest_Target[id.xy] = m_Float2FromFloat2(nearest); + _Crest_Target[id.xy] = nearest; } void Apply(const uint3 id) @@ -146,7 +144,7 @@ void Apply(const uint3 id) result.y = distance; - _Crest_Target[id.xy] = m_Float2FromFloat2(result); + _Crest_Target[id.xy] = result; } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/LevelTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/LevelTexture.compute index 1576f2388..be546e691 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/LevelTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/LevelTexture.compute @@ -3,8 +3,6 @@ // Adds height from a provided texture. Used by Painted and Texture input modes. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #pragma multi_compile_local __ d_CatmullRom @@ -29,7 +27,7 @@ float _Crest_Multiplier; float2 _Crest_TextureSize; float2 _Crest_TexturePosition; float2 _Crest_TextureRotation; -float2 _Crest_TextureResolution; +float2 _Crest_Resolution; CBUFFER_END m_CrestNameSpace @@ -51,7 +49,7 @@ void Execute(uint3 id) } #if d_CatmullRom - const float source = Utility::SampleTextureCatmullRom(_Crest_Texture, LODData_linear_clamp_sampler, uv, _Crest_TextureResolution) + const float source = Utility::SampleTextureCatmullRom(_Crest_Texture, LODData_linear_clamp_sampler, uv, _Crest_Resolution) #else const float source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0.0) #endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ScatteringTexture.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ScatteringTexture.compute index c7b9981a5..e44e43f5b 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ScatteringTexture.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/ScatteringTexture.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #include "HLSLSupport.cginc" diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/SphereWaterInteraction.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/SphereWaterInteraction.compute index dc5f89487..29c37c6c2 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/SphereWaterInteraction.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Input/Hidden/SphereWaterInteraction.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute #include "HLSLSupport.cginc" @@ -14,7 +12,7 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl" -RWTexture2DArray _Crest_Target; +RWTexture2DArray _Crest_Target; CBUFFER_START(CrestPerWaterInput) float3 _Crest_Position; @@ -118,7 +116,7 @@ void Execute(uint3 id) // Helps interaction to work at different scales acceleration /= minimumWavelength; - _Crest_Target[id] = m_Float2Constructor(_Crest_Target[id].x, _Crest_Target[id].y + acceleration * _Crest_SimDeltaTime); + _Crest_Target[id] = float2(_Crest_Target[id].x, _Crest_Target[id].y + acceleration * _Crest_SimDeltaTime); } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/PackLevel.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/PackLevel.compute index dc1458c75..51a96d4ef 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/PackLevel.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/PackLevel.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestPackLevel #include "HLSLSupport.cginc" diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/Query.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/Query.compute index fb1265f01..f327e7ff1 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/Query.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/Query.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestQueryDisplacement d_CrestDisplacement #pragma kernel CrestQueryFlow d_CrestFlow #pragma kernel CrestQueryDepth d_CrestDepth diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryDisplacements.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryDisplacements.compute index 21900262b..8991294cb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryDisplacements.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryDisplacements.compute @@ -3,8 +3,6 @@ // Merged into Query.compute. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute [numthreads(1, 1, 1)] void CrestExecute(uint3 id : SV_DispatchThreadID) { } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryFlow.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryFlow.compute index 21900262b..8991294cb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryFlow.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/Query/QueryFlow.compute @@ -3,8 +3,6 @@ // Merged into Query.compute. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestExecute [numthreads(1, 1, 1)] void CrestExecute(uint3 id : SV_DispatchThreadID) { } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShapeCombine.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShapeCombine.compute index 0e4b3efa7..30efd0ffa 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShapeCombine.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShapeCombine.compute @@ -1,19 +1,21 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 +// Compute shader to perform combine of displacements. Reads and writes to texture array which saves +// needing to do ping pong of render targets. Unfortunately reading/writing float4s is not supported +// on pre-DX11.3 hardware (aka typed UAV loads), so this path is not the default, for now.. -#pragma kernel CrestShapeCombineAnimatedWaves -#pragma kernel CrestShapeCopyAnimatedWaves -#pragma kernel CrestShapeCombineDynamicWaves d_CombineDynamicWaves - -#pragma multi_compile_local _ d_Combine -#pragma multi_compile_local _ d_DynamicWaves -#pragma multi_compile_local _ d_Flow - -#if d_CombineDynamicWaves -#define d_DynamicWaves 1 -#endif +#pragma kernel ShapeCombine +#pragma kernel ShapeCombine_DISABLE_COMBINE _DISABLE_COMBINE +#pragma kernel ShapeCombine_FLOW_ON _FLOW_ON +#pragma kernel ShapeCombine_FLOW_ON_DISABLE_COMBINE _FLOW_ON _DISABLE_COMBINE +#pragma kernel ShapeCombine_DYNAMIC_WAVE_SIM_ON _DYNAMIC_WAVE_SIM_ON +#pragma kernel ShapeCombine_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE _DYNAMIC_WAVE_SIM_ON _DISABLE_COMBINE +#pragma kernel ShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON _FLOW_ON _DYNAMIC_WAVE_SIM_ON +#pragma kernel ShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE _FLOW_ON _DYNAMIC_WAVE_SIM_ON _DISABLE_COMBINE +#pragma kernel ShapeCombineDynamicWaves +#pragma kernel ShapeCombineDynamicWaves_DISABLE_COMBINE _DISABLE_COMBINE +#pragma kernel ShapeCombineCopyDynamicWaves #include "HLSLSupport.cginc" @@ -28,10 +30,11 @@ float _Crest_DisplaceClamp; Texture2DArray _Crest_WaveBuffer; RWTexture2DArray _Crest_Target; +RWTexture2DArray _Crest_DynamicWavesTarget; +RWTexture2DArray _Crest_AnimatedWavesTarget; m_CrestNameSpace -#if d_Flow void Flow(const float texel, out float2 offsets, out float2 weights) { const float period = max(3.0 * texel, 1.0); @@ -41,9 +44,7 @@ void Flow(const float texel, out float2 offsets, out float2 weights) if (weights.x > 1.0) weights.x = 2.0 - weights.x; weights.y = 1.0 - weights.x; } -#endif -#if d_Combine void SampleDisplacementsCompute( in RWTexture2DArray i_dispSampler, in float i_resolution, in float3 i_uv_slice, @@ -81,11 +82,10 @@ void SampleDisplacementsCompute( io_worldPos += i_wt * dataLerped.xyz; } -#endif -void ShapeCombine(uint3 id) +void ShapeCombineBase(uint3 id) { - const uint slice0 = id.z; + const uint slice0 = _Crest_LodIndex; const Cascade cascade = Cascade::MakeAnimatedWaves(slice0); const float3 uv = cascade.IDToUV(id.xy); @@ -93,25 +93,23 @@ void ShapeCombine(uint3 id) float3 result = 0.0; -#if !d_CombineDynamicWaves // Sample in waves for this cascade. { -#if d_Flow +#if _FLOW_ON const half2 flow = Cascade::MakeFlow(slice0).SampleFlow(positionWSXZ); float2 offsets, weights; Flow(cascade._Texel, offsets, weights); - result += cascade.SampleAnimatedWavesOverflow(_Crest_WaveBuffer, positionWSXZ - offsets.x * flow, 1.0).xyz * weights.x; - result += cascade.SampleAnimatedWavesOverflow(_Crest_WaveBuffer, positionWSXZ - offsets.y * flow, 1.0).xyz * weights.y; + result += cascade.Sample(_Crest_WaveBuffer, positionWSXZ - offsets[0] * flow).xyz * weights[0]; + result += cascade.Sample(_Crest_WaveBuffer, positionWSXZ - offsets[1] * flow).xyz * weights[1]; #else - result += _Crest_WaveBuffer[id].xyz; -#endif + result += cascade.Sample(_Crest_WaveBuffer, uv).xyz; +#endif // _FLOW_ON } -#endif // Disabled for last LOD. -#if d_Combine +#if !_DISABLE_COMBINE { const Cascade cascade = Cascade::MakeAnimatedWaves(slice0 + 1); // Sample the shape 1 texture at this world position. @@ -121,37 +119,61 @@ void ShapeCombine(uint3 id) } #endif -#if d_DynamicWaves +#if _DYNAMIC_WAVE_SIM_ON { // Convert dynamic wave sim to displacements. result += Cascade::MakeDynamicWaves(slice0) .SampleDynamicWavesDisplacement(positionWSXZ, _Crest_HorizontalDisplace, _Crest_DisplaceClamp); } -#endif +#endif // _DYNAMIC_WAVE_SIM_ON - _Crest_Target[id] = float4(result, 0.0); -} - -void ShapeCombineAnimatedWaves(uint3 id) -{ - id.z = _Crest_LodIndex; - ShapeCombine(id); -} - -void ShapeCopyAnimatedWaves(uint3 id) -{ - ShapeCombine(id); + _Crest_Target[uint3(id.xy, slice0)] = float4(result, 0.0); } void ShapeCombineDynamicWaves(uint3 id) { - // We are combining from the target which matches the Animated Waves descriptor. - id.z = _Crest_LodIndex; - ShapeCombine(id); + const uint slice0 = _Crest_LodIndex; + const Cascade cascade = Cascade::MakeAnimatedWaves(slice0); + const float3 uv = cascade.IDToUV(id.xy); + const float2 positionWSXZ = cascade.UVToWorld(uv); + float3 result = 0.0; + + // Disabled for last LOD. +#if !_DISABLE_COMBINE + { + // We are sampling from the target which matches Animated Waves descriptor. + const Cascade cascade = Cascade::MakeAnimatedWaves(slice0 + 1); + const float3 uv = cascade.WorldToUV(positionWSXZ); + // Waves to combine down from the next lod up the chain. + SampleDisplacementsCompute(_Crest_DynamicWavesTarget, cascade._Resolution, uv, 1.0, result); + } +#endif + + { + // We are sampling from Dynamic Waves. + const Cascade cascade = Cascade::MakeDynamicWaves(slice0); + const float3 uv = cascade.WorldToUV(positionWSXZ); + result += cascade.SampleDynamicWavesDisplacement(uv, _Crest_HorizontalDisplace, _Crest_DisplaceClamp); + } + + _Crest_DynamicWavesTarget[uint3(id.xy, slice0)] = float4(result, 0.0); +} + +void ShapeCombineCopyDynamicWaves(uint3 id) +{ + _Crest_AnimatedWavesTarget[id] += _Crest_DynamicWavesTarget[id]; } m_CrestNameSpaceEnd -m_CrestKernelDefault(ShapeCombineAnimatedWaves) -m_CrestKernelDefault(ShapeCopyAnimatedWaves) -m_CrestKernelDefault(ShapeCombineDynamicWaves) +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_DISABLE_COMBINE(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_FLOW_ON(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_FLOW_ON_DISABLE_COMBINE(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_DYNAMIC_WAVE_SIM_ON(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombine_FLOW_ON_DYNAMIC_WAVE_SIM_ON_DISABLE_COMBINE(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineBase(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombineDynamicWaves(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineDynamicWaves(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombineDynamicWaves_DISABLE_COMBINE(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineDynamicWaves(id); } +[numthreads(THREAD_GROUP_SIZE_X, THREAD_GROUP_SIZE_Y, 1)] void ShapeCombineCopyDynamicWaves(uint3 id : SV_DispatchThreadID) { m_Crest::ShapeCombineCopyDynamicWaves(id); } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShorelineColor.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShorelineColor.compute index 7573eb4e7..46dff08e6 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShorelineColor.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/ShorelineColor.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestShorelineColor #pragma multi_compile_local __ d_Crest_ShorelineColorSource_ShorelineDistance diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateDynamicWaves.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateDynamicWaves.compute index 1fc641928..466ac359c 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateDynamicWaves.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateDynamicWaves.compute @@ -3,19 +3,16 @@ // Solves 2D wave equation -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestUpdateDynamicWaves #include "HLSLSupport.cginc" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Constants.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl" -RWTexture2DArray _Crest_Target; +RWTexture2DArray _Crest_Target; CBUFFER_START(CrestPerMaterial) float _Crest_Damping; @@ -48,7 +45,7 @@ void UpdateDynamicWaves(uint3 id) if (sliceIndexSource < 0.0 || sliceIndexSource >= cascadeSource._Count) { // Always initialise with 0 values. - _Crest_Target[id] = 0.0; + _Crest_Target[id] = (float2)0; return; } @@ -75,7 +72,7 @@ void UpdateDynamicWaves(uint3 id) // Wave reflections off geometry. if (waterDepth <= 0.0) { - _Crest_Target[id] = 0.0; + _Crest_Target[id] = float2(0.0, 0.0); return; } @@ -145,7 +142,7 @@ void UpdateDynamicWaves(uint3 id) vtp = 0.0; } - _Crest_Target[id] = m_Float2Constructor(ftp, vtp); + _Crest_Target[id] = float2(ftp, vtp); } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateFoam.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateFoam.compute index d29e11d9b..3adf4376f 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateFoam.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateFoam.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestUpdateFoam #include "HLSLSupport.cginc" @@ -55,16 +53,9 @@ void UpdateFoam(uint3 id) // accumulation of foam and causes overshoots when _Crest_WaveFoamStrength is less than 1.0. float simDeltaTime = _Crest_NeedsPrewarming ? max(_Crest_SimDeltaTime, min(1.0, _Crest_WaveFoamStrength - 1.0) / _Crest_FoamFadeRate) : _Crest_SimDeltaTime; - // Limit wave contributions at low water scales only where filtering is needed. - uint filteredSlice = slice0; - if (g_Crest_WaterScale <= 8) - { - filteredSlice = max(_Crest_MinimumWavesSlice, filteredSlice); - } - // The determinant of the displacement Jacobian is a good measure for turbulence. float det; - const half3 displacement = Cascade::MakeAnimatedWaves(filteredSlice).SampleDisplacement(worldPosXZ, det); + const half3 displacement = Cascade::MakeAnimatedWaves(max(_Crest_MinimumWavesSlice, slice0)).SampleDisplacement(worldPosXZ, det); foam += 5.0 * simDeltaTime * _Crest_WaveFoamStrength * saturate( _Crest_WaveFoamCoverage - det ); // Prewarm shoreline foam. 1.0 / _Crest_FoamFadeRate perfectly matches a paused water in edit mode which is fine for diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.compute index 5acea7a65..4388987d8 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.compute @@ -3,8 +3,6 @@ // Soft shadow term is red, hard shadow term is green. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestUpdateShadowsBRP _BRP #pragma kernel CrestUpdateShadowsHRP _HRP #pragma kernel CrestUpdateShadowsURP _URP @@ -35,7 +33,7 @@ bool _Crest_SampleColorMap; float3 _Crest_Absorption; float3 _Crest_Scattering; -RWTexture2DArray _Crest_Target; +RWTexture2DArray _Crest_Target; m_CrestNameSpace @@ -148,7 +146,7 @@ void UpdateShadows(const uint3 id) shadow = lerp(shadow, shadowThisFrame, _Crest_JitterDiameters_CurrentFrameWeights.zw * _Crest_SimDeltaTime * 60.0); } - _Crest_Target[id] = m_Float2FromFloat2(shadow); + _Crest_Target[id] = shadow; } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.hlsl index 1e5e3a30f..d58bb60cf 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Data/UpdateShadow.hlsl @@ -1,4 +1,176 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -// Replaced with UpdateShadow.compute. +// Soft shadow term is red, hard shadow term is green. In HDRP, hard shadows are not computed and y channel will be 0. + +#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" +#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Constants.hlsl" +#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" +#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl" +#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl" +// Noise functions used for jitter. +#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Noise/Noise.hlsl" + +CBUFFER_START(CrestPerMaterial) +// Settings._jitterDiameterSoft, Settings._jitterDiameterHard, Settings._currentFrameWeightSoft, Settings._currentFrameWeightHard +float4 _Crest_JitterDiameters_CurrentFrameWeights; +float _Crest_SimDeltaTime; + +bool _Crest_ClearShadows; + +float3 _Crest_CenterPos; +float3 _Crest_Scale; +float4x4 _Crest_MainCameraProjectionMatrix; + +bool _Crest_SampleColorMap; +float3 _Crest_Absorption; +float3 _Crest_Scattering; +CBUFFER_END + +m_CrestNameSpace + +struct Attributes +{ + uint id : SV_VertexID; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + float3 positionWS : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO +}; + +Varyings Vertex(Attributes input) +{ + // This will work for all pipelines. + Varyings output = (Varyings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + output.positionCS = GetFullScreenTriangleVertexPosition(input.id); + float2 uv = GetFullScreenTriangleTexCoord(input.id); + + // World position from UV. + output.positionWS.xyz = float3(uv.x - 0.5, 0.0, uv.y - 0.5) * _Crest_Scale * 4.0 + _Crest_CenterPos; + output.positionWS.y = g_Crest_WaterCenter.y; + + return output; +} + +half SampleShadows(const float4 i_positionWS); +half ComputeShadowFade(const float4 i_positionWS); + +// Compiler shows warning when using intermediate returns, disable this. +#pragma warning(push) +#pragma warning(disable: 4000) +half ComputeShadow(const float4 i_positionWS, const float i_jitterDiameter, const half i_terrainHeight) +{ + float4 positionWS = i_positionWS; + + if (i_jitterDiameter > 0.0) + { + // Add jitter. + positionWS.xz += i_jitterDiameter * (hash33(uint3(abs(positionWS.xz * 10.0), _Time.y * 120.0)) - 0.5).xy; + + // Shadow Bleeding. + // If we are not within a terrain, then check for shadow bleeding. + if (i_positionWS.y > i_terrainHeight) + { + // WorldToSafeUV + half terrainHeight = Cascade::MakeDepth(_Crest_LodIndex).SampleSceneHeight(positionWS.xz); + + // If our current position is below the jittered terrain height, then we have landed within a terrain and + // we do not want to sample those shadows. + if (i_positionWS.y < terrainHeight) + { + // Return no shadows. + return 1.0; + } + } + } + + return SampleShadows(positionWS); +} +#pragma warning(pop) + +half2 Fragment(Varyings input) +{ + float4 positionWS = float4(input.positionWS.xyz, 1.0); + + // Shadow from last frame. Manually implement black border. + const float sliceIndexSource = clamp((int)_Crest_LodIndex + g_Crest_LodChange, 0.0, g_Crest_LodCount - 1.0); + half2 shadow = Cascade::MakeShadowSource(sliceIndexSource).SampleShadowOverflow(positionWS.xz, 1.0); + + // Add displacement so shorelines do not receive shadows incorrectly. + positionWS.xyz += Cascade::MakeAnimatedWaves(_Crest_LodIndex).SampleDisplacement(positionWS.xz); + + // This was calculated in vertex but we have to sample sea level offset in fragment. + float4 mainCameraCoordinates = mul(_Crest_MainCameraProjectionMatrix, positionWS); + + // Check if the current sample is visible in the main camera (and therefore the shadow map can be sampled). This is + // required as the shadow buffer is world aligned and surrounds viewer. + float3 projected = mainCameraCoordinates.xyz / mainCameraCoordinates.w; + if (projected.z < 1.0 && projected.z > 0.0 && abs(projected.x) < 1.0 && abs(projected.y) < 1.0) + { + half2 shadowThisFrame = 1.0; + +#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) + positionWS.xyz -= _WorldSpaceCameraPos.xyz; +#endif + + half terrainHeight = Cascade::MakeDepth(_Crest_LodIndex).SampleSceneHeight(positionWS.xz); + + half softJitter = _Crest_JitterDiameters_CurrentFrameWeights[CREST_SHADOW_INDEX_SOFT]; + + if (_Crest_SampleColorMap) + { + half3 absorption = _Crest_Absorption; + half3 scattering = _Crest_Scattering; + + if (g_Crest_SampleAbsorptionSimulation) + { + absorption = Cascade::MakeAbsorption(_Crest_LodIndex).SampleAbsorption(positionWS.xz); + } + + if (g_Crest_SampleScatteringSimulation) + { + scattering = Cascade::MakeScattering(_Crest_LodIndex).SampleScattering(positionWS.xz); + } + + half3 extinction = absorption + scattering; + half factor = saturate(min(min(extinction.x, extinction.y), extinction.z) * g_Crest_DynamicSoftShadowsFactor); + softJitter = (1.0 - factor) * k_Crest_MaximumShadowJitter; + } + + // Add soft shadowing data. + shadowThisFrame[CREST_SHADOW_INDEX_SOFT] = ComputeShadow + ( + positionWS, + softJitter, + terrainHeight + ); + +#ifdef CREST_SAMPLE_SHADOW_HARD + // Add hard shadowing data. + shadowThisFrame[CREST_SHADOW_INDEX_HARD] = ComputeShadow + ( + positionWS, + _Crest_JitterDiameters_CurrentFrameWeights[CREST_SHADOW_INDEX_HARD], + terrainHeight + ); +#endif + + shadowThisFrame = (half2)1.0 - saturate(shadowThisFrame + ComputeShadowFade(positionWS)); + + shadow = lerp(shadow, shadowThisFrame, _Crest_JitterDiameters_CurrentFrameWeights.zw * _Crest_SimDeltaTime * 60.0); + } + + return shadow; +} + +m_CrestNameSpaceEnd + +m_CrestVertex +m_CrestFragment(half2) diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl index 8c097e510..fbdb22702 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl @@ -39,7 +39,6 @@ result._Texture = g_Crest_Cascade##name##source; \ result._SamplingParameters = g_Crest_SamplingParametersCascade##name##source; \ result._Index = i_Index; \ - result._IndexI = i_Index; \ result._PositionSnapped = perSlice.xy; \ result._Texel = perSlice.z; \ result._Resolution = perType.y; \ @@ -57,7 +56,6 @@ result._Texture = i_Cascade._Texture; \ result._SamplingParameters = i_Cascade._SamplingParameters; \ result._Index = i_Index; \ - result._IndexI = i_Index; \ result._PositionSnapped = perSlice.xy; \ result._Texel = perSlice.z; \ result._Resolution = perType.y; \ @@ -72,7 +70,6 @@ const float4 perAll = g_Crest_CascadeData##source[i_Index]; \ Cascade result; \ result._Index = i_Index; \ - result._IndexI = i_Index; \ result._Scale = perAll.x; \ result._Weight = perAll.y; \ result._MaximumWavelength = perAll.z; \ @@ -143,51 +140,6 @@ } \ } \ return result; \ - } \ - half4 Sample##name##Overflow(const Texture2DArray i_Texture, const float2 i_Position, const float i_Border) m_ConstantReturn \ - { \ - half4 result = 0.0; \ - const float3 uv = WorldToUV(i_Position); \ - const half2 r = abs(uv.xy - 0.5); \ - const half rMax = 0.5 - _OneOverResolution * i_Border; \ - if (max(r.x, r.y) <= rMax) \ - { \ - result = Sample(i_Texture, uv); \ - } \ - else if ((_Index + 1) < _Count) \ - { \ - const Cascade cascade = Cascade::Make##name(_Index + 1, this); \ - const float3 uv = cascade.WorldToUV(i_Position); \ - const half2 r = abs(uv.xy - 0.5); \ - const half rMax = 0.5 - cascade._OneOverResolution * i_Border; \ - if (max(r.x, r.y) <= rMax) \ - { \ - result = Sample(i_Texture, uv); \ - } \ - } \ - return result; \ - } \ - half4 Sample##name##Overflow(const Texture2DArray i_Texture, const float3 i_UV, const float i_Border) m_ConstantReturn \ - { \ - half4 result = 0.0; \ - const half2 r = abs(i_UV.xy - 0.5); \ - const half rMax = 0.5 - _OneOverResolution * i_Border; \ - if (max(r.x, r.y) <= rMax) \ - { \ - result = Sample(i_Texture, i_UV); \ - } \ - else if ((_Index + 1) < _Count) \ - { \ - const Cascade cascade = Cascade::Make##name(_Index + 1, this); \ - const float3 uv = cascade.WorldToUV(UVToWorld(i_UV)); \ - const half2 r = abs(uv.xy - 0.5); \ - const half rMax = 0.5 - cascade._OneOverResolution * i_Border; \ - if (max(r.x, r.y) <= rMax) \ - { \ - result = Sample(i_Texture, uv); \ - } \ - } \ - return result; \ } #define m_SampleWeighted(name, type) \ @@ -223,8 +175,6 @@ struct Cascade // For copy constructor. float4 _SamplingParameters[MAX_LOD_COUNT]; - uint _IndexI; - m_MakeCascadeShared m_MakeCascadeSharedPrevious @@ -233,7 +183,6 @@ struct Cascade const float4 perAll = i_Previous ? g_Crest_CascadeDataSource[i_Index] : g_Crest_CascadeData[i_Index]; Cascade result; result._Index = i_Index; - result._IndexI = i_Index; result._Scale = perAll.x; result._Weight = perAll.y; result._MaximumWavelength = perAll.z; @@ -283,12 +232,6 @@ struct Cascade return float3((i_Position - _PositionSnapped) / (_Texel * _Resolution) + 0.5, _Index); } - uint3 WorldToID(const float2 i_Position) m_ConstantReturn - { - const float3 uv = WorldToUV(i_Position); - return uint3(uv.xy * _Resolution, _IndexI); - } - float2 IDToWorld(const uint2 i_ID) m_ConstantReturn { return UVToWorld(IDToUV(i_ID)); @@ -411,7 +354,6 @@ struct Cascade float4 position = SampleAnimatedWaves(uv); io_LevelOffset += position.w * i_Weight; io_Position += position.xyz * i_Weight; - io_Position.y += position.w * i_Weight; // Derivatives { @@ -514,13 +456,6 @@ struct Cascade return value; } - void SampleSignedDepthFromSeaLevelAndDistance(const float2 i_Position, const float i_Weight, inout half io_Depth, inout half io_Distance) m_ConstantReturn - { - const half2 value = SampleSignedDepthFromSeaLevelAndDistance(i_Position) * i_Weight; - io_Depth += value.x; - io_Distance += value.y; - } - void SampleSignedDepthFromSeaLevel(const float2 i_Position, const float i_Weight, inout half io_Depth) m_ConstantReturn { io_Depth += (g_Crest_WaterCenter.y - SampleSceneHeight(i_Position)) * i_Weight; diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl index 99761e9ef..c2e1b0a44 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl @@ -9,7 +9,7 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl" SamplerState LODData_linear_clamp_sampler; -SamplerState sampler_Crest_point_clamp; +SamplerState LODData_point_clamp_sampler; SamplerState sampler_Crest_linear_repeat; SamplerState _Crest_linear_clamp_sampler; @@ -25,11 +25,6 @@ float g_Crest_ClipByDefault; float g_Crest_LodAlphaBlackPointFade; float g_Crest_LodAlphaBlackPointWhitePointFade; -// Refraction -float g_Crest_WaterDepthAtViewer; -float g_Crest_MaximumVerticalDisplacement; -float2 g_Crest_HorizonNormal; - // Hack - due to SV_IsFrontFace occasionally coming through as true for // backfaces, add a param here that forces water to be in undrwater state. I // think the root cause here might be imprecision or numerical issues at water diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl deleted file mode 100644 index caa1408a3..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#ifndef d_WaveHarmonic_Crest_Keywords -#define d_WaveHarmonic_Crest_Keywords - -#define d_Crest_AlbedoLod CREST_ALBEDO_SIMULATION -#define d_Crest_FlowLod defined(_CREST_FLOW_LOD) -#define d_Crest_ShadowLod CREST_SHADOW_SIMULATION -#define d_Crest_AbsorptionLod CREST_ABSORPTION_SIMULATION -#define d_Crest_ScatteringLod CREST_SCATTERING_SIMULATION - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl.meta deleted file mode 100644 index 2dedf6b8e..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 2e2c3338345cc4cc79fac0ec9b65a4f2 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl index 506f2db81..48bb0e5e7 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl @@ -13,22 +13,6 @@ #define m_FloatMaximum 3.402823466e+38 - -// -// Fallback for WebGPU -// - -#ifdef SHADER_API_WEBGPU -#define m_Float2 float4 -#define m_Float2Constructor(x, y) float4(x, y, 0.0, 0.0) -#define m_Float2FromFloat2(p0) float4(p0.x, p0.y, 0, 0) -#else -#define m_Float2 float2 -#define m_Float2Constructor(x, y) float2(x, y) -#define m_Float2FromFloat2(p0) p0 -#endif - - #if (CREST_FULL_PRECISION_DISPLACEMENT != 0) #define m_DisplacementTexture(texture, components) texture #else diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl index 014966cf5..e0fe16020 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl @@ -1,27 +1,19 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. +// +// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead +// -#ifndef d_WaveHarmonic_Crest_Settings -#define d_WaveHarmonic_Crest_Settings +#ifndef SETTINGS_CREST_HLSL +#define SETTINGS_CREST_HLSL +// +// WaveHarmonic.Crest.Editor.ShaderSettings: static fields +// +#define CREST_PACKAGE_HDRP (1) +#define CREST_PACKAGE_URP (1) +#define CREST_PORTALS (0) +#define CREST_SHIFTING_ORIGIN (0) +#define CREST_FULL_PRECISION_DISPLACEMENT (1) +#define CREST_DISCARD_ATMOSPHERIC_SCATTERING (1) +#define CREST_LEGACY_UNDERWATER (0) -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl" -#if CREST_PLATFORM_STANDALONE -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl" -#elif CREST_PLATFORM_SERVER -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl" -#elif CREST_PLATFORM_ANDROID -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl" -#elif CREST_PLATFORM_IOS -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl" -#elif CREST_PLATFORM_WEB -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl" -#elif CREST_PLATFORM_TVOS -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl" -#elif CREST_PLATFORM_VISIONOS -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl" -#else -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl" #endif - -#endif // d_WaveHarmonic_Crest_Settings diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.meta deleted file mode 100644 index 819fec87d..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bb30ad2b71bed4acca040c6ce2900f37 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl deleted file mode 100644 index 542f721d9..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_ANDROID_HLSL -#define SETTINGS_CREST_ANDROID_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsAndroid: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl.meta deleted file mode 100644 index 44dff3e0e..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 307613c3b5e1c4f7da556862bfea5712 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl deleted file mode 100644 index da123f78d..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_DEFAULT_HLSL -#define SETTINGS_CREST_DEFAULT_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsDefault: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl.meta deleted file mode 100644 index ad7d9394c..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9b6abac1d09714922b174070c93c9054 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl deleted file mode 100644 index 6e2d7bdfc..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_SERVER_HLSL -#define SETTINGS_CREST_SERVER_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsServer: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl.meta deleted file mode 100644 index 653581335..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 15a7369ec789c4ae08ac764eab29463e -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl deleted file mode 100644 index 7755870e4..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_STANDALONE_HLSL -#define SETTINGS_CREST_STANDALONE_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsStandalone: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl.meta deleted file mode 100644 index c0c5a54e3..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d9f563484a71c4e04a3aefcbef8ce36a -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl deleted file mode 100644 index 7be6ced42..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_WEB_HLSL -#define SETTINGS_CREST_WEB_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsWeb: static fields -// -#define CREST_ALBEDO_SIMULATION (0) -#define CREST_ABSORPTION_SIMULATION (0) -#define CREST_SCATTERING_SIMULATION (0) -#define CREST_SHADOW_SIMULATION (0) -#define CREST_CAUSTICS_FORCE_DISTORTION (0) -#define CREST_FOAM_BIOLUMINESCENCE (0) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (0) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl.meta deleted file mode 100644 index 1d3ac30ec..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0eecd007d82c74bf88658c84586cda62 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl deleted file mode 100644 index 8f5f66b62..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_HLSL -#define SETTINGS_CREST_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettings: static fields -// -#define CREST_PACKAGE_HDRP (1) -#define CREST_PACKAGE_URP (1) -#define CREST_PORTALS (0) -#define CREST_SHIFTING_ORIGIN (0) -#define CREST_PLATFORM_STANDALONE (1) -#define CREST_PLATFORM_SERVER (0) -#define CREST_PLATFORM_ANDROID (0) -#define CREST_PLATFORM_IOS (0) -#define CREST_PLATFORM_WEB (0) -#define CREST_PLATFORM_TVOS (0) -#define CREST_PLATFORM_VISIONOS (0) -#define CREST_FULL_PRECISION_DISPLACEMENT (1) -#define CREST_DISCARD_ATMOSPHERIC_SCATTERING (1) -#define CREST_LEGACY_UNDERWATER (0) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl.meta deleted file mode 100644 index c4f520504..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b25f99570a3c543dca0d91bc54a4e27e -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl deleted file mode 100644 index a0d7bd725..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_IOS_HLSL -#define SETTINGS_CREST_IOS_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsIOS: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl.meta deleted file mode 100644 index 3e155b6ec..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9d8991669495c4da8b6d2d9c62dadcb1 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl deleted file mode 100644 index 8a7be96c4..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_TVOS_HLSL -#define SETTINGS_CREST_TVOS_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsTVOS: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl.meta deleted file mode 100644 index 7d1c76ca8..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: bff51ef931a4443a7b6c1a2fc2b88772 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl deleted file mode 100644 index 223f61aa9..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead -// - -#ifndef SETTINGS_CREST_VISIONOS_HLSL -#define SETTINGS_CREST_VISIONOS_HLSL -// -// WaveHarmonic.Crest.Editor.ShaderSettingsVisionOS: static fields -// -#define CREST_ALBEDO_SIMULATION (1) -#define CREST_ABSORPTION_SIMULATION (1) -#define CREST_SCATTERING_SIMULATION (1) -#define CREST_SHADOW_SIMULATION (1) -#define CREST_CAUSTICS_FORCE_DISTORTION (1) -#define CREST_FOAM_BIOLUMINESCENCE (1) -#define CREST_NORMAL_MAPS (1) -#define CREST_SIMPLE_TRANSPARENCY (0) -#define CREST_PLANAR_REFLECTIONS (1) - - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl.meta deleted file mode 100644 index 8f51b1be2..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d0648a06882284ebc88f4b28f3c6f825 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Filtering.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Filtering.hlsl index 95f107129..f34ade870 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Filtering.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Filtering.hlsl @@ -66,67 +66,6 @@ float4 SampleTextureCatmullRom(in Texture2D tex, in SamplerState linearS return result; } -float4 CubicWeights(const float f) -{ - const float f2 = f * f; - const float f3 = f2 * f; - - // Catmull–Rom (a = -0.5) - return float4 - ( - -0.5 * f3 + f2 - 0.5 * f, - 1.5 * f3 - 2.5 * f2 + 1.0, - -1.5 * f3 + 2.0 * f2 + 0.5 * f, - 0.5 * f3 - 0.5 * f2 - ); -} - -float4 SampleBicubicRepeat -( - const Texture2DArray i_Texture, - const float2 i_UV, - const uint2 i_Size, - const uint i_Slice -) -{ - // Convert to texel space (centered at pixel centers). - const float2 samplePosition = i_UV * (float2)i_Size - 0.5; - const int2 texelPosition = (int2)floor(samplePosition); - const float2 f = samplePosition - (float2)texelPosition; - - // Precompute weights. - const float4 wx = CubicWeights(f.x); - const float4 wy = CubicWeights(f.y); - - const uint2 size = i_Size - 1; - - const uint4 x = uint4 - ( - (texelPosition.x - 1) & size.x, - (texelPosition.x + 0) & size.x, - (texelPosition.x + 1) & size.x, - (texelPosition.x + 2) & size.x - ); - - // Horizontal pass. - float4 row[4]; - [unroll] - for (int j = -1; j <= 2; ++j) - { - const int y = (texelPosition.y + j) & size.y; - - const float4 t0 = i_Texture[uint3(x.x, y, i_Slice)]; - const float4 t1 = i_Texture[uint3(x.y, y, i_Slice)]; - const float4 t2 = i_Texture[uint3(x.z, y, i_Slice)]; - const float4 t3 = i_Texture[uint3(x.w, y, i_Slice)]; - - row[j + 1] = t0 * wx.x + t1 * wx.y + t2 * wx.z + t3 * wx.w; - } - - // Vertical pass. - return row[0] * wy.x + row[1] * wy.y + row[2] * wy.z + row[3] * wy.w; -} - m_UtilityNameSpaceEnd #endif // d_WaveHarmonic_Utility_Filtering diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl index 5f75bd0ff..e94a647fb 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl @@ -43,16 +43,6 @@ float2 WorldNormalToScreenDirection(const float3 i_PositionWS, const float3 i_No return direction; } -float3 SafeComputeWorldSpacePosition(float2 positionNDC, float deviceDepth, float4x4 invViewProjMatrix) -{ - float4 positionCS = ComputeClipSpacePosition(positionNDC, deviceDepth); - float4 hpositionWS = mul(invViewProjMatrix, positionCS); - - // w is sometimes zero when using oblique projection. - // Zero is better than NaN. - return hpositionWS.w > 0.0 ? hpositionWS.xyz / hpositionWS.w : 0.0; -} - m_UtilityNameSpaceEnd #endif // d_WaveHarmonic_Utility_Helpers diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/Defines.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/Defines.hlsl index ad04da0d4..f7c590f2f 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/Defines.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/Defines.hlsl @@ -86,9 +86,6 @@ // Transparent Objects Receives Shadows // -// WebGPU does not like the binding. -#ifndef SHADER_API_WEBGPU - #if _SURFACE_TYPE_TRANSPARENT #if _TRANSPARENT_RECEIVES_SHADOWS #if SHADERPASS == SHADERPASS_FORWARD || SHADERPASS == SHADERPASS_FORWARD_ADD @@ -111,6 +108,4 @@ float4 _ShadowMapTexture_TexelSize; #endif #endif -#endif // SHADER_API_WEBGPU - #endif // d_WaveHarmonic_Utility_ShaderGraphDefines diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Lighting.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Lighting.hlsl index 3025b3224..a96a589f8 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Lighting.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Lighting.hlsl @@ -21,6 +21,24 @@ #define CLUSTER_LIGHT_LOOP_SUBTRACTIVE_LIGHT_CHECK FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK #endif // FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK +#if UNITY_VERSION >= 60000000 +#if defined(STEREO_INSTANCING_ON) || defined(STEREO_MULTIVIEW_ON) +#if _ALPHATEST_ON +#if !USE_CLUSTER_LIGHT_LOOP +// If not clustered and additional light shadows and XR, the shading model +// completely breaks. It is like shadow attenuation is NaN or some obscure +// compiler issue. For 2022.3, it is broken for forward+ only, but cannot be fixed. +#define d_ShadowMaskBroken 1 +#else +#if _RECEIVE_SHADOWS_OFF +// Right eye broken rendering similar to above. +#define d_AdditionalLightsBroken 1 +#endif +#endif +#endif +#endif +#endif + #endif // CREST_URP #if CREST_HDRP @@ -60,10 +78,7 @@ void PrimaryLight #elif CREST_BIRP #ifndef USING_DIRECTIONAL_LIGHT // Yes. This function wants the world position of the surface. - o_Direction = UnityWorldSpaceLightDir(i_PositionWS); - // Prevents divide by zero. - if (all(o_Direction == 0)) o_Direction = half3(0.0, 1.0, 0.0); - o_Direction = normalize(o_Direction); + o_Direction = normalize(UnityWorldSpaceLightDir(i_PositionWS)); #else o_Direction = _WorldSpaceLightPos0.xyz; // Prevents divide by zero. @@ -138,6 +153,14 @@ LIGHT_LOOP_BEGIN(pixelLightCount) // Includes shadows and cookies. Light light = GetAdditionalLight(lightIndex, inputData, shadowMask, aoFactor); +#if d_ShadowMaskBroken + light.shadowAttenuation = 1.0; +#endif + +#if d_AdditionalLightsBroken + light.color = 0.0; +#endif + #ifdef _LIGHT_LAYERS if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) #endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.Obsolete.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.Obsolete.hlsl index 57c5b0833..3eaf2374f 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.Obsolete.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.Obsolete.hlsl @@ -11,6 +11,8 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" +float2 _Crest_HorizonNormal; + TEXTURE2D_X(_Crest_WaterMaskTexture); m_CrestNameSpace @@ -43,7 +45,7 @@ half4 Fragment(Varyings input) const uint2 positionSS = input.positionCS.xy; const float mask = LOAD_TEXTURE2D_X(_Crest_WaterMaskTexture, positionSS).x; - const float2 offset = -((float2)mask) * g_Crest_HorizonNormal; + const float2 offset = -((float2)mask) * _Crest_HorizonNormal; float weight = 1.0; // Sample three pixels along the normal. If the sample is different than the diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.hlsl index b5715bd32..509a8c7d9 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Meniscus/Meniscus.hlsl @@ -13,7 +13,6 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Lighting.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/VolumeLighting.hlsl" @@ -41,8 +40,6 @@ int _Crest_DataSliceOffset; half _Crest_Radius; half _Crest_RefractionStrength; -bool _Crest_PortalInverted; - m_CrestNameSpace struct Attributes @@ -90,7 +87,7 @@ half4 Fragment(Varyings input) #if d_Masked // Prevent rendering inside of new portal modules. - if ((LOAD_TEXTURE2D_X(_Crest_WaterMaskTexture, input.positionCS.xy).r == k_Crest_MaskInsidePortal) == _Crest_PortalInverted) + if (LOAD_TEXTURE2D_X(_Crest_WaterMaskTexture, input.positionCS.xy).r == k_Crest_MaskInsidePortal) { discard; } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Caustics.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Caustics.hlsl index 6bdb10ccf..0b0dd44bc 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Caustics.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Caustics.hlsl @@ -77,7 +77,6 @@ half3 Caustics ); } -#if d_Crest_CausticsForceDistortion if (i_Underwater) { float2 surfacePosXZ = i_ScenePositionWS.xz; @@ -94,7 +93,6 @@ half3 Caustics cuv1.xy += 1.30 * causticN; cuv2.xy += 1.77 * causticN; } -#endif half causticsStrength = i_Strength; diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Data.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Data.hlsl index 76aad347c..42a6da350 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Data.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Data.hlsl @@ -12,43 +12,28 @@ TEXTURE2D_FLOAT(_Crest_WaterLine); float _Crest_WaterLineTexel; float2 _Crest_WaterLineResolution; float2 _Crest_WaterLineSnappedPosition; -bool _Crest_WaterLineFlatWater; m_CrestNameSpace float SampleWaterLineHeight(const float2 i_PositionWS) { - if (_Crest_WaterLineFlatWater) - { - return g_Crest_WaterCenter.y; - } - else - { - const float2 uv = (i_PositionWS - _Crest_WaterLineSnappedPosition) / (_Crest_WaterLineTexel * _Crest_WaterLineResolution) + 0.5; - return _Crest_WaterLine.SampleLevel(_Crest_linear_clamp_sampler, uv, 0).r + g_Crest_WaterCenter.y; - } + const float2 uv = (i_PositionWS - _Crest_WaterLineSnappedPosition) / (_Crest_WaterLineTexel * _Crest_WaterLineResolution) + 0.5; + return _Crest_WaterLine.SampleLevel(_Crest_linear_clamp_sampler, uv, 0).r + g_Crest_WaterCenter.y; } half3 SampleWaterLineNormal(const float2 i_PositionWS, const float i_Height) { - if (_Crest_WaterLineFlatWater) - { - return half3(0, 1, 0); - } - else - { - const float2 uv = (i_PositionWS - _Crest_WaterLineSnappedPosition) / (_Crest_WaterLineTexel * _Crest_WaterLineResolution) + 0.5; - const float3 dd = float3(1.0 / _Crest_WaterLineResolution.xy, 0.0); - const float xOffset = _Crest_WaterLine.SampleLevel(_Crest_linear_clamp_sampler, uv + dd.xz, 0).r; - const float zOffset = _Crest_WaterLine.SampleLevel(_Crest_linear_clamp_sampler, uv + dd.zy, 0).r; + const float2 uv = (i_PositionWS - _Crest_WaterLineSnappedPosition) / (_Crest_WaterLineTexel * _Crest_WaterLineResolution) + 0.5; + const float3 dd = float3(1.0 / _Crest_WaterLineResolution.xy, 0.0); + const float xOffset = _Crest_WaterLine.SampleLevel(_Crest_linear_clamp_sampler, uv + dd.xz, 0).r; + const float zOffset = _Crest_WaterLine.SampleLevel(_Crest_linear_clamp_sampler, uv + dd.zy, 0).r; - return normalize(half3 - ( - (xOffset - i_Height) / _Crest_WaterLineTexel, - 1.0, - (zOffset - i_Height) / _Crest_WaterLineTexel - )); - } + return normalize(half3 + ( + (xOffset - i_Height) / _Crest_WaterLineTexel, + 1.0, + (zOffset - i_Height) / _Crest_WaterLineTexel + )); } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl deleted file mode 100644 index f4aebcd3f..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl +++ /dev/null @@ -1,52 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#ifndef d_WaveHarmonic_Crest_Surface_Emission -#define d_WaveHarmonic_Crest_Surface_Emission - -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" - -m_CrestNameSpace - -half3 FoamBioluminescence -( - const half i_FoamData, - const half i_FoamMap, - const half3 i_BioluminescenceColor, - const half i_BioluminescenceIntensity, - const half i_BioluminescenceGlowCoverage, - const half i_BioluminescenceGlowIntensity, - const bool i_BioluminescenceSparklesEnabled, - const half i_BioluminescenceSparklesMap, - const half i_BioluminescenceSparklesCoverage, - const half i_BioluminescenceSparklesIntensity, - const half i_BioluminescenceMaximumDepth, - const half i_WaterDepth -) -{ - half3 emission = 0.0; - - const half weight = 1.0 - saturate(i_WaterDepth / i_BioluminescenceMaximumDepth); - - if (weight <= 0.0) - { - return emission; - } - - emission += - (i_BioluminescenceColor * i_FoamMap * i_BioluminescenceIntensity) + - (i_BioluminescenceColor * saturate(i_FoamData - (1.0 - i_BioluminescenceGlowCoverage)) * i_BioluminescenceGlowIntensity); - - if (i_BioluminescenceSparklesEnabled) - { - emission += (i_BioluminescenceColor * i_BioluminescenceSparklesMap * saturate(i_FoamData - (1.0 - i_BioluminescenceSparklesCoverage)) * i_BioluminescenceSparklesIntensity); - } - - emission *= weight; - - return emission; -} - -m_CrestNameSpaceEnd - -#endif // d_WaveHarmonic_Crest_Surface_Emission diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl.meta deleted file mode 100644 index f36a3fcf9..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 4707eb239a4b242d4ac074ac67b5544e -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Foam.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Foam.hlsl index 19663c866..1e012cec9 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Foam.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Foam.hlsl @@ -16,7 +16,7 @@ m_CrestNameSpace -half2 WhiteFoamTexture +half WhiteFoamTexture ( const TiledTexture i_Texture, const half i_Foam, @@ -25,8 +25,7 @@ half2 WhiteFoamTexture const float2 i_WorldXZ1, const float2 i_TexelOffset, const half i_LodAlpha, - const Cascade i_CascadeData0, - const bool i_Sample2ndChannel = false + const Cascade i_CascadeData0 ) { const float2 uvOffset = i_TexelOffset + g_Crest_Time * i_Texture._speed / 32.0; @@ -34,32 +33,19 @@ half2 WhiteFoamTexture // material 'scale' slider into an intuitive range. const float scale = i_Texture._scale * i_CascadeData0._Scale / 10.0; - const half2 f0 = i_Texture.Sample((i_WorldXZ0 + uvOffset) / scale).rg; - const half2 f1 = i_Texture.Sample((i_WorldXZ1 + uvOffset) / (2.0 * scale)).rg; - - const half fr = lerp(f0.r, f1.r, i_LodAlpha); + half ft = lerp + ( + i_Texture.Sample((i_WorldXZ0 + uvOffset) / scale).r, + i_Texture.Sample((i_WorldXZ1 + uvOffset) / (2.0 * scale)).r, + i_LodAlpha + ); // Black point fade. - const half result = saturate(1.0 - i_Foam); - -#if d_Crest_FoamBioluminescence - if (i_Sample2ndChannel) - { - // Helps with exaggerating at LOD borders. Very specific to sparkles as they do not - // overlap leaving a dead zone in the middle. - const half fg = f0.g * min(0.5, 1.0 - i_LodAlpha) * 2.0 + - f1.g * min(0.5, i_LodAlpha) * 2.0; - - return smoothstep(result, result + i_Feather, half2(fr, fg)); - } - else -#endif - { - return half2(smoothstep(result, result + i_Feather, fr), 0.0); - } + half result = saturate(1.0 - i_Foam); + return smoothstep(result, result + i_Feather, ft); } -half2 MultiScaleFoamAlbedo +half MultiScaleFoamAlbedo ( const TiledTexture i_Texture, const half i_Feather, @@ -67,8 +53,7 @@ half2 MultiScaleFoamAlbedo const Cascade i_CascadeData0, const Cascade i_CascadeData1, const half i_LodAlpha, - const float2 i_UndisplacedXZ, - const bool i_Sample2ndChannel + const float2 i_UndisplacedXZ ) { float2 worldXZ0 = i_UndisplacedXZ; @@ -82,7 +67,7 @@ half2 MultiScaleFoamAlbedo worldXZ1 -= ShiftingOriginOffset(i_Texture, i_CascadeData1); #endif // CREST_SHIFTING_ORIGIN - return WhiteFoamTexture(i_Texture, i_FoamData, i_Feather, worldXZ0, worldXZ1, (float2)0.0, i_LodAlpha, i_CascadeData0, i_Sample2ndChannel); + return WhiteFoamTexture(i_Texture, i_FoamData, i_Feather, worldXZ0, worldXZ1, (float2)0.0, i_LodAlpha, i_CascadeData0); } half2 MultiScaleFoamNormal @@ -112,8 +97,8 @@ half2 MultiScaleFoamNormal // 0.25 is magic number found through tweaking. const float2 dd = float2(0.25 * i_PixelZ * i_Texture._texel, 0.0); - const half whiteFoam_x = WhiteFoamTexture(i_Texture, i_FoamData, i_Feather, worldXZ0, worldXZ1, dd.xy, i_LodAlpha, i_CascadeData0).r; - const half whiteFoam_z = WhiteFoamTexture(i_Texture, i_FoamData, i_Feather, worldXZ0, worldXZ1, dd.yx, i_LodAlpha, i_CascadeData0).r; + const half whiteFoam_x = WhiteFoamTexture(i_Texture, i_FoamData, i_Feather, worldXZ0, worldXZ1, dd.xy, i_LodAlpha, i_CascadeData0); + const half whiteFoam_z = WhiteFoamTexture(i_Texture, i_FoamData, i_Feather, worldXZ0, worldXZ1, dd.yx, i_LodAlpha, i_CascadeData0); // Compute a foam normal - manually push in derivatives. If I used blend // smooths all the normals towards straight up when there is no foam. @@ -122,7 +107,7 @@ half2 MultiScaleFoamNormal return magicStrengthFactor * i_NormalStrength * half2(whiteFoam_x - i_FoamAlbedo, whiteFoam_z - i_FoamAlbedo) / dd.x; } -half2 MultiScaleFoamAlbedo +half MultiScaleFoamAlbedo ( const Flow i_Flow, const TiledTexture i_Texture, @@ -131,8 +116,7 @@ half2 MultiScaleFoamAlbedo const Cascade i_CascadeData0, const Cascade i_CascadeData1, const half i_LodAlpha, - const float2 i_UndisplacedXZ, - const bool i_Sample2ndChannel + const float2 i_UndisplacedXZ ) { return MultiScaleFoamAlbedo @@ -143,8 +127,7 @@ half2 MultiScaleFoamAlbedo i_CascadeData0, i_CascadeData1, i_LodAlpha, - i_UndisplacedXZ - i_Flow._Flow * i_Flow._Offset0, - i_Sample2ndChannel + i_UndisplacedXZ - i_Flow._Flow * i_Flow._Offset0 ) * i_Flow._Weight0 + MultiScaleFoamAlbedo ( i_Texture, @@ -153,8 +136,7 @@ half2 MultiScaleFoamAlbedo i_CascadeData0, i_CascadeData1, i_LodAlpha, - i_UndisplacedXZ - i_Flow._Flow * i_Flow._Offset1, - i_Sample2ndChannel + i_UndisplacedXZ - i_Flow._Flow * i_Flow._Offset1 ) * i_Flow._Weight1; } @@ -232,10 +214,8 @@ void ApplyFoamToSurface // as if it had transmission. // There is still ugliness around the edges. There will either be black or // incorrect reflections depending on the magic value. - io_NormalWS = i_Foam > 0.0 ? half3(0.0, 1.0, 0.0) : io_NormalWS; -#if _SPECULAR_SETUP + io_NormalWS.y *= i_Foam > 0.15 ? -1.0 : 1.0; io_Specular = lerp(io_Specular, i_Specular, i_Foam); -#endif } } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fog.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fog.hlsl index a4345caf7..fec0aeb9b 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fog.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fog.hlsl @@ -23,31 +23,13 @@ void SetUpFog(bool i_Underwater, float3 i_PositionWS, float i_Multiplier, float { s_IsUnderWater = i_Underwater; - // XR does not like early returns in URP. -#if !defined(STEREO_INSTANCING_ON) && !defined(STEREO_MULTIVIEW_ON) - if (!s_IsUnderWater) - { - return; - } -#endif - #if (CREST_LEGACY_UNDERWATER != 1) - ApplyUnderwaterEffect - ( - 0, // Not used (color) - 0, // TIR only - 0, // Caustics only - i_FogDistance, - i_ViewWS, - i_PositionSS, - i_PositionWS, - false, // No caustics - true, // TODO: implement - false, // Do not apply lighting - 1.0, // TODO: implement - s_VolumeOpacity, - s_VolumeLighting - ); + s_PositionSS = i_PositionSS; + s_PositionWS = i_PositionWS; + s_ViewWS = i_ViewWS; + s_FogDistance = i_FogDistance; + s_DepthRaw = 0; + s_FogMultiplier = i_Multiplier; #endif } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fragment.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fragment.hlsl index 241a6f595..0360294b8 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fragment.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fragment.hlsl @@ -6,7 +6,7 @@ #define m_Properties \ const float2 i_UndisplacedXZ, \ - float i_LodAlpha, \ + const float i_LodAlpha, \ const half i_WaterLevelOffset, \ const float2 i_WaterLevelDerivatives, \ const half2 i_Flow, \ @@ -19,36 +19,13 @@ const float3 i_PositionWS, \ const float3 i_PositionVS, \ const float2 i_StaticLightMapUV, \ - inout half3 o_Albedo, \ - inout half3 o_NormalWS, \ - inout half3 o_Specular, \ - inout half3 o_Emission, \ - inout half o_Smoothness, \ - inout half o_Occlusion, \ - inout half o_Alpha - -#define m_Parameters \ - i_UndisplacedXZ, \ - i_LodAlpha, \ - i_WaterLevelOffset, \ - i_WaterLevelDerivatives, \ - i_Flow, \ - i_ViewDirectionWS, \ - i_Facing, \ - i_SceneColor, \ - i_SceneDepthRaw, \ - i_ScreenPosition, \ - i_ScreenPositionRaw, \ - i_PositionWS, \ - i_PositionVS, \ - i_StaticLightMapUV, \ - o_Albedo, \ - o_NormalWS, \ - o_Specular, \ - o_Emission, \ - o_Smoothness, \ - o_Occlusion, \ - o_Alpha + out half3 o_Albedo, \ + out half3 o_NormalWS, \ + out half3 o_Specular, \ + out half3 o_Emission, \ + out half o_Smoothness, \ + out half o_Occlusion, \ + out half o_Alpha // Guard against Shader Graph preview. #ifndef SHADERGRAPH_PREVIEW @@ -56,7 +33,6 @@ #define d_Crest_WaterSurface 1 #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" @@ -78,7 +54,6 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Refraction.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Caustics.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/VolumeLighting.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Emission.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Fresnel.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Foam.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Alpha.hlsl" @@ -104,18 +79,17 @@ static const TiledTexture _Crest_CausticsTiledTexture = static const TiledTexture _Crest_CausticsDistortionTiledTexture = TiledTexture::Make(_Crest_CausticsDistortionTexture, sampler_Crest_CausticsDistortionTexture, _Crest_CausticsDistortionTexture_TexelSize, _Crest_CausticsDistortionScale, 1.0); -void Fragment -( - m_Properties, - const uint i_LodIndex0, - const uint i_LodIndex1, - const float2 i_PositionSS, - const bool i_Underwater, - const float i_SceneZRaw, - const float i_NegativeFog -) +void Fragment(m_Properties) { - float2 scenePositionSS = i_PositionSS; + o_Albedo = 0.0; + o_NormalWS = half3(0.0, 1.0, 0.0); + o_Specular = 0.0; + o_Emission = 0.0; + o_Smoothness = 0.7; + o_Occlusion = 1.0; + o_Alpha = 1.0; + + const float2 positionSS = i_ScreenPosition.xy * _ScreenSize.xy; // Editor only. There is no defined editor symbol. if (_Crest_DrawBoundaryXZ) @@ -131,25 +105,47 @@ void Fragment } } - const uint slice0 = i_LodIndex0; - const uint slice1 = i_LodIndex1; + bool underwater = IsUnderWater(i_Facing, g_Crest_ForceUnderwater, positionSS); -#if d_Crest_FlowLod + // TODO: Should we use PosToSIs or check for overflow? + float slice0 = _Crest_LodIndex; + float slice1 = _Crest_LodIndex + 1; + +#ifdef CREST_FLOW_ON const Flow flow = Flow::Make(i_Flow, g_Crest_Time); #endif const Cascade cascade0 = Cascade::Make(slice0); const Cascade cascade1 = Cascade::Make(slice1); - const float sceneZ = Utility::CrestLinearEyeDepth(i_SceneZRaw); - const float pixelZ = -i_PositionVS.z; + float sceneRawZ = i_SceneDepthRaw; + float negativeFog = _ProjectionParams.y; - const bool isLastLod = slice0 == (uint)g_Crest_LodCount - 1; +#if (CREST_PORTALS != 0) +#ifndef CREST_SHADOWPASS +#if _ALPHATEST_ON + if (m_CrestPortal) + { + const float pixelRawZ = i_ScreenPositionRaw.z / i_ScreenPositionRaw.w; + if (Portal::EvaluateSurface(i_ScreenPosition.xy, pixelRawZ, i_PositionWS, underwater, sceneRawZ, negativeFog)) + { + o_Alpha = 0.0; + return; + } + } +#endif +#endif +#endif + + float sceneZ = Utility::CrestLinearEyeDepth(sceneRawZ); + float pixelZ = -i_PositionVS.z; + + const bool isLastLod = _Crest_LodIndex == (uint)g_Crest_LodCount - 1; const float weight0 = (1.0 - i_LodAlpha) * cascade0._Weight; const float weight1 = (1.0 - weight0) * cascade1._Weight; // Data that fades towards the edge. - half foam = 0.0; half _determinant = 0.0; half4 albedo = 0.0; half2 shadow = 0.0; half waterDepth = i_WaterLevelOffset; half shorelineDistance = 0.0; + half foam = 0.0; half _determinant = 0.0; half4 albedo = 0.0; half2 shadow = 0.0; if (weight0 > m_CrestSampleLodThreshold) { Cascade::MakeAnimatedWaves(slice0).SampleNormals(i_UndisplacedXZ, weight0, o_NormalWS.xz, _determinant); @@ -159,28 +155,15 @@ void Fragment Cascade::MakeFoam(slice0).SampleFoam(i_UndisplacedXZ, weight0, foam); } -#if d_Crest_AlbedoLod if (_Crest_AlbedoEnabled) { Cascade::MakeAlbedo(slice0).SampleAlbedo(i_UndisplacedXZ, weight0, albedo); } -#endif -#if d_Crest_ShadowLod if (_Crest_ShadowsEnabled) { Cascade::MakeShadow(slice0).SampleShadow(i_PositionWS.xz, weight0, shadow); } -#endif - -#if d_Crest_SimpleTransparency || d_Crest_FoamBioluminescence -#if !d_Crest_SimpleTransparency - if (_Crest_FoamEnabled && _Crest_FoamBioluminescenceEnabled) -#endif - { - Cascade::MakeDepth(slice0).SampleSignedDepthFromSeaLevelAndDistance(i_PositionWS.xz, weight0, waterDepth, shorelineDistance); - } -#endif } if (weight1 > m_CrestSampleLodThreshold) @@ -192,28 +175,15 @@ void Fragment Cascade::MakeFoam(slice1).SampleFoam(i_UndisplacedXZ, weight1, foam); } -#if d_Crest_AlbedoLod if (_Crest_AlbedoEnabled) { Cascade::MakeAlbedo(slice1).SampleAlbedo(i_UndisplacedXZ, weight1, albedo); } -#endif -#if d_Crest_ShadowLod if (_Crest_ShadowsEnabled) { Cascade::MakeShadow(slice1).SampleShadow(i_PositionWS.xz, weight1, shadow); } -#endif - -#if d_Crest_SimpleTransparency || d_Crest_FoamBioluminescence -#if !d_Crest_SimpleTransparency - if (_Crest_FoamEnabled && _Crest_FoamBioluminescenceEnabled) -#endif - { - Cascade::MakeDepth(slice1).SampleSignedDepthFromSeaLevelAndDistance(i_PositionWS.xz, weight1, waterDepth, shorelineDistance); - } -#endif } // Invert so shadows are black as we normally multiply this by lighting. @@ -221,81 +191,99 @@ void Fragment // Data that displays to the edge. // The default simulation value has been written to the border of the last slice. - half3 absorption = _Crest_Absorption.xyz; half3 scattering = _Crest_Scattering.xyz; - -#if d_Crest_AbsorptionLod || d_Crest_ScatteringLod + half3 absorption = 0.0; half3 scattering = 0.0; { const float weight0 = (1.0 - (isLastLod ? 0.0 : i_LodAlpha)) * cascade0._Weight; const float weight1 = (1.0 - weight0) * cascade1._Weight; -#if d_Crest_ScatteringLod - if (g_Crest_SampleScatteringSimulation) - { - scattering = 0.0; - } -#endif - -#if d_Crest_AbsorptionLod - if (g_Crest_SampleAbsorptionSimulation) - { - absorption = 0.0; - } -#endif - if (weight0 > m_CrestSampleLodThreshold) { -#if d_Crest_ScatteringLod if (g_Crest_SampleScatteringSimulation) { Cascade::MakeScattering(slice0).SampleScattering(i_UndisplacedXZ, weight0, scattering); } -#endif -#if d_Crest_AbsorptionLod if (g_Crest_SampleAbsorptionSimulation) { Cascade::MakeAbsorption(slice0).SampleAbsorption(i_UndisplacedXZ, weight0, absorption); } -#endif } if (weight1 > m_CrestSampleLodThreshold) { -#if d_Crest_ScatteringLod if (g_Crest_SampleScatteringSimulation) { Cascade::MakeScattering(slice1).SampleScattering(i_UndisplacedXZ, weight1, scattering); } -#endif -#if d_Crest_AbsorptionLod if (g_Crest_SampleAbsorptionSimulation) { Cascade::MakeAbsorption(slice1).SampleAbsorption(i_UndisplacedXZ, weight1, absorption); } -#endif } } -#endif + + if (!g_Crest_SampleScatteringSimulation) + { + scattering = _Crest_Scattering.xyz; + } + + if (!g_Crest_SampleAbsorptionSimulation) + { + absorption = _Crest_Absorption.xyz; + } // Determinant needs to be one when no waves. if (isLastLod) { _determinant += 1.0 - weight0; - waterDepth = 10000.0; } -#if d_Transparent - // Feather at intersection. Cannot be used for shadows since depth is not available. - const float feather = -#if d_Crest_SimpleTransparency - saturate(waterDepth / 0.2); -#else - saturate((sceneZ - pixelZ) / 0.2); -#endif + // Normal. + { + if (_Crest_NormalMapEnabled) + { + o_NormalWS.xz += SampleNormalMaps + ( +#ifdef CREST_FLOW_ON + flow, #endif + _Crest_NormalMapTiledTexture, + _Crest_NormalMapStrength, + i_UndisplacedXZ, + i_LodAlpha, + cascade0 + ); + } - const half3 extinction = VolumeExtinction(absorption, scattering); + o_NormalWS = normalize(o_NormalWS); + + WaterNormal + ( + i_WaterLevelDerivatives, + i_ViewDirectionWS, + _Crest_MinimumReflectionDirectionY, + underwater, + o_NormalWS + ); + + o_NormalWS = normalize(o_NormalWS); + + o_NormalWS.xz *= _Crest_NormalsStrengthOverall; + o_NormalWS.y = lerp(1.0, o_NormalWS.y, _Crest_NormalsStrengthOverall); + + if (underwater) + { + // Flip when underwater. + o_NormalWS.xyz *= -1.0; + } + } + + // Default for opaque render type. + float sceneDistance = 1000.0; + float3 scenePositionWS = 0.0; + + const half3 ambientLight = AmbientLight(); float3 lightIntensity = 0.0; half3 lightDirection = 0.0; @@ -307,123 +295,24 @@ void Fragment lightDirection ); - const half3 ambientLight = AmbientLight(); - const half3 additionalLight = AdditionalLighting(i_PositionWS, i_ScreenPositionRaw, i_StaticLightMapUV); + half3 additionalLight = AdditionalLighting(i_PositionWS, i_ScreenPositionRaw, i_StaticLightMapUV); - // Normal. - { - WaterNormal - ( - i_WaterLevelDerivatives, - i_ViewDirectionWS, - _Crest_MinimumReflectionDirectionY, - i_Underwater, - o_NormalWS - ); - -#if d_Crest_NormalMap - if (_Crest_NormalMapEnabled) - { - const half2 normalMap = SampleNormalMaps - ( -#if d_Crest_FlowLod - flow, -#endif - _Crest_NormalMapTiledTexture, - _Crest_NormalMapStrength, - i_UndisplacedXZ, - i_LodAlpha, - cascade0 - ); - - half normalMapStrength = _Crest_NormalMapStrength; - - if (_Crest_NormalMapTurbulenceEnabled) - { - normalMapStrength = NormalMapTurbulence - ( - o_NormalWS, - normalMap, - normalMapStrength, - _Crest_NormalMapTurbulenceCoverage, - _Crest_NormalMapTurbulenceStrength, - i_ViewDirectionWS, - _determinant, - g_Crest_WaterCenter.y + i_WaterLevelOffset, - pixelZ, - lightDirection - ); - } - - o_NormalWS.xz += normalMap * normalMapStrength; - } -#endif // d_Crest_NormalMap - - o_NormalWS = normalize(o_NormalWS); - - WaterNormal - ( - i_WaterLevelDerivatives, - i_ViewDirectionWS, - _Crest_MinimumReflectionDirectionY, - i_Underwater, - o_NormalWS - ); - - o_NormalWS = normalize(o_NormalWS); - - o_NormalWS.xz *= _Crest_NormalsStrengthOverall; - o_NormalWS.y = lerp(1.0, o_NormalWS.y, _Crest_NormalsStrengthOverall); - - if (i_Underwater) - { - // Flip when underwater. - o_NormalWS.xyz *= -1.0; - } - } - - // Default for opaque render type. - float sceneDistance = 1000.0; - float3 scenePositionWS = i_PositionWS; - -#if d_Crest_SimpleTransparency - sceneDistance = waterDepth; - // Increase ray for grazing angles. - sceneDistance += (1.0 - dot(i_ViewDirectionWS, o_NormalWS)) * waterDepth; - scenePositionWS.y = i_PositionWS.y - waterDepth; - // Cannot sample scene so go with average light. - o_Emission = i_Underwater ? 0.0 : (0.5 * (lightIntensity + additionalLight + ambientLight) * INV_PI); -#if CREST_HDRP - o_Emission /= GetCurrentExposureMultiplier(); -#endif -#endif - - bool caustics = !i_Underwater; - -#if !d_Crest_SimpleTransparency #if d_Transparent #ifndef d_SkipRefraction + bool caustics; RefractedScene ( _Crest_RefractionStrength, - 1.000293, // air - _Crest_RefractiveIndexOfWater, o_NormalWS, - i_PositionWS, i_ScreenPosition.xy, - i_ScreenPositionRaw, pixelZ, - i_ViewDirectionWS, + i_SceneColor, sceneZ, - i_SceneZRaw, - cascade0._Scale, - i_LodAlpha, - i_Underwater, - _Crest_TotalInternalReflectionIntensity, + sceneRawZ, + underwater, o_Emission, sceneDistance, scenePositionWS, - scenePositionSS, caustics ); @@ -440,46 +329,45 @@ void Fragment #endif #endif // d_SkipRefraction #endif // d_Transparent -#endif // d_Crest_SimpleTransparency + + float refractedSeaLevel = g_Crest_WaterCenter.y; + float3 refractedSurfacePosition = float3(0, refractedSeaLevel, 0); + if (!underwater && slice1 < g_Crest_LodCount) + { + // Sample larger slice to avoid the first slice. + float4 displacement = Cascade::MakeAnimatedWaves(slice1).Sample(scenePositionWS.xz); + refractedSeaLevel = g_Crest_WaterCenter.y + displacement.w; + refractedSurfacePosition = displacement.xyz; + refractedSurfacePosition.y += refractedSeaLevel; + } // Out-scattering. - if (!i_Underwater) + if (!underwater) { - // Account for extinction of light as it travels down through volume. - o_Emission *= exp(-extinction * max(0.0, i_PositionWS.y - scenePositionWS.y)); + // Account for average extinction of light as it travels down through volume. Assume flat water as anything else would be expensive. + half3 extinction = absorption.xyz + scattering.xyz; + o_Emission *= exp(-extinction * max(0.0, refractedSeaLevel - scenePositionWS.y)); } #if d_Transparent #ifndef d_SkipRefraction // Caustics - if (_Crest_CausticsEnabled && !i_Underwater && caustics) + if (_Crest_CausticsEnabled && !underwater && caustics) { - half lightOcclusion = 1.0; -#if !d_Crest_SimpleTransparency - lightOcclusion = PrimaryLightShadows(scenePositionWS, scenePositionSS); -#endif - -#if d_Crest_SimpleTransparency - if (_Crest_RefractionStrength > 0.0) - { - // Gives a parallax like effect. - const half3 ray = refract(-i_ViewDirectionWS, o_NormalWS, 1.0 / _Crest_RefractiveIndexOfWater) * _Crest_RefractionStrength; - scenePositionWS += ray * waterDepth * 2.0; - } -#endif + half lightOcclusion = PrimaryLightShadows(scenePositionWS, positionSS); half blur = 0.0; -#if d_Crest_FlowLod +#ifdef CREST_FLOW_ON blur = _Crest_CausticsMotionBlur; #endif o_Emission *= Caustics ( -#if d_Crest_FlowLod +#ifdef CREST_FLOW_ON flow, #endif scenePositionWS, - i_PositionWS.y, + refractedSurfacePosition.y, lightIntensity, lightDirection, lightOcclusion, @@ -492,7 +380,7 @@ void Fragment _Crest_CausticsDistortionTiledTexture, _Crest_CausticsDistortionStrength, blur, - _Crest_CausticsForceDistortion + underwater ); } #endif // d_SkipRefraction @@ -516,6 +404,7 @@ void Fragment } // Volume Lighting + const half3 extinction = VolumeExtinction(absorption, scattering); const half3 volumeOpacity = VolumeOpacity(extinction, sceneDistance); const half3 volumeLight = VolumeLighting ( @@ -542,7 +431,7 @@ void Fragment ( i_ViewDirectionWS, o_NormalWS, - i_Underwater, + underwater, 1.0, // air _Crest_RefractiveIndexOfWater, _Crest_TotalInternalReflectionIntensity, @@ -550,7 +439,7 @@ void Fragment reflected ); - if (i_Underwater) + if (underwater) { o_Emission *= transmitted; o_Emission += volumeLight * reflected; @@ -563,12 +452,10 @@ void Fragment } } -#if _SPECULAR_SETUP // Specular { o_Specular = _Crest_Specular * reflected * shadow.y; } -#endif // Smoothness { @@ -578,27 +465,24 @@ void Fragment // Occlusion { - o_Occlusion = i_Underwater ? _Crest_OcclusionUnderwater : _Crest_Occlusion; + o_Occlusion = underwater ? _Crest_OcclusionUnderwater : _Crest_Occlusion; } // Planar Reflections -#if d_Crest_PlanarReflections if (_Crest_PlanarReflectionsEnabled) { half4 reflection = PlanarReflection ( - _Crest_ReflectionColorTexture, - sampler_Crest_ReflectionColorTexture, + _Crest_ReflectionTexture, + sampler_Crest_ReflectionTexture, _Crest_PlanarReflectionsIntensity, o_Smoothness, _Crest_PlanarReflectionsRoughness, - _Crest_MinimumReflectionDirectionY, - pixelZ, o_NormalWS, _Crest_PlanarReflectionsDistortion, i_ViewDirectionWS, i_ScreenPosition.xy, - i_Underwater + underwater ); half alpha = reflection.a; @@ -607,14 +491,13 @@ void Fragment // Results are darker than Unity's. o_Occlusion *= 1.0 - alpha; } -#endif // d_Crest_PlanarReflections // Foam if (_Crest_FoamEnabled) { - half2 albedo = MultiScaleFoamAlbedo + half albedo = MultiScaleFoamAlbedo ( -#if d_Crest_FlowLod +#ifdef CREST_FLOW_ON flow, #endif _Crest_FoamTiledTexture, @@ -623,20 +506,19 @@ void Fragment cascade0, cascade1, i_LodAlpha, - i_UndisplacedXZ, - _Crest_FoamBioluminescenceEnabled && _Crest_FoamBioluminescenceSparklesEnabled + i_UndisplacedXZ ); half2 normal = MultiScaleFoamNormal ( -#if d_Crest_FlowLod +#ifdef CREST_FLOW_ON flow, #endif _Crest_FoamTiledTexture, _Crest_FoamFeather, _Crest_FoamNormalStrength, foam, - albedo.x, + albedo, cascade0, cascade1, i_LodAlpha, @@ -648,13 +530,13 @@ void Fragment ApplyFoamToSurface ( - albedo.x, + albedo, normal, intensity, _Crest_Occlusion, _Crest_FoamSmoothness, _Crest_Specular, - i_Underwater, + underwater, o_Albedo, o_NormalWS, o_Emission, @@ -664,71 +546,36 @@ void Fragment ); // We will use this for shadow casting. - const half foamData = foam; - foam = albedo.r; - -#if d_Crest_FoamBioluminescence - if (_Crest_FoamBioluminescenceEnabled) - { - half3 emission = FoamBioluminescence - ( - foamData, - albedo.r, - _Crest_FoamBioluminescenceColor.rgb, - _Crest_FoamBioluminescenceIntensity, - _Crest_FoamBioluminescenceGlowCoverage, - _Crest_FoamBioluminescenceGlowIntensity, - _Crest_FoamBioluminescenceSparklesEnabled, - albedo.y, - _Crest_FoamBioluminescenceSparklesCoverage, - _Crest_FoamBioluminescenceSparklesIntensity, - _Crest_FoamBioluminescenceMaximumDepth, - waterDepth - ); - - emission *= _Crest_FoamBioluminescenceSeaLevelOnly ? saturate(1.0 - abs(i_WaterLevelOffset)) : 1.0; - -#if d_Transparent - // Apply feathering to avoid hardening the edge. - emission *= feather * feather * feather; -#endif - - o_Emission += emission; - } -#endif // d_Crest_FoamBioluminescence + foam = albedo; } // Albedo -#if d_Crest_AlbedoLod if (_Crest_AlbedoEnabled) { const float foamMask = _Crest_AlbedoIgnoreFoam ? (1.0 - saturate(foam)) : 1.0; o_Albedo = lerp(o_Albedo, albedo.rgb, albedo.a * foamMask); o_Emission *= 1.0 - albedo.a * foamMask; } -#endif - -#if d_Crest_SimpleTransparency - o_Alpha = i_Underwater - ? 1.0 - transmitted - : max(max(length(volumeOpacity), _Crest_TransparencyMinimumAlpha), max(foam, albedo.a)); -#endif // Alpha { #ifndef CREST_SHADOWPASS #if d_Transparent // Feather at intersection. Cannot be used for shadows since depth is not available. - o_Alpha = min(o_Alpha, feather); + o_Alpha = saturate((sceneZ - pixelZ) / 0.2); #endif #endif // This keyword works for all RPs despite BIRP having prefixes in serialised data. -#if d_Crest_AlphaTest +#if _ALPHATEST_ON #if CREST_SHADOWPASS - o_Alpha = min(o_Alpha, max(foam, albedo.a) - _Crest_ShadowCasterThreshold); + o_Alpha = max(foam, albedo.a) - _Crest_ShadowCasterThreshold; #endif -#endif // d_Crest_AlphaTest + + // Add 0.5 bias for LOD blending and texel resolution correction. This will help to + // tighten and smooth clipped edges. + o_Alpha -= ClipSurface(i_PositionWS.xz) > 0.5 ? 2.0 : 0.0; +#endif // _ALPHATEST_ON // Specular in HDRP is still affected outside the 0-1 alpha range. o_Alpha = min(o_Alpha, 1.0); @@ -736,107 +583,22 @@ void Fragment SetUpFog ( - i_Underwater, + underwater, i_PositionWS, 1.0, // N/A: multiplier for fog nodes - pixelZ - i_NegativeFog, + sceneDistance - negativeFog, i_ViewDirectionWS, - i_PositionSS + positionSS ); } -// IMPORTANT! -// Do not branch on o_Alpha, as it is not robust. Rendering will break on stereo -// rendering in the form of losing additional lighting and/or broken reflection -// probe sampling. This is an issue with the shader compiler it seems. -void Fragment(m_Properties) -{ - const float2 positionSS = i_ScreenPosition.xy * _ScreenSize.xy; - - bool underwater = IsUnderWater(i_Facing, g_Crest_ForceUnderwater, positionSS); - float sceneRawZ = i_SceneDepthRaw; - float negativeFog = _ProjectionParams.y; - -#if d_Crest_AlphaTest -#if !d_Crest_SimpleTransparency -#ifndef CREST_SHADOWPASS -#if (CREST_PORTALS != 0) - if (m_CrestPortal) - { - const float pixelRawZ = i_ScreenPositionRaw.z / i_ScreenPositionRaw.w; - o_Alpha = Portal::EvaluateSurface(i_ScreenPosition.xy, pixelRawZ, i_PositionWS, underwater, sceneRawZ, negativeFog) ? -1.0 : 1.0; -#ifndef SHADER_API_WEBGPU - clip(o_Alpha); -#endif - } -#endif -#endif -#endif -#endif - - uint slice0; - uint slice1; - float alpha; - -#if d_Crest_AlphaTest || d_Crest_CustomMesh - PosToSliceIndices(i_PositionWS.xz, 0.0, g_Crest_LodCount - 1.0, g_Crest_WaterScale, slice0, slice1, alpha); -#endif - -#if d_Crest_AlphaTest - { - const Cascade cascade0 = Cascade::Make(slice0); - const Cascade cascade1 = Cascade::Make(slice1); - const float weight0 = (1.0 - alpha) * cascade0._Weight; - const float weight1 = (1.0 - weight0) * cascade1._Weight; - - float clipSurface = 0.0; - if (weight0 > m_CrestSampleLodThreshold) - { - Cascade::MakeClip(slice0).SampleClip(i_PositionWS.xz, weight0, clipSurface); - } - if (weight1 > m_CrestSampleLodThreshold) - { - Cascade::MakeClip(slice1).SampleClip(i_PositionWS.xz, weight1, clipSurface); - } - - // Add 0.5 bias for LOD blending and texel resolution correction. This will help to - // tighten and smooth clipped edges. - o_Alpha -= clipSurface > 0.5 ? 2.0 : 0.0; - -#ifndef SHADER_API_WEBGPU - clip(o_Alpha); -#endif - } -#endif - - { -#if !d_Crest_CustomMesh - slice0 = _Crest_LodIndex; - slice1 = _Crest_LodIndex + 1; - alpha = i_LodAlpha; -#endif - - i_LodAlpha = alpha; - - Fragment - ( - m_Parameters, - slice0, - slice1, - positionSS, - underwater, - sceneRawZ, - negativeFog - ); - } -} - m_CrestNameSpaceEnd #endif // SHADERGRAPH_PREVIEW void Fragment_float(m_Properties) { +#if SHADERGRAPH_PREVIEW o_Albedo = 0.0; o_NormalWS = half3(0.0, 1.0, 0.0); o_Specular = 0.0; @@ -844,10 +606,32 @@ void Fragment_float(m_Properties) o_Smoothness = 0.7; o_Occlusion = 1.0; o_Alpha = 1.0; - -#if !SHADERGRAPH_PREVIEW - m_Crest::Fragment(m_Parameters); -#endif +#else // SHADERGRAPH_PREVIEW + m_Crest::Fragment + ( + i_UndisplacedXZ, + i_LodAlpha, + i_WaterLevelOffset, + i_WaterLevelDerivatives, + i_Flow, + i_ViewDirectionWS, + i_Facing, + i_SceneColor, + i_SceneDepthRaw, + i_ScreenPosition, + i_ScreenPositionRaw, + i_PositionWS, + i_PositionVS, + i_StaticLightMapUV, + o_Albedo, + o_NormalWS, + o_Specular, + o_Emission, + o_Smoothness, + o_Occlusion, + o_Alpha + ); +#endif // SHADERGRAPH_PREVIEW } #undef m_Properties diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Geometry.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Geometry.hlsl index 6f60da002..8cd0366e3 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Geometry.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Geometry.hlsl @@ -11,7 +11,9 @@ // These are per cascade, set per chunk instance. CBUFFER_START(CrestChunkGeometryData) float _Crest_ChunkMeshScaleAlpha; +float _Crest_ChunkMeshScaleAlphaSource; float _Crest_ChunkGeometryGridWidth; +float _Crest_ChunkGeometryGridWidthSource; CBUFFER_END m_CrestNameSpace diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl deleted file mode 100644 index 4620b13c1..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl +++ /dev/null @@ -1,20 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#ifndef d_WaveHarmonic_Crest_SurfaceKeywords -#define d_WaveHarmonic_Crest_SurfaceKeywords - -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl" - -#define d_Crest_AlphaTest defined(_ALPHATEST_ON) -#define d_Crest_MotionVectors defined(_TRANSPARENT_WRITES_MOTION_VEC) - -#define d_Crest_CustomMesh defined(_CREST_CUSTOM_MESH) - -#define d_Crest_CausticsForceDistortion CREST_CAUSTICS_FORCE_DISTORTION -#define d_Crest_FoamBioluminescence CREST_FOAM_BIOLUMINESCENCE -#define d_Crest_NormalMap CREST_NORMAL_MAPS -#define d_Crest_SimpleTransparency CREST_SIMPLE_TRANSPARENCY -#define d_Crest_PlanarReflections CREST_PLANAR_REFLECTIONS - -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl.meta deleted file mode 100644 index 373d3cf83..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9d4fdd4ba0e96485c93d748132deef6a -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Normal.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Normal.hlsl index eaa83e799..416bdaea5 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Normal.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Normal.hlsl @@ -5,7 +5,6 @@ #define CREST_WATER_NORMAL_H #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Constants.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Texture.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Flow.hlsl" @@ -14,43 +13,12 @@ #include "Packages/com.waveharmonic.crest.shifting-origin/Runtime/Shaders/ShiftingOrigin.hlsl" #endif -#if _CREST_CUSTOM_MESH -float4 _Crest_NormalMapParameters[MAX_LOD_COUNT]; -#define _Crest_ChunkNormalMapParameters _Crest_NormalMapParameters[i_CascadeData._IndexI] -#else // These are per cascade, set per chunk instance. float _Crest_ChunkFarNormalsWeight; float2 _Crest_ChunkNormalScrollSpeed; -#define _Crest_ChunkNormalMapParameters float3(_Crest_ChunkNormalScrollSpeed, _Crest_ChunkFarNormalsWeight) -#endif m_CrestNameSpace -// Limit how close to horizontal reflection ray can get, useful to avoid unsightly below-horizon reflections. -half3 ApplyMinimumReflectionDirectionY -( - const half i_MinimumReflectionDirectionY, - const half3 i_ViewDirectionWS, - const half3 i_NormalWS -) -{ - half3 normal = i_NormalWS; - - float3 refl = reflect(-i_ViewDirectionWS, normal); - if (refl.y < i_MinimumReflectionDirectionY) - { - // Find the normal that keeps the reflection direction above the horizon. Compute - // the reflection dir that does work, normalize it, and then normal is half vector - // between this good reflection direction and view direction. - float3 FL = refl; - FL.y = i_MinimumReflectionDirectionY; - FL = normalize(FL); - normal = normalize(FL + i_ViewDirectionWS); - } - - return normal; -} - half2 SampleNormalMaps ( const TiledTexture i_NormalMap, @@ -67,24 +35,20 @@ half2 SampleNormalMaps worldXZUndisplaced -= ShiftingOriginOffset(i_NormalMap, i_CascadeData); #endif - const float3 parameters = _Crest_ChunkNormalMapParameters.xyz; - const float2 speed = parameters.xy; - const float farWeight = parameters.z; - const float2 v0 = float2(0.94, 0.34), v1 = float2(-0.85, -0.53); float scale = i_NormalMap._scale * i_CascadeData._Scale / 10.0; - const float spdmulL = speed.x * i_NormalMap._speed; + const float spdmulL = _Crest_ChunkNormalScrollSpeed.x * i_NormalMap._speed; half2 norm = UnpackNormal(i_NormalMap.Sample((worldXZUndisplaced + v0 * g_Crest_Time * spdmulL) / scale)).xy + UnpackNormal(i_NormalMap.Sample((worldXZUndisplaced + v1 * g_Crest_Time * spdmulL) / scale)).xy; // blend in next higher scale of normals to obtain continuity - const half nblend = i_LodAlpha * farWeight; + const half nblend = i_LodAlpha * _Crest_ChunkFarNormalsWeight; if (nblend > 0.001) { // next lod level scale *= 2.0; - const float spdmulH = speed.y * i_NormalMap._speed; + const float spdmulH = _Crest_ChunkNormalScrollSpeed.y * i_NormalMap._speed; norm = lerp(norm, UnpackNormal(i_NormalMap.Sample((worldXZUndisplaced + v0 * g_Crest_Time * spdmulH) / scale)).xy + UnpackNormal(i_NormalMap.Sample((worldXZUndisplaced + v1 * g_Crest_Time * spdmulH) / scale)).xy, @@ -92,7 +56,7 @@ half2 SampleNormalMaps } // approximate combine of normals. would be better if normals applied in local frame. - return norm; + return i_Strength * norm; } half2 SampleNormalMaps @@ -122,41 +86,6 @@ half2 SampleNormalMaps ) * i_Flow._Weight1; } -half NormalMapTurbulence -( - const half3 i_NormalWS, - const half2 i_NormalMap, - const half i_NormalMapStrength, - const half i_Coverage, - const half i_Strength, - const half3 i_ViewDirectionWS, - const half i_Determinant, - const half i_WaterLevel, - const float i_PixelZ, - const half3 i_PrimaryLightDirection -) -{ - half strength = i_NormalMapStrength; - - if (saturate(i_Coverage - i_Determinant) > 0) - { - // Add boosted normal map. - half3 normal = i_NormalWS; - normal.xz += i_NormalMap * i_Strength; - normal = normalize(normal); - - // Increase normal map strength only if "sparkle". - if (dot(normal, normalize(i_ViewDirectionWS + i_PrimaryLightDirection)) >= 0.99) - { - // Height (100m) & distance (2m) cull. Looks odd up close and degrades up high. - const half cull = max(saturate(abs(_WorldSpaceCameraPos.y - i_WaterLevel) * 0.01), 1.0 - saturate(i_PixelZ * 0.5)); - strength = lerp(i_Strength, strength, cull); - } - } - - return strength; -} - void WaterNormal ( const float2 i_WaterLevelDerivatives, @@ -177,11 +106,22 @@ void WaterNormal return; } - io_NormalWS = ApplyMinimumReflectionDirectionY(i_MinimumReflectionDirectionY, i_ViewDirectionWS, io_NormalWS); + // Limit how close to horizontal reflection ray can get, useful to avoid unsightly below-horizon reflections. + { + float3 refl = reflect(-i_ViewDirectionWS, io_NormalWS); + if (refl.y < i_MinimumReflectionDirectionY) + { + // Find the normal that keeps the reflection direction above the horizon. Compute + // the reflection dir that does work, normalize it, and then normal is half vector + // between this good reflection direction and view direction. + float3 FL = refl; + FL.y = i_MinimumReflectionDirectionY; + FL = normalize(FL); + io_NormalWS = normalize(FL + i_ViewDirectionWS); + } + } } - - m_CrestNameSpaceEnd #endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Reflection.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Reflection.hlsl index d0f6d3f59..bbccbb56a 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Reflection.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Reflection.hlsl @@ -6,16 +6,10 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Utility.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl" -float _Crest_ReflectionOverscan; float4 _Crest_ReflectionPositionNormal[2]; -float4x4 _Crest_ReflectionMatrixIVP[2]; -float4x4 _Crest_ReflectionMatrixV[2]; -Texture2DArray _Crest_ReflectionColorTexture; -SamplerState sampler_Crest_ReflectionColorTexture; -Texture2DArray _Crest_ReflectionDepthTexture; -SamplerState sampler_Crest_ReflectionDepthTexture; +Texture2DArray _Crest_ReflectionTexture; +SamplerState sampler_Crest_ReflectionTexture; m_CrestNameSpace @@ -26,8 +20,6 @@ half4 PlanarReflection const half i_Intensity, const half i_Smoothness, const half i_Roughness, - const half i_MinimumReflectionDirectionY, - const float i_SurfaceDepth, const half3 i_NormalWS, const half i_NormalStrength, const half3 i_ViewDirectionWS, @@ -35,18 +27,10 @@ half4 PlanarReflection const bool i_Underwater ) { - const uint slice = i_Underwater ? 1 : 0; - half3 planeNormal = half3(0.0, i_Underwater ? -1.0 : 1.0, 0.0); half3 reflected = reflect(-i_ViewDirectionWS, lerp(planeNormal, i_NormalWS, i_NormalStrength)); reflected.y = -reflected.y; - // Limit how close to horizontal reflection ray can get, useful to avoid unsightly below-horizon reflections. - if (!i_Underwater) - { - reflected = ApplyMinimumReflectionDirectionY(i_MinimumReflectionDirectionY, i_ViewDirectionWS, reflected); - } - float4 positionCS = mul(UNITY_MATRIX_VP, half4(reflected, 0.0)); #if UNITY_UV_STARTS_AT_TOP positionCS.y = -positionCS.y; @@ -54,39 +38,19 @@ half4 PlanarReflection float2 positionNDC = positionCS.xy * rcp(positionCS.w) * 0.5 + 0.5; - // Overscan. - positionNDC.xy -= 0.5; - positionNDC.xy *= _Crest_ReflectionOverscan; - positionNDC.xy += 0.5; - // Cancel out distortion if out of bounds. We could make this nicer by doing an edge fade but the improvement is // barely noticeable. Edge fade requires recalculating the above a second time. - if (i_Underwater) { - const float4 positionAndNormal = _Crest_ReflectionPositionNormal[slice]; + float4 positionAndNormal = _Crest_ReflectionPositionNormal[i_Underwater]; if (dot(positionNDC - positionAndNormal.xy, positionAndNormal.zw) < 0.0) { - float2 ndc = i_PositionNDC; - ndc.xy -= 0.5; - ndc.xy *= _Crest_ReflectionOverscan; - ndc.xy += 0.5; - - positionNDC = lerp(ndc, positionNDC, 0.25); + positionNDC = lerp(i_PositionNDC, positionNDC, 0.25); } } - half4 reflection; - - if (_Crest_PlanarReflectionsApplySmoothness) - { - const half roughness = PerceptualSmoothnessToPerceptualRoughness(i_Smoothness); - half level = PerceptualRoughnessToMipmapLevel(roughness, i_Roughness); - reflection = i_ReflectionsTexture.SampleLevel(sampler_Crest_ReflectionColorTexture, float3(positionNDC, i_Underwater), level); - } - else - { - reflection = i_ReflectionsTexture.SampleLevel(sampler_Crest_point_clamp, float3(positionNDC, i_Underwater), 0.0); - } + const half roughness = PerceptualSmoothnessToPerceptualRoughness(i_Smoothness); + const half level = PerceptualRoughnessToMipmapLevel(roughness, i_Roughness); + half4 reflection = i_ReflectionsTexture.SampleLevel(sampler_Crest_ReflectionTexture, float3(positionNDC, i_Underwater), level); // If more than four layers are used on the terrain, they will appear black if HDR // is enabled on the planar reflection camera. Alpha is probably a negative value. @@ -94,21 +58,6 @@ half4 PlanarReflection reflection.a *= i_Intensity; - // Mitigate leaks. - { - // TODO: calculate linear depth from device depth directly. First attempt failed. - // Most effective when surface is smooth due to mip-maps. Surprisingly effective - // even when rough. - const float rRawDepth = _Crest_ReflectionDepthTexture.SampleLevel(sampler_Crest_ReflectionDepthTexture, float3(positionNDC, i_Underwater), 0).r; - const float3 rPositionWS = Utility::SafeComputeWorldSpacePosition(positionNDC, rRawDepth, _Crest_ReflectionMatrixIVP[slice]); - const float rDepth = LinearEyeDepth(rPositionWS, _Crest_ReflectionMatrixV[slice]); - - if (rRawDepth > 0.0 && rDepth <= i_SurfaceDepth) - { - reflection.a = 0.0; - } - } - return reflection; } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Refraction.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Refraction.hlsl index f57f9e1cf..06962c1ed 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Refraction.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Refraction.hlsl @@ -4,8 +4,6 @@ #ifndef CREST_WATER_REFRACTION_H #define CREST_WATER_REFRACTION_H -#if !d_Crest_SimpleTransparency - #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl" @@ -20,144 +18,91 @@ #define FoveatedRemapLinearToNonUniform(uv) uv #endif -#if (UNITY_VERSION < 60000000) || !defined(CREST_URP) -float4 _CameraDepthTexture_TexelSize; -#endif - m_CrestNameSpace -float2 GetRefractionCoordinates(const half3 i_View, const half3 i_Normal, const float3 i_Position, const half i_IOR, const half i_Strength) -{ - float3 position = i_Position; - -#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) - position -= _WorldSpaceCameraPos; -#endif - - const half3 ray = refract(-i_View, i_Normal, i_IOR) * i_Strength; - float2 uv = ComputeNormalizedDeviceCoordinates(position + ray, UNITY_MATRIX_VP); - -#if CREST_HDRP - // Prevent artifacts at edge. Maybe because depth is an atlas for HDRP. - uv = clamp(uv, _CameraDepthTexture_TexelSize.xy, 1.0 - _CameraDepthTexture_TexelSize.xy); -#endif - - return FoveatedRemapLinearToNonUniform(uv); -} - // We take the unrefracted scene colour as input because having a Scene Colour node in the graph // appears to be necessary to ensure the scene colours are bound? void RefractedScene ( const half i_RefractionStrength, - const half i_AirIOR, - const half i_WaterIOR, const half3 i_NormalWS, - const float3 i_PositionWS, const float2 i_PositionNDC, - const float4 i_ScreenPositionRaw, const float i_PixelZ, - const half3 i_View, + const half3 i_SceneColorUnrefracted, const float i_SceneZ, const float i_SceneZRaw, - const float i_Scale, - const float i_LodAlpha, const bool i_Underwater, - const half i_TotalInternalReflectionIntensity, out half3 o_SceneColor, out float o_SceneDistance, out float3 o_ScenePositionWS, - out float2 o_PositionSS, out bool o_Caustics ) { + float2 positionNDC = i_PositionNDC; + float sceneDepthRaw = i_SceneZRaw; + o_Caustics = true; - half strength = i_RefractionStrength; - - const half _AirToWaterRatio = i_AirIOR / i_WaterIOR; - const half _WaterToAirRatio = i_WaterIOR / i_AirIOR; - - // If no TIR, then use same IOR. - const bool isA2WR = !i_Underwater || i_TotalInternalReflectionIntensity < 1.0; - - const half eta = isA2WR ? _AirToWaterRatio : _WaterToAirRatio; - - half3 normal = i_NormalWS; - - // Exchanges accuracy for less artifacts. - if (isA2WR) + // View ray intersects geometry surface either above or below water surface. + float2 refractOffset = i_RefractionStrength * i_NormalWS.xz; + if (!i_Underwater) { - half multiplier = 0.0; - - if (i_Underwater) - { - multiplier = 1.0; - // Max fade when water is 5m deep. - multiplier = saturate(g_Crest_WaterDepthAtViewer * 0.2); - // Max fade by displacement. - multiplier *= saturate(g_Crest_MaximumVerticalDisplacement - 1.0); - // Fade towards screen edge where off screen samples happen. + n is fade start. - multiplier *= saturate((dot(i_PositionNDC - 0.5, -g_Crest_HorizonNormal) + 0.5) * 2.0); - } - - normal.y *= multiplier; + // We're above the water, so behind interface is depth fog. + refractOffset *= min(1.0, 0.5 * (i_SceneZ - i_PixelZ)) / i_SceneZ; + } + else + { + // When looking up through water, full strength ends up being quite intense so reduce it a bunch. + refractOffset *= 0.3; } - // Since we lose detail at a distance, boosting refraction helps visually. - strength *= lerp(i_Scale, i_Scale * 2.0, i_LodAlpha) * 0.25; + // Blend at the edge of the screen to avoid artifacts. + refractOffset *= 1.0 - EdgeBlendingFactor(positionNDC, i_PixelZ); - // Restrict to a reasonable maximum. - strength = min(strength, i_RefractionStrength * 4.0); - - float2 uv = GetRefractionCoordinates(i_View, normal, i_PositionWS, eta, strength); - - o_PositionSS = min(uv * _ScreenSize.xy, _ScreenSize.xy - 1.0); - -#if CREST_BIRP - float deviceDepth = LoadSceneDepth(o_PositionSS); -#else - float deviceDepth = SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); -#endif + const float2 positionNDCRefracted = FoveatedRemapLinearToNonUniform(positionNDC + refractOffset); + float sceneDepthRawRefracted = SHADERGRAPH_SAMPLE_SCENE_DEPTH(positionNDCRefracted); #if (CREST_PORTALS != 0) #if _ALPHATEST_ON - Portal::EvaluateRefraction(uv, i_SceneZRaw, i_Underwater, deviceDepth, o_Caustics); + // Portals + Portal::EvaluateRefraction(positionNDCRefracted, i_SceneZRaw, i_Underwater, sceneDepthRawRefracted, o_Caustics); #endif #endif - float linearDepth = Utility::CrestLinearEyeDepth(deviceDepth); - float depthDifference = linearDepth - i_PixelZ; - normal *= saturate(depthDifference); + const float sceneZRefract = Utility::CrestLinearEyeDepth(sceneDepthRawRefracted); - uv = GetRefractionCoordinates(i_View, normal, i_PositionWS, eta, strength); + // Depth fog & caustics - only if view ray starts from above water. + // Compute depth fog alpha based on refracted position if it landed on an + // underwater surface, or on unrefracted depth otherwise. + if (sceneZRefract > i_PixelZ) + { + // Refracted. + o_SceneDistance = sceneZRefract - i_PixelZ; + o_SceneColor = SHADERGRAPH_SAMPLE_SCENE_COLOR(positionNDCRefracted); - o_PositionSS = min(uv * _ScreenSize.xy, _ScreenSize.xy - 1.0); + positionNDC = positionNDCRefracted; + sceneDepthRaw = sceneDepthRawRefracted; + } + else + { + // Unrefracted. + // It seems that when MSAA is enabled this can sometimes be negative. + o_SceneDistance = max(i_SceneZ - i_PixelZ, 0.0); + o_SceneColor = i_SceneColorUnrefracted; -#if CREST_BIRP - deviceDepth = LoadSceneDepth(o_PositionSS); -#else - deviceDepth = SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); -#endif + // NOTE: Causes refraction artifact with caustics. Cannot remember exactly why this was added. + // o_Caustics = false; + positionNDC = FoveatedRemapLinearToNonUniform(positionNDC); + } - linearDepth = Utility::CrestLinearEyeDepth(deviceDepth); - // It seems that when MSAA is enabled this can sometimes be negative. - depthDifference = max(linearDepth - i_PixelZ, 0.0); + if (i_Underwater) + { + // Depth fog is handled by underwater shader. + o_SceneDistance = i_PixelZ; + } -#if CREST_BIRP - // Sampling artifacts which manifest as a fine outline around refractions. Always - // affects BIRP unless we use Load. Does not affect URP unless downsampling or MSAA - // is used, but Load exposes us to RT scaling. Best to use Sample with HDRP too. - o_SceneColor = LoadSceneColor(o_PositionSS).rgb; -#else - // Sampling artifacts if downsampling or MSAA used. Load does not help. And we get - // outlines around all objects irrespective of refraction. - o_SceneColor = SHADERGRAPH_SAMPLE_SCENE_COLOR(uv).rgb; -#endif - - o_SceneDistance = depthDifference; - o_ScenePositionWS = ComputeWorldSpacePosition(uv, deviceDepth, UNITY_MATRIX_I_VP); + o_ScenePositionWS = ComputeWorldSpacePosition(positionNDC, sceneDepthRaw, UNITY_MATRIX_I_VP); #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) o_ScenePositionWS += _WorldSpaceCameraPos; #endif @@ -166,4 +111,3 @@ void RefractedScene m_CrestNameSpaceEnd #endif -#endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl index 87bf5696c..2626b6cdc 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl @@ -58,8 +58,4 @@ #endif #endif -#if !defined(CREST_HDRP) && (SHADERPASS == SHADERPASS_MOTION_VECTORS) -#define _TRANSPARENT_WRITES_MOTION_VEC -#endif - #endif // CREST_SHADERGRAPH_CONSTANTS_H diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Vertex.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Vertex.hlsl index 47f56512e..098a6bdf6 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Vertex.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Vertex.hlsl @@ -20,7 +20,6 @@ #ifndef SHADERGRAPH_PREVIEW #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl" @@ -30,7 +29,13 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl" -#if d_Crest_MotionVectors +#ifndef CREST_HDRP +#if (SHADERPASS == SHADERPASS_MOTION_VECTORS) +#define _TRANSPARENT_WRITES_MOTION_VEC 1 +#endif +#endif + +#if _TRANSPARENT_WRITES_MOTION_VEC #define m_Slice clamp((int)_Crest_LodIndex + (isMotionVectors ? g_Crest_LodChange : 0), 0, g_Crest_LodCount) #define m_Make(slice) Make(slice, isMotionVectors) #else @@ -45,14 +50,12 @@ void Vertex(m_Properties) // This will get called twice. // With current and previous time respectively. - o_PositionWS = i_PositionWS; - o_UndisplacedXZ = i_PositionWS.xz; + o_UndisplacedXZ = 0.0; o_LodAlpha = 0.0; o_WaterLevelOffset = 0.0; o_WaterLevelDerivatives = 0.0; o_Flow = 0.0; -#if !d_Crest_CustomMesh const bool isMotionVectors = i_Time < _Time.y; const float slice0 = m_Slice; @@ -60,6 +63,8 @@ void Vertex(m_Properties) const Cascade cascade0 = Cascade::m_Make(slice0); const Cascade cascade1 = Cascade::m_Make(slice1); + o_PositionWS = i_PositionWS; + // Vertex snapping and LOD transition. SnapAndTransitionVertLayout ( @@ -94,48 +99,48 @@ void Vertex(m_Properties) // Data that needs to be sampled at the undisplaced position. if (weight0 > m_CrestSampleLodThreshold) { -#if d_Crest_MotionVectors +#if _TRANSPARENT_WRITES_MOTION_VEC if (isMotionVectors) { - Cascade::MakeAnimatedWavesSource(slice0).SampleDisplacement(o_UndisplacedXZ, weight0, o_PositionWS, o_WaterLevelDerivatives, o_WaterLevelOffset); + Cascade::MakeAnimatedWavesSource(slice0).SampleDisplacement(o_UndisplacedXZ, weight0, o_PositionWS, o_WaterLevelDerivatives); } else #endif { - Cascade::MakeAnimatedWaves(slice0).SampleDisplacement(o_UndisplacedXZ, weight0, o_PositionWS, o_WaterLevelDerivatives, o_WaterLevelOffset); + Cascade::MakeAnimatedWaves(slice0).SampleDisplacement(o_UndisplacedXZ, weight0, o_PositionWS, o_WaterLevelDerivatives); } } if (weight1 > m_CrestSampleLodThreshold) { -#if d_Crest_MotionVectors +#if _TRANSPARENT_WRITES_MOTION_VEC if (isMotionVectors) { - Cascade::MakeAnimatedWavesSource(slice1).SampleDisplacement(o_UndisplacedXZ, weight1, o_PositionWS, o_WaterLevelDerivatives, o_WaterLevelOffset); + Cascade::MakeAnimatedWavesSource(slice1).SampleDisplacement(o_UndisplacedXZ, weight1, o_PositionWS, o_WaterLevelDerivatives); } else #endif { - Cascade::MakeAnimatedWaves(slice1).SampleDisplacement(o_UndisplacedXZ, weight1, o_PositionWS, o_WaterLevelDerivatives, o_WaterLevelOffset); + Cascade::MakeAnimatedWaves(slice1).SampleDisplacement(o_UndisplacedXZ, weight1, o_PositionWS, o_WaterLevelDerivatives); } } // Data that needs to be sampled at the displaced position. if (weight0 > m_CrestSampleLodThreshold) { -#if d_Crest_FlowLod +#if CREST_FLOW_ON Cascade::MakeFlow(slice0).SampleFlow(o_UndisplacedXZ, weight0, o_Flow); #endif } if (weight1 > m_CrestSampleLodThreshold) { -#if d_Crest_FlowLod +#if CREST_FLOW_ON Cascade::MakeFlow(slice1).SampleFlow(o_UndisplacedXZ, weight1, o_Flow); #endif } -#if d_Crest_MotionVectors +#if _TRANSPARENT_WRITES_MOTION_VEC if (isMotionVectors) { o_PositionWS.xz -= g_Crest_WaterCenter.xz; @@ -144,7 +149,6 @@ void Vertex(m_Properties) o_PositionWS.xz += g_Crest_WaterCenterDelta; } #endif -#endif } m_CrestNameSpaceEnd diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Water.shadergraph b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Water.shadergraph index 355a12d30..8a2f25858 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Water.shadergraph +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Water.shadergraph @@ -179,62 +179,11 @@ }, { "m_Id": "e4a54526c6204b5badd66e158dcf0b1d" - }, - { - "m_Id": "eb89085b4d7c46c7bf82f63a3b43a0c6" - }, - { - "m_Id": "a12a11f74d174f1d8a63d18ee8743b25" - }, - { - "m_Id": "9f311e65704646e48b52019d389d3cd0" - }, - { - "m_Id": "d209a2766f5546688fe4bc92416cd548" - }, - { - "m_Id": "8ec616eaa4964d38b92b904775e34f7e" - }, - { - "m_Id": "feb1793feb264a239de366d730977489" - }, - { - "m_Id": "cc11871fc2f74ea2821e2c9f78d3d58e" - }, - { - "m_Id": "a485464528a74269852b53d441f1f0a8" - }, - { - "m_Id": "bc35f605d4fc49869c24479f827fbfa8" - }, - { - "m_Id": "dd752976323845b0aad610adb0672e38" - }, - { - "m_Id": "8c45cfde06fb4d5ca12db7bcfa8f6316" - }, - { - "m_Id": "30ad385314c946f5a3cbd7adefe9c270" - }, - { - "m_Id": "c06c8782d1b742d189925deba54c21bc" - }, - { - "m_Id": "38e9cee298f8483e8ca80e75574c2175" - }, - { - "m_Id": "4a21e5afa49f40d38aef98a49226fa6e" - }, - { - "m_Id": "a6704108884e487799aa5f653566e56b" } ], "m_Keywords": [ { "m_Id": "b91141f3e4cf4131ab732e6ae5828231" - }, - { - "m_Id": "ada9e52f38cd4e66a4e97c1fd2a5bd65" } ], "m_Dropdowns": [], @@ -254,12 +203,6 @@ { "m_Id": "9475b0c108bc456eb09f35111542022b" }, - { - "m_Id": "72dfddd5562c42e4bf73f41a47cd4863" - }, - { - "m_Id": "0c1d5d0d16af4922b19d366983ea194e" - }, { "m_Id": "330cb63ecb704ddebac4935cb0b85ab7" }, @@ -269,9 +212,6 @@ { "m_Id": "76dfbf9d02da4e2b9a7cffa11a17b81d" }, - { - "m_Id": "475b6b25b79b44d19bf94d0af92bc9a1" - }, { "m_Id": "76a4c02b522d4e1d84eca095e84b1f30" }, @@ -280,9 +220,6 @@ }, { "m_Id": "d65753c4eac547c5a73c35da6956d9e2" - }, - { - "m_Id": "9125a3c8387e4d38987cc5707394b95b" } ], "m_Nodes": [ @@ -913,15 +850,15 @@ { "m_Id": "b7891fe7e5a34f03adebd8a45505c5fc" }, + { + "m_Id": "8e8aee51883445f1b08bfbec696cb18d" + }, { "m_Id": "e207931e020242bba83058a59f3fb07d" }, { "m_Id": "01717f91918a4191a16ca9eb0a394f85" }, - { - "m_Id": "8e8aee51883445f1b08bfbec696cb18d" - }, { "m_Id": "641a42645cc2483bb33d553093357479" }, @@ -1273,30 +1210,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.CategoryData", - "m_ObjectId": "0c1d5d0d16af4922b19d366983ea194e", - "m_Name": "Reflections (Planar)", - "m_ChildObjectList": [ - { - "m_Id": "d6af4ca8280b4d56b6f2bf1c8b7a0bbd" - }, - { - "m_Id": "2d31998b356d41179aa5291dcedc7850" - }, - { - "m_Id": "eb89085b4d7c46c7bf82f63a3b43a0c6" - }, - { - "m_Id": "0d81099c729342968bf4ee002d378dcf" - }, - { - "m_Id": "e632a014145542d8a0f6bad7aac6cb63" - } - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode", @@ -1971,29 +1884,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", - "m_ObjectId": "30ad385314c946f5a3cbd7adefe9c270", - "m_Guid": { - "m_GuidSerialized": "23c5d086-28d3-4f64-a7c7-b7bec078341f" - }, - "m_Name": "Foam Bioluminescence Enabled", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Enabled", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Enabled", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceEnabled", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": false -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.CategoryData", @@ -2002,6 +1892,12 @@ "m_ChildObjectList": [ { "m_Id": "14f5135a4bf8f5868cb55001b6472657" + }, + { + "m_Id": "bbd2579dfd7f38879fab18706b09b5fb" + }, + { + "m_Id": "d33c23a144f9400888ebc0b17741ceea" } ] } @@ -2027,34 +1923,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "38e9cee298f8483e8ca80e75574c2175", - "m_Guid": { - "m_GuidSerialized": "eb0230f0-4d3b-4348-b7af-d0c613693fbe" - }, - "m_Name": "Foam Bioluminescence Intensity", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Intensity", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Intensity", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceIntensity", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 1.0, - "m_FloatType": 0, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -2093,15 +1961,6 @@ }, { "m_Id": "e608dd8f43794f5d8b3995446b21467f" - }, - { - "m_Id": "a12a11f74d174f1d8a63d18ee8743b25" - }, - { - "m_Id": "9f311e65704646e48b52019d389d3cd0" - }, - { - "m_Id": "d209a2766f5546688fe4bc92416cd548" } ] } @@ -2379,45 +2238,6 @@ "m_PositionSource": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.CategoryData", - "m_ObjectId": "475b6b25b79b44d19bf94d0af92bc9a1", - "m_Name": "Bioluminescence", - "m_ChildObjectList": [ - { - "m_Id": "30ad385314c946f5a3cbd7adefe9c270" - }, - { - "m_Id": "feb1793feb264a239de366d730977489" - }, - { - "m_Id": "38e9cee298f8483e8ca80e75574c2175" - }, - { - "m_Id": "8c45cfde06fb4d5ca12db7bcfa8f6316" - }, - { - "m_Id": "4a21e5afa49f40d38aef98a49226fa6e" - }, - { - "m_Id": "cc11871fc2f74ea2821e2c9f78d3d58e" - }, - { - "m_Id": "c06c8782d1b742d189925deba54c21bc" - }, - { - "m_Id": "dd752976323845b0aad610adb0672e38" - }, - { - "m_Id": "a485464528a74269852b53d441f1f0a8" - }, - { - "m_Id": "bc35f605d4fc49869c24479f827fbfa8" - } - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", @@ -2464,29 +2284,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", - "m_ObjectId": "4a21e5afa49f40d38aef98a49226fa6e", - "m_Guid": { - "m_GuidSerialized": "b17934e1-f74e-4c4b-8313-3f5274067918" - }, - "m_Name": "Foam Bioluminescence Sea Level Only", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Sea Level Only", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Sea_Level_Only", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceSeaLevelOnly", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": true -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", @@ -3571,7 +3368,7 @@ "overrideHLSLDeclaration": false, "hlslDeclarationOverride": 0, "m_Hidden": false, - "m_Value": 0.0, + "m_Value": 0.03, "m_FloatType": 1, "m_RangeValues": { "x": -1.0, @@ -3602,24 +3399,6 @@ "m_Value": false } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.CategoryData", - "m_ObjectId": "72dfddd5562c42e4bf73f41a47cd4863", - "m_Name": "Reflections (Underwater)", - "m_ChildObjectList": [ - { - "m_Id": "21db17a76f094b19ba523148b6f7aa41" - }, - { - "m_Id": "bbd2579dfd7f38879fab18706b09b5fb" - }, - { - "m_Id": "d33c23a144f9400888ebc0b17741ceea" - } - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -3665,9 +3444,6 @@ { "m_Id": "91e9a577d315a3848dfb1f48a6743f9c" }, - { - "m_Id": "a6704108884e487799aa5f653566e56b" - }, { "m_Id": "4b09daebd022cf89bc77ad473c95586c" }, @@ -4220,34 +3996,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "8c45cfde06fb4d5ca12db7bcfa8f6316", - "m_Guid": { - "m_GuidSerialized": "c201c2da-d89e-4a7b-bc1f-358cac6ea74e" - }, - "m_Name": "Foam Bioluminescence Maximum Depth", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Maximum Depth", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Maximum_Depth", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceMaximumDepth", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": Infinity, - "m_FloatType": 0, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", @@ -4305,34 +4053,6 @@ "m_SerializedDescriptor": "SurfaceDescription.Metallic" } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "8ec616eaa4964d38b92b904775e34f7e", - "m_Guid": { - "m_GuidSerialized": "025be3df-ddb1-4553-894c-4cbcafe64fda" - }, - "m_Name": "Transparency Minimum Alpha", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Transparency Minimum Alpha", - "m_DefaultReferenceName": "_Transparency_Minimum_Alpha", - "m_OverrideReferenceName": "_Crest_TransparencyMinimumAlpha", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 0.95, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode", @@ -4388,18 +4108,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.CategoryData", - "m_ObjectId": "9125a3c8387e4d38987cc5707394b95b", - "m_Name": "Simple Transparency", - "m_ChildObjectList": [ - { - "m_Id": "8ec616eaa4964d38b92b904775e34f7e" - } - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", @@ -4535,6 +4243,9 @@ { "m_Id": "c700bce5ef10cf8e9e5b69ba043d383b" }, + { + "m_Id": "21db17a76f094b19ba523148b6f7aa41" + }, { "m_Id": "7b2f0f23d232ab88bcacd3e88392015a" }, @@ -4549,6 +4260,18 @@ }, { "m_Id": "71f6994de656018baa684da1128e623c" + }, + { + "m_Id": "d6af4ca8280b4d56b6f2bf1c8b7a0bbd" + }, + { + "m_Id": "2d31998b356d41179aa5291dcedc7850" + }, + { + "m_Id": "0d81099c729342968bf4ee002d378dcf" + }, + { + "m_Id": "e632a014145542d8a0f6bad7aac6cb63" } ] } @@ -4724,34 +4447,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "9f311e65704646e48b52019d389d3cd0", - "m_Guid": { - "m_GuidSerialized": "04aa688a-8387-4eda-bda1-edead599c4f0" - }, - "m_Name": "Normal Map Turbulence Strength", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Normal Map Turbulence Strength", - "m_DefaultReferenceName": "_Normal_Map_Turbulence_Strength", - "m_OverrideReferenceName": "_Crest_NormalMapTurbulenceStrength", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 0.6, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", @@ -4782,29 +4477,6 @@ "m_DefaultType": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", - "m_ObjectId": "a12a11f74d174f1d8a63d18ee8743b25", - "m_Guid": { - "m_GuidSerialized": "709317fe-af13-425b-90cf-63507779f13c" - }, - "m_Name": "Normal Map Turbulence Enabled", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Normal Map Turbulence Enabled", - "m_DefaultReferenceName": "_Normal_Map_Turbulence_Enabled", - "m_OverrideReferenceName": "_Crest_NormalMapTurbulenceEnabled", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": true -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", @@ -4930,34 +4602,6 @@ "m_FunctionBody": "Enter function body here..." } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "a485464528a74269852b53d441f1f0a8", - "m_Guid": { - "m_GuidSerialized": "dbd6fa2d-e2ba-4ea9-b67c-e21877462ec6" - }, - "m_Name": "Foam Bioluminescence Sparkles Intensity", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Sparkles Intensity", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Sparkles_Intensity", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceSparklesIntensity", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 500.0, - "m_FloatType": 0, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 2, "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget", @@ -5026,29 +4670,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", - "m_ObjectId": "a6704108884e487799aa5f653566e56b", - "m_Guid": { - "m_GuidSerialized": "c4fdecae-cdbb-4529-8ad0-3ef2226477a5" - }, - "m_Name": "Caustics Force Distortion", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Caustics Force Distortion", - "m_DefaultReferenceName": "_Caustics_Force_Distortion", - "m_OverrideReferenceName": "_Crest_CausticsForceDistortion", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": false -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.ViewDirectionNode", @@ -5188,9 +4809,6 @@ }, { "m_Id": "aa75e7087fa330809fdc753edcd8995b" - }, - { - "m_Id": "ada9e52f38cd4e66a4e97c1fd2a5bd65" } ] } @@ -5261,31 +4879,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", - "m_ObjectId": "ada9e52f38cd4e66a4e97c1fd2a5bd65", - "m_Guid": { - "m_GuidSerialized": "787edb3a-324f-493b-b3da-febad061005c" - }, - "m_Name": "Custom Mesh", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Custom Mesh", - "m_DefaultReferenceName": "_CUSTOM_MESH", - "m_OverrideReferenceName": "_CREST_CUSTOM_MESH", - "m_GeneratePropertyBlock": false, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_KeywordType": 0, - "m_KeywordDefinition": 1, - "m_KeywordScope": 0, - "m_KeywordStages": 63, - "m_Entries": [], - "m_Value": 0, - "m_IsEditable": true -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", @@ -5450,7 +5043,7 @@ "m_DefaultRefNameVersion": 0, "m_RefNameGeneratedByDisplayName": "", "m_DefaultReferenceName": "BOOLEAN_547DED44_ON", - "m_OverrideReferenceName": "_CREST_FLOW_LOD", + "m_OverrideReferenceName": "CREST_FLOW_ON", "m_GeneratePropertyBlock": true, "m_UseCustomSlotLabel": false, "m_CustomSlotLabel": "", @@ -5547,34 +5140,6 @@ } } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "bc35f605d4fc49869c24479f827fbfa8", - "m_Guid": { - "m_GuidSerialized": "be221cdb-d9a6-46a9-8e5c-899bb77b9ba5" - }, - "m_Name": "Foam Bioluminescence Sparkles Coverage", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Sparkles Coverage", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Sparkles_Coverage", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceSparklesCoverage", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 0.5, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", @@ -5626,34 +5191,6 @@ } } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "c06c8782d1b742d189925deba54c21bc", - "m_Guid": { - "m_GuidSerialized": "ed5634bc-281c-4def-8a6e-9956331f4a20" - }, - "m_Name": "Foam Bioluminescence Glow Coverage", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Glow Coverage", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Glow_Coverage", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceGlowCoverage", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 0.4, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", @@ -5807,34 +5344,6 @@ } } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "cc11871fc2f74ea2821e2c9f78d3d58e", - "m_Guid": { - "m_GuidSerialized": "db78df35-c8ae-45f7-b19b-6873133e270d" - }, - "m_Name": "Foam Bioluminescence Glow Intensity", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Glow Intensity", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Glow_Intensity", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceGlowIntensity", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 0.7, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.ObjectNode", @@ -5997,34 +5506,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "d209a2766f5546688fe4bc92416cd548", - "m_Guid": { - "m_GuidSerialized": "187a910c-bd28-405b-b1e4-f495ca40e9f9" - }, - "m_Name": "Normal Map Turbulence Coverage", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Normal Map Turbulence Coverage", - "m_DefaultReferenceName": "_Normal_Map_Turbulence_Coverage", - "m_OverrideReferenceName": "_Crest_NormalMapTurbulenceCoverage", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 0.8999999761581421, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode", @@ -6357,29 +5838,6 @@ "m_DefaultValue": true } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", - "m_ObjectId": "dd752976323845b0aad610adb0672e38", - "m_Guid": { - "m_GuidSerialized": "4f72390b-2958-4755-9633-fdce875f1c0e" - }, - "m_Name": "Foam Bioluminescence Sparkles Enabled", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Sparkles Enabled", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Sparkles_Enabled", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceSparklesEnabled", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": true -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -6575,29 +6033,6 @@ "m_Space": 2 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", - "m_ObjectId": "eb89085b4d7c46c7bf82f63a3b43a0c6", - "m_Guid": { - "m_GuidSerialized": "bdc2d1fe-238b-4105-83e0-87f8ef392283" - }, - "m_Name": "Planar Reflections Apply Smoothness", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Planar Reflections Apply Smoothness", - "m_DefaultReferenceName": "_Planar_Reflections_Apply_Smoothness", - "m_OverrideReferenceName": "_Crest_PlanarReflectionsApplySmoothness", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": false -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", @@ -6910,36 +6345,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 3, - "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", - "m_ObjectId": "feb1793feb264a239de366d730977489", - "m_Guid": { - "m_GuidSerialized": "87224bff-8cf6-4adb-83d2-8ec6ed30c979" - }, - "m_Name": "Foam Bioluminescence Color", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Foam Bioluminescence Color", - "m_DefaultReferenceName": "_Foam_Bioluminescence_Color", - "m_OverrideReferenceName": "_Crest_FoamBioluminescenceColor", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": { - "r": 0.0, - "g": 1.55, - "b": 6.0, - "a": 1.0 - }, - "isMainColor": false, - "m_ColorMode": 1 -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blit.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blit.compute deleted file mode 100644 index 9d789ee7a..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blit.compute +++ /dev/null @@ -1,36 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#pragma exclude_renderers glcore gles3 - -#pragma kernel CrestAdd - -#pragma multi_compile_local d_Float1 d_Float2 d_Float3 d_Float4 - -#if d_Float1 -#define m_Type float -#elif d_Float2 -#define m_Type float2 -#elif d_Float3 -#define m_Type float3 -#elif d_Float4 -#define m_Type float4 -#endif - -#include "HLSLSupport.cginc" - -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Macros.hlsl" - -Texture2DArray _Crest_Source; -RWTexture2DArray _Crest_Target; - -m_UtilityNameSpace - -void Add(uint3 id) -{ - _Crest_Target[id] += _Crest_Source[id]; -} - -m_UtilityNameSpaceEnd - -m_UtilityKernelDefault(Add) diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blit.compute.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blit.compute.meta deleted file mode 100644 index 57ac67596..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blit.compute.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d18c1734c0d4d4e7b9a09a5da1ad1b2c -ComputeShaderImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blur.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blur.compute deleted file mode 100644 index 484e87048..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blur.compute +++ /dev/null @@ -1,63 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#pragma exclude_renderers glcore gles3 - -#pragma kernel BlurHorizontal -#pragma kernel BlurVertical - -#pragma multi_compile_local d_Float1 d_Float2 d_Float3 d_Float4 - -#if d_Float1 -#define m_Type float -#elif d_Float2 -#define m_Type float2 -#elif d_Float3 -#define m_Type float3 -#elif d_Float4 -#define m_Type float4 -#endif - -Texture2DArray _Crest_Source; -RWTexture2DArray _Crest_Target; - -// (width, height, slices) -uint _Crest_Resolution; - -// 5-tap Gaussian (sigma ≈ 1) -static const float w0 = 0.4026; -static const float w1 = 0.2442; -static const float w2 = 0.0545; - -uint2 ClampXY(uint2 p) -{ - return clamp(p, 0, _Crest_Resolution - 1); -} - -[numthreads(8, 8, 1)] -void BlurHorizontal(uint3 id : SV_DispatchThreadID) -{ - const int3 p = int3(id.x, id.y, id.z); - const int2 xy = p.xy; - - _Crest_Target[p] = - _Crest_Source[id] * w0 + - _Crest_Source[uint3(ClampXY(xy + int2( 1, 0)), p.z)] * w1 + - _Crest_Source[uint3(ClampXY(xy + int2(-1, 0)), p.z)] * w1 + - _Crest_Source[uint3(ClampXY(xy + int2( 2, 0)), p.z)] * w2 + - _Crest_Source[uint3(ClampXY(xy + int2(-2, 0)), p.z)] * w2; -} - -[numthreads(8, 8, 1)] -void BlurVertical(uint3 id : SV_DispatchThreadID) -{ - const int3 p = int3(id.x, id.y, id.z); - const int2 xy = p.xy; - - _Crest_Target[p] = - _Crest_Source[id] * w0 + - _Crest_Source[uint3(ClampXY(xy + int2(0, 1)), p.z)] * w1 + - _Crest_Source[uint3(ClampXY(xy + int2(0, -1)), p.z)] * w1 + - _Crest_Source[uint3(ClampXY(xy + int2(0, 2)), p.z)] * w2 + - _Crest_Source[uint3(ClampXY(xy + int2(0, -2)), p.z)] * w2; -} diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blur.compute.meta b/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blur.compute.meta deleted file mode 100644 index cf48b605a..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Blur.compute.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 5a49c73b133c743caa1d82459943eabf -ComputeShaderImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Clear.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Clear.compute index 0f9bc7186..4103fa5be 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Clear.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Utility/Clear.compute @@ -3,33 +3,19 @@ // Clear specific components using a mask. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestClearTarget #pragma kernel CrestClearTargetBoundaryX d_BoundaryX #pragma kernel CrestClearTargetBoundaryY d_BoundaryY -#pragma multi_compile_local d_Float1 d_Float2 d_Float3 d_Float4 - -#if d_Float1 -#define m_Type float -#elif d_Float2 -#define m_Type float2 -#elif d_Float3 -#define m_Type float3 -#elif d_Float4 -#define m_Type float4 -#endif - #include "HLSLSupport.cginc" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Macros.hlsl" -RWTexture2DArray _Crest_Target; +RWTexture2DArray _Crest_Target; CBUFFER_START(CrestPerMaterial) -m_Type _Crest_ClearMask; -m_Type _Crest_ClearColor; +float4 _Crest_ClearMask; +float4 _Crest_ClearColor; uint _Crest_Resolution; uint _Crest_TargetSlice; CBUFFER_END diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Graph/IntegrateWaterVolume.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Graph/IntegrateWaterVolume.hlsl index 0c15da0e1..561f33e06 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Graph/IntegrateWaterVolume.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Graph/IntegrateWaterVolume.hlsl @@ -31,8 +31,13 @@ m_CrestNameSpace static bool s_IsUnderWater; -static half3 s_VolumeOpacity; -static half3 s_VolumeLighting; +static float s_FogDistance; +static half s_FogMultiplier; + +static float2 s_PositionSS; +static float3 s_PositionWS; +static half3 s_ViewWS; +static float s_DepthRaw; float3 ApplyFog(float3 color) { @@ -41,11 +46,22 @@ float3 ApplyFog(float3 color) { return color; } - else #endif - { - return lerp(color, s_VolumeLighting, s_VolumeOpacity * (s_IsUnderWater ? 1.0 : 0.0)); - } + + return ApplyUnderwaterEffect + ( + color, + s_DepthRaw, + 0, // Caustics only + s_FogDistance, + s_ViewWS, + s_PositionSS, + s_PositionWS, + false, // No caustics + true, // TODO: implement + true, // TODO: implement + s_FogMultiplier + ); } float3 NoFog(float3 color) @@ -106,23 +122,12 @@ void SetUpFog(const float2 i_PositionNDC, const float3 i_PositionWS, const float } s_IsUnderWater = true; - - ApplyUnderwaterEffect - ( - 0, // Color - 0, // TIR only - 0, // Caustics only - fogDistance, - GetWorldSpaceNormalizeViewDir(i_PositionWS), - positionSS, - i_PositionWS, - false, // No caustics - true, // TODO: implement - true, // TODO: implement - i_Multiplier, - s_VolumeOpacity, - s_VolumeLighting - ); + s_PositionSS = positionSS; + s_PositionWS = i_PositionWS; + s_ViewWS = GetWorldSpaceNormalizeViewDir(i_PositionWS); + s_FogDistance = fogDistance; + s_DepthRaw = i_DepthRaw; + s_FogMultiplier = i_Multiplier; } m_CrestNameSpaceEnd @@ -211,11 +216,6 @@ void CrestNodeIntegrateWaterVolume_float o_Color = i_Color; o_Emission = i_Emission; - if (i_Multiplier == 0) - { - return; - } - #ifndef SHADERGRAPH_PREVIEW m_Crest::SetUpFog(i_PositionNDC, i_PositionWS, i_DepthRaw, i_Multiplier); #endif diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Mask.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Mask.compute index e196eb9ef..8399f625d 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Mask.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Mask.compute @@ -1,8 +1,6 @@ // Crest Water System // Copyright © 2024 Wave Harmonic. All rights reserved. -#pragma exclude_renderers glcore gles3 - #pragma kernel CrestWaterLineBRP _BRP #pragma kernel CrestWaterLineHRP _HRP #pragma kernel CrestWaterLineURP _URP diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/MaskArtifacts.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/MaskArtifacts.compute index d71692b15..86ea8139d 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/MaskArtifacts.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/MaskArtifacts.compute @@ -4,8 +4,6 @@ // Checks both orthogonal and diagonal pixels to fill artefacts in the mask. If checked pixels are all the same then it // assumes that the current pixel should also be the same and fixes it. -#pragma exclude_renderers glcore gles3 - #pragma kernel FillMaskArtefacts _BRP // Built-in will not handle this for us unlike other RPs. diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl index 6a3a63a3b..dcac03cb5 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl @@ -5,12 +5,6 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/UnderwaterShared.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Debug.hlsl" -#if (CREST_LEGACY_UNDERWATER == 1) || defined(CREST_URP) -#define d_Crest_SampleColor 1 -#else -#define d_Crest_SampleColor 0 -#endif - #ifndef SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER #define FoveatedRemapLinearToNonUniform(uv) uv #endif @@ -25,7 +19,7 @@ TEXTURE2D_X(_Crest_CameraColorTexture); m_CrestNameSpace -#if (CREST_LEGACY_UNDERWATER != 0) || d_Crest_CustomColorTexture +#if (CREST_LEGACY_UNDERWATER != 0) float3 SampleSceneColor(float2 i_UV) { return LOAD_TEXTURE2D_X(_Crest_CameraColorTexture, i_UV * _ScreenSize.xy).rgb; @@ -153,8 +147,7 @@ half4 Fragment(Varyings input) #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) positionWS += _WorldSpaceCameraPos; #endif - half3 vo =0; half3 vl = 0; - sceneColour = ApplyUnderwaterEffect(sceneColour, rawDepth, sceneZ, fogDistance, view, positionSS, positionWS, hasCaustics, outScatterScene, applyLighting, 1.0, vo, vl); + sceneColour = ApplyUnderwaterEffect(sceneColour, rawDepth, sceneZ, fogDistance, view, positionSS, positionWS, hasCaustics, outScatterScene, applyLighting, 1.0); } return half4(sceneColour, 1.0); @@ -174,14 +167,18 @@ half4 FragmentPlanarReflections(Varyings input) return half4(_Crest_Scattering.xyz, 1.0); } -#if d_Crest_SampleColor half3 color = SampleSceneColor(positionNDC).rgb; -#else - half3 color = LoadSceneColor(positionSS).rgb; -#endif // Calculate position and account for possible NaNs discovered during testing. - float3 positionWS = Utility::SafeComputeWorldSpacePosition(positionNDC, depth, UNITY_MATRIX_I_VP); + float3 positionWS; + { + float4 positionCS = ComputeClipSpacePosition(positionNDC, depth); + float4 hpositionWS = mul(UNITY_MATRIX_I_VP, positionCS); + + // w is sometimes zero when using oblique projection. + // Zero is better than NaN. + positionWS = hpositionWS.w > 0.0 ? hpositionWS.xyz / hpositionWS.w : 0.0; + } #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) positionWS += _WorldSpaceCameraPos; @@ -190,8 +187,7 @@ half4 FragmentPlanarReflections(Varyings input) const half3 view = GetWorldSpaceNormalizeViewDir(positionWS); const bool hasCaustics = depth > 0.0; - half3 vo = 0; half3 vl = 0; - color = ApplyUnderwaterEffect(color, depth, 0.0, 0.0, view, positionSS, positionWS, hasCaustics, true, true, 1.0, vo, vl); + color = ApplyUnderwaterEffect(color, depth, 0.0, 0.0, view, positionSS, positionWS, hasCaustics, true, true, 1.0); return half4(color, 1.0); } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.shader b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.shader index e9bf31114..ac0983410 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.shader +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.shader @@ -52,7 +52,7 @@ Shader "Crest/Underwater" [PerRendererData] _Crest_CausticsDistortionStrength("Caustics Distortion Strength", Range(0, 0.25)) = 0.16 [PerRendererData] _Crest_CausticsDistortionScale("Caustics Distortion Scale", Range(0.01, 1000)) = 250 [PerRendererData] _Crest_CausticsMotionBlur("Caustics Motion Blur", Range(0, 10)) = 1 - [PerRendererData] [Toggle(_CREST_FLOW_LOD)] _CREST_FLOW_LOD("Flow Enabled", Float) = 0 + [PerRendererData] [Toggle] CREST_FLOW("Flow Enabled", Float) = 0 } HLSLINCLUDE @@ -61,7 +61,7 @@ Shader "Crest/Underwater" // #pragma enable_d3d11_debug_symbols // Also on the water shader. - #pragma multi_compile_local_fragment __ _CREST_FLOW_LOD + #pragma multi_compile_local_fragment __ CREST_FLOW_ON #pragma shader_feature_local_fragment __ d_Dithering @@ -231,6 +231,8 @@ Shader "Crest/Underwater" HLSLPROGRAM #include_with_pragmas "UnderwaterHDRP.hlsl" + #define d_Crest_CustomColorTexture 1 + #define d_Crest_Portal 1 #define d_Crest_Geometry 1 #define d_Crest_FogBefore 1 @@ -284,6 +286,8 @@ Shader "Crest/Underwater" HLSLPROGRAM #include_with_pragmas "UnderwaterHDRP.hlsl" + #define d_Crest_CustomColorTexture 1 + #define d_Crest_Portal 1 #define d_Crest_PortalNegativeVolume 1 #define d_Crest_PortalWithBackFace 1 @@ -292,35 +296,6 @@ Shader "Crest/Underwater" #pragma fragment Fragment ENDHLSL } - - Pass - { - PackageRequirements - { - "com.waveharmonic.crest.portals" - } - - Name "Fog After (Negative)" - - Cull Front - ZTest LEqual - - HLSLPROGRAM - #include_with_pragmas "UnderwaterHDRP.hlsl" - - #pragma multi_compile_local _ d_Crest_ComputeMask - - // Needs custom otherwise it will overwrite the fog before. - #define d_Crest_CustomColorTexture 1 - #define d_Crest_Portal 1 - #define d_Crest_Geometry 1 - #define d_Crest_FogBefore 1 - - #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl" - - #pragma fragment Fragment - ENDHLSL - } } SubShader @@ -492,6 +467,8 @@ Shader "Crest/Underwater" #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #define d_Crest_CustomColorTexture 1 + #define d_Crest_Portal 1 #define d_Crest_Geometry 1 #define d_Crest_FogBefore 1 @@ -549,6 +526,8 @@ Shader "Crest/Underwater" #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #define d_Crest_CustomColorTexture 1 + #define d_Crest_Portal 1 #define d_Crest_PortalNegativeVolume 1 #define d_Crest_PortalWithBackFace 1 @@ -557,37 +536,6 @@ Shader "Crest/Underwater" #pragma fragment Fragment ENDHLSL } - - Pass - { - PackageRequirements - { - "com.waveharmonic.crest.portals" - } - - Name "Fog After (Negative)" - - Cull Front - ZTest LEqual - - HLSLPROGRAM - #include_with_pragmas "UnderwaterURP.hlsl" - #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - #pragma multi_compile_local _ d_Crest_ComputeMask - - // Needs custom otherwise it will overwrite the fog before. - #define d_Crest_CustomColorTexture 1 - #define d_Crest_Portal 1 - #define d_Crest_Geometry 1 - #define d_Crest_FogBefore 1 - - #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl" - - #pragma fragment Fragment - ENDHLSL - } } SubShader @@ -741,6 +689,9 @@ Shader "Crest/Underwater" #pragma multi_compile_local _ d_Crest_ComputeMask + // For negative volumes. + #define d_Crest_CustomColorTexture 1 + #define d_Crest_Portal 1 #define d_Crest_Geometry 1 #define d_Crest_FogBefore 1 @@ -794,6 +745,8 @@ Shader "Crest/Underwater" HLSLPROGRAM #include_with_pragmas "UnderwaterBIRP.hlsl" + #define d_Crest_CustomColorTexture 1 + #define d_Crest_Portal 1 #define d_Crest_PortalNegativeVolume 1 #define d_Crest_PortalWithBackFace 1 @@ -802,35 +755,6 @@ Shader "Crest/Underwater" #pragma fragment Fragment ENDHLSL } - - Pass - { - PackageRequirements - { - "com.waveharmonic.crest.portals" - } - - Name "Fog After (Negative)" - - Cull Front - ZTest LEqual - - HLSLPROGRAM - #include_with_pragmas "UnderwaterBIRP.hlsl" - - #pragma multi_compile_local _ d_Crest_ComputeMask - - // Needs custom otherwise it will overwrite the fog before. - #define d_Crest_CustomColorTexture 1 - - #define d_Crest_Portal 1 - #define d_Crest_Geometry 1 - #define d_Crest_FogBefore 1 - #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/Underwater.hlsl" - - #pragma fragment Fragment - ENDHLSL - } } CustomEditor "WaveHarmonic.Crest.Editor.CustomShaderGUI" } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/UnderwaterShared.hlsl b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/UnderwaterShared.hlsl index 33cf4d619..f23a02f5e 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/UnderwaterShared.hlsl +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Volume/UnderwaterShared.hlsl @@ -5,7 +5,6 @@ #define CREST_UNDERWATER_EFFECT_SHARED_INCLUDED #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl" -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Constants.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl" @@ -14,9 +13,6 @@ #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl" #include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl" -#undef d_Crest_CausticsForceDistortion -#define d_Crest_CausticsForceDistortion 1 - #if d_Crest_Portal #include "Packages/com.waveharmonic.crest.portals/Runtime/Shaders/Library/Portals.hlsl" #endif @@ -203,9 +199,7 @@ half3 ApplyUnderwaterEffect const bool hasCaustics, const bool i_OutScatterScene, const bool i_ApplyLighting, - const half i_multiplier, - out half3 volumeOpacity, - out half3 volumeLight + const half i_multiplier ) { const bool isUnderwater = true; @@ -214,8 +208,8 @@ half3 ApplyUnderwaterEffect PrimaryLight(i_positionWS, lightColor, lightDirection); // Uniform effect calculated from camera position. - volumeLight = 0.0; - volumeOpacity = 1.0; + half3 volumeLight = 0.0; + half3 volumeOpacity = 1.0; { half3 absorption = _Crest_Absorption.xyz; half3 scattering = _Crest_Scattering.xyz; @@ -230,20 +224,19 @@ half3 ApplyUnderwaterEffect absorption *= _Crest_ExtinctionMultiplier; scattering *= _Crest_ExtinctionMultiplier; - const float4 displacement = Cascade::MakeAnimatedWaves(sliceIndex).Sample(_WorldSpaceCameraPos.xz); - const float waterLevel = g_Crest_WaterCenter.y + displacement.y + displacement.w; + const float waterLevel = g_Crest_WaterCenter.y + Cascade::MakeAnimatedWaves(sliceIndex).Sample(_WorldSpaceCameraPos.xz).w; half shadow = 1.0; -#if d_Crest_ShadowLod { +// #if CREST_SHADOWS_ON // Camera should be at center of LOD system so no need for blending (alpha, weights, etc). This might not be // the case if there is large horizontal displacement, but the _Crest_DataSliceOffset should help by setting a // large enough slice as minimum. half2 shadowSoftHard = Cascade::MakeShadow(sliceIndex).SampleShadow(_WorldSpaceCameraPos.xz); // Soft in red, hard in green. But hard not computed in HDRP. shadow = 1.0 - shadowSoftHard.x; +// #endif } -#endif half3 ambientLighting = AmbientLight(_Crest_AmbientLighting); @@ -296,7 +289,7 @@ half3 ApplyUnderwaterEffect const uint slice0 = PositionToSliceIndex(i_positionWS.xz, 0, g_Crest_WaterScale); -#if d_Crest_FlowLod +#ifdef CREST_FLOW_ON half2 flowData = Cascade::MakeFlow(slice0).SampleFlow(i_positionWS.xz); const Flow flow = Flow::Make(flowData, g_Crest_Time); blur = _Crest_CausticsMotionBlur; @@ -307,7 +300,7 @@ half3 ApplyUnderwaterEffect sceneColour *= Caustics ( -#if d_Crest_FlowLod +#ifdef CREST_FLOW_ON flow, #endif i_positionWS, diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTCompute.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTCompute.compute index 491acbefc..57124fd6c 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTCompute.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTCompute.compute @@ -3,8 +3,6 @@ // Inspired by https://github.com/speps/GX-EncinoWaves -#pragma exclude_renderers glcore gles3 - // First SIZE constant must match FFT_KERNEL_0_RESOLUTION in FFTCompute.cs #pragma kernel ComputeFFT SIZE=8 PASSES=3 CHANNEL=x TX=8 TY=1 FINAL=0 #pragma kernel ComputeFFT SIZE=8 PASSES=3 CHANNEL=y TX=1 TY=8 FINAL=1 @@ -24,13 +22,11 @@ // Must match CASCADE_COUNT in FFTCompute.cs #define CASCADE_COUNT 16 -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" - Texture2D _Crest_InputButterfly; #if !FINAL -RWTexture2DArray _Crest_Output1; -RWTexture2DArray _Crest_Output2; -RWTexture2DArray _Crest_Output3; +RWTexture2DArray _Crest_Output1; +RWTexture2DArray _Crest_Output2; +RWTexture2DArray _Crest_Output3; #else Texture2DArray _Crest_InputH; Texture2DArray _Crest_InputX; @@ -144,9 +140,9 @@ void ComputeFFT(const uint3 id : SV_DispatchThreadID) { const uint coord = id.CHANNEL; #if !FINAL - _Crest_IntermediatesH[coord] = conj(_Crest_Output1[id].xy); - _Crest_IntermediatesX[coord] = conj(_Crest_Output2[id].xy); - _Crest_IntermediatesZ[coord] = conj(_Crest_Output3[id].xy); + _Crest_IntermediatesH[coord] = conj(_Crest_Output1[id]); + _Crest_IntermediatesX[coord] = conj(_Crest_Output2[id]); + _Crest_IntermediatesZ[coord] = conj(_Crest_Output3[id]); #else _Crest_IntermediatesH[coord] = _Crest_InputH[id]; _Crest_IntermediatesX[coord] = _Crest_InputX[id]; @@ -168,9 +164,9 @@ void ComputeFFT(const uint3 id : SV_DispatchThreadID) const float2 resultZ = pingpong ? _Crest_IntermediatesZ[coord] : _Crest_ScratchZ[coord]; #if !FINAL - _Crest_Output1[id] = m_Float2FromFloat2(resultH); - _Crest_Output2[id] = m_Float2FromFloat2(resultX); - _Crest_Output3[id] = m_Float2FromFloat2(resultZ); + _Crest_Output1[id] = resultH; + _Crest_Output2[id] = resultX; + _Crest_Output3[id] = resultZ; #else const float sign = ((id.x + id.y) % 2) == 1 ? -1.0 : 1.0; const float3 res = float3(sign * resultX.x, sign * resultH.x, sign * resultZ.x); diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTSpectrum.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTSpectrum.compute index 5ac919c83..2857a4232 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTSpectrum.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/FFT/FFTSpectrum.compute @@ -3,8 +3,6 @@ // Inspired by https://github.com/speps/GX-EncinoWaves -#pragma exclude_renderers glcore gles3 - #pragma kernel SpectrumInitalize #pragma kernel SpectrumUpdate @@ -20,8 +18,6 @@ #define SPECTRUM_OCTAVE_COUNT 14.0 #define SPECTRUM_SMALLEST_WL_POW_2 -4.0 -#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl" - uint _Crest_Size; float _Crest_WindSpeed; float _Crest_Turbulence; @@ -224,9 +220,9 @@ float _Crest_Time; float _Crest_Chop; Texture2DArray _Crest_Init0; -RWTexture2DArray _Crest_ResultHeight; -RWTexture2DArray _Crest_ResultDisplaceX; -RWTexture2DArray _Crest_ResultDisplaceZ; +RWTexture2DArray _Crest_ResultHeight; +RWTexture2DArray _Crest_ResultDisplaceX; +RWTexture2DArray _Crest_ResultDisplaceZ; float2 cmul(float2 lhs, float2 rhs) { @@ -261,7 +257,7 @@ void SpectrumUpdate(uint3 id : SV_DispatchThreadID) const float4 h0 = _Crest_Init0[id]; const float2 h = cmul(h0.xy, fwd) + cmul(h0.zw, bkwd); - _Crest_ResultHeight[id] = m_Float2FromFloat2(h); - _Crest_ResultDisplaceX[id] = m_Float2FromFloat2((_Crest_Chop * float2(-h.y * k.x, h.x * k.x) / (kMag + 0.00001f))); - _Crest_ResultDisplaceZ[id] = m_Float2FromFloat2((_Crest_Chop * float2(-h.y * k.y, h.x * k.y) / (kMag + 0.00001f))); + _Crest_ResultHeight[id] = h; + _Crest_ResultDisplaceX[id] = _Crest_Chop * float2(-h.y * k.x, h.x * k.x) / (kMag + 0.00001f); + _Crest_ResultDisplaceZ[id] = _Crest_Chop * float2(-h.y * k.y, h.x * k.y) / (kMag + 0.00001f); } diff --git a/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/Gerstner/Gerstner.compute b/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/Gerstner/Gerstner.compute index 48e1c22c2..7c2f80f49 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/Gerstner/Gerstner.compute +++ b/Packages/com.waveharmonic.crest/Runtime/Shaders/Waves/Gerstner/Gerstner.compute @@ -3,8 +3,6 @@ // Computes a set of patches of waves, one for each scale. -#pragma exclude_renderers glcore gles3 - #pragma kernel Gerstner #include "HLSLSupport.cginc" diff --git a/Packages/com.waveharmonic.crest/Runtime/Textures/Foam (Packed).png b/Packages/com.waveharmonic.crest/Runtime/Textures/Foam (Packed).png deleted file mode 100644 index a3d65e0ff..000000000 Binary files a/Packages/com.waveharmonic.crest/Runtime/Textures/Foam (Packed).png and /dev/null differ diff --git a/Packages/com.waveharmonic.crest/Runtime/Textures/Foam (Packed).png.meta b/Packages/com.waveharmonic.crest/Runtime/Textures/Foam (Packed).png.meta deleted file mode 100644 index eb4872870..000000000 --- a/Packages/com.waveharmonic.crest/Runtime/Textures/Foam (Packed).png.meta +++ /dev/null @@ -1,153 +0,0 @@ -fileFormatVersion: 2 -guid: 959dd0505e2c54585865f51257daa0e3 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 13 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - flipGreenChannel: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMipmapLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 0 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - swizzle: 50462976 - cookieLightType: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Android - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iOS - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iPhone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - mipmapLimitGroupName: - pSDRemoveMatte: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png b/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png index b619b3215..452ab8aea 100644 Binary files a/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png and b/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png differ diff --git a/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png.meta b/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png.meta index b73b66d8d..75ef155a3 100644 --- a/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png.meta +++ b/Packages/com.waveharmonic.crest/Runtime/Textures/foam.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2bbb24aeb7e7f44f69d698df51b54fb6 +guid: 959dd0505e2c54585865f51257daa0e3 TextureImporter: internalIDToNameTable: [] externalObjects: {} @@ -7,7 +7,7 @@ TextureImporter: mipmaps: mipMapMode: 0 enableMipMap: 1 - sRGBTexture: 0 + sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 @@ -51,21 +51,21 @@ TextureImporter: spritePixelsToUnits: 100 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 0 + alphaUsage: 1 alphaIsTransparency: 0 spriteTessellationDetail: -1 - textureType: 10 + textureType: 0 textureShape: 1 - singleChannelComponent: 1 + singleChannelComponent: 0 flipbookRows: 1 flipbookColumns: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 - ignorePngGamma: 1 + ignorePngGamma: 0 applyGammaDecoding: 0 swizzle: 50462976 - cookieLightType: 0 + cookieLightType: 1 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform @@ -93,32 +93,6 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Android - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iOS - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - serializedVersion: 3 buildTarget: iPhone maxTextureSize: 2048 @@ -132,6 +106,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall.meta deleted file mode 100644 index 459aabd92..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1a05fa025372247f1befc557e1f48693 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data.meta deleted file mode 100644 index 94515beda..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8ba88e0268aa04a0f89a046f7fb5ff8a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data/Waterfall_Spectrum.asset b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data/Waterfall_Spectrum.asset deleted file mode 100644 index fdbf93234..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data/Waterfall_Spectrum.asset +++ /dev/null @@ -1,67 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 382a5d8b1147b4e78a31353c022b8e15, type: 3} - m_Name: Waterfall_Spectrum - m_EditorClassIdentifier: - _Version: 0 - _WaveDirectionVariance: 56.71233 - _GravityScale: 1 - _Multiplier: 3 - _PowerLogarithmicScales: - - -7.10794 - - -6.42794 - - -5.93794 - - -5.27794 - - -4.67794 - - -3.71794 - - -3.17794 - - -2.60794 - - -1.93794 - - -1.11794 - - -0.85794 - - -0.36794 - - 0.04206 - - -8 - _PowerDisabled: 0000000000000001010101010101 - _ChopScales: - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - _GravityScales: - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - _Chop: 2 - _ShowAdvancedControls: 0 - _Model: 0 diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data/Waterfall_Spectrum.asset.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data/Waterfall_Spectrum.asset.meta deleted file mode 100644 index 6f91c22ff..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Data/Waterfall_Spectrum.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7cb0688d6e33547ffbd4ca60c5957d87 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials.meta deleted file mode 100644 index 07409ffec..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 26a4ce3e4069c485c81799196a127a0f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Flow.mat b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Flow.mat deleted file mode 100644 index 28e927f25..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Flow.mat +++ /dev/null @@ -1,91 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Waterfall.Flow - m_Shader: {fileID: 4800000, guid: 5198aecab500144dbb5ee73bad91640a, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: - - d_ApplyRotation - - d_Feather - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: - - _Crest_Version: 0 - m_Floats: - - _BumpScale: 1 - - _Crest_ApplyRotation: 1 - - _Crest_Direction: 0.25 - - _Crest_Feather: 1 - - _Crest_FeatherWidth: 0.1 - - _Crest_Speed: 2 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _GlossMapScale: 1 - - _Glossiness: 0.5 - - _GlossyReflections: 1 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 1 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - m_BuildTextureStacks: [] diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Flow.mat.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Flow.mat.meta deleted file mode 100644 index 2a7600d4d..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Flow.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3bd63d41497594c9694eeadece2c77de -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Foam.mat b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Foam.mat deleted file mode 100644 index ae281d5ef..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Foam.mat +++ /dev/null @@ -1,94 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Waterfall.Foam - m_Shader: {fileID: 4800000, guid: 955fe6ade516e42e0ab0b0bbb116170a, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Crest_Texture: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: - - _Crest_Version: 0 - m_Floats: - - _BumpScale: 1 - - _Crest_ColorMask: 15 - - _Crest_Feather: 0 - - _Crest_FeatherWidth: 0.42 - - _Crest_Strength: 2.5 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _FoamValue: 1 - - _GlossMapScale: 1 - - _Glossiness: 0.5 - - _GlossyReflections: 1 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 1 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Crest_Value: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - m_BuildTextureStacks: [] diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Foam.mat.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Foam.mat.meta deleted file mode 100644 index 3a5187707..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Foam.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ae2ad1d19000449dd9d7a77cdd04e573 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Level.mat b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Level.mat deleted file mode 100644 index d564c587f..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Level.mat +++ /dev/null @@ -1,33 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Waterfall.Level - m_Shader: {fileID: 4800000, guid: 06402bee7075b4b9fafef2b1ddf3b5cc, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: [] - m_Ints: - - _Crest_Version: 0 - m_Floats: - - _Crest_BlendOperation: 4 - - _Crest_BlendSource: 1 - - _Crest_BlendTarget: 0 - m_Colors: [] - m_BuildTextureStacks: [] diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Level.mat.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Level.mat.meta deleted file mode 100644 index f32f475ee..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Level.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5a2a5694a99914b7a870b8a9e7ca9a10 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Waves.mat b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Waves.mat deleted file mode 100644 index a137cb821..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Waves.mat +++ /dev/null @@ -1,139 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &-8518889649984849879 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 7 ---- !u!21 &2100000 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Waterfall.Waves - m_Shader: {fileID: 4800000, guid: 95ec6475fc33247d4b80d07df23f2748, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: - - d_Feather - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BaseMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _SpecGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - unity_Lightmaps: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - unity_LightmapsInd: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - unity_ShadowMasks: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: - - _Crest_Version: 0 - m_Floats: - - _AlphaClip: 0 - - _AlphaToMask: 0 - - _Blend: 0 - - _BlendModePreserveSpecular: 1 - - _BumpScale: 1 - - _ClearCoatMask: 0 - - _ClearCoatSmoothness: 0 - - _Crest_BlendModeSource: 1 - - _Crest_BlendModeTarget: 1 - - _Crest_Feather: 1 - - _Crest_FeatherWaveStart: 2 - - _Crest_FeatherWidth: 0.25 - - _Cull: 2 - - _Cutoff: 0.5 - - _DetailAlbedoMapScale: 1 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _DstBlendAlpha: 0 - - _EnvironmentReflections: 1 - - _GlossMapScale: 0 - - _Glossiness: 0 - - _GlossyReflections: 0 - - _Metallic: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.005 - - _QueueOffset: 0 - - _ReceiveShadows: 1 - - _Smoothness: 0.5 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 1 - - _SrcBlend: 1 - - _SrcBlendAlpha: 1 - - _Surface: 0 - - _WorkflowMode: 1 - - _ZWrite: 1 - m_Colors: - - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - m_BuildTextureStacks: [] diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Waves.mat.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Waves.mat.meta deleted file mode 100644 index bf1d947f3..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall.Waves.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d34974f634c384c9fb22490642466521 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_DamFace.mat b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_DamFace.mat deleted file mode 100644 index d253eaeeb..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_DamFace.mat +++ /dev/null @@ -1,213 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &-3057876995197988825 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 0 ---- !u!21 &2100000 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Waterfall_DamFace - m_Shader: {fileID: -6465566751694194690, guid: 717b077102735454887bdc5c26938762, - type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: - - _DISABLE_SSR_TRANSPARENT - - _SPECULARHIGHLIGHTS_OFF - m_InvalidKeywords: [] - m_LightmapFlags: 2 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: 2000 - stringTagMap: - MotionVector: User - RenderType: Opaque - disabledShaderPasses: - - TransparentDepthPrepass - - TransparentDepthPostpass - - TransparentBackface - - RayTracingPrepass - - MOTIONVECTORS - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - unity_Lightmaps: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - unity_LightmapsInd: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - unity_ShadowMasks: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _AddPrecomputedVelocity: 0 - - _AlphaClip: 0 - - _AlphaCutoffEnable: 1 - - _AlphaDstBlend: 0 - - _AlphaSrcBlend: 1 - - _AlphaToMask: 0 - - _BUILTIN_AlphaClip: 0 - - _BUILTIN_Blend: 0 - - _BUILTIN_CullMode: 2 - - _BUILTIN_DstBlend: 0 - - _BUILTIN_QueueControl: 0 - - _BUILTIN_QueueOffset: 0 - - _BUILTIN_SrcBlend: 1 - - _BUILTIN_Surface: 0 - - _BUILTIN_ZTest: 4 - - _BUILTIN_ZWrite: 1 - - _BUILTIN_ZWriteControl: 0 - - _Blend: 0 - - _BlendMode: 0 - - _BlendModePreserveSpecular: 0 - - _BumpScale: 1 - - _CastShadows: 1 - - _ConservativeDepthOffsetEnable: 0 - - _Cull: 2 - - _CullMode: 2 - - _CullModeForward: 2 - - _Cutoff: 0.5 - - _DepthOffsetEnable: 0 - - _DetailAlbedoMapScale: 0 - - _DetailNormalMapScale: 1 - - _DoubleSidedEnable: 0 - - _DoubleSidedGIMode: 0 - - _DoubleSidedNormalMode: 2 - - _DstBlend: 0 - - _EnableBlendModePreserveSpecularLighting: 1 - - _EnableFogOnTransparent: 1 - - _ExcludeFromTUAndAA: 0 - - _Metallic: 0 - - _Normal_Flip_Back_Faces: 1 - - _OcclusionStrength: 1 - - _OpaqueCullMode: 2 - - _QueueControl: 1 - - _QueueOffset: 0 - - _RayTracing: 0 - - _ReceiveShadows: 1 - - _ReceivesSSR: 1 - - _ReceivesSSRTransparent: 0 - - _RefractionModel: 0 - - _RenderQueueType: 1 - - _RequireSplitLighting: 0 - - _SPECULARHIGHLIGHTS_OFF: 1 - - _Smoothness: 0.5 - - _SmoothnessTextureChannel: 0 - - _SrcBlend: 1 - - _StencilRef: 0 - - _StencilRefDepth: 8 - - _StencilRefDistortionVec: 4 - - _StencilRefGBuffer: 10 - - _StencilRefMV: 40 - - _StencilWriteMask: 6 - - _StencilWriteMaskDepth: 9 - - _StencilWriteMaskDistortionVec: 4 - - _StencilWriteMaskGBuffer: 15 - - _StencilWriteMaskMV: 41 - - _SupportDecals: 1 - - _Surface: 0 - - _SurfaceType: 0 - - _TransparentBackfaceEnable: 0 - - _TransparentCullMode: 2 - - _TransparentDepthPostpassEnable: 0 - - _TransparentDepthPrepassEnable: 0 - - _TransparentSortPriority: 0 - - _TransparentWritingMotionVec: 0 - - _TransparentZWrite: 0 - - _UseShadowThreshold: 0 - - _Water_Volume_Multiplier: 1 - - _WorkflowMode: 1 - - _ZTest: 4 - - _ZTestDepthEqualForOpaque: 3 - - _ZTestGBuffer: 3 - - _ZTestTransparent: 4 - - _ZWrite: 1 - - _ZWriteControl: 0 - m_Colors: - - _Color: {r: 0.32599998, g: 0.32599998, b: 0.32599998, a: 1} - - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} - - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} - - _EmissiveColor: {r: 0, g: 0, b: 0, a: 0} - - _SpecularColor: {r: 0, g: 0, b: 0, a: 0} - m_BuildTextureStacks: [] ---- !u!114 &3917630386427683899 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 13 - hdPluginSubTargetMaterialVersions: - m_Keys: [] - m_Values: ---- !u!114 &6014071897694565224 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 7 diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_DamFace.mat.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_DamFace.mat.meta deleted file mode 100644 index e6e085cdd..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_DamFace.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d35bb2f2962984017b2cb349ab2bd86e -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_Water.mat b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_Water.mat deleted file mode 100644 index 7dffbe457..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_Water.mat +++ /dev/null @@ -1,105 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &-5994654682710206810 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 13 - hdPluginSubTargetMaterialVersions: - m_Keys: [] - m_Values: ---- !u!114 &-4042563326011365698 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 7 ---- !u!21 &2100000 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Waterfall_Water - m_Shader: {fileID: -6465566751694194690, guid: 00ffe7d0b7161420897069dc6e12822c, - type: 3} - m_Parent: {fileID: -876546973899608171, guid: 00ffe7d0b7161420897069dc6e12822c, - type: 3} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: - - _ALPHATEST_ON - - _BUILTIN_ALPHATEST_ON - - _BUILTIN_AlphaClip - - _BUILTIN_SURFACE_TYPE_TRANSPARENT - - _BUILTIN_TRANSPARENT_RECEIVES_SHADOWS - - _CREST_FLOW_LOD - - _DOUBLESIDED_ON - - _ENABLE_FOG_ON_TRANSPARENT - - _SPECULAR_SETUP - - _SURFACE_TYPE_TRANSPARENT - - _TRANSPARENT_WRITES_MOTION_VEC - m_InvalidKeywords: [] - m_LightmapFlags: 2 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 1 - m_CustomRenderQueue: 3000 - stringTagMap: - MotionVector: User - RenderType: Transparent - disabledShaderPasses: - - TransparentDepthPostpass - - TransparentBackface - - RayTracingPrepass - - MOTIONVECTORS - - SHADOWCASTER - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: [] - m_Ints: [] - m_Floats: - - _AlphaDstBlend: 10 - - _BUILTIN_DstBlend: 10 - - _BUILTIN_QueueControl: 0 - - _BUILTIN_SrcBlend: 5 - - _BUILTIN_ZWrite: 1 - - _CREST_FLOW_LOD: 1 - - _CullMode: 0 - - _CullModeForward: 0 - - _DstBlend: 10 - - _QueueControl: 0 - - _RefractionModel: 0 - - _SrcBlend: 5 - - _ZTestGBuffer: 3 - m_Colors: - - _DoubleSidedConstants: {r: 1, g: 1, b: 1, a: 0} - m_BuildTextureStacks: [] ---- !u!114 &4748330692745026848 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 0 diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_Water.mat.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_Water.mat.meta deleted file mode 100644 index b59732ae2..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Materials/Waterfall_Water.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1bfb69197fce146549f77147aa8abf64 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs.meta deleted file mode 100644 index 3fc2b5519..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c31f5143c4ab34eaf92c4337e74f25f5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall.prefab b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall.prefab deleted file mode 100644 index 50d59756b..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall.prefab +++ /dev/null @@ -1,622 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &430583269639052101 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1365260983945568687} - - component: {fileID: 8691393138181591487} - m_Layer: 0 - m_Name: Waterfall - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1365260983945568687 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 430583269639052101} - 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: - - {fileID: 670501250478138977} - - {fileID: 438596788235388687} - - {fileID: 136319280512927771} - - {fileID: 7276616196977082695} - - {fileID: 3028779372333677402} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &8691393138181591487 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 430583269639052101} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d6cefaddfdcb9420abe40ac27e03cd4d, type: 3} - m_Name: - m_EditorClassIdentifier: - _Version: 0 - _Crest: {fileID: 136319280512927771} - _CrestRadius: 1 - _Face: {fileID: 7276616196977082695} - _FaceAngle: 5 - _Waves: {fileID: 3028779372333677402} - _PlungePool: {fileID: 0} - _Foam: {fileID: 438596788235388687} - _FoamOffset: -0.5 - _FoamPadding: 0 - _Flow: {fileID: 670501250478138977} - _FlowPadding: 10 ---- !u!1 &927192355878342099 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 136319280512927771} - - component: {fileID: 3405966749773726744} - - component: {fileID: 4477874448197848730} - - component: {fileID: 191777397795315479} - m_Layer: 0 - m_Name: Crest - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &136319280512927771 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 927192355878342099} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068} - m_LocalPosition: {x: 0, y: -1, z: 0} - m_LocalScale: {x: 2, y: 5, z: 2} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1365260983945568687} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} ---- !u!33 &3405966749773726744 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 927192355878342099} - m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &4477874448197848730 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 927192355878342099} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 5a2a5694a99914b7a870b8a9e7ca9a10, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &191777397795315479 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 927192355878342099} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a4edd034314af4679ba066d79580dc1d, type: 3} - m_Name: - m_EditorClassIdentifier: - _Mode: 3 - _Weight: 1 - _Queue: 20 - _Blend: 0 - _FeatherWidth: 0.1 - _FollowHorizontalWaveMotion: 1 - _Data: - rid: 2117146443697881088 - _DrawBounds: 0 - _OverrideHeight: 0 - _HeightRange: {x: -100, y: 100} - _Version: 1 - references: - version: 2 - RefIds: - - rid: 2117146443697881088 - type: {class: LevelRendererLodInputData, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Input: {fileID: 191777397795315479} - _Renderer: {fileID: 4477874448197848730} - _DisableRenderer: 1 - _OverrideShaderPass: 0 - _ShaderPassIndex: 0 - _CheckShaderName: 1 - _CheckShaderPasses: 1 ---- !u!1 &1076978445207944872 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3028779372333677402} - - component: {fileID: 2379726923234061809} - - component: {fileID: 2899061627673433862} - - component: {fileID: 5876181749474261199} - m_Layer: 0 - m_Name: Waves - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &3028779372333677402 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1076978445207944872} - serializedVersion: 2 - m_LocalRotation: {x: 0.5, y: 0.5, z: -0.5, w: 0.5} - m_LocalPosition: {x: 0, y: -5, z: 3.8499546} - m_LocalScale: {x: 10, y: 10, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1365260983945568687} - m_LocalEulerAnglesHint: {x: 90, y: 90, z: 0} ---- !u!33 &2379726923234061809 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1076978445207944872} - m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &2899061627673433862 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1076978445207944872} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: d34974f634c384c9fb22490642466521, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &5876181749474261199 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1076978445207944872} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 002f2642204d348f3a2fab18595c44cd, type: 3} - m_Name: - m_EditorClassIdentifier: - _Mode: 3 - _Weight: 1 - _Queue: 0 - _Blend: 1 - _FeatherWidth: 0.1 - _FollowHorizontalWaveMotion: 1 - _Data: - rid: 1613819547554152512 - _DrawBounds: 0 - _Spectrum: {fileID: 11400000, guid: 7cb0688d6e33547ffbd4ca60c5957d87, type: 2} - _EvaluateSpectrumAtRunTimeEveryFrame: 0 - _RespectShallowWaterAttenuation: 1 - _SeaLevelOnly: 0 - _OverrideGlobalWindDirection: 1 - _WaveDirectionHeadingAngle: 137.27078 - _OverrideGlobalWindSpeed: 1 - _WindSpeed: 150 - _Resolution: 128 - _IncludeInDropDetailHeightBasedOnWaves: 0 - _DrawSlicesInEditor: 0 - _AlphaSource: 0 - _Swell: 1 - _ReverseWaveWeight: 0.5 - _ComponentsPerOctave: 8 - _RandomSeed: 0 - _ManualGeneration: 0 - _Version: 3 - references: - version: 2 - RefIds: - - rid: 1613819547554152512 - type: {class: ShapeWavesRendererLodInputData, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Input: {fileID: 5876181749474261199} - _Renderer: {fileID: 2899061627673433862} - _DisableRenderer: 1 - _OverrideShaderPass: 0 - _ShaderPassIndex: 0 - _CheckShaderName: 1 - _CheckShaderPasses: 1 ---- !u!1 &6492310282501239527 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7276616196977082695} - - component: {fileID: 5993156162723736142} - m_Layer: 0 - m_Name: Face - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7276616196977082695 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6492310282501239527} - serializedVersion: 2 - m_LocalRotation: {x: 0.6755902, y: 3.9348448e-11, z: -3.6056363e-11, w: 0.7372774} - m_LocalPosition: {x: 0, y: -3, z: 1.1749773} - m_LocalScale: {x: 1, y: 1, z: 0.40152794} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1365260983945568687} - m_LocalEulerAnglesHint: {x: 85, y: 0, z: 0} ---- !u!114 &5993156162723736142 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6492310282501239527} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a4edd034314af4679ba066d79580dc1d, type: 3} - m_Name: - m_EditorClassIdentifier: - _Mode: 7 - _Weight: 1 - _Queue: 10 - _Blend: 3 - _FeatherWidth: 0.1 - _FollowHorizontalWaveMotion: 1 - _Data: - rid: 2117146427251490818 - _DrawBounds: 0 - _OverrideHeight: 0 - _HeightRange: {x: -100, y: 100} - _Version: 1 - references: - version: 2 - RefIds: - - rid: 2117146427251490818 - type: {class: LevelGeometryLodInputData, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Input: {fileID: 5993156162723736142} - _Geometry: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &7958292229098436895 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 670501250478138977} - - component: {fileID: 6549144807931631555} - - component: {fileID: 8838000136446182423} - - component: {fileID: 3620820364525833372} - m_Layer: 0 - m_Name: Flow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &670501250478138977 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7958292229098436895} - serializedVersion: 2 - m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: -10, z: 0.6749773} - m_LocalScale: {x: 11, y: 11.349955, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1365260983945568687} - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!33 &6549144807931631555 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7958292229098436895} - m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &8838000136446182423 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7958292229098436895} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 3bd63d41497594c9694eeadece2c77de, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &3620820364525833372 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7958292229098436895} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a0cdc7659b2c244dbbb625ccd8ae65ae, type: 3} - m_Name: - m_EditorClassIdentifier: - _Mode: 3 - _Weight: 1 - _Queue: 0 - _Blend: 1 - _FeatherWidth: 0.1 - _FollowHorizontalWaveMotion: 0 - _Data: - rid: 2117146424074305538 - _DrawBounds: 0 - _Version: 0 - references: - version: 2 - RefIds: - - rid: 2117146424074305538 - type: {class: FlowRendererLodInputData, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Input: {fileID: 3620820364525833372} - _Renderer: {fileID: 8838000136446182423} - _DisableRenderer: 1 - _OverrideShaderPass: 0 - _ShaderPassIndex: 0 - _CheckShaderName: 1 - _CheckShaderPasses: 1 ---- !u!1 &8719883926298806077 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 438596788235388687} - - component: {fileID: 7026826943783500482} - - component: {fileID: 2148735341880686178} - - component: {fileID: 1443687986539177302} - m_Layer: 0 - m_Name: Foam - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &438596788235388687 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8719883926298806077} - serializedVersion: 2 - m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: -10, z: 0.1749773} - m_LocalScale: {x: 10, y: 1.3499546, z: 2.7873979} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1365260983945568687} - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!33 &7026826943783500482 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8719883926298806077} - m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &2148735341880686178 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8719883926298806077} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: ae2ad1d19000449dd9d7a77cdd04e573, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &1443687986539177302 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8719883926298806077} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 67bc7f0b9724d44ab9f0ddf0b1b5a773, type: 3} - m_Name: - m_EditorClassIdentifier: - _Mode: 3 - _Weight: 1 - _Queue: 0 - _Blend: 1 - _FeatherWidth: 0 - _FollowHorizontalWaveMotion: 0 - _Data: - rid: 1613819574912811009 - _DrawBounds: 0 - _Version: 0 - references: - version: 2 - RefIds: - - rid: 1613819574912811009 - type: {class: FoamRendererLodInputData, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Input: {fileID: 1443687986539177302} - _Renderer: {fileID: 2148735341880686178} - _DisableRenderer: 1 - _OverrideShaderPass: 0 - _ShaderPassIndex: 0 - _CheckShaderName: 1 - _CheckShaderPasses: 1 diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall.prefab.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall.prefab.meta deleted file mode 100644 index 18eb255eb..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c0171fd4367dc4f46892f2ac19a32f7b -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall_Scene.prefab b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall_Scene.prefab deleted file mode 100644 index 3979434a3..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall_Scene.prefab +++ /dev/null @@ -1,1663 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &248080860883671658 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7793347724800820925} - m_Layer: 0 - m_Name: Camera - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7793347724800820925 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 248080860883671658} - 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: - - {fileID: 4816728919069153276} - - {fileID: 6912237214384677096} - m_Father: {fileID: 5671401972438653350} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2399428086997768560 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2456457704648770694} - - component: {fileID: 4146528549483536551} - - component: {fileID: 57695271167665568} - - component: {fileID: 9056551314058705957} - m_Layer: 0 - m_Name: Wall - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2456457704648770694 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399428086997768560} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 2, z: -10} - m_LocalScale: {x: 11, y: 7, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 349154442357681413} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &4146528549483536551 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399428086997768560} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &57695271167665568 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399428086997768560} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: -876546973899608171, guid: 717b077102735454887bdc5c26938762, type: 3} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &9056551314058705957 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399428086997768560} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!1 &2930984078620855332 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7428102670690890087} - - component: {fileID: 4492633328209446262} - m_Layer: 0 - m_Name: WaterLevel - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7428102670690890087 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2930984078620855332} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -5} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 490387838688371579} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &4492633328209446262 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2930984078620855332} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a4edd034314af4679ba066d79580dc1d, type: 3} - m_Name: - m_EditorClassIdentifier: - _Mode: 7 - _Weight: 1 - _Queue: 0 - _Blend: 0 - _FeatherWidth: 0.1 - _FollowHorizontalWaveMotion: 1 - _Data: - rid: 1613819574912811026 - _DrawBounds: 0 - _OverrideHeight: 0 - _HeightRange: {x: -100, y: 100} - _Version: 1 - references: - version: 2 - RefIds: - - rid: 1613819574912811026 - type: {class: LevelGeometryLodInputData, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Input: {fileID: 4492633328209446262} - _Geometry: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &3446019678015784530 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2346690168056780806} - m_Layer: 0 - m_Name: Lighting - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2346690168056780806 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3446019678015784530} - 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: - - {fileID: 8787568180410600781} - - {fileID: 6767765651116522165} - - {fileID: 1256385251891781115} - m_Father: {fileID: 5671401972438653350} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &4582534698458250225 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1616544984971310765} - - component: {fileID: 2610903512259126124} - - component: {fileID: 2990156243455062750} - - component: {fileID: 3501766363199954312} - m_Layer: 0 - m_Name: Crest - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1616544984971310765 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4582534698458250225} - serializedVersion: 2 - m_LocalRotation: {x: 0.5, y: -0.5, z: 0.5, w: 0.5} - m_LocalPosition: {x: 0, y: 4.4, z: 0} - m_LocalScale: {x: 1, y: 5, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 349154442357681413} - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!33 &2610903512259126124 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4582534698458250225} - m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &2990156243455062750 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4582534698458250225} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: d35bb2f2962984017b2cb349ab2bd86e, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!136 &3501766363199954312 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4582534698458250225} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5000001 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} ---- !u!1 &5385431007998953166 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 349154442357681413} - m_Layer: 0 - m_Name: Structure - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &349154442357681413 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5385431007998953166} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: -5, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 2456457704648770694} - - {fileID: 1888213936239472165} - - {fileID: 4905456147386615111} - - {fileID: 4862380508630828140} - - {fileID: 1616544984971310765} - m_Father: {fileID: 490387838688371579} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &6267012682398370174 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4905456147386615111} - - component: {fileID: 2874364266687251561} - - component: {fileID: 1711793888068627130} - - component: {fileID: 8827357169186167462} - m_Layer: 0 - m_Name: Wall - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4905456147386615111 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6267012682398370174} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -5, y: 2, z: -4} - m_LocalScale: {x: 1, y: 7, z: 12} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 349154442357681413} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &2874364266687251561 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6267012682398370174} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &1711793888068627130 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6267012682398370174} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: -876546973899608171, guid: 717b077102735454887bdc5c26938762, type: 3} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &8827357169186167462 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6267012682398370174} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!1 &6590818618340500086 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1888213936239472165} - - component: {fileID: 4664721191141803398} - - component: {fileID: 6842693015101764406} - - component: {fileID: 3164294158888826507} - m_Layer: 0 - m_Name: Wall - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1888213936239472165 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6590818618340500086} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 5, y: 2, z: -4} - m_LocalScale: {x: 1, y: 7, z: 12} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 349154442357681413} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &4664721191141803398 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6590818618340500086} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &6842693015101764406 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6590818618340500086} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: -876546973899608171, guid: 717b077102735454887bdc5c26938762, type: 3} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &3164294158888826507 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6590818618340500086} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!1 &7415801413193746998 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 490387838688371579} - m_Layer: 0 - m_Name: Sample - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &490387838688371579 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7415801413193746998} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 5, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 7428102670690890087} - - {fileID: 349154442357681413} - - {fileID: 999940253967726138} - m_Father: {fileID: 5671401972438653350} - m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} ---- !u!1 &7860836644916374629 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4862380508630828140} - - component: {fileID: 6058287255120096458} - - component: {fileID: 1905903139993718216} - - component: {fileID: 2133705125501230340} - m_Layer: 0 - m_Name: Face - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4862380508630828140 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7860836644916374629} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0.9, z: 0} - m_LocalScale: {x: 10, y: 7, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 349154442357681413} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &6058287255120096458 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7860836644916374629} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &1905903139993718216 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7860836644916374629} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: d35bb2f2962984017b2cb349ab2bd86e, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &2133705125501230340 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7860836644916374629} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!1 &8076532871235354634 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2655492681883575407} - - component: {fileID: 812457817446371558} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2655492681883575407 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8076532871235354634} - 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: 5671401972438653350} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &812457817446371558 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8076532871235354634} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e64c239f69eea46778ded6dcc3427a34, type: 3} - m_Name: - m_EditorClassIdentifier: - _Layer: 4 - _Material: {fileID: 2100000, guid: 1bfb69197fce146549f77147aa8abf64, type: 2} - _VolumeMaterial: {fileID: 0} - _ChunkTemplate: {fileID: 1516456258233481520, guid: 17840562212c147d6bdb5144d35bc442, - type: 3} - _CastShadows: 0 - _WaterBodyCulling: 1 - _TimeSliceBoundsUpdateFrameCount: 1 - _SurfaceSelfIntersectionFixMode: 4 - _AllowRenderQueueSorting: 0 - _Version: 2 - _Camera: {fileID: 0} - _TimeProvider: {fileID: 0} - _WindZone: {fileID: 0} - _OverrideWindZoneWindSpeed: 0 - _WindSpeed: 10 - _OverrideWindZoneWindDirection: 0 - _WindDirection: 0 - _OverrideWindZoneWindTurbulence: 0 - _WindTurbulence: 0.145 - _OverrideGravity: 0 - _GravityOverride: -9.8 - _GravityMultiplier: 1 - _PrimaryLight: {fileID: 0} - _InjectionPoint: 0 - _WriteToColorTexture: 1 - _WriteToDepthTexture: 1 - _WriteMotionVectors: 1 - _OverrideRenderHDR: 0 - _RenderHDR: 1 - _Surface: - rid: 4199187345983668402 - _ScaleRange: {x: 4, y: 256} - _DropDetailHeightBasedOnWaves: 0.2 - _Slices: 7 - _Resolution: 384 - _GeometryDownSampleFactor: 2 - _ExtentsSizeMultiplier: 100 - _MultipleViewpoints: 0 - _Viewpoint: {fileID: 0} - _CameraExclusions: -1 - _DataBackgroundMode: 3 - _CenterOfDetailDisplacementCorrection: 1 - _SampleTerrainHeightForScale: 1 - _ForceScaleChangeSmoothing: 0 - _TeleportThreshold: 10 - _AnimatedWavesLod: - rid: 7357419506351996928 - _DepthLod: - rid: 7357419506351996929 - _LevelLod: - rid: 7357419506351996930 - _FoamLod: - rid: 7357419506351996931 - _DynamicWavesLod: - rid: 7357419506351996932 - _FlowLod: - rid: 7357419506351996933 - _ShadowLod: - rid: 7357419506351996934 - _AbsorptionLod: - rid: 7357419506351996935 - _ScatteringLod: - rid: 7357419506351996936 - _ClipLod: - rid: 7357419506351996937 - _AlbedoLod: - rid: 7357419506351996938 - _Reflections: - rid: 7357419506351996939 - _Underwater: - rid: 7357419506351996940 - _Meniscus: - rid: 9040549687677943937 - _Portals: - rid: 7357419506351996941 - _ShowWaterProxyPlane: 0 - _FollowSceneCamera: 1 - _EditorMultipleViewpoints: 1 - _HeightQueries: 1 - _Debug: - _SimulatePaused: 0 - _AttachDebugGUI: 0 - _ShowHiddenObjects: 0 - _DisableFollowViewpoint: 0 - _DestroyResourcesInOnDisable: 0 - _DrawLodOutline: 0 - _ShowDebugInformation: 0 - _LogScaleChange: 0 - _PauseOnScaleChange: 0 - _IgnoreWavesForScaleChange: 0 - _OverrideScale: 0 - _ScaleOverride: 1 - _ForceNoGraphics: 0 - _Resources: {fileID: 11400000, guid: 0817af17dea584e5382e6216db162d4a, type: 2} - references: - version: 2 - RefIds: - - rid: 4199187345983668402 - type: {class: SurfaceRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Version: 0 - _Enabled: 1 - _MeshType: 0 - _Layer: 4 - _Material: {fileID: 2100000, guid: 1bfb69197fce146549f77147aa8abf64, 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: - _UniformTiles: 0 - _DisableSkirt: 0 - - rid: 7357419506351996928 - type: {class: AnimatedWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _OverrideResolution: 0 - _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 - - rid: 7357419506351996929 - type: {class: DepthLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _OverrideResolution: 1 - _Resolution: 256 - _TextureFormatMode: 100 - _TextureFormat: 46 - _Blur: 0 - _BlurIterations: 1 - _QuerySource: 1 - _MaximumQueryCount: 512 - _IncludeTerrainHeight: 0 - _EnableSignedDistanceFields: 1 - - rid: 7357419506351996930 - type: {class: LevelLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _OverrideResolution: 0 - _Resolution: 256 - _TextureFormatMode: 300 - _TextureFormat: 45 - _Blur: 0 - _BlurIterations: 4 - - rid: 7357419506351996931 - type: {class: FoamLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _OverrideResolution: 1 - _Resolution: 256 - _TextureFormatMode: 100 - _TextureFormat: 45 - _Blur: 0 - _BlurIterations: 1 - _SimulationFrequency: 30 - _Prewarm: 1 - _Settings: {fileID: 0} - - rid: 7357419506351996932 - type: {class: DynamicWavesLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 0 - _OverrideResolution: 0 - _Resolution: 512 - _TextureFormatMode: 300 - _TextureFormat: 46 - _Blur: 0 - _BlurIterations: 1 - _SimulationFrequency: 60 - _AttenuationInShallows: 1 - _Settings: {fileID: 0} - - rid: 7357419506351996933 - type: {class: FlowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _OverrideResolution: 1 - _Resolution: 128 - _TextureFormatMode: 100 - _TextureFormat: 46 - _Blur: 0 - _BlurIterations: 1 - _QuerySource: 1 - _MaximumQueryCount: 1024 - - rid: 7357419506351996934 - type: {class: ShadowLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _OverrideResolution: 1 - _Resolution: 256 - _TextureFormatMode: 100 - _TextureFormat: 6 - _Blur: 1 - _BlurIterations: 1 - _SimulationFrequency: 60 - _DynamicSoftShadows: 1 - _SoftJitterExtinctionFactor: 0.75 - _JitterDiameterSoft: 15 - _CurrentFrameWeightSoft: 0.03 - _JitterDiameterHard: 0.6 - _CurrentFrameWeightHard: 0.15 - _AllowNullLight: 0 - _AllowNoShadows: 0 - - rid: 7357419506351996935 - type: {class: AbsorptionLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 0 - _OverrideResolution: 1 - _Resolution: 256 - _TextureFormatMode: 200 - _TextureFormat: 23 - _Blur: 0 - _BlurIterations: 1 - _ShorelineColorSource: 0 - _ShorelineColor: {r: 0.513, g: 1, b: 1, a: 0.153} - _ShorelineColorMaximumDistance: 10 - _ShorelineColorFalloff: 2 - - rid: 7357419506351996936 - type: {class: ScatteringLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 0 - _OverrideResolution: 1 - _Resolution: 256 - _TextureFormatMode: 200 - _TextureFormat: 23 - _Blur: 0 - _BlurIterations: 1 - _ShorelineColorSource: 0 - _ShorelineColor: {r: 0, g: 0.588, b: 1, a: 1} - _ShorelineColorMaximumDistance: 10 - _ShorelineColorFalloff: 2 - - rid: 7357419506351996937 - type: {class: ClipLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 0 - _OverrideResolution: 1 - _Resolution: 256 - _TextureFormatMode: 100 - _TextureFormat: 5 - _Blur: 0 - _BlurIterations: 1 - _DefaultClippingState: 0 - - rid: 7357419506351996938 - type: {class: AlbedoLod, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 0 - _OverrideResolution: 1 - _Resolution: 768 - _TextureFormatMode: 100 - _TextureFormat: 8 - _Blur: 0 - _BlurIterations: 1 - - rid: 7357419506351996939 - type: {class: WaterReflections, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Version: 0 - _Enabled: 0 - _Mode: 1 - _Layers: - serializedVersion: 2 - m_Bits: 1 - _Resolution: 256 - _Overscan: 1.5 - _RenderOnlySingleCamera: 0 - _Sky: 1 - _DisablePixelLights: 1 - _DisableShadows: 1 - _HDR: 1 - _Stencil: 0 - _QualitySettingsOverride: - _OverrideLodBias: 0 - _LodBias: 0.5 - _OverrideMaximumLodLevel: 0 - _MaximumLodLevel: 1 - _OverrideTerrainPixelError: 0 - _TerrainPixelError: 10 - _ClipPlaneOffset: 0 - _FarClipPlane: 1000 - _DisableOcclusionCulling: 1 - _RefreshPerFrames: 1 - _FrameRefreshOffset: 0 - _UseObliqueMatrix: 1 - _NonObliqueNearSurface: 0 - _NonObliqueNearSurfaceThreshold: 0.05 - _Debug: - _ShowHiddenObjects: 0 - _DisableRecursiveRendering: 0 - _ForceCompatibility: 0 - _AllowMSAA: 0 - - rid: 7357419506351996940 - type: {class: UnderwaterRenderer, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _Layer: 4 - _Material: {fileID: 2100000, guid: f2b096e4d95e646c49d48ece0afa0547, type: 2} - _EnvironmentalLightingEnable: 0 - _EnvironmentalLightingWeight: 1 - _EnvironmentalLightingVolumeProfile: {fileID: 0} - _CameraExclusions: 6 - _CopyWaterMaterialParametersEachFrame: 1 - _FarPlaneMultiplier: 0.68 - _CullLimit: 0.001 - _Debug: - _VisualizeMask: 0 - _DisableMask: 0 - _VisualizeStencil: 0 - _DisableHeightAboveWaterOptimization: 0 - _DisableArtifactCorrection: 0 - _OnlyReflectionCameras: 0 - _Version: 0 - _AllCameras: 0 - - rid: 7357419506351996941 - type: {class: PortalRenderer, ns: WaveHarmonic.Crest.Portals, asm: WaveHarmonic.Crest} - data: - _Enabled: 0 - _Mode: 2 - _Geometry: {fileID: 0} - _Invert: 0 - - rid: 9040549687677943937 - type: {class: Meniscus, ns: WaveHarmonic.Crest, asm: WaveHarmonic.Crest} - data: - _Enabled: 1 - _Layer: 4 - _Material: {fileID: 2100000, guid: 238e45299a5ec46308e9bf99ddf67963, type: 2} - _CameraExclusions: 6 ---- !u!1 &8690342836163527637 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5671401972438653350} - m_Layer: 0 - m_Name: Waterfall_Scene - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &5671401972438653350 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8690342836163527637} - 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: - - {fileID: 7793347724800820925} - - {fileID: 2346690168056780806} - - {fileID: 2655492681883575407} - - {fileID: 490387838688371579} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &1031716473681042863 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 2346690168056780806} - m_Modifications: - - target: {fileID: 963553959586484309, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_Name - value: Lighting - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: bece9afbf3ddd49059dd73ba2cc986f6, type: 3} ---- !u!4 &6767765651116522165 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 6033288213199496986, guid: bece9afbf3ddd49059dd73ba2cc986f6, - type: 3} - m_PrefabInstance: {fileID: 1031716473681042863} - m_PrefabAsset: {fileID: 0} ---- !u!1001 &1073924661208916543 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 2346690168056780806} - m_Modifications: - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2942909709672342223, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - propertyPath: m_Name - value: Atmosphere - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 63a4b7e65d06948649ac3e10077d8c2e, type: 3} ---- !u!4 &1256385251891781115 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 2272289698115174340, guid: 63a4b7e65d06948649ac3e10077d8c2e, - type: 3} - m_PrefabInstance: {fileID: 1073924661208916543} - m_PrefabAsset: {fileID: 0} ---- !u!1001 &2239100442969282453 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 490387838688371579} - m_Modifications: - - target: {fileID: 430583269639052101, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_Name - value: Waterfall - objectReference: {fileID: 0} - - target: {fileID: 438596788235388687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalScale.y - value: 1.3499546 - objectReference: {fileID: 0} - - target: {fileID: 438596788235388687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 438596788235388687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.z - value: 0.1749773 - objectReference: {fileID: 0} - - target: {fileID: 670501250478138977, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalScale.y - value: 11.349955 - objectReference: {fileID: 0} - - target: {fileID: 670501250478138977, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.z - value: 0.6749773 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3028779372333677402, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.y - value: -5 - objectReference: {fileID: 0} - - target: {fileID: 3028779372333677402, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.z - value: 3.8499546 - objectReference: {fileID: 0} - - target: {fileID: 7276616196977082695, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalScale.z - value: 0.40152794 - objectReference: {fileID: 0} - - target: {fileID: 7276616196977082695, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.y - value: -3 - objectReference: {fileID: 0} - - target: {fileID: 7276616196977082695, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - propertyPath: m_LocalPosition.z - value: 1.1749773 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c0171fd4367dc4f46892f2ac19a32f7b, type: 3} ---- !u!4 &999940253967726138 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 1365260983945568687, guid: c0171fd4367dc4f46892f2ac19a32f7b, - type: 3} - m_PrefabInstance: {fileID: 2239100442969282453} - m_PrefabAsset: {fileID: 0} ---- !u!1001 &2520293337757733031 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 7793347724800820925} - m_Modifications: - - target: {fileID: 6079220456006713144, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_Name - value: PostProcessing - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 5e01cffb9e8324147affb8e08fd5ed13, type: 3} ---- !u!4 &6912237214384677096 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 9013060131419009103, guid: 5e01cffb9e8324147affb8e08fd5ed13, - type: 3} - m_PrefabInstance: {fileID: 2520293337757733031} - m_PrefabAsset: {fileID: 0} ---- !u!1001 &6976531039911863856 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 7793347724800820925} - m_Modifications: - - target: {fileID: 2452750316707852747, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_Name - value: Camera - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalPosition.x - value: 6.195094 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalPosition.y - value: 10.186275 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalPosition.z - value: 8.432072 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalRotation.w - value: -0.36942175 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalRotation.x - value: -0.11581722 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalRotation.y - value: 0.8797928 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalRotation.z - value: -0.27582338 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c26fe2b4fef6c484089497b549dd6b04, type: 3} ---- !u!4 &4816728919069153276 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 2452750316707852748, guid: c26fe2b4fef6c484089497b549dd6b04, - type: 3} - m_PrefabInstance: {fileID: 6976531039911863856} - m_PrefabAsset: {fileID: 0} ---- !u!1001 &7681117619760331714 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 2346690168056780806} - m_Modifications: - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalRotation.w - value: 0.69087535 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalRotation.x - value: 0.28616995 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalRotation.y - value: -0.6133878 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalRotation.z - value: 0.25407356 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 45 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -83.2 - objectReference: {fileID: 0} - - target: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5304508333967466499, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_Name - value: Sun - objectReference: {fileID: 0} - - target: {fileID: 8430430470315967237, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_BoundingSphereOverride.w - value: 1.772098e+24 - objectReference: {fileID: 0} - - target: {fileID: 8430430470315967237, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_BoundingSphereOverride.x - value: 1e-45 - objectReference: {fileID: 0} - - target: {fileID: 8430430470315967237, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_BoundingSphereOverride.y - value: 1.772098e+24 - objectReference: {fileID: 0} - - target: {fileID: 8430430470315967237, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - propertyPath: m_BoundingSphereOverride.z - value: 1e-45 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 774ab582b39374a7e9d5dac8e31b9a5a, type: 3} ---- !u!4 &8787568180410600781 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 1399345652565587599, guid: 774ab582b39374a7e9d5dac8e31b9a5a, - type: 3} - m_PrefabInstance: {fileID: 7681117619760331714} - m_PrefabAsset: {fileID: 0} diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall_Scene.prefab.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall_Scene.prefab.meta deleted file mode 100644 index 28c19b689..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Prefabs/Waterfall_Scene.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b676eddee169f491c8baaec18b951e3e -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene.meta deleted file mode 100644 index 71474f42b..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eee09ea2a79db4dc599a9def8bb1323c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene/Waterfall.unity b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene/Waterfall.unity deleted file mode 100644 index 2807648ae..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene/Waterfall.unity +++ /dev/null @@ -1,199 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -OcclusionCullingSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 - m_SceneGUID: 00000000000000000000000000000000 - m_OcclusionCullingData: {fileID: 0} ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 9 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} - m_SkyboxMaterial: {fileID: 2100000, guid: 9dbeaf053c6fb4c2f93b45a9995c408e, type: 2} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} - m_UseRadianceAmbientProbe: 0 ---- !u!157 &3 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 12 - m_GIWorkflowMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_LightmapEditorSettings: - serializedVersion: 12 - m_Resolution: 2 - m_BakeResolution: 40 - m_AtlasSize: 1024 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_ExtractAmbientOcclusion: 0 - m_Padding: 2 - 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 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 512 - m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 256 - m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 1 - m_PVRDenoiserTypeDirect: 1 - m_PVRDenoiserTypeIndirect: 1 - m_PVRDenoiserTypeAO: 1 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 1 - m_PVRCulling: 1 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 112000000, guid: c7dbde43832e94a8a8f197950b80d1da, - type: 2} - m_LightingSettings: {fileID: 4890085278179872738, guid: 6e72aca972f324f7886200f86939d735, - type: 2} ---- !u!196 &4 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 3 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - manualTileSize: 0 - tileSize: 256 - buildHeightMesh: 0 - maxJobWorkers: 0 - preserveTilesOutsideBounds: 0 - debug: - m_Flags: 0 - m_NavMeshData: {fileID: 0} ---- !u!1001 &5319695609817526913 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5671401972438653350, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8690342836163527637, guid: b676eddee169f491c8baaec18b951e3e, - type: 3} - propertyPath: m_Name - value: Scene - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: b676eddee169f491c8baaec18b951e3e, type: 3} ---- !u!1660057539 &9223372036854775807 -SceneRoots: - m_ObjectHideFlags: 0 - m_Roots: - - {fileID: 5319695609817526913} diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene/Waterfall.unity.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene/Waterfall.unity.meta deleted file mode 100644 index 646076c3a..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scene/Waterfall.unity.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 3f7718da774f0463abb58475d24c7099 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts.meta deleted file mode 100644 index 89d5360c5..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eb9ae671244cd4f9090a3c9a9248a95e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/Waterfall.cs b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/Waterfall.cs deleted file mode 100644 index 2f52ba61c..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/Waterfall.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -using UnityEngine; - -namespace WaveHarmonic.Crest.Examples -{ - [AddComponentMenu(Constants.k_MenuPrefixSample + "Waterfall (Sample)")] - [ExecuteAlways] - sealed class Waterfall : MonoBehaviour - { - [SerializeField, HideInInspector] -#pragma warning disable 414 - int _Version = 0; -#pragma warning restore 414 - - public Transform _Crest; - public float _CrestRadius = 1f; - - public Transform _Face; - public float _FaceAngle = 5f; - - public Transform _Waves; - - [Tooltip("The bottom of the waterfall. If unset, it will use sea level.")] - public Transform _PlungePool; - - public Transform _Foam; - public float _FoamOffset; - public float _FoamPadding; - - public Transform _Flow; - public float _FlowPadding = 10f; - - float HeightFromPlungePool => transform.position.y - (_PlungePool != null - ? _PlungePool.position.y - : WaterRenderer.Instance != null - ? WaterRenderer.Instance.SeaLevel - : 0f); - - void OnEnable() - { - Update(); - } - - void Update() - { - UpdateFace(); - UpdateCrest(); - UpdateWaves(); - UpdateFoam(); - UpdateFlow(); - } - - void UpdateCrest() - { - if (_Crest == null) - { - return; - } - - var crest = _Crest; - - var position = crest.localPosition; - position.y = -_CrestRadius; - crest.localPosition = position; - - var scale = crest.localScale; - scale.x = _CrestRadius * 2f; - scale.z = _CrestRadius * 2f; - crest.localScale = scale; - } - - void UpdateFace() - { - if (_Face == null) - { - return; - } - - var face = _Face; - var angle = _FaceAngle * Mathf.Deg2Rad; - var ratio = 1f / Mathf.Cos(angle); - var height = HeightFromPlungePool - _CrestRadius; - var center = height * 0.5f; - - var rotation = face.localRotation.eulerAngles; - rotation.x = 90f - _FaceAngle; - face.localRotation = Quaternion.Euler(rotation); - - // Plane is 10m. - var scale = face.localScale; - scale.z = height * 0.1f * ratio; - face.localScale = scale; - - var position = face.localPosition; - position.y = -center; - position.z = center * ratio * Mathf.Sin(angle); - - position.y += -_CrestRadius; - position.z += _CrestRadius; - - face.localPosition = position; - } - - void UpdateWaves() - { - if (_Waves == null) - { - return; - } - - var waves = _Waves; - - var feather = 0f; - - if (_Waves.TryGetComponent(out var renderer) && renderer.sharedMaterial != null && renderer.sharedMaterial.IsKeywordEnabled("d_Feather")) - { - feather = renderer.sharedMaterial.GetFloat(Shader.PropertyToID("_Crest_FeatherWidth")); - } - - var position = waves.localPosition; - - var scale = waves.localScale.x; - - position.z = scale * 0.5f + (_Face.localPosition.z * 2f - _CrestRadius) - feather * scale; - - position.y = -HeightFromPlungePool; - - waves.localPosition = position; - } - - void UpdateFoam() - { - if (_Foam == null) - { - return; - } - - var foam = _Foam; - - var size = _Face.localPosition.z * 2f - _CrestRadius; - - var scale = foam.localScale; - scale.y = size + _FoamPadding; - foam.localScale = scale; - - var position = _Foam.localPosition; - position.z = size * 0.5f + _FoamOffset; - _Foam.localPosition = position; - } - - void UpdateFlow() - { - if (_Flow == null) - { - return; - } - - var flow = _Flow; - - var size = _Face.localPosition.z * 2f - _CrestRadius; - - var scale = flow.localScale; - scale.y = size + _FlowPadding; - flow.localScale = scale; - - var position = _Flow.localPosition; - position.z = size * 0.5f; - _Flow.localPosition = position; - } - } -} diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/Waterfall.cs.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/Waterfall.cs.meta deleted file mode 100644 index 982893b20..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/Waterfall.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d6cefaddfdcb9420abe40ac27e03cd4d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/WaveHarmonic.Crest.Samples.Waterfall.asmdef b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/WaveHarmonic.Crest.Samples.Waterfall.asmdef deleted file mode 100644 index c9c9545b8..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/WaveHarmonic.Crest.Samples.Waterfall.asmdef +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "WaveHarmonic.Crest.Samples.Waterfall", - "rootNamespace": "", - "references": [ - "GUID:7c347618730f5467f86a58f333ce21df", - "GUID:056ff2a5b2f124d468c6655552acdca5" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "UNITY_2022_3_OR_NEWER", - "d_Crest" - ], - "versionDefines": [ - { - "name": "com.waveharmonic.crest", - "expression": "", - "define": "d_Crest" - } - ], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/WaveHarmonic.Crest.Samples.Waterfall.asmdef.meta b/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/WaveHarmonic.Crest.Samples.Waterfall.asmdef.meta deleted file mode 100644 index 301ec3f8d..000000000 --- a/Packages/com.waveharmonic.crest/Samples~/Waterfall/Scripts/WaveHarmonic.Crest.Samples.Waterfall.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 054255244fbfd4fa8b9b4d829c6bc703 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Shared/Prefabs/Sun.prefab b/Packages/com.waveharmonic.crest/Shared/Prefabs/Sun.prefab index 1f7096a77..269cb8ebb 100644 --- a/Packages/com.waveharmonic.crest/Shared/Prefabs/Sun.prefab +++ b/Packages/com.waveharmonic.crest/Shared/Prefabs/Sun.prefab @@ -428,7 +428,6 @@ MonoBehaviour: m_EditorClassIdentifier: _Version: 0 _Source: 1 - _Viewer: {fileID: 0} _Layer: 0 _MinimumWavelength: 1 _DistanceFromSurfaceSigned: 0 diff --git a/Packages/com.waveharmonic.crest/Shared/Scripts/AlignSceneViewToCamera.cs b/Packages/com.waveharmonic.crest/Shared/Scripts/AlignSceneViewToCamera.cs index 1b2661882..b24fa032d 100644 --- a/Packages/com.waveharmonic.crest/Shared/Scripts/AlignSceneViewToCamera.cs +++ b/Packages/com.waveharmonic.crest/Shared/Scripts/AlignSceneViewToCamera.cs @@ -5,7 +5,6 @@ using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; -using WaveHarmonic.Crest.Internal.Compatibility; namespace WaveHarmonic.Crest.Examples { @@ -22,7 +21,7 @@ namespace WaveHarmonic.Crest.Examples #pragma warning restore 414 #if UNITY_EDITOR - static ulong s_Scene; + static int s_Scene; static bool s_SceneChanged; [InitializeOnLoadMethod] @@ -30,16 +29,16 @@ namespace WaveHarmonic.Crest.Examples { EditorSceneManager.sceneClosed -= OnSceneClosed; EditorSceneManager.sceneClosed += OnSceneClosed; - s_Scene = SceneManager.GetActiveScene().GetRawSceneHandle(); + s_Scene = SceneManager.GetActiveScene().handle; } static void OnSceneClosed(Scene a) { // TODO: Report to Unity // Does not work if only game view is open. Handles will never update. - if (s_Scene == a.GetRawSceneHandle()) return; + if (s_Scene == a.handle) return; s_SceneChanged = true; - s_Scene = a.GetRawSceneHandle(); + s_Scene = a.handle; } void OnEnable() diff --git a/Packages/com.waveharmonic.crest/Shared/Scripts/Input.meta b/Packages/com.waveharmonic.crest/Shared/Scripts/Input.meta deleted file mode 100644 index 43e5d0c5c..000000000 --- a/Packages/com.waveharmonic.crest/Shared/Scripts/Input.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5923ff6194bdd4740a68caa8ecad46d4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Shared/Scripts/Input/InputModulePatcher.cs b/Packages/com.waveharmonic.crest/Shared/Scripts/Input/InputModulePatcher.cs deleted file mode 100644 index 611a3ffa5..000000000 --- a/Packages/com.waveharmonic.crest/Shared/Scripts/Input/InputModulePatcher.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Crest Water System -// Copyright © 2024 Wave Harmonic. All rights reserved. - -#if d_UnityInputSystem && ENABLE_INPUT_SYSTEM -#define INPUT_SYSTEM_ENABLED -#endif - -using UnityEngine; - -namespace WaveHarmonic.Crest.Examples -{ -#if !CREST_DEBUG - [AddComponentMenu("")] -#endif - sealed class InputModulePatcher : MonoBehaviour - { -#if INPUT_SYSTEM_ENABLED - void OnEnable() - { - GetComponent().enabled = false; - } -#endif - } -} diff --git a/Packages/com.waveharmonic.crest/Shared/Scripts/Input/InputModulePatcher.cs.meta b/Packages/com.waveharmonic.crest/Shared/Scripts/Input/InputModulePatcher.cs.meta deleted file mode 100644 index 9484d25f5..000000000 --- a/Packages/com.waveharmonic.crest/Shared/Scripts/Input/InputModulePatcher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 539016482e955484bbeb4193a95d3e15 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.waveharmonic.crest/Shared/Scripts/RandomMotion.cs b/Packages/com.waveharmonic.crest/Shared/Scripts/RandomMotion.cs index 2449a6b68..5a865d3af 100644 --- a/Packages/com.waveharmonic.crest/Shared/Scripts/RandomMotion.cs +++ b/Packages/com.waveharmonic.crest/Shared/Scripts/RandomMotion.cs @@ -18,9 +18,6 @@ namespace WaveHarmonic.Crest.Examples int _Version = 0; #pragma warning restore 414 - [SerializeField] - bool _WorldSpace; - [Header("Translation")] [SerializeField] @@ -55,7 +52,7 @@ namespace WaveHarmonic.Crest.Examples void Start() { - _Origin = _WorldSpace ? transform.position : transform.localPosition; + _Origin = transform.position; _OrthogonalAxis = Quaternion.AngleAxis(90f, Vector3.up) * _Axis; } @@ -67,21 +64,10 @@ namespace WaveHarmonic.Crest.Examples // Do circles in perlin noise var rnd = 2f * (Mathf.PerlinNoise(0.5f + 0.5f * Mathf.Cos(_Frequency * Time.time), 0.5f + 0.5f * Mathf.Sin(_Frequency * Time.time)) - 0.5f); - // Prevent jump at start. - var amplitude = Mathf.Min(_Amplitude, _Amplitude * Time.timeSinceLevelLoad); - var orthoPhaseOff = Mathf.PI / 2f; var rndOrtho = 2f * (Mathf.PerlinNoise(0.5f + 0.5f * Mathf.Cos(_Frequency * Time.time + orthoPhaseOff), 0.5f + 0.5f * Mathf.Sin(_Frequency * Time.time + orthoPhaseOff)) - 0.5f); - var position = _Origin + (_Axis * rnd + _OrthogonalMotion * rndOrtho * _OrthogonalAxis) * amplitude; - if (_WorldSpace) - { - transform.position = position; - } - else - { - transform.localPosition = position; - } + transform.position = _Origin + (_Axis * rnd + _OrthogonalMotion * rndOrtho * _OrthogonalAxis) * _Amplitude; } // Rotation diff --git a/Packages/com.waveharmonic.crest/Shared/Scripts/Rendering/LegacyPostProcessingVolume.cs b/Packages/com.waveharmonic.crest/Shared/Scripts/Rendering/LegacyPostProcessingVolume.cs index b9a15292e..b59a44e81 100644 --- a/Packages/com.waveharmonic.crest/Shared/Scripts/Rendering/LegacyPostProcessingVolume.cs +++ b/Packages/com.waveharmonic.crest/Shared/Scripts/Rendering/LegacyPostProcessingVolume.cs @@ -34,11 +34,6 @@ namespace WaveHarmonic.Crest.Examples return; } - if (Helpers.IsWebGPU) - { - return; - } - _QuickVolumes.Clear(); foreach (var volume in GetComponents()) diff --git a/Packages/com.waveharmonic.crest/Shared/Settings/Atmosphere.asset b/Packages/com.waveharmonic.crest/Shared/Settings/Atmosphere.asset index 6838938a7..3e093453c 100644 --- a/Packages/com.waveharmonic.crest/Shared/Settings/Atmosphere.asset +++ b/Packages/com.waveharmonic.crest/Shared/Settings/Atmosphere.asset @@ -46,15 +46,18 @@ MonoBehaviour: type: m_OverrideState: 0 m_Value: 1 - atmosphericScattering: + sphericalMode: m_OverrideState: 0 m_Value: 1 - renderingMode: + seaLevel: m_OverrideState: 0 m_Value: 0 - material: + planetaryRadius: m_OverrideState: 0 - m_Value: {fileID: 0} + m_Value: 6378100 + planetCenterPosition: + m_OverrideState: 0 + m_Value: {x: 0, y: -6378100, z: 0} airDensityR: m_OverrideState: 0 m_Value: 0.04534 @@ -66,7 +69,7 @@ MonoBehaviour: m_Value: 0.23264056 airTint: m_OverrideState: 0 - m_Value: {r: 1, g: 1, b: 1, a: 1} + m_Value: {r: 0.9, g: 0.9, b: 1, a: 1} airMaximumAltitude: m_OverrideState: 0 m_Value: 55261.973 @@ -82,15 +85,6 @@ MonoBehaviour: aerosolAnisotropy: m_OverrideState: 0 m_Value: 0 - 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} @@ -133,16 +127,13 @@ MonoBehaviour: horizonZenithShift: m_OverrideState: 0 m_Value: 0 - m_SkyVersion: 2 + numberOfBounces: + m_OverrideState: 0 + m_Value: 3 + m_SkyVersion: 1 m_ObsoleteEarthPreset: m_OverrideState: 0 m_Value: 1 - planetaryRadius: - m_OverrideState: 0 - m_Value: 6378100 - planetCenterPosition: - m_OverrideState: 0 - m_Value: {x: 0, y: -6378100, z: 0} --- !u!114 &-3053135762479981819 MonoBehaviour: m_ObjectHideFlags: 3 @@ -375,12 +366,6 @@ 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 @@ -473,18 +458,6 @@ 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 @@ -494,7 +467,6 @@ MonoBehaviour: fogType: m_OverrideState: 1 m_Value: 3 - m_Version: 1 --- !u!114 &5321722785694334585 MonoBehaviour: m_ObjectHideFlags: 3 @@ -565,9 +537,6 @@ MonoBehaviour: sliceDistributionUniformity: m_OverrideState: 0 m_Value: 0.75 - multipleScatteringIntensity: - m_OverrideState: 0 - m_Value: 0 m_FogControlMode: m_OverrideState: 0 m_Value: 0 diff --git a/Packages/com.waveharmonic.crest/Shared/Settings/PostProcessing.asset b/Packages/com.waveharmonic.crest/Shared/Settings/PostProcessing.asset index 1899c6a37..55d71aed0 100644 --- a/Packages/com.waveharmonic.crest/Shared/Settings/PostProcessing.asset +++ b/Packages/com.waveharmonic.crest/Shared/Settings/PostProcessing.asset @@ -96,7 +96,6 @@ MonoBehaviour: - {fileID: 89624805562497374} - {fileID: 7577113519358791614} - {fileID: 4527986752527755293} - - {fileID: 1051598088582843543} --- !u!114 &89624805562497374 MonoBehaviour: m_ObjectHideFlags: 3 @@ -186,52 +185,6 @@ MonoBehaviour: tint: m_OverrideState: 0 m_Value: 0 ---- !u!114 &1051598088582843543 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 24f077503be6ae942a1e1245dbd53ea9, type: 3} - m_Name: Bloom - m_EditorClassIdentifier: - active: 1 - quality: - m_OverrideState: 0 - m_Value: 1 - threshold: - m_OverrideState: 1 - m_Value: 1 - intensity: - m_OverrideState: 1 - m_Value: 1 - scatter: - m_OverrideState: 0 - m_Value: 0.7 - tint: - m_OverrideState: 0 - m_Value: {r: 1, g: 1, b: 1, a: 1} - dirtTexture: - m_OverrideState: 0 - m_Value: {fileID: 0} - dirtIntensity: - m_OverrideState: 0 - m_Value: 0 - anamorphic: - m_OverrideState: 0 - m_Value: 1 - m_Resolution: - m_OverrideState: 0 - m_Value: 2 - m_HighQualityPrefiltering: - m_OverrideState: 0 - m_Value: 0 - m_HighQualityFiltering: - m_OverrideState: 0 - m_Value: 1 --- !u!114 &1692474355597373712 MonoBehaviour: m_ObjectHideFlags: 3 diff --git a/Packages/com.waveharmonic.crest/Shared/Shaders/Lit.shadergraph b/Packages/com.waveharmonic.crest/Shared/Shaders/Lit.shadergraph index 17e7838fc..4cf3119ae 100644 --- a/Packages/com.waveharmonic.crest/Shared/Shaders/Lit.shadergraph +++ b/Packages/com.waveharmonic.crest/Shared/Shaders/Lit.shadergraph @@ -62,9 +62,6 @@ }, { "m_Id": "988d3fda4b75435b9f2630355731fbc7" - }, - { - "m_Id": "5ab14e58fd6d47fc94208753d460c917" } ], "m_Keywords": [ @@ -321,9 +318,6 @@ }, { "m_Id": "3d920b053a2f4bbfaaf6ba4f8c9f137e" - }, - { - "m_Id": "af669ec9501e494e8249b25fb552a4e6" } ], "m_GroupDatas": [ @@ -1056,20 +1050,6 @@ "m_SlotId": 0 } }, - { - "m_OutputSlot": { - "m_Node": { - "m_Id": "af669ec9501e494e8249b25fb552a4e6" - }, - "m_SlotId": 0 - }, - "m_InputSlot": { - "m_Node": { - "m_Id": "3d920b053a2f4bbfaaf6ba4f8c9f137e" - }, - "m_SlotId": -1490972 - } - }, { "m_OutputSlot": { "m_Node": { @@ -1427,9 +1407,6 @@ "m_ChildObjectList": [ { "m_Id": "65d8361074904a08ba28f1116b517849" - }, - { - "m_Id": "5ab14e58fd6d47fc94208753d460c917" } ] } @@ -3653,21 +3630,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "4a0bdf43d1d44b39b77034a01053b999", - "m_Id": 0, - "m_DisplayName": "Water Volume Multiplier", - "m_SlotType": 1, - "m_Hidden": false, - "m_ShaderOutputName": "Out", - "m_StageCapability": 3, - "m_Value": 0.0, - "m_DefaultValue": 0.0, - "m_Labels": [] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", @@ -4278,34 +4240,6 @@ } } -{ - "m_SGVersion": 1, - "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", - "m_ObjectId": "5ab14e58fd6d47fc94208753d460c917", - "m_Guid": { - "m_GuidSerialized": "5da6eda6-901d-4429-a84c-4b0e0ef60ca6" - }, - "m_Name": "Water Volume Multiplier", - "m_DefaultRefNameVersion": 1, - "m_RefNameGeneratedByDisplayName": "Water Volume Multiplier", - "m_DefaultReferenceName": "_Water_Volume_Multiplier", - "m_OverrideReferenceName": "", - "m_GeneratePropertyBlock": true, - "m_UseCustomSlotLabel": false, - "m_CustomSlotLabel": "", - "m_DismissedVersion": 0, - "m_Precision": 0, - "overrideHLSLDeclaration": false, - "hlslDeclarationOverride": 0, - "m_Hidden": false, - "m_Value": 1.0, - "m_FloatType": 1, - "m_RangeValues": { - "x": 0.0, - "y": 1.0 - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.PropertyNode", @@ -7057,42 +6991,6 @@ "m_DefaultType": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.PropertyNode", - "m_ObjectId": "af669ec9501e494e8249b25fb552a4e6", - "m_Group": { - "m_Id": "" - }, - "m_Name": "Property", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": -732.5001220703125, - "y": 336.00006103515627, - "width": 199.5001220703125, - "height": 33.99993896484375 - } - }, - "m_Slots": [ - { - "m_Id": "4a0bdf43d1d44b39b77034a01053b999" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_Property": { - "m_Id": "5ab14e58fd6d47fc94208753d460c917" - } -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", diff --git a/Packages/com.waveharmonic.crest/package.json b/Packages/com.waveharmonic.crest/package.json index 0842adc62..27b5a4f20 100644 --- a/Packages/com.waveharmonic.crest/package.json +++ b/Packages/com.waveharmonic.crest/package.json @@ -1,10 +1,10 @@ { "name": "com.waveharmonic.crest", - "version": "5.7.0", + "version": "5.6.6", "displayName": "Crest", "description": "An advanced water system for Unity.", "unity": "2022.3", - "unityRelease": "62f3", + "unityRelease": "21f1", "hideInEditor": false, "documentationUrl": "https://docs.crest.waveharmonic.com/About/Introduction.html", "changelogUrl": "https://docs.crest.waveharmonic.com/About/History.html", @@ -35,11 +35,6 @@ "description": "Demonstrates wakes using the Sphere Water Interaction.", "path": "Samples~/Wakes" }, - { - "displayName": "Waterfall", - "description": "An example of kitbashing a waterfall using various inputs.", - "path": "Samples~/Waterfall" - }, { "displayName": "Boats", "description": "Simple examples using boats.", @@ -47,7 +42,7 @@ } ], "dependencies": { - "com.unity.render-pipelines.core": "14.0.12", - "com.unity.shadergraph": "14.0.12" + "com.unity.render-pipelines.core": "14.0.11", + "com.unity.shadergraph": "14.0.11" } } \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index ee76a34c0..044f826c9 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -552,8 +552,8 @@ "depth": 0, "source": "embedded", "dependencies": { - "com.unity.render-pipelines.core": "14.0.12", - "com.unity.shadergraph": "14.0.12" + "com.unity.render-pipelines.core": "14.0.11", + "com.unity.shadergraph": "14.0.11" } }, "com.unity.modules.accessibility": { diff --git a/ProjectSettings/Packages/com.waveharmonic.crest/Settings.asset b/ProjectSettings/Packages/com.waveharmonic.crest/Settings.asset deleted file mode 100644 index 3adefaf3d..000000000 --- a/ProjectSettings/Packages/com.waveharmonic.crest/Settings.asset +++ /dev/null @@ -1,183 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &1 -MonoBehaviour: - m_ObjectHideFlags: 53 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8ac118e410ac44d44a323c7c14819660, type: 3} - m_Name: - m_EditorClassIdentifier: WaveHarmonic.Crest.Editor::WaveHarmonic.Crest.Editor.Settings.ProjectSettings - _DebugEnableStrippingLogging: 0 - _DebugOnlyLogRemainingVariants: 0 - _StripBrokenVariants: 1 - _FullPrecisionDisplacementOnHalfPrecisionPlatforms: 1 - _RenderAtmosphericScatteringWhenUnderWater: 0 - _LegacyUnderwater: 0 - _Platforms: 1 - _PlatformSettingsDesktop: - _Default: 0 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettingsServer: - _Default: 0 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettingsAndroid: - _Default: 0 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettingsIOS: - _Default: 0 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettingsTVOS: - _Default: 0 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettingsVisionOS: - _Default: 0 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettingsWeb: - _Default: 0 - _OverrideAlbedoSimulation: 1 - _AlbedoSimulation: 0 - _OverrideAbsorptionSimulation: 1 - _AbsorptionSimulation: 0 - _OverrideScatteringSimulation: 1 - _ScatteringSimulation: 0 - _OverrideShadowSimulation: 1 - _ShadowSimulation: 0 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 1 - _PlanarReflections: 0 - _OverrideFoamBioluminescence: 1 - _FoamBioluminescence: 0 - _OverrideCausticsForceDistortion: 1 - _CausticsForceDistortion: 0 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _PlatformSettings: - _Default: 1 - _OverrideAlbedoSimulation: 0 - _AlbedoSimulation: 1 - _OverrideAbsorptionSimulation: 0 - _AbsorptionSimulation: 1 - _OverrideScatteringSimulation: 0 - _ScatteringSimulation: 1 - _OverrideShadowSimulation: 0 - _ShadowSimulation: 1 - _OverrideNormalMaps: 0 - _NormalMaps: 1 - _OverridePlanarReflections: 0 - _PlanarReflections: 1 - _OverrideFoamBioluminescence: 0 - _FoamBioluminescence: 1 - _OverrideCausticsForceDistortion: 0 - _CausticsForceDistortion: 1 - _OverrideSimpleTransparency: 0 - _SimpleTransparency: 0 - _Version: 1 - _MaterialVersion: 1