├── .gitattributes ├── .gitignore ├── Assets ├── Demo.unity ├── Demo.unity.meta ├── Resources.meta ├── Resources │ ├── BullshitOcean.shader │ ├── BullshitOcean.shader.meta │ ├── Combine.mat │ ├── Combine.mat.meta │ ├── CombineShader.shader │ ├── CombineShader.shader.meta │ ├── EncinoFFT.compute │ ├── EncinoFFT.compute.meta │ ├── EncinoSpectrum.compute │ ├── EncinoSpectrum.compute.meta │ ├── Noise.png │ ├── Noise.png.meta │ ├── Ocean.mat │ └── Ocean.mat.meta ├── Scripts.meta └── Scripts │ ├── Bullshit.cs │ ├── Bullshit.cs.meta │ ├── WaveSpectrum.cs │ └── WaveSpectrum.cs.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | *.VC.db 27 | 28 | # Unity3D generated meta files 29 | *.pidb.meta 30 | *.pdb.meta 31 | 32 | # Unity3D Generated File On Crash Reports 33 | sysinfo.txt 34 | 35 | # Builds 36 | *.apk 37 | *.unitypackage 38 | -------------------------------------------------------------------------------- /Assets/Demo.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.426483, g: 0.45923156, b: 0.4860593, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &839049560 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 839049562} 124 | - component: {fileID: 839049561} 125 | m_Layer: 0 126 | m_Name: Directional Light 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!108 &839049561 133 | Light: 134 | m_ObjectHideFlags: 0 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 839049560} 138 | m_Enabled: 1 139 | serializedVersion: 8 140 | m_Type: 1 141 | m_Color: {r: 1, g: 0.98823535, b: 0.6117647, a: 1} 142 | m_Intensity: 1.68 143 | m_Range: 10 144 | m_SpotAngle: 30 145 | m_CookieSize: 10 146 | m_Shadows: 147 | m_Type: 2 148 | m_Resolution: -1 149 | m_CustomResolution: -1 150 | m_Strength: 1 151 | m_Bias: 0.05 152 | m_NormalBias: 0.4 153 | m_NearPlane: 0.2 154 | m_Cookie: {fileID: 0} 155 | m_DrawHalo: 0 156 | m_Flare: {fileID: 0} 157 | m_RenderMode: 0 158 | m_CullingMask: 159 | serializedVersion: 2 160 | m_Bits: 4294967295 161 | m_Lightmapping: 4 162 | m_AreaSize: {x: 1, y: 1} 163 | m_BounceIntensity: 1 164 | m_ColorTemperature: 6570 165 | m_UseColorTemperature: 0 166 | m_ShadowRadius: 0 167 | m_ShadowAngle: 0 168 | --- !u!4 &839049562 169 | Transform: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 839049560} 174 | m_LocalRotation: {x: 0, y: 0.99813485, z: -0.06104851, w: 0} 175 | m_LocalPosition: {x: 0, y: 0, z: 0} 176 | m_LocalScale: {x: 1, y: 1, z: 1} 177 | m_Children: [] 178 | m_Father: {fileID: 0} 179 | m_RootOrder: 1 180 | m_LocalEulerAnglesHint: {x: 7, y: 180, z: 0} 181 | --- !u!1 &1546396638 182 | GameObject: 183 | m_ObjectHideFlags: 0 184 | m_PrefabParentObject: {fileID: 0} 185 | m_PrefabInternal: {fileID: 0} 186 | serializedVersion: 5 187 | m_Component: 188 | - component: {fileID: 1546396642} 189 | - component: {fileID: 1546396641} 190 | - component: {fileID: 1546396640} 191 | - component: {fileID: 1546396639} 192 | - component: {fileID: 1546396643} 193 | - component: {fileID: 1546396644} 194 | m_Layer: 0 195 | m_Name: Main Camera 196 | m_TagString: MainCamera 197 | m_Icon: {fileID: 0} 198 | m_NavMeshLayer: 0 199 | m_StaticEditorFlags: 0 200 | m_IsActive: 1 201 | --- !u!81 &1546396639 202 | AudioListener: 203 | m_ObjectHideFlags: 0 204 | m_PrefabParentObject: {fileID: 0} 205 | m_PrefabInternal: {fileID: 0} 206 | m_GameObject: {fileID: 1546396638} 207 | m_Enabled: 1 208 | --- !u!124 &1546396640 209 | Behaviour: 210 | m_ObjectHideFlags: 0 211 | m_PrefabParentObject: {fileID: 0} 212 | m_PrefabInternal: {fileID: 0} 213 | m_GameObject: {fileID: 1546396638} 214 | m_Enabled: 1 215 | --- !u!20 &1546396641 216 | Camera: 217 | m_ObjectHideFlags: 0 218 | m_PrefabParentObject: {fileID: 0} 219 | m_PrefabInternal: {fileID: 0} 220 | m_GameObject: {fileID: 1546396638} 221 | m_Enabled: 1 222 | serializedVersion: 2 223 | m_ClearFlags: 1 224 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 225 | m_NormalizedViewPortRect: 226 | serializedVersion: 2 227 | x: 0 228 | y: 0 229 | width: 1 230 | height: 1 231 | near clip plane: 0.3 232 | far clip plane: 100 233 | field of view: 60 234 | orthographic: 0 235 | orthographic size: 1 236 | m_Depth: -1 237 | m_CullingMask: 238 | serializedVersion: 2 239 | m_Bits: 4294967295 240 | m_RenderingPath: -1 241 | m_TargetTexture: {fileID: 0} 242 | m_TargetDisplay: 0 243 | m_TargetEye: 3 244 | m_HDR: 1 245 | m_AllowMSAA: 1 246 | m_AllowDynamicResolution: 0 247 | m_ForceIntoRT: 0 248 | m_OcclusionCulling: 1 249 | m_StereoConvergence: 10 250 | m_StereoSeparation: 0.022 251 | --- !u!4 &1546396642 252 | Transform: 253 | m_ObjectHideFlags: 0 254 | m_PrefabParentObject: {fileID: 0} 255 | m_PrefabInternal: {fileID: 0} 256 | m_GameObject: {fileID: 1546396638} 257 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 258 | m_LocalPosition: {x: 0, y: 5, z: -10} 259 | m_LocalScale: {x: 1, y: 1, z: 1} 260 | m_Children: [] 261 | m_Father: {fileID: 0} 262 | m_RootOrder: 0 263 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 264 | --- !u!114 &1546396643 265 | MonoBehaviour: 266 | m_ObjectHideFlags: 0 267 | m_PrefabParentObject: {fileID: 0} 268 | m_PrefabInternal: {fileID: 0} 269 | m_GameObject: {fileID: 1546396638} 270 | m_Enabled: 1 271 | m_EditorHideFlags: 0 272 | m_Script: {fileID: 11500000, guid: 376a035cc678f654d98b201c629a9020, type: 3} 273 | m_Name: 274 | m_EditorClassIdentifier: 275 | projectorMat: {fileID: 2100000, guid: 6dcda722a0f8c1c4f8f05c84a9019b09, type: 2} 276 | OceanLevel: 0 277 | outScale: 0.1 278 | --- !u!114 &1546396644 279 | MonoBehaviour: 280 | m_ObjectHideFlags: 0 281 | m_PrefabParentObject: {fileID: 0} 282 | m_PrefabInternal: {fileID: 0} 283 | m_GameObject: {fileID: 1546396638} 284 | m_Enabled: 1 285 | m_EditorHideFlags: 0 286 | m_Script: {fileID: 11500000, guid: 47e88b7e7b3aeb14fba1f827d8708107, type: 3} 287 | m_Name: 288 | m_EditorClassIdentifier: 289 | N: 512 290 | L: 200 291 | amplitude: 1 292 | windDir: {x: 1, y: 1} 293 | windVelocity: 20 294 | fresnelLookupTex: {fileID: 0} 295 | texButterfly: {fileID: 0} 296 | bufferSpectrumH0: {fileID: 0} 297 | bufferSpectrumH: {fileID: 0} 298 | bufferSpectrumDx: {fileID: 0} 299 | bufferSpectrumDy: {fileID: 0} 300 | bufferHFinal: {fileID: 0} 301 | bufferDxFinal: {fileID: 0} 302 | bufferDyFinal: {fileID: 0} 303 | choppiness: 2 304 | -------------------------------------------------------------------------------- /Assets/Demo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 579a44394bdf78340888317ac2213fda 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c160ce1a666cac438a1504f21beb225 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/BullshitOcean.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/BullshitOcean" { 2 | Properties { 3 | _SeaColor ("Color", Color) = (1,1,1,1) 4 | _MainTex ("Albedo (RGB)", 2D) = "white" {} 5 | _NormalTex ("Normal Map", 2D) = "white" {} 6 | _DispTex ("Displacement Map", 2D) = "white" {} 7 | _Glossiness ("Smoothness", Range(0,1)) = 0.7 8 | _Metallic ("Metallic", Range(0,1)) = 0.0 9 | _Choppiness("Choppiness", Range(0, 1000)) = 100 10 | _EdgeLength("EdgeLength", Range(1, 128)) = 4 11 | } 12 | SubShader { 13 | Tags { "RenderType"="Opaque" } 14 | LOD 200 15 | 16 | CGPROGRAM 17 | #pragma surface surf Ocean fullforwardshadows vertex:vert tessellate:tess 18 | #pragma target 5.0 19 | #pragma enable_d3d11_debug_symbols 20 | #include "Tessellation.cginc" 21 | #include "UnityCG.cginc" 22 | #include "Lighting.cginc" 23 | 24 | #define _PI 3.1415926f 25 | 26 | sampler2D _MainTex; 27 | 28 | struct Input { 29 | float2 uv_MainTex; 30 | float2 coord; 31 | }; 32 | 33 | struct appdata 34 | { 35 | float4 vertex : POSITION; 36 | float4 tangent : TANGENT; 37 | float3 normal : NORMAL; 38 | float2 texcoord : TEXCOORD0; 39 | }; 40 | 41 | float4 _SeaColor; 42 | float L; 43 | float Amplitude; 44 | float _NormalTexelSize; 45 | float OceanLevel; 46 | sampler2D _NormalTex; 47 | sampler2D _DispTex; 48 | sampler2D _NoiseTex; 49 | sampler2D _FresnelLookup; 50 | float4x4 _RangeMatrix; 51 | float _Glossiness; 52 | float _Metallic; 53 | float _Choppiness; 54 | float _EdgeLength; 55 | 56 | half4 LightingOcean(SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) 57 | { 58 | float cosTheta = dot(s.Normal, viewDir); 59 | float fresnel = tex2D(_FresnelLookup, float2(cosTheta, 0)).r; 60 | half3 h = normalize(lightDir + viewDir); 61 | half diff = max(0, dot(s.Normal, lightDir)); 62 | float nh = max(0, dot(s.Normal, h)); 63 | float spec = pow(nh, 48.0) * s.Gloss; 64 | half4 c; 65 | c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec * fresnel) * atten * 2; 66 | c.a = s.Alpha; 67 | return c; 68 | } 69 | 70 | float4 tess (appdata v0, appdata v1, appdata v2) 71 | { 72 | return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength); 73 | } 74 | 75 | void vert(inout appdata v) 76 | { 77 | float4 pos = lerp(lerp(_RangeMatrix[0], _RangeMatrix[1], v.texcoord.x), 78 | lerp(_RangeMatrix[2], _RangeMatrix[3], v.texcoord.x), 79 | v.texcoord.y); 80 | float4 worldPos = mul(unity_ObjectToWorld, pos); 81 | worldPos.y = OceanLevel; 82 | float4 revertPos = mul(unity_WorldToObject, worldPos); 83 | pos = revertPos; 84 | float2 coord = pos.xz / L; 85 | float3 displacement = tex2Dlod(_DispTex, float4(coord, 0, 0)).rgb; 86 | pos.xyz += displacement.rgb * Amplitude * float3(_Choppiness, 1, _Choppiness); 87 | v.vertex = pos; 88 | v.texcoord = coord; 89 | } 90 | 91 | void surf (Input IN, inout SurfaceOutput o) { 92 | float4 grad = tex2D(_NormalTex, IN.uv_MainTex); 93 | // make foam more details 94 | float limit = 0.8f; 95 | float rnd = tex2D(_NoiseTex, IN.coord * 10).r; 96 | float k = grad.w * grad.w * (grad.w > rnd ? 1 : rnd); 97 | fixed4 c = lerp(_SeaColor, float4(1,1,1,1), k); 98 | float3 n = normalize(float3(grad.xy, _NormalTexelSize)); 99 | o.Albedo = c; 100 | o.Normal = n; 101 | o.Gloss = lerp(_Glossiness, 0, k); 102 | } 103 | ENDCG 104 | } 105 | FallBack "Diffuse" 106 | } -------------------------------------------------------------------------------- /Assets/Resources/BullshitOcean.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: feabfede8102b0b4c8eff0781891f684 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Combine.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Combine 10 | m_Shader: {fileID: 4800000, guid: 5620e64fb5e5d124fa644bf94fe510ff, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _Color: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailAlbedoMap: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailMask: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _DetailNormalMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _EmissionMap: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MainTex: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _MetallicGlossMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _OcclusionMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | - _ParallaxMap: 58 | m_Texture: {fileID: 0} 59 | m_Scale: {x: 1, y: 1} 60 | m_Offset: {x: 0, y: 0} 61 | m_Floats: 62 | - _BumpScale: 1 63 | - _Cutoff: 0.5 64 | - _DetailNormalMapScale: 1 65 | - _DstBlend: 0 66 | - _GlossMapScale: 1 67 | - _Glossiness: 0.5 68 | - _GlossyReflections: 1 69 | - _Metallic: 0 70 | - _Mode: 0 71 | - _OcclusionStrength: 1 72 | - _Parallax: 0.02 73 | - _SmoothnessTextureChannel: 0 74 | - _SpecularHighlights: 1 75 | - _SrcBlend: 1 76 | - _UVSec: 0 77 | - _ZWrite: 1 78 | m_Colors: 79 | - _Color: {r: 1, g: 1, b: 1, a: 1} 80 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 81 | -------------------------------------------------------------------------------- /Assets/Resources/Combine.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73fb302be23c48b46b5d698eb8058661 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/CombineShader.shader: -------------------------------------------------------------------------------- 1 | Shader "Unlit/CombineShader" 2 | { 3 | SubShader 4 | { 5 | Cull Off ZWrite Off ZTest Always 6 | Pass 7 | { 8 | CGPROGRAM 9 | #pragma vertex vert_img 10 | #pragma fragment frag 11 | 12 | #include "UnityCG.cginc" 13 | 14 | int N; 15 | float L; 16 | float invL; 17 | Texture2D inputH; 18 | Texture2D inputDx; 19 | Texture2D inputDy; 20 | 21 | float3 SampleDisplacement(int2 coord) 22 | { 23 | coord.x += coord.x < 0 ? N : (coord.x >= N ? -N : 0); 24 | coord.y += coord.y < 0 ? N : (coord.y >= N ? -N : 0); 25 | return float3(inputDx[coord], inputH[coord], inputDy[coord]) 26 | * float3(invL, 1.0f, invL); 27 | } 28 | 29 | void frag(v2f_img i, out float4 outDisplacement : SV_Target0, out float4 outGradientFold : SV_Target1) 30 | { 31 | int2 coord = floor(i.pos.xy); 32 | outDisplacement = float4(SampleDisplacement(coord), 1); 33 | 34 | float3 dispL = SampleDisplacement(coord + int2(-1, 0)); 35 | float3 dispR = SampleDisplacement(coord + int2(+1, 0)); 36 | float3 dispT = SampleDisplacement(coord + int2(0, -1)); 37 | float3 dispB = SampleDisplacement(coord + int2(0, +1)); 38 | 39 | float3 diffH = dispR - dispL; 40 | float3 diffV = dispB - dispT; 41 | float2 Dx = diffH.xz * N * 2; 42 | float2 Dy = diffV.xz * N * 2; 43 | float J = (1.0f + Dx.x) * (1.0f + Dy.y) - Dx.y * Dy.x; 44 | float fold = max(1.0f - saturate(J), 0); 45 | 46 | outGradientFold = float4(-diffH.y, -diffV.y, 0, fold); 47 | } 48 | ENDCG 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Resources/CombineShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5620e64fb5e5d124fa644bf94fe510ff 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/EncinoFFT.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel EncinoFFT SIZE=256 PASSES=8 CHANNEL=x TX=256 TY=1 FINAL=0 2 | #pragma kernel EncinoFFT SIZE=256 PASSES=8 CHANNEL=y TX=1 TY=256 FINAL=1 3 | #pragma kernel EncinoFFT SIZE=512 PASSES=9 CHANNEL=x TX=512 TY=1 FINAL=0 4 | #pragma kernel EncinoFFT SIZE=512 PASSES=9 CHANNEL=y TX=1 TY=512 FINAL=1 5 | #pragma kernel EncinoFFT SIZE=1024 PASSES=10 CHANNEL=x TX=1024 TY=1 FINAL=0 6 | #pragma kernel EncinoFFT SIZE=1024 PASSES=10 CHANNEL=y TX=1 TY=1024 FINAL=1 7 | 8 | Texture2D input; 9 | Texture2D inputButterfly; 10 | #if !FINAL 11 | RWTexture2D output; 12 | #else 13 | RWTexture2D output; 14 | #endif 15 | 16 | groupshared float2 intermediates[SIZE]; 17 | groupshared float2 scratch[SIZE]; 18 | 19 | void ButterflyPass(float2 butterfly, uint coord, uint passIndex) 20 | { 21 | uint indexA, indexB; 22 | 23 | uint offset = 1 << passIndex; 24 | if ((coord / offset) % 2 == 1) 25 | { 26 | indexA = coord - offset; 27 | indexB = coord; 28 | } 29 | else 30 | { 31 | indexA = coord; 32 | indexB = coord + offset; 33 | } 34 | 35 | if (passIndex == 0) 36 | { 37 | indexA = reversebits(indexA) >> (32 - PASSES); 38 | indexB = reversebits(indexB) >> (32 - PASSES); 39 | } 40 | 41 | const bool pingpong = (passIndex % 2) == 0; 42 | 43 | float2 valueA, valueB; 44 | if (pingpong) 45 | { 46 | valueA = intermediates[indexA]; 47 | valueB = intermediates[indexB]; 48 | } 49 | else 50 | { 51 | valueA = scratch[indexA]; 52 | valueB = scratch[indexB]; 53 | } 54 | 55 | float2 weight = butterfly.xy; 56 | float2 weightedValueB = weight * valueB.r + weight.gr * valueB.g * float2(-1,1); 57 | float2 result = valueA + weightedValueB; 58 | 59 | if (pingpong) 60 | { 61 | scratch[coord] = result; 62 | } 63 | else 64 | { 65 | intermediates[coord] = result; 66 | } 67 | } 68 | 69 | float2 conj(float2 v) 70 | { 71 | return float2(v.x, -v.y); 72 | } 73 | 74 | [numthreads(TX,TY,1)] 75 | void EncinoFFT(uint2 id : SV_DispatchThreadID) 76 | { 77 | uint coord = id.CHANNEL; 78 | #if !FINAL 79 | intermediates[coord] = conj(input[id]); 80 | #else 81 | intermediates[coord] = input[id]; 82 | #endif 83 | 84 | [unroll(PASSES)] 85 | for (uint passIndex = 0; passIndex < PASSES; ++passIndex) 86 | { 87 | GroupMemoryBarrierWithGroupSync(); 88 | ButterflyPass(inputButterfly[uint2(coord, passIndex)], coord, passIndex); 89 | } 90 | 91 | GroupMemoryBarrierWithGroupSync(); 92 | 93 | const bool pingpong = (PASSES % 2) == 0; 94 | const float2 result = pingpong ? intermediates[coord] : scratch[coord]; 95 | #if !FINAL 96 | output[id] = result; 97 | #else 98 | const float sign = ((id.x + id.y) % 2) == 1 ? -1.0f : 1.0f; 99 | output[id] = sign * result.x; 100 | #endif 101 | } 102 | -------------------------------------------------------------------------------- /Assets/Resources/EncinoFFT.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c65575c39dff4b04baabe1904a77e283 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 4 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/EncinoSpectrum.compute: -------------------------------------------------------------------------------- 1 | #define INV2PI 0.15915494309f 2 | #define INVPI2 0.63661977236f 3 | #define HPI 1.57079632679f 4 | #define PI 3.14159265358f 5 | #define PI2 6.28318530717f 6 | #define HSQRT2 0.70710678118f 7 | #define _G 9.81f 8 | 9 | #pragma kernel EncinoSpectrumInit 10 | #pragma kernel EncinoSpectrumUpdate 11 | 12 | RWTexture2D outputH0; 13 | uint N; 14 | float L; 15 | float windVelocity; 16 | float2 windDir_normal; 17 | 18 | // 以下随机数的相关内容可以参看 19 | // http://www.reedbeta.com/blog/quick-and-easy-gpu-random-numbers-in-d3d11/ 20 | uint rngState; 21 | 22 | 23 | uint WangHash(uint seed) 24 | { 25 | seed = (seed ^ 61) ^ (seed >> 16); 26 | seed *= 9; 27 | seed = seed ^ (seed >> 4); 28 | seed *= 0x27d4eb2d; 29 | seed = seed ^ (seed >> 15); 30 | return seed; 31 | } 32 | 33 | uint Rand() 34 | { 35 | // Xorshift algorithm from George Marsaglia's paper 36 | rngState ^= (rngState << 13); 37 | rngState ^= (rngState >> 17); 38 | rngState ^= (rngState << 5); 39 | return rngState; 40 | } 41 | 42 | float RandFloat() 43 | { 44 | return Rand() / 4294967296.0f; 45 | } 46 | 47 | float RandGauss() 48 | { 49 | float u1 = RandFloat(); 50 | float u2 = RandFloat(); 51 | if (u1 < 1e-6f) 52 | u1 = 1e-6f; 53 | return sqrt(-2.0f * log(u1)) * cos(PI2 * u2); 54 | } 55 | 56 | float GeneralizedABSpectrum(float A, float B, float w) 57 | { 58 | float w4 = w * w; 59 | w4 *= w4; 60 | float w5 = w4 * w; 61 | return A / w5 * exp(-B / w4); 62 | } 63 | 64 | float PositiveCosSquaredDirectionSpreading(float theta) 65 | { 66 | if (theta > -HPI && theta < HPI) 67 | { 68 | return INVPI2 * cos(theta) * cos(theta); 69 | } 70 | return 0; 71 | } 72 | 73 | [numthreads(8,8,1)] 74 | void EncinoSpectrumInit(uint2 id : SV_DispatchThreadID) 75 | { 76 | int2 center = N.xx / 2; 77 | int2 coord = id - center; 78 | if (coord.x == 0 && coord.y == 0) 79 | { 80 | outputH0[id] = float4(0, 0, 0, 0); 81 | return; 82 | } 83 | 84 | // Find wave vector and number 85 | float2 k = PI2 * coord / L; 86 | float klength = length(k); 87 | 88 | // Init seed 89 | rngState = WangHash(id.y * N + id.x); 90 | 91 | float w = sqrt(_G * klength); 92 | float dwdk = _G / (2.0f * w); 93 | 94 | // Get Non-Directional Wave Spectra 95 | float A = 0.01f * _G * _G; 96 | float B = _G / windVelocity; 97 | //B *= B; 98 | //B *= B; 99 | //B *= 0.6858f; 100 | float SnonD = GeneralizedABSpectrum(A, B, w) * dwdk / klength; 101 | 102 | // Get Direction Spreading Function 103 | float thetaPos = atan2(-k.y, k.x); 104 | float thetaNeg = atan2(k.y, -k.x); 105 | float DPos = PositiveCosSquaredDirectionSpreading(thetaPos); 106 | float DNeg = PositiveCosSquaredDirectionSpreading(thetaNeg); 107 | 108 | // Get Amplitude 109 | float dk = PI2 / L; 110 | float SPos = SnonD * DPos; 111 | float SNeg = SnonD * DNeg; 112 | float APos = RandGauss() * sqrt(abs(SPos) * dk * dk * 2); 113 | float ANeg = RandGauss() * sqrt(abs(SNeg) * dk * dk * 2); 114 | 115 | // Random Phase 116 | float PPos = RandFloat() * PI2; 117 | float PNeg = RandFloat() * PI2; 118 | 119 | outputH0[id] = float4( 120 | APos * float2(cos(PPos), - sin(PPos)), 121 | ANeg * float2(cos(PNeg), - sin(PNeg)) 122 | ); 123 | } 124 | 125 | float time; 126 | 127 | Texture2D inputH0; 128 | RWTexture2D outputH; 129 | RWTexture2D outputDx; 130 | RWTexture2D outputDy; 131 | 132 | float2 cmul(float2 lhs, float2 rhs) 133 | { 134 | return float2( 135 | lhs.x * rhs.x - lhs.y * rhs.y, 136 | lhs.x * rhs.y + lhs.y * rhs.x 137 | ); 138 | } 139 | 140 | 141 | [numthreads(8,8,1)] 142 | void EncinoSpectrumUpdate(uint2 id : SV_DispatchThreadID) 143 | { 144 | int2 center = N.xx / 2; 145 | int2 coord = id - center; 146 | 147 | float2 k = PI2 * coord / L; 148 | float klength = length(k); 149 | 150 | float w = sqrt(abs(_G * k)); 151 | 152 | // Advance time 153 | float sw; float cw; 154 | sincos(w * time, sw, cw); 155 | 156 | float2 fwd = float2(cw, -sw); 157 | float2 bkwd = float2(cw, sw); 158 | 159 | float4 h0 = inputH0[id]; 160 | float2 h = cmul(h0.xy, fwd) + cmul(h0.zw, bkwd); 161 | 162 | outputH[id] = h; 163 | outputDx[id] = float2(-h.y * k.x, h.x * k.x) / (klength + 0.00001f); 164 | outputDy[id] = float2(-h.y * k.y, h.x * k.y) / (klength + 0.00001f); 165 | } 166 | -------------------------------------------------------------------------------- /Assets/Resources/EncinoSpectrum.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10ca5602164a34c45b0becdb627b9cbf 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 4 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobdawn/Unity-GPU-FFTOcean/e199f93db1e787f8d07efce63825060bcacd65f9/Assets/Resources/Noise.png -------------------------------------------------------------------------------- /Assets/Resources/Noise.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c817a1f974d79234a92be349570e174a 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | spriteSheet: 69 | serializedVersion: 2 70 | sprites: [] 71 | outline: [] 72 | physicsShape: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/Resources/Ocean.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Ocean 10 | m_Shader: {fileID: 4800000, guid: feabfede8102b0b4c8eff0781891f684, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _Color: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailAlbedoMap: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailMask: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _DetailNormalMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _DispTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _EmissionMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _MainTex: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _MetallicGlossMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | - _NoiseTex: 58 | m_Texture: {fileID: 2800000, guid: c817a1f974d79234a92be349570e174a, type: 3} 59 | m_Scale: {x: 1, y: 1} 60 | m_Offset: {x: 0, y: 0} 61 | - _NormalTex: 62 | m_Texture: {fileID: 0} 63 | m_Scale: {x: 1, y: 1} 64 | m_Offset: {x: 0, y: 0} 65 | - _OcclusionMap: 66 | m_Texture: {fileID: 0} 67 | m_Scale: {x: 1, y: 1} 68 | m_Offset: {x: 0, y: 0} 69 | - _ParallaxMap: 70 | m_Texture: {fileID: 0} 71 | m_Scale: {x: 1, y: 1} 72 | m_Offset: {x: 0, y: 0} 73 | m_Floats: 74 | - _BumpScale: 1 75 | - _Choppiness: 100 76 | - _Cutoff: 0.5 77 | - _DetailNormalMapScale: 1 78 | - _DstBlend: 0 79 | - _EdgeLength: 16 80 | - _GlossMapScale: 1 81 | - _Glossiness: 0.7 82 | - _GlossyReflections: 1 83 | - _Metal: 0 84 | - _Metallic: 0 85 | - _Mode: 0 86 | - _OcclusionStrength: 1 87 | - _Parallax: 0.02 88 | - _Smoothness: 0.7 89 | - _SmoothnessTextureChannel: 0 90 | - _SpecularHighlights: 1 91 | - _SrcBlend: 1 92 | - _UVSec: 0 93 | - _ZWrite: 1 94 | m_Colors: 95 | - _Color: {r: 1, g: 1, b: 1, a: 1} 96 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 97 | - _SeaColor: {r: 0.10942906, g: 0.2911109, b: 0.64705884, a: 1} 98 | -------------------------------------------------------------------------------- /Assets/Resources/Ocean.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6dcda722a0f8c1c4f8f05c84a9019b09 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: deb11d4210c158d4faa427644a4b6941 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Bullshit.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(Camera))] 6 | public class Bullshit : MonoBehaviour { 7 | public Material projectorMat; 8 | public float OceanLevel = 0; 9 | 10 | Camera cam; 11 | 12 | class FrustrumPoint 13 | { 14 | public Vector4 localPos; 15 | public Vector4 worldPos; 16 | } 17 | 18 | // Use this for initialization 19 | void Start () { 20 | cam = GetComponent(); 21 | CreateGrid(); 22 | } 23 | 24 | // Update is called once per frame 25 | void Update () { 26 | GetCrossPoint(); 27 | MakeRangeMatrix(); 28 | MeshTransformKeep(); 29 | } 30 | 31 | #region 防止裁剪 32 | void MeshTransformKeep() 33 | { 34 | GridTransform.rotation = Quaternion.Euler(Vector3.zero); 35 | } 36 | #endregion 37 | 38 | #region 调试用 39 | void OnDrawGizmos() 40 | { 41 | if (cam == null) return; 42 | Matrix4x4 matrixV = cam.worldToCameraMatrix; 43 | Matrix4x4 matrixP = cam.projectionMatrix; 44 | var ivp = (matrixP * matrixV).inverse; 45 | //foreach (var v in frustrumCorner) 46 | //{ 47 | // Gizmos.DrawSphere(cameraToWorld(v), 0.1f); 48 | //} 49 | //foreach (var v in crossPoints) 50 | //{ 51 | // Gizmos.DrawSphere(v.worldPos, 0.1f); 52 | //} 53 | if (crossPoints.Count <= 3) return; 54 | Vector3 s1 = (Vector3)(crossPoints[1].worldPos - crossPoints[0].worldPos); 55 | Vector3 s2 = (Vector3)(crossPoints[3].worldPos - crossPoints[1].worldPos); 56 | Vector3 s3 = (Vector3)(crossPoints[1].worldPos - crossPoints[2].worldPos); 57 | Vector3 s4 = (Vector3)(crossPoints[3].worldPos - crossPoints[1].worldPos); 58 | Vector3 d1 = Vector3.Cross(s1, s2); 59 | Vector3 d2 = Vector3.Cross(s3, s4); 60 | //if (Vector3.Dot(d1, d2) > 0) 61 | //{ 62 | // Gizmos.DrawLine(crossPoints[0].worldPos, crossPoints[2].worldPos); 63 | // Gizmos.DrawLine(crossPoints[1].worldPos, crossPoints[3].worldPos); 64 | // Gizmos.DrawLine(crossPoints[0].worldPos, crossPoints[1].worldPos); 65 | // Gizmos.DrawLine(crossPoints[2].worldPos, crossPoints[3].worldPos); 66 | //} 67 | //else 68 | //{ 69 | // Gizmos.DrawLine(crossPoints[0].worldPos, crossPoints[3].worldPos); 70 | // Gizmos.DrawLine(crossPoints[1].worldPos, crossPoints[2].worldPos); 71 | // Gizmos.DrawLine(crossPoints[0].worldPos, crossPoints[1].worldPos); 72 | // Gizmos.DrawLine(crossPoints[2].worldPos, crossPoints[3].worldPos); 73 | //} 74 | //for (int i = 0; i < crossPoints.Count - 1; i++) 75 | //{ 76 | // Gizmos.DrawLine(crossPoints[i].worldPos, crossPoints[i + 1].worldPos); 77 | //} 78 | //Gizmos.DrawLine(crossPoints[crossPoints.Count - 1].worldPos, crossPoints[0].worldPos); 79 | Gizmos.color = Color.red; 80 | Gizmos.DrawLine(crossPoints[0].worldPos, crossPoints[1].worldPos); 81 | 82 | Gizmos.color = Color.yellow; 83 | Gizmos.DrawLine(crossPoints[1].worldPos, crossPoints[2].worldPos); 84 | 85 | Gizmos.color = Color.green; 86 | Gizmos.DrawLine(crossPoints[2].worldPos, crossPoints[3].worldPos); 87 | 88 | Gizmos.color = Color.blue; 89 | Gizmos.DrawLine(crossPoints[3].worldPos, crossPoints[0].worldPos); 90 | } 91 | #endregion 92 | 93 | #region 遍历交点,传入矩阵 94 | Matrix4x4 matrixR; 95 | void MakeRangeMatrix() 96 | { 97 | matrixR = Matrix4x4.zero; 98 | if (crossPoints.Count < 3) 99 | return; 100 | if (crossPoints.Count == 3) 101 | { 102 | Vector3 t1 = (Vector3)(crossPoints[1].worldPos - crossPoints[0].worldPos); 103 | Vector3 t2 = (Vector3)(crossPoints[2].worldPos - crossPoints[1].worldPos); 104 | if (Vector3.Cross(t1, t2).y > 0) 105 | { 106 | matrixR.SetRow(2, crossPoints[0].worldPos); 107 | matrixR.SetRow(0, crossPoints[0].worldPos); 108 | matrixR.SetRow(3, crossPoints[1].worldPos); 109 | matrixR.SetRow(1, crossPoints[2].worldPos); 110 | } 111 | else 112 | { 113 | matrixR.SetRow(0, crossPoints[0].worldPos); 114 | matrixR.SetRow(2, crossPoints[0].worldPos); 115 | matrixR.SetRow(1, crossPoints[1].worldPos); 116 | matrixR.SetRow(3, crossPoints[2].worldPos); 117 | } 118 | projectorMat.SetMatrix("_RangeMatrix", matrixR); 119 | return; 120 | } 121 | // 0 1 122 | // 123 | // 3 2 124 | Resort4Point(ref crossPoints); 125 | matrixR.SetRow(0, crossPoints[0].worldPos); 126 | matrixR.SetRow(1, crossPoints[3].worldPos); 127 | matrixR.SetRow(2, crossPoints[1].worldPos); 128 | matrixR.SetRow(3, crossPoints[2].worldPos); 129 | projectorMat.SetMatrix("_RangeMatrix", matrixR); 130 | } 131 | 132 | void Resort4Point(ref List list) 133 | { 134 | Vector3 s1 = (Vector3)(crossPoints[1].worldPos - crossPoints[0].worldPos); 135 | Vector3 s2 = (Vector3)(crossPoints[2].worldPos - crossPoints[1].worldPos); 136 | Vector3 d1 = Vector3.Cross(s1, s2); 137 | //第一次交换,保证前3点次序 138 | if (d1.y < 0) 139 | { 140 | FrustrumPoint t = crossPoints[1]; 141 | crossPoints[1] = crossPoints[2]; 142 | crossPoints[2] = t; 143 | } 144 | s1 = (Vector3)(crossPoints[2].worldPos - crossPoints[1].worldPos); 145 | s2 = (Vector3)(crossPoints[3].worldPos - crossPoints[2].worldPos); 146 | Vector3 s3 = (Vector3)(crossPoints[0].worldPos - crossPoints[3].worldPos); 147 | Vector3 s4 = (Vector3)(crossPoints[1].worldPos - crossPoints[0].worldPos); 148 | d1 = Vector3.Cross(s1, s2); 149 | Vector3 d2 = Vector3.Cross(s2, s3); 150 | Vector3 d3 = Vector3.Cross(s3, s4); 151 | //第二次交换,保证4点次序 152 | if (d1.y * d2.y < 0) 153 | { 154 | FrustrumPoint t = crossPoints[2]; 155 | crossPoints[2] = crossPoints[1]; 156 | crossPoints[1] = t; 157 | } 158 | else if (d2.y * d3.y < 0) 159 | { 160 | FrustrumPoint t = crossPoints[3]; 161 | crossPoints[3] = crossPoints[2]; 162 | crossPoints[2] = t; 163 | } 164 | //最后判断是否正面朝上 165 | s1 = (Vector3)(crossPoints[2].worldPos - crossPoints[1].worldPos); 166 | s2 = (Vector3)(crossPoints[3].worldPos - crossPoints[2].worldPos); 167 | d1 = Vector3.Cross(s1, s2); 168 | if (d1.y < 0) 169 | { 170 | FrustrumPoint t = crossPoints[3]; 171 | crossPoints[3] = crossPoints[0]; 172 | crossPoints[0] = t; 173 | t = crossPoints[2]; 174 | crossPoints[2] = crossPoints[1]; 175 | crossPoints[1] = t; 176 | } 177 | } 178 | #endregion 179 | 180 | #region 交点计算 181 | [SerializeField] 182 | float outScale = 0.1f; 183 | readonly Vector4[] frustrumCorner = new Vector4[]{ 184 | // near 185 | new Vector4(-1, -1, -1, 1), 186 | new Vector4( 1, -1, -1, 1), 187 | new Vector4( 1, 1, -1, 1), 188 | new Vector4(-1, 1, -1, 1), 189 | // far 190 | new Vector4(-1, -1, 1, 1), 191 | new Vector4( 1, -1, 1, 1), 192 | new Vector4( 1, 1, 1, 1), 193 | new Vector4(-1, 1, 1, 1) 194 | }; 195 | 196 | readonly static int[,] segments = { 197 | {0,1}, {1,2}, {2,3}, {3,0}, 198 | {4,5}, {5,6}, {6,7}, {7,4}, 199 | {0,4}, {1,5}, {2,6}, {3,7} 200 | }; 201 | 202 | List crossPoints; 203 | Matrix4x4 Matrix_I_VP; 204 | Matrix4x4 Matrix_VP; 205 | 206 | void GetCrossPoint() 207 | { 208 | if (crossPoints == null) 209 | crossPoints = new List(); 210 | crossPoints.Clear(); 211 | Matrix_VP = cam.projectionMatrix * cam.worldToCameraMatrix; 212 | Matrix_I_VP = Matrix_VP.inverse; 213 | for (int i = 0; i < 12; i++) 214 | { 215 | FrustrumPoint crossPoint = new FrustrumPoint(); 216 | if (IsSegmentIntersectOcean(segments[i, 0], segments[i, 1], OceanLevel, ref crossPoint)) 217 | { 218 | crossPoints.Add(crossPoint); 219 | } 220 | } 221 | //为了留出裕度,统统向外扩张5% 222 | Vector4 middle = Vector4.zero; 223 | foreach (var p in crossPoints) 224 | { 225 | middle += p.worldPos; 226 | } 227 | middle /= crossPoints.Count; 228 | for (int i = 0; i < crossPoints.Count; i++) 229 | { 230 | crossPoints[i].worldPos = (crossPoints[i].worldPos - middle) * (1 + outScale) + middle; 231 | } 232 | } 233 | 234 | Vector4 cameraToWorld(Vector4 localPos) 235 | { 236 | Vector4 res = Matrix_I_VP * localPos; 237 | res /= res.w; 238 | return res; 239 | } 240 | 241 | Vector4 worldToCamera(Vector4 worldSpace) 242 | { 243 | Vector4 res = Matrix_VP * worldSpace; 244 | res /= res.w; 245 | return res; 246 | } 247 | 248 | private bool IsSegmentIntersectOcean(int p1, int p2, float OceanLevel, ref FrustrumPoint crossPoint) 249 | { 250 | Vector4 a = cameraToWorld(frustrumCorner[p1]); 251 | Vector4 b = cameraToWorld(frustrumCorner[p2]); 252 | if ((a.y - OceanLevel) * (b.y - OceanLevel) > 0) return false; //同侧无交点 253 | var p = (OceanLevel - a.y) / (b.y - a.y); 254 | crossPoint = new FrustrumPoint(); 255 | crossPoint.worldPos = new Vector4( 256 | a.x + p * (b.x - a.x), 257 | OceanLevel, 258 | a.z + p * (b.z - a.z), 259 | 1); 260 | crossPoint.localPos = worldToCamera(crossPoint.worldPos); 261 | return true; 262 | } 263 | 264 | #endregion 265 | 266 | #region 网格创建 267 | readonly int MaxVerticeCount = 65000; 268 | int tDivide; 269 | Transform GridTransform; 270 | void CreateGrid() 271 | { 272 | int w = Screen.width, h = Screen.height; 273 | tDivide = 1; 274 | do 275 | { 276 | w = Screen.width / tDivide; 277 | h = Screen.height / tDivide; 278 | tDivide++; 279 | } 280 | while (w * h > MaxVerticeCount); 281 | Mesh mesh = MakeMesh(w, h); 282 | GameObject grid = new GameObject("ProjectedOceanMesh"); 283 | grid.transform.SetParent(transform); 284 | //扔在视锥体前方,防止被裁剪 285 | grid.transform.localPosition = new Vector3(0, 0, 10); 286 | MeshFilter mf = grid.AddComponent(); 287 | MeshRenderer mr = grid.AddComponent(); 288 | 289 | mf.sharedMesh = mesh; 290 | //mr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; 291 | //mr.receiveShadows = false; 292 | //mr.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion; 293 | mr.sharedMaterial = projectorMat; 294 | GridTransform = grid.transform; 295 | } 296 | 297 | 298 | // Make Mesh with given width and given height 299 | Mesh MakeMesh(int W, int H) 300 | { 301 | Vector3[] vertices = new Vector3[W * H]; 302 | Vector2[] texcoords = new Vector2[W * H]; 303 | int[] indices = new int[(W - 1) * (H - 1) * 6]; 304 | 305 | for (int x = 0; x < W; x++) 306 | { 307 | for (int y = 0; y < H; y++) 308 | { 309 | Vector2 uv = new Vector3((float)x / (float)(W - 1), (float)y / (float)(H - 1)); 310 | Vector3 pos = new Vector3(x, 0, y) * 0.00001f; 311 | texcoords[x + y * W] = uv; 312 | vertices[x + y * W] = pos; 313 | } 314 | } 315 | int num = 0; 316 | for (int x = 0; x < W - 1; x++) 317 | { 318 | for (int y = 0; y < H - 1; y++) 319 | { 320 | indices[num++] = x + y * W; 321 | indices[num++] = x + (y + 1) * W; 322 | indices[num++] = (x + 1) + y * W; 323 | 324 | indices[num++] = x + (y + 1) * W; 325 | indices[num++] = (x + 1) + (y + 1) * W; 326 | indices[num++] = (x + 1) + y * W; 327 | } 328 | } 329 | Mesh mesh = new Mesh(); 330 | mesh.vertices = vertices; 331 | mesh.uv = texcoords; 332 | mesh.triangles = indices; 333 | mesh.UploadMeshData(false); 334 | mesh.RecalculateNormals(); 335 | return mesh; 336 | } 337 | #endregion 338 | } 339 | -------------------------------------------------------------------------------- /Assets/Scripts/Bullshit.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 376a035cc678f654d98b201c629a9020 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/WaveSpectrum.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(Bullshit))] 6 | public class WaveSpectrum : MonoBehaviour { 7 | [SerializeField] 8 | int N = 512; //傅里叶级数,需为2的N次幂 9 | [SerializeField] 10 | float L = 200f; //实际范围 11 | //波幅常数A 12 | [SerializeField] 13 | float amplitude = 0.0002f; 14 | //风速和风向 15 | [SerializeField] 16 | Vector2 windDir = new Vector2(32.0f, 32.0f); 17 | Vector2 windDir_normal; 18 | [SerializeField] 19 | float windVelocity; 20 | 21 | #region Mono 22 | void Start() 23 | { 24 | //统一N 25 | if (!Mathf.IsPowerOfTwo(N)) N = Mathf.NextPowerOfTwo(N); 26 | texButterfly = InitButterflyToTexture(); 27 | windDir_normal = windDir.normalized; 28 | FFTInit(); 29 | SpectrumInit(); 30 | MaterialInit(); 31 | OceanMatInit(); 32 | FresnelInit(); 33 | } 34 | 35 | // Update is called once per frame 36 | void Update () { 37 | float time = Time.time; 38 | SpectrumUpdate(time); 39 | FFTUpdate(bufferSpectrumH, bufferHFinal); 40 | FFTUpdate(bufferSpectrumDx, bufferDxFinal); 41 | FFTUpdate(bufferSpectrumDy, bufferDyFinal); 42 | Combine(); 43 | } 44 | 45 | void LateUpdate() 46 | { 47 | OceanLateUpdate(); 48 | } 49 | #endregion 50 | #region 菲涅尔预计算 51 | [SerializeField] 52 | Texture2D fresnelLookupTex; 53 | void FresnelInit() 54 | { 55 | fresnelLookupTex = new Texture2D(512, 1, TextureFormat.RFloat, false); 56 | float t = 1 / 511f; 57 | for (int i = 0; i < 512; i++) 58 | { 59 | float cosTheta = i * t; 60 | float schilick = Schilick(cosTheta); 61 | fresnelLookupTex.SetPixel(i, 0, new Color(schilick, 0, 0, 1)); 62 | } 63 | fresnelLookupTex.Apply(); 64 | } 65 | 66 | // Schilick近似:R(\theta)=R(0)+(1-R(0))(1-cos\theta_i)^5 67 | float Schilick(float cost) 68 | { 69 | float water_n = 1.333f; 70 | float R0 = (1 - water_n) / (1 + water_n); 71 | R0 *= R0; 72 | return R0 + (1 - R0) * Mathf.Pow(1 - cost, 5); 73 | } 74 | #endregion 75 | #region 蝶形运算 76 | [SerializeField] 77 | Texture2D texButterfly; 78 | Texture2D InitButterflyToTexture() 79 | { 80 | int logN = (int)(Mathf.Log(N, 2)); 81 | var butterflyData = new Vector2[N * logN]; 82 | //offset = 当前层数的偏移量 83 | //numIterations = 当前层数的总共有几个数据 84 | int offset = 1, numIterations = N >> 1; 85 | //逐行填充蝶形运算数据 86 | for (int row = 0; row < logN; row++) 87 | { 88 | int rowStart = row * N; 89 | //start和end用于记录本次录制的区域,毕竟蝶形操作越往后有效的数据越少 90 | int start = 0, end = 2 * offset; 91 | float singlePhase = 2f * Mathf.PI * numIterations / N; 92 | for (int i = 0; i < numIterations; i++) 93 | { 94 | int K = 0; 95 | for (int k = start; k < end; k += 2) 96 | { 97 | //计算需要用的w^k_n 98 | float phase = K * singlePhase; 99 | float cos = Mathf.Cos(phase); 100 | float sin = Mathf.Sin(phase); 101 | int hk = k >> 1; 102 | //总之就是随着递归阶段的上升,offset增加 103 | butterflyData[rowStart + hk].x = cos; 104 | butterflyData[rowStart + hk].y = -sin; 105 | butterflyData[rowStart + hk + offset].x = -cos; 106 | butterflyData[rowStart + hk + offset].y = sin; 107 | K++; 108 | } 109 | start += 4 * offset; 110 | end = start + 2 * offset; 111 | } 112 | numIterations >>= 1; 113 | offset <<= 1; 114 | } 115 | //填充进texture2D中,为保证进度,使用16位R和G 116 | texButterfly = new Texture2D(N, logN, TextureFormat.RGHalf, false); 117 | for (int y = 0; y < logN; y++) 118 | { 119 | for (int x = 0; x < N; x++) 120 | { 121 | int idx = y * N + x; 122 | texButterfly.SetPixel(x, y, new Color(butterflyData[idx].x, butterflyData[idx].y, 0)); 123 | } 124 | } 125 | texButterfly.Apply(false, true); 126 | return texButterfly; 127 | } 128 | #endregion 129 | #region Compute Shader调用 130 | private ComputeShader shaderSpectrum; 131 | [SerializeField] 132 | private RenderTexture bufferSpectrumH0; 133 | [SerializeField] 134 | private RenderTexture bufferSpectrumH; 135 | [SerializeField] 136 | private RenderTexture bufferSpectrumDx; 137 | [SerializeField] 138 | private RenderTexture bufferSpectrumDy; 139 | private int kernelSpectrumInit; 140 | private int kernelSpectrumUpdate; 141 | 142 | void SpectrumInit() 143 | { 144 | shaderSpectrum = (ComputeShader)Resources.Load("EncinoSpectrum", typeof(ComputeShader)); 145 | kernelSpectrumInit = shaderSpectrum.FindKernel("EncinoSpectrumInit"); 146 | kernelSpectrumUpdate = shaderSpectrum.FindKernel("EncinoSpectrumUpdate"); 147 | //准备h0频谱图 148 | bufferSpectrumH0 = new RenderTexture(N, N, 0, RenderTextureFormat.ARGBFloat); 149 | bufferSpectrumH0.enableRandomWrite = true; 150 | bufferSpectrumH0.Create(); 151 | bufferSpectrumH = CreateSpectrumUAV(); 152 | bufferSpectrumDx = CreateSpectrumUAV(); 153 | bufferSpectrumDy = CreateSpectrumUAV(); 154 | } 155 | 156 | void SpectrumUpdate(float time) 157 | { 158 | //第一步,计算h0 159 | shaderSpectrum.SetInt("N", N); 160 | shaderSpectrum.SetFloat("L", L); 161 | shaderSpectrum.SetFloats("windDir_normal", windDir_normal.x, windDir_normal.y); 162 | shaderSpectrum.SetFloat("windVelocity", windVelocity); 163 | shaderSpectrum.SetTexture(kernelSpectrumInit, "outputH0", bufferSpectrumH0); 164 | shaderSpectrum.Dispatch(kernelSpectrumInit, N / 8, N / 8, 1); 165 | //第二步,根据时间计算h' 166 | shaderSpectrum.SetFloat("time", time); 167 | shaderSpectrum.SetTexture(kernelSpectrumUpdate, "inputH0", bufferSpectrumH0); 168 | shaderSpectrum.SetTexture(kernelSpectrumUpdate, "outputH", bufferSpectrumH); 169 | shaderSpectrum.SetTexture(kernelSpectrumUpdate, "outputDx", bufferSpectrumDx); 170 | shaderSpectrum.SetTexture(kernelSpectrumUpdate, "outputDy", bufferSpectrumDy); 171 | shaderSpectrum.Dispatch(kernelSpectrumUpdate, N / 8, N / 8, 1); 172 | } 173 | 174 | RenderTexture CreateSpectrumUAV() 175 | { 176 | var uav = new RenderTexture(N, N, 0, RenderTextureFormat.ARGBFloat); 177 | uav.enableRandomWrite = true; 178 | uav.Create(); 179 | return uav; 180 | } 181 | #endregion 182 | #region FFT调用 183 | ComputeShader shaderFFT; 184 | RenderTexture bufferFFTTemp; 185 | int kernelFFTX = 0; 186 | int kernelFFTY = 1; 187 | [SerializeField] 188 | private RenderTexture bufferHFinal; 189 | [SerializeField] 190 | private RenderTexture bufferDxFinal; 191 | [SerializeField] 192 | private RenderTexture bufferDyFinal; 193 | 194 | void FFTInit() 195 | { 196 | shaderFFT = (ComputeShader)Resources.Load("EncinoFFT", typeof(ComputeShader)); 197 | int log2difference = (int)Mathf.Log(2, N / 256); 198 | kernelFFTX = log2difference * 2; 199 | kernelFFTY = kernelFFTX + 1; 200 | // 201 | bufferFFTTemp = new RenderTexture(N, N, 0, RenderTextureFormat.RGFloat); 202 | bufferFFTTemp.enableRandomWrite = true; 203 | bufferFFTTemp.Create(); 204 | 205 | bufferHFinal = CreateFinalTexture(); 206 | bufferDxFinal = CreateFinalTexture(); 207 | bufferDyFinal = CreateFinalTexture(); 208 | } 209 | 210 | void FFTUpdate(RenderTexture spectrum, RenderTexture output) 211 | { 212 | shaderFFT.SetTexture(kernelFFTX, "input", spectrum); 213 | shaderFFT.SetTexture(kernelFFTX, "inputButterfly", texButterfly); 214 | shaderFFT.SetTexture(kernelFFTX, "output", bufferFFTTemp); 215 | shaderFFT.Dispatch(kernelFFTX, 1, N, 1); 216 | shaderFFT.SetTexture(kernelFFTY, "input", bufferFFTTemp); 217 | shaderFFT.SetTexture(kernelFFTY, "inputButterfly", texButterfly); 218 | shaderFFT.SetTexture(kernelFFTY, "output", output); 219 | shaderFFT.Dispatch(kernelFFTY, N, 1, 1); 220 | } 221 | 222 | RenderTexture CreateFinalTexture() 223 | { 224 | var texture = new RenderTexture(N, N, 0, RenderTextureFormat.RFloat); 225 | texture.enableRandomWrite = true; 226 | texture.Create(); 227 | return texture; 228 | } 229 | #endregion 230 | #region 计算法线和偏移 231 | public float choppiness = 2f; 232 | Material combineMat; 233 | private RenderTexture bufferDisplacement; 234 | private RenderTexture bufferGradientFold; 235 | void MaterialInit() 236 | { 237 | combineMat = (Material)Resources.Load("Combine", typeof(Material)); 238 | bufferDisplacement = CreateCombinedTexture(); 239 | bufferGradientFold = CreateCombinedTexture(); 240 | } 241 | 242 | void Combine() 243 | { 244 | if (combineMat == null) return; 245 | combineMat.SetInt("N", N); 246 | combineMat.SetFloat("L", L); 247 | combineMat.SetFloat("invL", 1.0f / L); 248 | combineMat.SetTexture("inputH", bufferHFinal); 249 | combineMat.SetTexture("inputDx", bufferDxFinal); 250 | combineMat.SetTexture("inputDy", bufferDyFinal); 251 | Graphics.SetRenderTarget(new RenderBuffer[] { bufferDisplacement.colorBuffer, bufferGradientFold.colorBuffer }, bufferDisplacement.depthBuffer); 252 | GL.PushMatrix(); 253 | GL.LoadPixelMatrix(0, N, N, 0); 254 | GL.Viewport(new Rect(0, 0, N, N)); 255 | combineMat.SetPass(0); 256 | GL.Begin(GL.QUADS); 257 | GL.TexCoord2(0, 0); 258 | GL.Vertex3(0, 0, 0); 259 | GL.TexCoord2(1, 0); 260 | GL.Vertex3(N, 0, 0); 261 | GL.TexCoord2(1, 1); 262 | GL.Vertex3(N, N, 0); 263 | GL.TexCoord2(0, 1); 264 | GL.Vertex3(0, N, 0); 265 | GL.End(); 266 | GL.PopMatrix(); 267 | Graphics.SetRenderTarget(null); 268 | } 269 | 270 | RenderTexture CreateCombinedTexture() 271 | { 272 | var texture = new RenderTexture(N, N, 0, RenderTextureFormat.ARGBFloat); 273 | texture.enableRandomWrite = true; 274 | texture.useMipMap = true; 275 | texture.autoGenerateMips = true; 276 | texture.filterMode = FilterMode.Bilinear; 277 | texture.wrapMode = TextureWrapMode.Repeat; 278 | texture.Create(); 279 | return texture; 280 | } 281 | #endregion 282 | #region 展示 283 | Material oceanMat; 284 | void OceanMatInit() 285 | { 286 | oceanMat = (Material)Resources.Load("Ocean", typeof(Material)); 287 | } 288 | 289 | void OceanLateUpdate() 290 | { 291 | oceanMat.SetTexture("_NormalTex", bufferGradientFold); 292 | oceanMat.SetTexture("_DispTex", bufferDisplacement); 293 | oceanMat.SetFloat("L", L); 294 | oceanMat.SetFloat("_NormalTexelSize", 2.0f * L / N); 295 | oceanMat.SetFloat("Amplitude", amplitude); 296 | oceanMat.SetFloat("OceanLevel", GetComponent().OceanLevel); 297 | oceanMat.SetTexture("_FresnelLookup", fresnelLookupTex); 298 | } 299 | #endregion 300 | } 301 | -------------------------------------------------------------------------------- /Assets/Scripts/WaveSpectrum.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47e88b7e7b3aeb14fba1f827d8708107 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 14 7 | productGUID: c77f7e442d6f2d941828e28d6a757788 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | defaultScreenOrientation: 4 11 | targetDevice: 2 12 | useOnDemandResources: 0 13 | accelerometerFrequency: 60 14 | companyName: DefaultCompany 15 | productName: FFTOccean 16 | defaultCursor: {fileID: 0} 17 | cursorHotspot: {x: 0, y: 0} 18 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 19 | m_ShowUnitySplashScreen: 1 20 | m_ShowUnitySplashLogo: 1 21 | m_SplashScreenOverlayOpacity: 1 22 | m_SplashScreenAnimation: 1 23 | m_SplashScreenLogoStyle: 1 24 | m_SplashScreenDrawMode: 0 25 | m_SplashScreenBackgroundAnimationZoom: 1 26 | m_SplashScreenLogoAnimationZoom: 1 27 | m_SplashScreenBackgroundLandscapeAspect: 1 28 | m_SplashScreenBackgroundPortraitAspect: 1 29 | m_SplashScreenBackgroundLandscapeUvs: 30 | serializedVersion: 2 31 | x: 0 32 | y: 0 33 | width: 1 34 | height: 1 35 | m_SplashScreenBackgroundPortraitUvs: 36 | serializedVersion: 2 37 | x: 0 38 | y: 0 39 | width: 1 40 | height: 1 41 | m_SplashScreenLogos: [] 42 | m_VirtualRealitySplashScreen: {fileID: 0} 43 | m_HolographicTrackingLossScreen: {fileID: 0} 44 | defaultScreenWidth: 1024 45 | defaultScreenHeight: 768 46 | defaultScreenWidthWeb: 960 47 | defaultScreenHeightWeb: 600 48 | m_StereoRenderingPath: 0 49 | m_ActiveColorSpace: 0 50 | m_MTRendering: 1 51 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 52 | iosShowActivityIndicatorOnLoading: -1 53 | androidShowActivityIndicatorOnLoading: -1 54 | tizenShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidBlitType: 0 67 | defaultIsFullScreen: 1 68 | defaultIsNativeResolution: 1 69 | macRetinaSupport: 1 70 | runInBackground: 0 71 | captureSingleScreen: 0 72 | muteOtherAudioSources: 0 73 | Prepare IOS For Recording: 0 74 | Force IOS Speakers When Recording: 0 75 | deferSystemGesturesMode: 0 76 | hideHomeButton: 0 77 | submitAnalytics: 1 78 | usePlayerLog: 1 79 | bakeCollisionMeshes: 0 80 | forceSingleInstance: 0 81 | resizableWindow: 0 82 | useMacAppStoreValidation: 0 83 | macAppStoreCategory: public.app-category.games 84 | gpuSkinning: 0 85 | graphicsJobs: 0 86 | xboxPIXTextureCapture: 0 87 | xboxEnableAvatar: 0 88 | xboxEnableKinect: 0 89 | xboxEnableKinectAutoTracking: 0 90 | xboxEnableFitness: 0 91 | visibleInBackground: 1 92 | allowFullscreenSwitch: 1 93 | graphicsJobMode: 0 94 | macFullscreenMode: 2 95 | d3d11FullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | n3dsDisableStereoscopicView: 0 102 | n3dsEnableSharedListOpt: 1 103 | n3dsEnableVSync: 0 104 | xboxOneResolution: 0 105 | xboxOneSResolution: 0 106 | xboxOneXResolution: 3 107 | xboxOneMonoLoggingLevel: 0 108 | xboxOneLoggingLevel: 1 109 | xboxOneDisableEsram: 0 110 | xboxOnePresentImmediateThreshold: 0 111 | videoMemoryForVertexBuffers: 0 112 | psp2PowerMode: 0 113 | psp2AcquireBGM: 1 114 | wiiUTVResolution: 0 115 | wiiUGamePadMSAA: 1 116 | wiiUSupportsNunchuk: 0 117 | wiiUSupportsClassicController: 0 118 | wiiUSupportsBalanceBoard: 0 119 | wiiUSupportsMotionPlus: 0 120 | wiiUSupportsProController: 0 121 | wiiUAllowScreenCapture: 1 122 | wiiUControllerCount: 0 123 | m_SupportedAspectRatios: 124 | 4:3: 1 125 | 5:4: 1 126 | 16:10: 1 127 | 16:9: 1 128 | Others: 1 129 | bundleVersion: 1.0 130 | preloadedAssets: [] 131 | metroInputSource: 0 132 | wsaTransparentSwapchain: 0 133 | m_HolographicPauseOnTrackingLoss: 1 134 | xboxOneDisableKinectGpuReservation: 0 135 | xboxOneEnable7thCore: 0 136 | vrSettings: 137 | cardboard: 138 | depthFormat: 0 139 | enableTransitionView: 0 140 | daydream: 141 | depthFormat: 0 142 | useSustainedPerformanceMode: 0 143 | enableVideoLayer: 0 144 | useProtectedVideoMemory: 0 145 | minimumSupportedHeadTracking: 0 146 | maximumSupportedHeadTracking: 1 147 | hololens: 148 | depthFormat: 1 149 | depthBufferSharingEnabled: 0 150 | oculus: 151 | sharedDepthBuffer: 0 152 | dashSupport: 0 153 | protectGraphicsMemory: 0 154 | useHDRDisplay: 0 155 | m_ColorGamuts: 00000000 156 | targetPixelDensity: 30 157 | resolutionScalingMode: 0 158 | androidSupportedAspectRatio: 1 159 | androidMaxAspectRatio: 2.1 160 | applicationIdentifier: {} 161 | buildNumber: {} 162 | AndroidBundleVersionCode: 1 163 | AndroidMinSdkVersion: 16 164 | AndroidTargetSdkVersion: 0 165 | AndroidPreferredInstallLocation: 1 166 | aotOptions: 167 | stripEngineCode: 1 168 | iPhoneStrippingLevel: 0 169 | iPhoneScriptCallOptimization: 0 170 | ForceInternetPermission: 0 171 | ForceSDCardPermission: 0 172 | CreateWallpaper: 0 173 | APKExpansionFiles: 0 174 | keepLoadedShadersAlive: 0 175 | StripUnusedMeshComponents: 0 176 | VertexChannelCompressionMask: 177 | serializedVersion: 2 178 | m_Bits: 238 179 | iPhoneSdkVersion: 988 180 | iOSTargetOSVersionString: 7.0 181 | tvOSSdkVersion: 0 182 | tvOSRequireExtendedGameController: 0 183 | tvOSTargetOSVersionString: 9.0 184 | uIPrerenderedIcon: 0 185 | uIRequiresPersistentWiFi: 0 186 | uIRequiresFullScreen: 1 187 | uIStatusBarHidden: 1 188 | uIExitOnSuspend: 0 189 | uIStatusBarStyle: 0 190 | iPhoneSplashScreen: {fileID: 0} 191 | iPhoneHighResSplashScreen: {fileID: 0} 192 | iPhoneTallHighResSplashScreen: {fileID: 0} 193 | iPhone47inSplashScreen: {fileID: 0} 194 | iPhone55inPortraitSplashScreen: {fileID: 0} 195 | iPhone55inLandscapeSplashScreen: {fileID: 0} 196 | iPhone58inPortraitSplashScreen: {fileID: 0} 197 | iPhone58inLandscapeSplashScreen: {fileID: 0} 198 | iPadPortraitSplashScreen: {fileID: 0} 199 | iPadHighResPortraitSplashScreen: {fileID: 0} 200 | iPadLandscapeSplashScreen: {fileID: 0} 201 | iPadHighResLandscapeSplashScreen: {fileID: 0} 202 | appleTVSplashScreen: {fileID: 0} 203 | appleTVSplashScreen2x: {fileID: 0} 204 | tvOSSmallIconLayers: [] 205 | tvOSSmallIconLayers2x: [] 206 | tvOSLargeIconLayers: [] 207 | tvOSTopShelfImageLayers: [] 208 | tvOSTopShelfImageLayers2x: [] 209 | tvOSTopShelfImageWideLayers: [] 210 | tvOSTopShelfImageWideLayers2x: [] 211 | iOSLaunchScreenType: 0 212 | iOSLaunchScreenPortrait: {fileID: 0} 213 | iOSLaunchScreenLandscape: {fileID: 0} 214 | iOSLaunchScreenBackgroundColor: 215 | serializedVersion: 2 216 | rgba: 0 217 | iOSLaunchScreenFillPct: 100 218 | iOSLaunchScreenSize: 100 219 | iOSLaunchScreenCustomXibPath: 220 | iOSLaunchScreeniPadType: 0 221 | iOSLaunchScreeniPadImage: {fileID: 0} 222 | iOSLaunchScreeniPadBackgroundColor: 223 | serializedVersion: 2 224 | rgba: 0 225 | iOSLaunchScreeniPadFillPct: 100 226 | iOSLaunchScreeniPadSize: 100 227 | iOSLaunchScreeniPadCustomXibPath: 228 | iOSUseLaunchScreenStoryboard: 0 229 | iOSLaunchScreenCustomStoryboardPath: 230 | iOSDeviceRequirements: [] 231 | iOSURLSchemes: [] 232 | iOSBackgroundModes: 0 233 | iOSMetalForceHardShadows: 0 234 | metalEditorSupport: 1 235 | metalAPIValidation: 1 236 | iOSRenderExtraFrameOnPause: 0 237 | appleDeveloperTeamID: 238 | iOSManualSigningProvisioningProfileID: 239 | tvOSManualSigningProvisioningProfileID: 240 | appleEnableAutomaticSigning: 0 241 | clonedFromGUID: 00000000000000000000000000000000 242 | AndroidTargetDevice: 0 243 | AndroidSplashScreenScale: 0 244 | androidSplashScreen: {fileID: 0} 245 | AndroidKeystoreName: 246 | AndroidKeyaliasName: 247 | AndroidTVCompatibility: 1 248 | AndroidIsGame: 1 249 | AndroidEnableTango: 0 250 | androidEnableBanner: 1 251 | androidUseLowAccuracyLocation: 0 252 | m_AndroidBanners: 253 | - width: 320 254 | height: 180 255 | banner: {fileID: 0} 256 | androidGamepadSupportLevel: 0 257 | resolutionDialogBanner: {fileID: 0} 258 | m_BuildTargetIcons: [] 259 | m_BuildTargetBatching: [] 260 | m_BuildTargetGraphicsAPIs: [] 261 | m_BuildTargetVRSettings: [] 262 | m_BuildTargetEnableVuforiaSettings: [] 263 | openGLRequireES31: 0 264 | openGLRequireES31AEP: 0 265 | m_TemplateCustomTags: {} 266 | mobileMTRendering: 267 | Android: 1 268 | iPhone: 1 269 | tvOS: 1 270 | m_BuildTargetGroupLightmapEncodingQuality: [] 271 | wiiUTitleID: 0005000011000000 272 | wiiUGroupID: 00010000 273 | wiiUCommonSaveSize: 4096 274 | wiiUAccountSaveSize: 2048 275 | wiiUOlvAccessKey: 0 276 | wiiUTinCode: 0 277 | wiiUJoinGameId: 0 278 | wiiUJoinGameModeMask: 0000000000000000 279 | wiiUCommonBossSize: 0 280 | wiiUAccountBossSize: 0 281 | wiiUAddOnUniqueIDs: [] 282 | wiiUMainThreadStackSize: 3072 283 | wiiULoaderThreadStackSize: 1024 284 | wiiUSystemHeapSize: 128 285 | wiiUTVStartupScreen: {fileID: 0} 286 | wiiUGamePadStartupScreen: {fileID: 0} 287 | wiiUDrcBufferDisabled: 0 288 | wiiUProfilerLibPath: 289 | playModeTestRunnerEnabled: 0 290 | actionOnDotNetUnhandledException: 1 291 | enableInternalProfiler: 0 292 | logObjCUncaughtExceptions: 1 293 | enableCrashReportAPI: 0 294 | cameraUsageDescription: 295 | locationUsageDescription: 296 | microphoneUsageDescription: 297 | switchNetLibKey: 298 | switchSocketMemoryPoolSize: 6144 299 | switchSocketAllocatorPoolSize: 128 300 | switchSocketConcurrencyLimit: 14 301 | switchScreenResolutionBehavior: 2 302 | switchUseCPUProfiler: 0 303 | switchApplicationID: 0x01004b9000490000 304 | switchNSODependencies: 305 | switchTitleNames_0: 306 | switchTitleNames_1: 307 | switchTitleNames_2: 308 | switchTitleNames_3: 309 | switchTitleNames_4: 310 | switchTitleNames_5: 311 | switchTitleNames_6: 312 | switchTitleNames_7: 313 | switchTitleNames_8: 314 | switchTitleNames_9: 315 | switchTitleNames_10: 316 | switchTitleNames_11: 317 | switchTitleNames_12: 318 | switchTitleNames_13: 319 | switchTitleNames_14: 320 | switchPublisherNames_0: 321 | switchPublisherNames_1: 322 | switchPublisherNames_2: 323 | switchPublisherNames_3: 324 | switchPublisherNames_4: 325 | switchPublisherNames_5: 326 | switchPublisherNames_6: 327 | switchPublisherNames_7: 328 | switchPublisherNames_8: 329 | switchPublisherNames_9: 330 | switchPublisherNames_10: 331 | switchPublisherNames_11: 332 | switchPublisherNames_12: 333 | switchPublisherNames_13: 334 | switchPublisherNames_14: 335 | switchIcons_0: {fileID: 0} 336 | switchIcons_1: {fileID: 0} 337 | switchIcons_2: {fileID: 0} 338 | switchIcons_3: {fileID: 0} 339 | switchIcons_4: {fileID: 0} 340 | switchIcons_5: {fileID: 0} 341 | switchIcons_6: {fileID: 0} 342 | switchIcons_7: {fileID: 0} 343 | switchIcons_8: {fileID: 0} 344 | switchIcons_9: {fileID: 0} 345 | switchIcons_10: {fileID: 0} 346 | switchIcons_11: {fileID: 0} 347 | switchIcons_12: {fileID: 0} 348 | switchIcons_13: {fileID: 0} 349 | switchIcons_14: {fileID: 0} 350 | switchSmallIcons_0: {fileID: 0} 351 | switchSmallIcons_1: {fileID: 0} 352 | switchSmallIcons_2: {fileID: 0} 353 | switchSmallIcons_3: {fileID: 0} 354 | switchSmallIcons_4: {fileID: 0} 355 | switchSmallIcons_5: {fileID: 0} 356 | switchSmallIcons_6: {fileID: 0} 357 | switchSmallIcons_7: {fileID: 0} 358 | switchSmallIcons_8: {fileID: 0} 359 | switchSmallIcons_9: {fileID: 0} 360 | switchSmallIcons_10: {fileID: 0} 361 | switchSmallIcons_11: {fileID: 0} 362 | switchSmallIcons_12: {fileID: 0} 363 | switchSmallIcons_13: {fileID: 0} 364 | switchSmallIcons_14: {fileID: 0} 365 | switchManualHTML: 366 | switchAccessibleURLs: 367 | switchLegalInformation: 368 | switchMainThreadStackSize: 1048576 369 | switchPresenceGroupId: 370 | switchLogoHandling: 0 371 | switchReleaseVersion: 0 372 | switchDisplayVersion: 1.0.0 373 | switchStartupUserAccount: 0 374 | switchTouchScreenUsage: 0 375 | switchSupportedLanguagesMask: 0 376 | switchLogoType: 0 377 | switchApplicationErrorCodeCategory: 378 | switchUserAccountSaveDataSize: 0 379 | switchUserAccountSaveDataJournalSize: 0 380 | switchApplicationAttribute: 0 381 | switchCardSpecSize: -1 382 | switchCardSpecClock: -1 383 | switchRatingsMask: 0 384 | switchRatingsInt_0: 0 385 | switchRatingsInt_1: 0 386 | switchRatingsInt_2: 0 387 | switchRatingsInt_3: 0 388 | switchRatingsInt_4: 0 389 | switchRatingsInt_5: 0 390 | switchRatingsInt_6: 0 391 | switchRatingsInt_7: 0 392 | switchRatingsInt_8: 0 393 | switchRatingsInt_9: 0 394 | switchRatingsInt_10: 0 395 | switchRatingsInt_11: 0 396 | switchLocalCommunicationIds_0: 397 | switchLocalCommunicationIds_1: 398 | switchLocalCommunicationIds_2: 399 | switchLocalCommunicationIds_3: 400 | switchLocalCommunicationIds_4: 401 | switchLocalCommunicationIds_5: 402 | switchLocalCommunicationIds_6: 403 | switchLocalCommunicationIds_7: 404 | switchParentalControl: 0 405 | switchAllowsScreenshot: 1 406 | switchAllowsVideoCapturing: 1 407 | switchAllowsRuntimeAddOnContentInstall: 0 408 | switchDataLossConfirmation: 0 409 | switchUserAccountLockEnabled: 0 410 | switchSupportedNpadStyles: 3 411 | switchSocketConfigEnabled: 0 412 | switchTcpInitialSendBufferSize: 32 413 | switchTcpInitialReceiveBufferSize: 64 414 | switchTcpAutoSendBufferSizeMax: 256 415 | switchTcpAutoReceiveBufferSizeMax: 256 416 | switchUdpSendBufferSize: 9 417 | switchUdpReceiveBufferSize: 42 418 | switchSocketBufferEfficiency: 4 419 | switchSocketInitializeEnabled: 1 420 | switchNetworkInterfaceManagerInitializeEnabled: 1 421 | switchPlayerConnectionEnabled: 1 422 | ps4NPAgeRating: 12 423 | ps4NPTitleSecret: 424 | ps4NPTrophyPackPath: 425 | ps4ParentalLevel: 11 426 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 427 | ps4Category: 0 428 | ps4MasterVersion: 01.00 429 | ps4AppVersion: 01.00 430 | ps4AppType: 0 431 | ps4ParamSfxPath: 432 | ps4VideoOutPixelFormat: 0 433 | ps4VideoOutInitialWidth: 1920 434 | ps4VideoOutBaseModeInitialWidth: 1920 435 | ps4VideoOutReprojectionRate: 60 436 | ps4PronunciationXMLPath: 437 | ps4PronunciationSIGPath: 438 | ps4BackgroundImagePath: 439 | ps4StartupImagePath: 440 | ps4StartupImagesFolder: 441 | ps4IconImagesFolder: 442 | ps4SaveDataImagePath: 443 | ps4SdkOverride: 444 | ps4BGMPath: 445 | ps4ShareFilePath: 446 | ps4ShareOverlayImagePath: 447 | ps4PrivacyGuardImagePath: 448 | ps4NPtitleDatPath: 449 | ps4RemotePlayKeyAssignment: -1 450 | ps4RemotePlayKeyMappingDir: 451 | ps4PlayTogetherPlayerCount: 0 452 | ps4EnterButtonAssignment: 1 453 | ps4ApplicationParam1: 0 454 | ps4ApplicationParam2: 0 455 | ps4ApplicationParam3: 0 456 | ps4ApplicationParam4: 0 457 | ps4DownloadDataSize: 0 458 | ps4GarlicHeapSize: 2048 459 | ps4ProGarlicHeapSize: 2560 460 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 461 | ps4pnSessions: 1 462 | ps4pnPresence: 1 463 | ps4pnFriends: 1 464 | ps4pnGameCustomData: 1 465 | playerPrefsSupport: 0 466 | restrictedAudioUsageRights: 0 467 | ps4UseResolutionFallback: 0 468 | ps4ReprojectionSupport: 0 469 | ps4UseAudio3dBackend: 0 470 | ps4SocialScreenEnabled: 0 471 | ps4ScriptOptimizationLevel: 0 472 | ps4Audio3dVirtualSpeakerCount: 14 473 | ps4attribCpuUsage: 0 474 | ps4PatchPkgPath: 475 | ps4PatchLatestPkgPath: 476 | ps4PatchChangeinfoPath: 477 | ps4PatchDayOne: 0 478 | ps4attribUserManagement: 0 479 | ps4attribMoveSupport: 0 480 | ps4attrib3DSupport: 0 481 | ps4attribShareSupport: 0 482 | ps4attribExclusiveVR: 0 483 | ps4disableAutoHideSplash: 0 484 | ps4videoRecordingFeaturesUsed: 0 485 | ps4contentSearchFeaturesUsed: 0 486 | ps4attribEyeToEyeDistanceSettingVR: 0 487 | ps4IncludedModules: [] 488 | monoEnv: 489 | psp2Splashimage: {fileID: 0} 490 | psp2NPTrophyPackPath: 491 | psp2NPSupportGBMorGJP: 0 492 | psp2NPAgeRating: 12 493 | psp2NPTitleDatPath: 494 | psp2NPCommsID: 495 | psp2NPCommunicationsID: 496 | psp2NPCommsPassphrase: 497 | psp2NPCommsSig: 498 | psp2ParamSfxPath: 499 | psp2ManualPath: 500 | psp2LiveAreaGatePath: 501 | psp2LiveAreaBackroundPath: 502 | psp2LiveAreaPath: 503 | psp2LiveAreaTrialPath: 504 | psp2PatchChangeInfoPath: 505 | psp2PatchOriginalPackage: 506 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 507 | psp2KeystoneFile: 508 | psp2MemoryExpansionMode: 0 509 | psp2DRMType: 0 510 | psp2StorageType: 0 511 | psp2MediaCapacity: 0 512 | psp2DLCConfigPath: 513 | psp2ThumbnailPath: 514 | psp2BackgroundPath: 515 | psp2SoundPath: 516 | psp2TrophyCommId: 517 | psp2TrophyPackagePath: 518 | psp2PackagedResourcesPath: 519 | psp2SaveDataQuota: 10240 520 | psp2ParentalLevel: 1 521 | psp2ShortTitle: Not Set 522 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 523 | psp2Category: 0 524 | psp2MasterVersion: 01.00 525 | psp2AppVersion: 01.00 526 | psp2TVBootMode: 0 527 | psp2EnterButtonAssignment: 2 528 | psp2TVDisableEmu: 0 529 | psp2AllowTwitterDialog: 1 530 | psp2Upgradable: 0 531 | psp2HealthWarning: 0 532 | psp2UseLibLocation: 0 533 | psp2InfoBarOnStartup: 0 534 | psp2InfoBarColor: 0 535 | psp2ScriptOptimizationLevel: 0 536 | psmSplashimage: {fileID: 0} 537 | splashScreenBackgroundSourceLandscape: {fileID: 0} 538 | splashScreenBackgroundSourcePortrait: {fileID: 0} 539 | spritePackerPolicy: 540 | webGLMemorySize: 256 541 | webGLExceptionSupport: 1 542 | webGLNameFilesAsHashes: 0 543 | webGLDataCaching: 0 544 | webGLDebugSymbols: 0 545 | webGLEmscriptenArgs: 546 | webGLModulesDirectory: 547 | webGLTemplate: APPLICATION:Default 548 | webGLAnalyzeBuildSize: 0 549 | webGLUseEmbeddedResources: 0 550 | webGLUseWasm: 0 551 | webGLCompressionFormat: 1 552 | scriptingDefineSymbols: {} 553 | platformArchitecture: {} 554 | scriptingBackend: {} 555 | incrementalIl2cppBuild: {} 556 | additionalIl2CppArgs: 557 | scriptingRuntimeVersion: 0 558 | apiCompatibilityLevelPerPlatform: {} 559 | m_RenderingPath: 1 560 | m_MobileRenderingPath: 1 561 | metroPackageName: FFTOccean 562 | metroPackageVersion: 563 | metroCertificatePath: 564 | metroCertificatePassword: 565 | metroCertificateSubject: 566 | metroCertificateIssuer: 567 | metroCertificateNotAfter: 0000000000000000 568 | metroApplicationDescription: FFTOccean 569 | wsaImages: {} 570 | metroTileShortName: 571 | metroCommandLineArgsFile: 572 | metroTileShowName: 0 573 | metroMediumTileShowName: 0 574 | metroLargeTileShowName: 0 575 | metroWideTileShowName: 0 576 | metroDefaultTileSize: 1 577 | metroTileForegroundText: 2 578 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 579 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 580 | a: 1} 581 | metroSplashScreenUseBackgroundColor: 0 582 | platformCapabilities: {} 583 | metroFTAName: 584 | metroFTAFileTypes: [] 585 | metroProtocolName: 586 | metroCompilationOverrides: 1 587 | tizenProductDescription: 588 | tizenProductURL: 589 | tizenSigningProfileName: 590 | tizenGPSPermissions: 0 591 | tizenMicrophonePermissions: 0 592 | tizenDeploymentTarget: 593 | tizenDeploymentTargetType: -1 594 | tizenMinOSVersion: 1 595 | n3dsUseExtSaveData: 0 596 | n3dsCompressStaticMem: 1 597 | n3dsExtSaveDataNumber: 0x12345 598 | n3dsStackSize: 131072 599 | n3dsTargetPlatform: 2 600 | n3dsRegion: 7 601 | n3dsMediaSize: 0 602 | n3dsLogoStyle: 3 603 | n3dsTitle: GameName 604 | n3dsProductCode: 605 | n3dsApplicationId: 0xFF3FF 606 | XboxOneProductId: 607 | XboxOneUpdateKey: 608 | XboxOneSandboxId: 609 | XboxOneContentId: 610 | XboxOneTitleId: 611 | XboxOneSCId: 612 | XboxOneGameOsOverridePath: 613 | XboxOnePackagingOverridePath: 614 | XboxOneAppManifestOverridePath: 615 | XboxOnePackageEncryption: 0 616 | XboxOnePackageUpdateGranularity: 2 617 | XboxOneDescription: 618 | XboxOneLanguage: 619 | - enus 620 | XboxOneCapability: [] 621 | XboxOneGameRating: {} 622 | XboxOneIsContentPackage: 0 623 | XboxOneEnableGPUVariability: 0 624 | XboxOneSockets: {} 625 | XboxOneSplashScreen: {fileID: 0} 626 | XboxOneAllowedProductIds: [] 627 | XboxOnePersistentLocalStorageSize: 0 628 | XboxOneXTitleMemory: 8 629 | xboxOneScriptCompiler: 0 630 | vrEditorSettings: 631 | daydream: 632 | daydreamIconForeground: {fileID: 0} 633 | daydreamIconBackground: {fileID: 0} 634 | cloudServicesEnabled: 635 | Collab: 1 636 | facebookSdkVersion: 7.9.4 637 | apiCompatibilityLevel: 2 638 | cloudProjectId: b3f5d3d8-4359-49f2-b394-fda361abb96d 639 | projectName: FFTOccean 640 | organizationId: noobdawn 641 | cloudEnabled: 0 642 | enableNativePlatformBackendsForNewInputSystem: 0 643 | disableOldInputManagerSupport: 0 644 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.4.14f1 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 1 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity GPU FFTOcean 2 | 3 | NOTE: I did this at 2017.4; 4 | 5 | Inspired by https://github.com/speps/GX-EncinoWaves 6 | 7 | Original paper is : 8 | 9 | > Christopher J. Horvath. 2015. 10 | > [Empirical directional wave spectra for computer graphics.](http://dl.acm.org/authorize?N90195) 11 | > In Proceedings of the 2015 Symposium on Digital Production (DigiPro '15), 12 | > Los Angeles, Aug. 8, 2015, pp. 29-39. 13 | 14 | And I read these : 15 | 16 | > Tessendorf J . Simulating Ocean Water[J]. Simulating Nature Realistic & Interactive Techniques Siggraph, 1999. 17 | 18 | You can read my blog to see how does project works: 19 | 20 | [破晓的知乎专栏](https://zhuanlan.zhihu.com/p/53241188) 21 | 22 | ## Features 23 | 24 | * Project Mesh from screen to world space 25 | 26 | ## License 27 | 28 | Apache License, Version 2.0 --------------------------------------------------------------------------------