├── .gitignore ├── .vsconfig ├── Assets ├── Marching_Cubes.meta └── Marching_Cubes │ ├── --- MC Singletons ---.prefab │ ├── --- MC Singletons ---.prefab.meta │ ├── DemoScenes.meta │ ├── DemoScenes │ ├── ChunkVisualization.unity │ ├── ChunkVisualization.unity.meta │ ├── ChunkVisualizationSettings.lighting │ ├── ChunkVisualizationSettings.lighting.meta │ ├── FirstPersonLevel.unity │ ├── FirstPersonLevel.unity.meta │ ├── TerrainViewer.unity │ └── TerrainViewer.unity.meta │ ├── Materials.meta │ ├── Materials │ ├── CartoonTerrain.png │ ├── CartoonTerrain.png.meta │ ├── ChunkVisual.mat │ ├── ChunkVisual.mat.meta │ ├── FlatShadingTerrain.mat │ ├── FlatShadingTerrain.mat.meta │ ├── NormalTerrain.mat │ ├── NormalTerrain.mat.meta │ ├── Shaders.meta │ ├── Shaders │ │ ├── ChunkShader.shader │ │ ├── ChunkShader.shader.meta │ │ ├── FlatShading.shader │ │ ├── FlatShading.shader.meta │ │ ├── TerrainShader.shader │ │ └── TerrainShader.shader.meta │ ├── TerrainFlatImg.png │ └── TerrainFlatImg.png.meta │ ├── Scripts.meta │ ├── Scripts │ ├── Constants.cs │ ├── Constants.cs.meta │ ├── Demo.meta │ ├── Demo │ │ ├── FlyingCamera.cs │ │ └── FlyingCamera.cs.meta │ ├── Editor.meta │ ├── Editor │ │ ├── BiomeAutoUpdate.cs │ │ ├── BiomeAutoUpdate.cs.meta │ │ ├── NoiseTerrainAutoUpdate.cs │ │ ├── NoiseTerrainAutoUpdate.cs.meta │ │ ├── NoiseViewerAutoUpdate.cs │ │ ├── NoiseViewerAutoUpdate.cs.meta │ │ ├── WorldManagerEditor.cs │ │ └── WorldManagerEditor.cs.meta │ ├── Helper.meta │ ├── Helper │ │ ├── CompressHelper.cs │ │ ├── CompressHelper.cs.meta │ │ ├── Singleton.cs │ │ ├── Singleton.cs.meta │ │ ├── WorldManager.cs │ │ └── WorldManager.cs.meta │ ├── MarchingCubes.meta │ ├── MarchingCubes │ │ ├── BuildChunkJob.cs │ │ ├── BuildChunkJob.cs.meta │ │ ├── CameraTerrainModifier.cs │ │ ├── CameraTerrainModifier.cs.meta │ │ ├── MeshBuilder.cs │ │ └── MeshBuilder.cs.meta │ ├── TerrainGenerator.meta │ └── TerrainGenerator │ │ ├── Biome.meta │ │ ├── Biome │ │ ├── B_Desert.cs │ │ ├── B_Desert.cs.meta │ │ ├── B_Ice.cs │ │ ├── B_Ice.cs.meta │ │ ├── B_Mountains.cs │ │ ├── B_Mountains.cs.meta │ │ ├── B_Plains.cs │ │ ├── B_Plains.cs.meta │ │ ├── Biome.cs │ │ └── Biome.cs.meta │ │ ├── ChunkSystem.meta │ │ ├── ChunkSystem │ │ ├── Chunk.cs │ │ ├── Chunk.cs.meta │ │ ├── ChunkManager.cs │ │ ├── ChunkManager.cs.meta │ │ ├── Region.cs │ │ └── Region.cs.meta │ │ ├── Noise.cs │ │ ├── Noise.cs.meta │ │ ├── NoiseManager.cs │ │ ├── NoiseManager.cs.meta │ │ ├── NoiseTerrainViewer.cs │ │ └── NoiseTerrainViewer.cs.meta │ ├── WorldManager.prefab │ └── WorldManager.prefab.meta ├── LICENSE ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── BurstAotSettings_StandaloneWindows.json ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset ├── README.md └── UserSettings └── EditorUserSettings.asset /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties -------------------------------------------------------------------------------- /.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed63c55693f733b40b213fe8d5260791 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/--- MC Singletons ---.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &3577543227352792563 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 2758482650394560724} 12 | m_Layer: 0 13 | m_Name: --- MC Singletons --- 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &2758482650394560724 20 | Transform: 21 | m_ObjectHideFlags: 0 22 | m_CorrespondingSourceObject: {fileID: 0} 23 | m_PrefabInstance: {fileID: 0} 24 | m_PrefabAsset: {fileID: 0} 25 | m_GameObject: {fileID: 3577543227352792563} 26 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 27 | m_LocalPosition: {x: 0, y: 0, z: 0} 28 | m_LocalScale: {x: 1, y: 1, z: 1} 29 | m_Children: 30 | - {fileID: 7499796390301731562} 31 | - {fileID: 8656061851995920644} 32 | - {fileID: 7641641216547595553} 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | --- !u!1 &5246400935058690163 37 | GameObject: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | serializedVersion: 6 43 | m_Component: 44 | - component: {fileID: 8656061851995920644} 45 | - component: {fileID: 4456748041921147835} 46 | - component: {fileID: 5255459944120257049} 47 | - component: {fileID: 997808334374709775} 48 | - component: {fileID: 949443206355623918} 49 | - component: {fileID: 1424679412264877637} 50 | m_Layer: 0 51 | m_Name: NoiseManager 52 | m_TagString: Untagged 53 | m_Icon: {fileID: 0} 54 | m_NavMeshLayer: 0 55 | m_StaticEditorFlags: 0 56 | m_IsActive: 1 57 | --- !u!4 &8656061851995920644 58 | Transform: 59 | m_ObjectHideFlags: 0 60 | m_CorrespondingSourceObject: {fileID: 0} 61 | m_PrefabInstance: {fileID: 0} 62 | m_PrefabAsset: {fileID: 0} 63 | m_GameObject: {fileID: 5246400935058690163} 64 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 65 | m_LocalPosition: {x: 0, y: 0, z: 0} 66 | m_LocalScale: {x: 1, y: 1, z: 1} 67 | m_Children: [] 68 | m_Father: {fileID: 2758482650394560724} 69 | m_RootOrder: 1 70 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 71 | --- !u!114 &4456748041921147835 72 | MonoBehaviour: 73 | m_ObjectHideFlags: 0 74 | m_CorrespondingSourceObject: {fileID: 0} 75 | m_PrefabInstance: {fileID: 0} 76 | m_PrefabAsset: {fileID: 0} 77 | m_GameObject: {fileID: 5246400935058690163} 78 | m_Enabled: 1 79 | m_EditorHideFlags: 0 80 | m_Script: {fileID: 11500000, guid: cbad037a5d2c2bb49a28280c74dffa83, type: 3} 81 | m_Name: 82 | m_EditorClassIdentifier: 83 | worldConfig: 84 | worldSeed: 49652736 85 | biomeScale: 150 86 | diffToMerge: 0.025 87 | surfaceLevel: 38 88 | octaves: 5 89 | persistance: 0.1 90 | lacunarity: 9 91 | biomes: 92 | - biome: {fileID: 5255459944120257049} 93 | appearValue: 1 94 | - biome: {fileID: 997808334374709775} 95 | appearValue: 0.75 96 | - biome: {fileID: 949443206355623918} 97 | appearValue: 0.5 98 | - biome: {fileID: 1424679412264877637} 99 | appearValue: 0.25 100 | --- !u!114 &5255459944120257049 101 | MonoBehaviour: 102 | m_ObjectHideFlags: 0 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 5246400935058690163} 107 | m_Enabled: 1 108 | m_EditorHideFlags: 0 109 | m_Script: {fileID: 11500000, guid: 203436860b177a54ebd749e243c194b0, type: 3} 110 | m_Name: 111 | m_EditorClassIdentifier: 112 | terrainHeightCurve: 113 | serializedVersion: 2 114 | m_Curve: 115 | - serializedVersion: 3 116 | time: 0 117 | value: 0 118 | inSlope: 0 119 | outSlope: 1 120 | tangentMode: 0 121 | weightedMode: 0 122 | inWeight: 0 123 | outWeight: 0 124 | - serializedVersion: 3 125 | time: 1 126 | value: 1 127 | inSlope: 1 128 | outSlope: 0 129 | tangentMode: 0 130 | weightedMode: 0 131 | inWeight: 0 132 | outWeight: 0 133 | m_PreInfinity: 2 134 | m_PostInfinity: 2 135 | m_RotationOrder: 4 136 | scale: 50 137 | octaves: 4 138 | persistance: 0.5 139 | lacunarity: 2 140 | maxHeightDifference: 7 141 | snowDeep: 5 142 | iceNoiseScale: 14 143 | iceApearValue: 0.8 144 | iceMaxHeight: 8 145 | IcePersistance: 0.607 146 | IceLacunarity: 4.5 147 | --- !u!114 &997808334374709775 148 | MonoBehaviour: 149 | m_ObjectHideFlags: 0 150 | m_CorrespondingSourceObject: {fileID: 0} 151 | m_PrefabInstance: {fileID: 0} 152 | m_PrefabAsset: {fileID: 0} 153 | m_GameObject: {fileID: 5246400935058690163} 154 | m_Enabled: 1 155 | m_EditorHideFlags: 0 156 | m_Script: {fileID: 11500000, guid: 119732525eb80e94c824d2b984aba8ef, type: 3} 157 | m_Name: 158 | m_EditorClassIdentifier: 159 | terrainHeightCurve: 160 | serializedVersion: 2 161 | m_Curve: 162 | - serializedVersion: 3 163 | time: 0 164 | value: 0 165 | inSlope: 0.08828931 166 | outSlope: 0.08828931 167 | tangentMode: 0 168 | weightedMode: 0 169 | inWeight: 0 170 | outWeight: 0.45416668 171 | - serializedVersion: 3 172 | time: 0.8991164 173 | value: 0.9234049 174 | inSlope: 3.6884282 175 | outSlope: 3.6884282 176 | tangentMode: 0 177 | weightedMode: 0 178 | inWeight: 0.33333334 179 | outWeight: 0.48347223 180 | - serializedVersion: 3 181 | time: 1 182 | value: 1 183 | inSlope: 2 184 | outSlope: 2 185 | tangentMode: 0 186 | weightedMode: 0 187 | inWeight: 0 188 | outWeight: 0 189 | m_PreInfinity: 2 190 | m_PostInfinity: 1 191 | m_RotationOrder: 4 192 | scale: 70 193 | octaves: 3 194 | persistance: 0.5 195 | lacunarity: 2 196 | maxSurfaceheight: 69 197 | heightMatOffset: 10 198 | hightMatMult: 199 | serializedVersion: 2 200 | m_Curve: 201 | - serializedVersion: 3 202 | time: 0 203 | value: 0 204 | inSlope: 0.98488533 205 | outSlope: 0.98488533 206 | tangentMode: 34 207 | weightedMode: 0 208 | inWeight: 0 209 | outWeight: 0.33333334 210 | - serializedVersion: 3 211 | time: 0.23083198 212 | value: 0.22734304 213 | inSlope: 1.6940817 214 | outSlope: 1.6940817 215 | tangentMode: 0 216 | weightedMode: 0 217 | inWeight: 0.33333334 218 | outWeight: 0.14815924 219 | - serializedVersion: 3 220 | time: 0.7876964 221 | value: 1 222 | inSlope: 0.31231612 223 | outSlope: 0.31231612 224 | tangentMode: 0 225 | weightedMode: 0 226 | inWeight: 0.3191109 227 | outWeight: 0.33333334 228 | - serializedVersion: 3 229 | time: 0.80608416 230 | value: 0 231 | inSlope: Infinity 232 | outSlope: Infinity 233 | tangentMode: 0 234 | weightedMode: 0 235 | inWeight: 0 236 | outWeight: 0 237 | - serializedVersion: 3 238 | time: 1 239 | value: 0 240 | inSlope: 0 241 | outSlope: 0 242 | tangentMode: 0 243 | weightedMode: 0 244 | inWeight: 0.33333334 245 | outWeight: 0.33333334 246 | m_PreInfinity: 2 247 | m_PostInfinity: 2 248 | m_RotationOrder: 4 249 | snowHeight: 58 250 | rockLevel: 0.48 251 | dirtLevel: 0.22 252 | --- !u!114 &949443206355623918 253 | MonoBehaviour: 254 | m_ObjectHideFlags: 0 255 | m_CorrespondingSourceObject: {fileID: 0} 256 | m_PrefabInstance: {fileID: 0} 257 | m_PrefabAsset: {fileID: 0} 258 | m_GameObject: {fileID: 5246400935058690163} 259 | m_Enabled: 1 260 | m_EditorHideFlags: 0 261 | m_Script: {fileID: 11500000, guid: cf778f8e08e7a9f44b542b7976599454, type: 3} 262 | m_Name: 263 | m_EditorClassIdentifier: 264 | terrainHeightCurve: 265 | serializedVersion: 2 266 | m_Curve: 267 | - serializedVersion: 3 268 | time: 0 269 | value: 0 270 | inSlope: 1 271 | outSlope: 1 272 | tangentMode: 34 273 | weightedMode: 0 274 | inWeight: 0 275 | outWeight: 0 276 | - serializedVersion: 3 277 | time: 1 278 | value: 1 279 | inSlope: 1 280 | outSlope: 1 281 | tangentMode: 34 282 | weightedMode: 0 283 | inWeight: 0 284 | outWeight: 0 285 | m_PreInfinity: 2 286 | m_PostInfinity: 2 287 | m_RotationOrder: 4 288 | scale: 60 289 | octaves: 2 290 | persistance: 0.5 291 | lacunarity: 2 292 | maxHeightDifference: 7 293 | --- !u!114 &1424679412264877637 294 | MonoBehaviour: 295 | m_ObjectHideFlags: 0 296 | m_CorrespondingSourceObject: {fileID: 0} 297 | m_PrefabInstance: {fileID: 0} 298 | m_PrefabAsset: {fileID: 0} 299 | m_GameObject: {fileID: 5246400935058690163} 300 | m_Enabled: 1 301 | m_EditorHideFlags: 0 302 | m_Script: {fileID: 11500000, guid: 7273ccaa8df40dd4ead28bb0ae12586d, type: 3} 303 | m_Name: 304 | m_EditorClassIdentifier: 305 | terrainHeightCurve: 306 | serializedVersion: 2 307 | m_Curve: 308 | - serializedVersion: 3 309 | time: 0 310 | value: 0 311 | inSlope: 0 312 | outSlope: 0 313 | tangentMode: 0 314 | weightedMode: 0 315 | inWeight: 0 316 | outWeight: 0 317 | - serializedVersion: 3 318 | time: 1 319 | value: 1 320 | inSlope: 0 321 | outSlope: 0 322 | tangentMode: 0 323 | weightedMode: 0 324 | inWeight: 0 325 | outWeight: 0 326 | m_PreInfinity: 2 327 | m_PostInfinity: 2 328 | m_RotationOrder: 4 329 | scale: 80 330 | octaves: 2 331 | persistance: 0.46 332 | lacunarity: 2 333 | maxHeightDifference: 6 334 | sandDeep: 7 335 | --- !u!1 &6991779801882229593 336 | GameObject: 337 | m_ObjectHideFlags: 0 338 | m_CorrespondingSourceObject: {fileID: 0} 339 | m_PrefabInstance: {fileID: 0} 340 | m_PrefabAsset: {fileID: 0} 341 | serializedVersion: 6 342 | m_Component: 343 | - component: {fileID: 7499796390301731562} 344 | - component: {fileID: 917872863160039548} 345 | m_Layer: 0 346 | m_Name: MeshBuilderManager 347 | m_TagString: Untagged 348 | m_Icon: {fileID: 0} 349 | m_NavMeshLayer: 0 350 | m_StaticEditorFlags: 0 351 | m_IsActive: 1 352 | --- !u!4 &7499796390301731562 353 | Transform: 354 | m_ObjectHideFlags: 0 355 | m_CorrespondingSourceObject: {fileID: 0} 356 | m_PrefabInstance: {fileID: 0} 357 | m_PrefabAsset: {fileID: 0} 358 | m_GameObject: {fileID: 6991779801882229593} 359 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 360 | m_LocalPosition: {x: 0, y: 0, z: 0} 361 | m_LocalScale: {x: 1, y: 1, z: 1} 362 | m_Children: [] 363 | m_Father: {fileID: 2758482650394560724} 364 | m_RootOrder: 0 365 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 366 | --- !u!114 &917872863160039548 367 | MonoBehaviour: 368 | m_ObjectHideFlags: 0 369 | m_CorrespondingSourceObject: {fileID: 0} 370 | m_PrefabInstance: {fileID: 0} 371 | m_PrefabAsset: {fileID: 0} 372 | m_GameObject: {fileID: 6991779801882229593} 373 | m_Enabled: 1 374 | m_EditorHideFlags: 0 375 | m_Script: {fileID: 11500000, guid: a71d4d4994b362a4e8d7d105e9c0f33a, type: 3} 376 | m_Name: 377 | m_EditorClassIdentifier: 378 | isoLevel: 128 379 | interpolate: 1 380 | --- !u!1 &7735028669594396285 381 | GameObject: 382 | m_ObjectHideFlags: 0 383 | m_CorrespondingSourceObject: {fileID: 0} 384 | m_PrefabInstance: {fileID: 0} 385 | m_PrefabAsset: {fileID: 0} 386 | serializedVersion: 6 387 | m_Component: 388 | - component: {fileID: 7641641216547595553} 389 | - component: {fileID: 3206755284426175507} 390 | m_Layer: 0 391 | m_Name: ChunkManager 392 | m_TagString: Untagged 393 | m_Icon: {fileID: 0} 394 | m_NavMeshLayer: 0 395 | m_StaticEditorFlags: 0 396 | m_IsActive: 1 397 | --- !u!4 &7641641216547595553 398 | Transform: 399 | m_ObjectHideFlags: 0 400 | m_CorrespondingSourceObject: {fileID: 0} 401 | m_PrefabInstance: {fileID: 0} 402 | m_PrefabAsset: {fileID: 0} 403 | m_GameObject: {fileID: 7735028669594396285} 404 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 405 | m_LocalPosition: {x: 0, y: 0, z: 0} 406 | m_LocalScale: {x: 1, y: 1, z: 1} 407 | m_Children: [] 408 | m_Father: {fileID: 2758482650394560724} 409 | m_RootOrder: 2 410 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 411 | --- !u!114 &3206755284426175507 412 | MonoBehaviour: 413 | m_ObjectHideFlags: 0 414 | m_CorrespondingSourceObject: {fileID: 0} 415 | m_PrefabInstance: {fileID: 0} 416 | m_PrefabAsset: {fileID: 0} 417 | m_GameObject: {fileID: 7735028669594396285} 418 | m_Enabled: 1 419 | m_EditorHideFlags: 0 420 | m_Script: {fileID: 11500000, guid: 02dfafdeb5a90df46ab4078bb2288f7c, type: 3} 421 | m_Name: 422 | m_EditorClassIdentifier: 423 | terrainMaterial: {fileID: 2100000, guid: e5e158f8f9cada14380f5755c6cef11c, type: 2} 424 | chunkViewDistance: 6 425 | chunkMantainDistance: 0.3 426 | useCameraPosition: 1 427 | debugMode: 0 428 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/--- MC Singletons ---.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0dd8af356d25ee441896c42d31ada3b4 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6edeba5bd185a8744b958d2890fd7cd8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes/ChunkVisualization.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 400b22eefe6fd77488dd89c5723fd19b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes/ChunkVisualizationSettings.lighting: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!850595691 &4890085278179872738 4 | LightingSettings: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: ChunkVisualizationSettings 10 | serializedVersion: 3 11 | m_GIWorkflowMode: 0 12 | m_EnableBakedLightmaps: 1 13 | m_EnableRealtimeLightmaps: 0 14 | m_RealtimeEnvironmentLighting: 1 15 | m_BounceScale: 1 16 | m_AlbedoBoost: 1 17 | m_IndirectOutputScale: 1 18 | m_UsingShadowmask: 1 19 | m_BakeBackend: 1 20 | m_LightmapMaxSize: 1024 21 | m_BakeResolution: 40 22 | m_Padding: 2 23 | m_TextureCompression: 1 24 | m_AO: 0 25 | m_AOMaxDistance: 1 26 | m_CompAOExponent: 1 27 | m_CompAOExponentDirect: 0 28 | m_ExtractAO: 0 29 | m_MixedBakeMode: 2 30 | m_LightmapsBakeMode: 1 31 | m_FilterMode: 1 32 | m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} 33 | m_ExportTrainingData: 0 34 | m_TrainingDataDestination: TrainingData 35 | m_RealtimeResolution: 2 36 | m_ForceWhiteAlbedo: 0 37 | m_ForceUpdates: 0 38 | m_FinalGather: 0 39 | m_FinalGatherRayCount: 256 40 | m_FinalGatherFiltering: 1 41 | m_PVRCulling: 1 42 | m_PVRSampling: 1 43 | m_PVRDirectSampleCount: 32 44 | m_PVRSampleCount: 500 45 | m_PVREnvironmentSampleCount: 500 46 | m_PVREnvironmentReferencePointCount: 2048 47 | m_LightProbeSampleCountMultiplier: 4 48 | m_PVRBounces: 2 49 | m_PVRMinBounces: 2 50 | m_PVREnvironmentMIS: 0 51 | m_PVRFilteringMode: 2 52 | m_PVRDenoiserTypeDirect: 0 53 | m_PVRDenoiserTypeIndirect: 0 54 | m_PVRDenoiserTypeAO: 0 55 | m_PVRFilterTypeDirect: 0 56 | m_PVRFilterTypeIndirect: 0 57 | m_PVRFilterTypeAO: 0 58 | m_PVRFilteringGaussRadiusDirect: 1 59 | m_PVRFilteringGaussRadiusIndirect: 5 60 | m_PVRFilteringGaussRadiusAO: 2 61 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 62 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 63 | m_PVRFilteringAtrousPositionSigmaAO: 1 64 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes/ChunkVisualizationSettings.lighting.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90dbcafd173666643956fe7765dd24fa 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 4890085278179872738 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes/FirstPersonLevel.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44f1b522d161c5443a54ade00dee9724 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes/TerrainViewer.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: 9 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.4 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: 1007861968} 41 | m_IndirectSpecularColor: {r: 0.18190634, g: 0.2275866, b: 0.30741623, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 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: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 1299793051} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &399327858 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 399327860} 135 | m_Layer: 0 136 | m_Name: TerrainGenerator 137 | m_TagString: Untagged 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!4 &399327860 143 | Transform: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 399327858} 149 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 150 | m_LocalPosition: {x: 39.28322, y: -95.89134, z: 10.607007} 151 | m_LocalScale: {x: 1, y: 1, z: 1} 152 | m_Children: [] 153 | m_Father: {fileID: 0} 154 | m_RootOrder: 2 155 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 156 | --- !u!1 &963194225 157 | GameObject: 158 | m_ObjectHideFlags: 0 159 | m_CorrespondingSourceObject: {fileID: 0} 160 | m_PrefabInstance: {fileID: 0} 161 | m_PrefabAsset: {fileID: 0} 162 | serializedVersion: 6 163 | m_Component: 164 | - component: {fileID: 963194228} 165 | - component: {fileID: 963194227} 166 | - component: {fileID: 963194226} 167 | - component: {fileID: 963194230} 168 | m_Layer: 0 169 | m_Name: Main Camera - Player 170 | m_TagString: MainCamera 171 | m_Icon: {fileID: 0} 172 | m_NavMeshLayer: 0 173 | m_StaticEditorFlags: 0 174 | m_IsActive: 1 175 | --- !u!81 &963194226 176 | AudioListener: 177 | m_ObjectHideFlags: 0 178 | m_CorrespondingSourceObject: {fileID: 0} 179 | m_PrefabInstance: {fileID: 0} 180 | m_PrefabAsset: {fileID: 0} 181 | m_GameObject: {fileID: 963194225} 182 | m_Enabled: 1 183 | --- !u!20 &963194227 184 | Camera: 185 | m_ObjectHideFlags: 0 186 | m_CorrespondingSourceObject: {fileID: 0} 187 | m_PrefabInstance: {fileID: 0} 188 | m_PrefabAsset: {fileID: 0} 189 | m_GameObject: {fileID: 963194225} 190 | m_Enabled: 1 191 | serializedVersion: 2 192 | m_ClearFlags: 1 193 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 194 | m_projectionMatrixMode: 1 195 | m_GateFitMode: 2 196 | m_FOVAxisMode: 0 197 | m_SensorSize: {x: 36, y: 24} 198 | m_LensShift: {x: 0, y: 0} 199 | m_FocalLength: 50 200 | m_NormalizedViewPortRect: 201 | serializedVersion: 2 202 | x: 0 203 | y: 0 204 | width: 1 205 | height: 1 206 | near clip plane: 0.3 207 | far clip plane: 1000 208 | field of view: 60 209 | orthographic: 0 210 | orthographic size: 5 211 | m_Depth: -1 212 | m_CullingMask: 213 | serializedVersion: 2 214 | m_Bits: 4294967295 215 | m_RenderingPath: -1 216 | m_TargetTexture: {fileID: 0} 217 | m_TargetDisplay: 0 218 | m_TargetEye: 3 219 | m_HDR: 1 220 | m_AllowMSAA: 1 221 | m_AllowDynamicResolution: 0 222 | m_ForceIntoRT: 0 223 | m_OcclusionCulling: 1 224 | m_StereoConvergence: 10 225 | m_StereoSeparation: 0.022 226 | --- !u!4 &963194228 227 | Transform: 228 | m_ObjectHideFlags: 0 229 | m_CorrespondingSourceObject: {fileID: 0} 230 | m_PrefabInstance: {fileID: 0} 231 | m_PrefabAsset: {fileID: 0} 232 | m_GameObject: {fileID: 963194225} 233 | m_LocalRotation: {x: 0.3967428, y: 0.091878474, z: -0.039949898, w: 0.9124459} 234 | m_LocalPosition: {x: -22.711063, y: 68.15871, z: -58.897903} 235 | m_LocalScale: {x: 1, y: 1, z: 1} 236 | m_Children: [] 237 | m_Father: {fileID: 0} 238 | m_RootOrder: 1 239 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 240 | --- !u!114 &963194230 241 | MonoBehaviour: 242 | m_ObjectHideFlags: 0 243 | m_CorrespondingSourceObject: {fileID: 0} 244 | m_PrefabInstance: {fileID: 0} 245 | m_PrefabAsset: {fileID: 0} 246 | m_GameObject: {fileID: 963194225} 247 | m_Enabled: 1 248 | m_EditorHideFlags: 0 249 | m_Script: {fileID: 11500000, guid: eb295955006ba09429e78608f95fbe06, type: 3} 250 | m_Name: 251 | m_EditorClassIdentifier: 252 | speed: 30 253 | rotationSpeed: 10 254 | hideMouse: 0 255 | --- !u!1 &1007861967 256 | GameObject: 257 | m_ObjectHideFlags: 0 258 | m_CorrespondingSourceObject: {fileID: 0} 259 | m_PrefabInstance: {fileID: 0} 260 | m_PrefabAsset: {fileID: 0} 261 | serializedVersion: 6 262 | m_Component: 263 | - component: {fileID: 1007861969} 264 | - component: {fileID: 1007861968} 265 | m_Layer: 0 266 | m_Name: Directional Light 1 267 | m_TagString: Untagged 268 | m_Icon: {fileID: 0} 269 | m_NavMeshLayer: 0 270 | m_StaticEditorFlags: 0 271 | m_IsActive: 1 272 | --- !u!108 &1007861968 273 | Light: 274 | m_ObjectHideFlags: 0 275 | m_CorrespondingSourceObject: {fileID: 0} 276 | m_PrefabInstance: {fileID: 0} 277 | m_PrefabAsset: {fileID: 0} 278 | m_GameObject: {fileID: 1007861967} 279 | m_Enabled: 1 280 | serializedVersion: 10 281 | m_Type: 1 282 | m_Shape: 0 283 | m_Color: {r: 1, g: 0.9955209, b: 0.4669811, a: 1} 284 | m_Intensity: 0.7 285 | m_Range: 10 286 | m_SpotAngle: 30 287 | m_InnerSpotAngle: 21.80208 288 | m_CookieSize: 10 289 | m_Shadows: 290 | m_Type: 2 291 | m_Resolution: -1 292 | m_CustomResolution: -1 293 | m_Strength: 1 294 | m_Bias: 0.05 295 | m_NormalBias: 0 296 | m_NearPlane: 0.2 297 | m_CullingMatrixOverride: 298 | e00: 1 299 | e01: 0 300 | e02: 0 301 | e03: 0 302 | e10: 0 303 | e11: 1 304 | e12: 0 305 | e13: 0 306 | e20: 0 307 | e21: 0 308 | e22: 1 309 | e23: 0 310 | e30: 0 311 | e31: 0 312 | e32: 0 313 | e33: 1 314 | m_UseCullingMatrixOverride: 0 315 | m_Cookie: {fileID: 0} 316 | m_DrawHalo: 0 317 | m_Flare: {fileID: 0} 318 | m_RenderMode: 0 319 | m_CullingMask: 320 | serializedVersion: 2 321 | m_Bits: 4294967295 322 | m_RenderingLayerMask: 1 323 | m_Lightmapping: 1 324 | m_LightShadowCasterMode: 0 325 | m_AreaSize: {x: 1, y: 1} 326 | m_BounceIntensity: 1 327 | m_ColorTemperature: 6570 328 | m_UseColorTemperature: 0 329 | m_BoundingSphereOverride: {x: 0, y: 1, z: 0, w: 6e-44} 330 | m_UseBoundingSphereOverride: 0 331 | m_UseViewFrustumForShadowCasterCull: 1 332 | m_ShadowRadius: 0 333 | m_ShadowAngle: 0 334 | --- !u!4 &1007861969 335 | Transform: 336 | m_ObjectHideFlags: 0 337 | m_CorrespondingSourceObject: {fileID: 0} 338 | m_PrefabInstance: {fileID: 0} 339 | m_PrefabAsset: {fileID: 0} 340 | m_GameObject: {fileID: 1007861967} 341 | m_LocalRotation: {x: -0.23283549, y: 0.8763048, z: -0.4139122, w: 0.080958426} 342 | m_LocalPosition: {x: 0, y: 20.85, z: 0} 343 | m_LocalScale: {x: 1, y: 1, z: 1} 344 | m_Children: [] 345 | m_Father: {fileID: 0} 346 | m_RootOrder: 0 347 | m_LocalEulerAnglesHint: {x: 43.45, y: 512.552, z: 319.124} 348 | --- !u!1 &1175670604 stripped 349 | GameObject: 350 | m_CorrespondingSourceObject: {fileID: 5246400935058690163, guid: 0dd8af356d25ee441896c42d31ada3b4, 351 | type: 3} 352 | m_PrefabInstance: {fileID: 1637138001} 353 | m_PrefabAsset: {fileID: 0} 354 | --- !u!114 &1175670606 355 | MonoBehaviour: 356 | m_ObjectHideFlags: 0 357 | m_CorrespondingSourceObject: {fileID: 0} 358 | m_PrefabInstance: {fileID: 0} 359 | m_PrefabAsset: {fileID: 0} 360 | m_GameObject: {fileID: 1175670604} 361 | m_Enabled: 1 362 | m_EditorHideFlags: 0 363 | m_Script: {fileID: 11500000, guid: f9568358fb4a217469249723fa12e0e6, type: 3} 364 | m_Name: 365 | m_EditorClassIdentifier: 366 | testSize: 7 367 | chunkOffset: {x: 0, y: 0} 368 | --- !u!850595691 &1299793051 369 | LightingSettings: 370 | m_ObjectHideFlags: 0 371 | m_CorrespondingSourceObject: {fileID: 0} 372 | m_PrefabInstance: {fileID: 0} 373 | m_PrefabAsset: {fileID: 0} 374 | m_Name: Settings.lighting 375 | serializedVersion: 3 376 | m_GIWorkflowMode: 0 377 | m_EnableBakedLightmaps: 1 378 | m_EnableRealtimeLightmaps: 0 379 | m_RealtimeEnvironmentLighting: 1 380 | m_BounceScale: 1 381 | m_AlbedoBoost: 1 382 | m_IndirectOutputScale: 1 383 | m_UsingShadowmask: 1 384 | m_BakeBackend: 1 385 | m_LightmapMaxSize: 1024 386 | m_BakeResolution: 40 387 | m_Padding: 2 388 | m_TextureCompression: 1 389 | m_AO: 0 390 | m_AOMaxDistance: 1 391 | m_CompAOExponent: 1 392 | m_CompAOExponentDirect: 0 393 | m_ExtractAO: 0 394 | m_MixedBakeMode: 2 395 | m_LightmapsBakeMode: 1 396 | m_FilterMode: 1 397 | m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} 398 | m_ExportTrainingData: 0 399 | m_TrainingDataDestination: TrainingData 400 | m_RealtimeResolution: 2 401 | m_ForceWhiteAlbedo: 0 402 | m_ForceUpdates: 0 403 | m_FinalGather: 0 404 | m_FinalGatherRayCount: 256 405 | m_FinalGatherFiltering: 1 406 | m_PVRCulling: 1 407 | m_PVRSampling: 1 408 | m_PVRDirectSampleCount: 32 409 | m_PVRSampleCount: 500 410 | m_PVREnvironmentSampleCount: 500 411 | m_PVREnvironmentReferencePointCount: 2048 412 | m_LightProbeSampleCountMultiplier: 4 413 | m_PVRBounces: 2 414 | m_PVRMinBounces: 2 415 | m_PVREnvironmentMIS: 0 416 | m_PVRFilteringMode: 2 417 | m_PVRDenoiserTypeDirect: 0 418 | m_PVRDenoiserTypeIndirect: 0 419 | m_PVRDenoiserTypeAO: 0 420 | m_PVRFilterTypeDirect: 0 421 | m_PVRFilterTypeIndirect: 0 422 | m_PVRFilterTypeAO: 0 423 | m_PVRFilteringGaussRadiusDirect: 1 424 | m_PVRFilteringGaussRadiusIndirect: 5 425 | m_PVRFilteringGaussRadiusAO: 2 426 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 427 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 428 | m_PVRFilteringAtrousPositionSigmaAO: 1 429 | --- !u!1001 &1637138001 430 | PrefabInstance: 431 | m_ObjectHideFlags: 0 432 | serializedVersion: 2 433 | m_Modification: 434 | m_TransformParent: {fileID: 0} 435 | m_Modifications: 436 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 437 | type: 3} 438 | propertyPath: m_RootOrder 439 | value: 3 440 | objectReference: {fileID: 0} 441 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 442 | type: 3} 443 | propertyPath: m_LocalPosition.x 444 | value: 0 445 | objectReference: {fileID: 0} 446 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 447 | type: 3} 448 | propertyPath: m_LocalPosition.y 449 | value: 0 450 | objectReference: {fileID: 0} 451 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 452 | type: 3} 453 | propertyPath: m_LocalPosition.z 454 | value: 0 455 | objectReference: {fileID: 0} 456 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 457 | type: 3} 458 | propertyPath: m_LocalRotation.w 459 | value: 1 460 | objectReference: {fileID: 0} 461 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 462 | type: 3} 463 | propertyPath: m_LocalRotation.x 464 | value: 0 465 | objectReference: {fileID: 0} 466 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 467 | type: 3} 468 | propertyPath: m_LocalRotation.y 469 | value: 0 470 | objectReference: {fileID: 0} 471 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 472 | type: 3} 473 | propertyPath: m_LocalRotation.z 474 | value: 0 475 | objectReference: {fileID: 0} 476 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 477 | type: 3} 478 | propertyPath: m_LocalEulerAnglesHint.x 479 | value: 0 480 | objectReference: {fileID: 0} 481 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 482 | type: 3} 483 | propertyPath: m_LocalEulerAnglesHint.y 484 | value: 0 485 | objectReference: {fileID: 0} 486 | - target: {fileID: 2758482650394560724, guid: 0dd8af356d25ee441896c42d31ada3b4, 487 | type: 3} 488 | propertyPath: m_LocalEulerAnglesHint.z 489 | value: 0 490 | objectReference: {fileID: 0} 491 | - target: {fileID: 3206755284426175507, guid: 0dd8af356d25ee441896c42d31ada3b4, 492 | type: 3} 493 | propertyPath: m_Enabled 494 | value: 0 495 | objectReference: {fileID: 0} 496 | - target: {fileID: 3577543227352792563, guid: 0dd8af356d25ee441896c42d31ada3b4, 497 | type: 3} 498 | propertyPath: m_Name 499 | value: --- MC Singletons --- 500 | objectReference: {fileID: 0} 501 | m_RemovedComponents: [] 502 | m_SourcePrefab: {fileID: 100100000, guid: 0dd8af356d25ee441896c42d31ada3b4, type: 3} 503 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/DemoScenes/TerrainViewer.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41006a7fdae00e54d9ff05cc582729e4 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08fcca46f6d9f5940952668a13b5e2aa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/CartoonTerrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Javier-Garzo/Marching-cubes-on-Unity-3D/6c134ba410b9ca72c9ee977e75c66e6fa4ef07bc/Assets/Marching_Cubes/Materials/CartoonTerrain.png -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/CartoonTerrain.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05fb3e62c4ba3454181e8ebc257da85f 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 1 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 7 17 | mipMapFadeDistanceEnd: 10 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 0 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 2048 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 2048 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 5e97eb03825dee720800000000000000 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/ChunkVisual.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: ChunkVisual 11 | m_Shader: {fileID: 4800000, guid: 6c18b9cf2cb49344a940b4495c86efc0, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 0.9150943, g: 0.9150943, b: 0.9150943, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/ChunkVisual.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24a7a5b422425e04893ed810ba6590e9 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/FlatShadingTerrain.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: FlatShadingTerrain 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 2800000, guid: 27c611cb5eeecff42a6aeb76b87c86a6, type: 3} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _SpecGlossMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Floats: 63 | - _BumpScale: 1 64 | - _Cutoff: 0.5 65 | - _DetailNormalMapScale: 1 66 | - _DstBlend: 0 67 | - _GlossMapScale: 1 68 | - _Glossiness: 0.5 69 | - _GlossyReflections: 1 70 | - _Metallic: 0 71 | - _Mode: 0 72 | - _OcclusionStrength: 1 73 | - _Parallax: 0.02 74 | - _SmoothnessTextureChannel: 0 75 | - _SpecularHighlights: 1 76 | - _SrcBlend: 1 77 | - _UVSec: 0 78 | - _ZWrite: 1 79 | m_Colors: 80 | - _Color: {r: 1, g: 1, b: 1, a: 1} 81 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 82 | - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 83 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/FlatShadingTerrain.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6569354bb6444d41a464c5ae8e4ea9f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/NormalTerrain.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: NormalTerrain 11 | m_Shader: {fileID: 4800000, guid: 365ec3c4dfbd50f48b3b261af9673b93, type: 3} 12 | m_ShaderKeywords: AO_ON TEXTUREMODULE_ON _AOUV_UV0 _GRADIENTSPACE_WORLD_SPACE _GRADSETTINGS_B_USE_GLOBAL 13 | _GRADSETTINGS_D_USE_GLOBAL _GRADSETTINGS_F_USE_GLOBAL _GRADSETTINGS_L_USE_GLOBAL 14 | _GRADSETTINGS_R_USE_GLOBAL _GRADSETTINGS_T_USE_GLOBAL _LMAPBLENDINGMODE_ADD _MODE_OPAQUE 15 | _SHADING_B_VERTEX_COLOR _SHADING_D_VERTEX_COLOR _SHADING_F_VERTEXCOLOR _SHADING_L_VERTEX_COLOR 16 | _SHADING_R_VERTEX_COLOR _SHADING_T_VERTEX_COLOR 17 | m_LightmapFlags: 4 18 | m_EnableInstancingVariants: 0 19 | m_DoubleSidedGI: 1 20 | m_CustomRenderQueue: -1 21 | stringTagMap: {} 22 | disabledShaderPasses: [] 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _AOTexture: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _BumpMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailAlbedoMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailMask: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _DetailNormalMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _EmissionMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MainTex: 51 | m_Texture: {fileID: 2800000, guid: 05fb3e62c4ba3454181e8ebc257da85f, type: 3} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _MainTexture: 55 | m_Texture: {fileID: 2800000, guid: 05fb3e62c4ba3454181e8ebc257da85f, type: 3} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _MetallicGlossMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | - _OcclusionMap: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - _ParallaxMap: 67 | m_Texture: {fileID: 0} 68 | m_Scale: {x: 1, y: 1} 69 | m_Offset: {x: 0, y: 0} 70 | - _Ramp: 71 | m_Texture: {fileID: 0} 72 | m_Scale: {x: 1, y: 1} 73 | m_Offset: {x: 0, y: 0} 74 | - _TerrainHolesTexture: 75 | m_Texture: {fileID: 0} 76 | m_Scale: {x: 1, y: 1} 77 | m_Offset: {x: 0, y: 0} 78 | m_Floats: 79 | - _AOEnable: 0 80 | - _AOPower: 1 81 | - _AOuv: 0 82 | - _AmbientPower: 0 83 | - _Brightness: 0 84 | - _BumpScale: 1 85 | - _ColorCorrectionEnable: 0 86 | - _Cull: 2 87 | - _Cutoff: 0.5 88 | - _DetailNormalMapScale: 1 89 | - _DontMix: 0 90 | - _DstBlend: 0 91 | - _Fade: 1 92 | - _FogHeight: 10 93 | - _FogYStartPos: 0 94 | - _GlossMapScale: 1 95 | - _Glossiness: 0.5 96 | - _GlossyReflections: 1 97 | - _GradSettings_B: 0 98 | - _GradSettings_D: 0 99 | - _GradSettings_F: 0 100 | - _GradSettings_L: 0 101 | - _GradSettings_R: 0 102 | - _GradSettings_T: 0 103 | - _GradientHeight_B: 1 104 | - _GradientHeight_D: 1 105 | - _GradientHeight_F: 1 106 | - _GradientHeight_G: 1 107 | - _GradientHeight_L: 1 108 | - _GradientHeight_R: 1 109 | - _GradientHeight_T: 1 110 | - _GradientSpace: 0 111 | - _HFogEnable: 0 112 | - _LMPower: 1 113 | - _LmapBlendingMode: 0 114 | - _LmapEnable: 0 115 | - _MainTexturePower: 0 116 | - _Metallic: 0 117 | - _MinLight: -0.09 118 | - _Mode: 0 119 | - _OcclusionStrength: 1 120 | - _OtherSettings: 1 121 | - _Parallax: 0.02 122 | - _RealtimeShadow: 0 123 | - _RimEnable: 0 124 | - _RimPower: 1 125 | - _Rotation_B: 0 126 | - _Rotation_D: 0 127 | - _Rotation_F: 0 128 | - _Rotation_G: 0 129 | - _Rotation_L: 0 130 | - _Rotation_R: 0 131 | - _Rotation_T: 0 132 | - _Saturation: 0 133 | - _Shading_B: 0 134 | - _Shading_D: 0 135 | - _Shading_F: 0 136 | - _Shading_L: 0 137 | - _Shading_R: 0 138 | - _Shading_T: 0 139 | - _ShadowAmount: 0.8 140 | - _ShadowBlend: 0 141 | - _ShadowInfluence: 0 142 | - _ShowAO: 0 143 | - _ShowAmbientSettings: 0 144 | - _ShowBack: 0 145 | - _ShowBottom: 0 146 | - _ShowColorCorrection: 0 147 | - _ShowCustomShading: 1 148 | - _ShowFog: 0 149 | - _ShowFront: 0 150 | - _ShowGlobalGradientSettings: 0 151 | - _ShowLMap: 0 152 | - _ShowLeft: 0 153 | - _ShowRight: 0 154 | - _ShowTexture: 1 155 | - _ShowTop: 0 156 | - _SmoothnessTextureChannel: 0 157 | - _SpecularHighlights: 1 158 | - _SrcBlend: 1 159 | - _UVSec: 0 160 | - _UnityFogEnable: 0 161 | - _ZWrite: 1 162 | - _ZWriteOverride: 0 163 | m_Colors: 164 | - _AOColor: {r: 0, g: 0, b: 0, a: 1} 165 | - _AmbientColor: {r: 0.4, g: 0.4, b: 0.4, a: 1} 166 | - _Color: {r: 1, g: 1, b: 1, a: 1} 167 | - _Color1_B: {r: 1, g: 1, b: 1, a: 1} 168 | - _Color1_D: {r: 1, g: 1, b: 1, a: 1} 169 | - _Color1_F: {r: 1, g: 1, b: 1, a: 1} 170 | - _Color1_L: {r: 1, g: 1, b: 1, a: 1} 171 | - _Color1_R: {r: 1, g: 1, b: 1, a: 1} 172 | - _Color1_T: {r: 1, g: 1, b: 1, a: 1} 173 | - _Color2_B: {r: 1, g: 1, b: 1, a: 1} 174 | - _Color2_D: {r: 1, g: 1, b: 1, a: 1} 175 | - _Color2_F: {r: 1, g: 1, b: 1, a: 1} 176 | - _Color2_L: {r: 1, g: 1, b: 1, a: 1} 177 | - _Color2_R: {r: 1, g: 1, b: 1, a: 1} 178 | - _Color2_T: {r: 1, g: 1, b: 1, a: 1} 179 | - _Color_Fog: {r: 0.5, g: 0.5, b: 0.5, a: 1} 180 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 181 | - _GizmoPosition_B: {r: 0, g: 0, b: 10, a: 10} 182 | - _GizmoPosition_D: {r: 0, g: 0, b: 10, a: 10} 183 | - _GizmoPosition_F: {r: 0, g: 0, b: 10, a: 10} 184 | - _GizmoPosition_L: {r: 0, g: 0, b: 10, a: 10} 185 | - _GizmoPosition_R: {r: 0, g: 0, b: 10, a: 10} 186 | - _GizmoPosition_T: {r: 0, g: 0, b: 10, a: 10} 187 | - _GradientXStartPos_D: {r: 0, g: 0, b: 0, a: 0} 188 | - _GradientXStartPos_T: {r: 0, g: 0, b: 0, a: 0} 189 | - _GradientYStartPos_B: {r: 0, g: 0, b: 0, a: 0} 190 | - _GradientYStartPos_F: {r: 0, g: 0, b: 0, a: 0} 191 | - _GradientYStartPos_G: {r: 0, g: 0, b: 0, a: 0} 192 | - _GradientYStartPos_L: {r: 0, g: 0, b: 0, a: 0} 193 | - _GradientYStartPos_R: {r: 0, g: 0, b: 0, a: 0} 194 | - _LMColor: {r: 0, g: 0, b: 0, a: 1} 195 | - _RimColor: {r: 0, g: 0, b: 0, a: 1} 196 | - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} 197 | - _TintColor: {r: 0, g: 0, b: 0, a: 1} 198 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/NormalTerrain.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5e158f8f9cada14380f5755c6cef11c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfe840697b78aee49ac26e513d3ab9ef 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders/ChunkShader.shader: -------------------------------------------------------------------------------- 1 |  2 | 3 | Shader "Custom/ChunkShader" 4 | { 5 | Properties 6 | { 7 | [NoScaleOffset] _MainTex("Texture", 2D) = "white" {} 8 | } 9 | SubShader 10 | { 11 | Pass 12 | { 13 | Tags {"Queue" = "Geometry" "RenderType" = "Opaque" "LightMode" = "ForwardBase"} 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma geometry geom 17 | #pragma fragment frag 18 | #include "UnityCG.cginc" 19 | #include "Lighting.cginc" 20 | 21 | // compile shader into multiple variants, with and without shadows 22 | // (we don't care about any lightmaps yet, so skip these variants) 23 | #pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight 24 | // shadow helper functions and macros 25 | #include "AutoLight.cginc" 26 | 27 | struct v2f 28 | { 29 | float2 uv : TEXCOORD0; 30 | float3 vertex : TEXCOORD1; 31 | SHADOW_COORDS(2) // put shadows data into TEXCOORD2 32 | fixed3 diff : COLOR0; 33 | fixed3 ambient : COLOR1; 34 | float4 pos : SV_POSITION; 35 | float light : TEXCOORD3; 36 | }; 37 | v2f vert(appdata_base v) 38 | { 39 | v2f o; 40 | o.pos = UnityObjectToClipPos(v.vertex); 41 | o.uv = v.texcoord; 42 | o.vertex = v.vertex;; 43 | half3 worldNormal = UnityObjectToWorldNormal(v.normal); 44 | half nl = max(0, dot(worldNormal, _WorldSpaceLightPos0.xyz)); 45 | o.diff = nl * _LightColor0.rgb; 46 | o.ambient = ShadeSH9(half4(worldNormal,1)); 47 | // compute shadows data 48 | TRANSFER_SHADOW(o) 49 | return o; 50 | } 51 | 52 | sampler2D _MainTex; 53 | 54 | [maxvertexcount(3)] 55 | void geom(triangle v2f IN[3], inout TriangleStream triStream) 56 | { 57 | 58 | 59 | // Compute the normal 60 | float3 vecA = IN[1].vertex - IN[0].vertex; 61 | float3 vecB = IN[2].vertex - IN[0].vertex; 62 | float3 normal = cross(vecA, vecB); 63 | normal = normalize(mul(normal, (float3x3) unity_WorldToObject)); 64 | 65 | // Compute diffuse light 66 | float3 lightDir = normalize(_WorldSpaceLightPos0.xyz); 67 | 68 | for (int i = 0; i < 3; i++) 69 | { 70 | IN[i].light = dot(normal, lightDir);//v2f.light contain the flat shading illumination effect 71 | triStream.Append(IN[i]); 72 | } 73 | } 74 | 75 | fixed4 frag(v2f i) : SV_Target 76 | { 77 | 78 | 79 | fixed4 col = tex2D(_MainTex, i.uv); 80 | // compute shadow attenuation (1.0 = fully lit, 0.0 = fully shadowed) 81 | fixed shadow = SHADOW_ATTENUATION(i); 82 | // darken light's illumination with shadow, keep ambient intact 83 | float3 baseWorldPos = (unity_ObjectToWorld._m03_m13_m23 / 7) % 1; 84 | baseWorldPos.y = 1; 85 | if (baseWorldPos.x < 0) 86 | baseWorldPos.x = -baseWorldPos.x; 87 | if (baseWorldPos.z < 0) 88 | baseWorldPos.z = -baseWorldPos.z; 89 | 90 | 91 | fixed3 lighting = i.diff * shadow + i.ambient/2 * i.light + i.ambient/2; 92 | col.rgb *= lighting * baseWorldPos; 93 | return col; 94 | } 95 | ENDCG 96 | } 97 | 98 | // shadow casting support 99 | UsePass "Legacy Shaders/VertexLit/SHADOWCASTER" 100 | } 101 | } -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders/ChunkShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c18b9cf2cb49344a940b4495c86efc0 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders/FlatShading.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | //Shader from http://www.shaderslab.com/demo-90---flat-shading.html 5 | Shader "Custom/Geometry/FlatShading" 6 | { 7 | Properties 8 | { 9 | _Color("Color", Color) = (1,1,1,1) 10 | _MainTex("Albedo", 2D) = "white" {} 11 | } 12 | 13 | SubShader 14 | { 15 | 16 | Tags{ "Queue" = "Geometry" "RenderType" = "Opaque" "LightMode" = "ForwardBase" } 17 | 18 | Pass 19 | { 20 | CGPROGRAM 21 | 22 | #include "UnityCG.cginc" 23 | #pragma vertex vert 24 | #pragma geometry geom 25 | #pragma fragment frag 26 | 27 | float4 _Color; 28 | sampler2D _MainTex; 29 | 30 | struct v2g 31 | { 32 | float4 pos : SV_POSITION; 33 | float2 uv : TEXCOORD0; 34 | float3 vertex : TEXCOORD1; 35 | }; 36 | 37 | struct g2f 38 | { 39 | float4 pos : SV_POSITION; 40 | float2 uv : TEXCOORD0; 41 | float light : TEXCOORD1; 42 | }; 43 | 44 | v2g vert(appdata_full v) 45 | { 46 | v2g o; 47 | o.vertex = v.vertex; 48 | o.pos = UnityObjectToClipPos(v.vertex); 49 | o.uv = v.texcoord; 50 | return o; 51 | } 52 | 53 | [maxvertexcount(3)] 54 | void geom(triangle v2g IN[3], inout TriangleStream triStream) 55 | { 56 | g2f o; 57 | 58 | // Compute the normal 59 | float3 vecA = IN[1].vertex - IN[0].vertex; 60 | float3 vecB = IN[2].vertex - IN[0].vertex; 61 | float3 normal = cross(vecA, vecB); 62 | normal = normalize(mul(normal, (float3x3) unity_WorldToObject)); 63 | 64 | // Compute diffuse light 65 | float3 lightDir = normalize(_WorldSpaceLightPos0.xyz); 66 | o.light = max(0., dot(normal, lightDir)); 67 | 68 | // Compute barycentric uv 69 | o.uv = (IN[0].uv + IN[1].uv + IN[2].uv) / 3; 70 | 71 | for (int i = 0; i < 3; i++) 72 | { 73 | o.pos = IN[i].pos; 74 | triStream.Append(o); 75 | } 76 | } 77 | 78 | half4 frag(g2f i) : COLOR 79 | { 80 | float4 col = tex2D(_MainTex, i.uv); 81 | col.rgb *= i.light * _Color; 82 | return col; 83 | } 84 | 85 | ENDCG 86 | } 87 | } 88 | Fallback "Diffuse" 89 | } -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders/FlatShading.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04f6ea15b89a9034fb5d5f5331f9daab 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders/TerrainShader.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/TerrainShader" 2 | { 3 | Properties 4 | { 5 | [NoScaleOffset] _MainTex("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Pass 10 | { 11 | Tags {"Queue" = "Geometry" "RenderType" = "Opaque" "LightMode" = "ForwardBase"} 12 | CGPROGRAM 13 | #pragma vertex vert 14 | #pragma geometry geom 15 | #pragma fragment frag 16 | #include "UnityCG.cginc" 17 | #include "Lighting.cginc" 18 | 19 | // compile shader into multiple variants, with and without shadows 20 | // (we don't care about any lightmaps yet, so skip these variants) 21 | #pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight 22 | // shadow helper functions and macros 23 | #include "AutoLight.cginc" 24 | 25 | struct v2f 26 | { 27 | float2 uv : TEXCOORD0; 28 | float3 vertex : TEXCOORD1; 29 | SHADOW_COORDS(2) // put shadows data into TEXCOORD2 30 | fixed3 diff : COLOR0; 31 | fixed3 ambient : COLOR1; 32 | float4 pos : SV_POSITION; 33 | float light : TEXCOORD3; 34 | }; 35 | v2f vert(appdata_base v) 36 | { 37 | v2f o; 38 | o.pos = UnityObjectToClipPos(v.vertex); 39 | o.uv = v.texcoord; 40 | o.vertex = v.vertex;; 41 | half3 worldNormal = UnityObjectToWorldNormal(v.normal); 42 | half nl = max(0, dot(worldNormal, _WorldSpaceLightPos0.xyz)); 43 | o.diff = nl * _LightColor0.rgb; 44 | o.ambient = ShadeSH9(half4(worldNormal,1)); 45 | // compute shadows data 46 | TRANSFER_SHADOW(o) 47 | return o; 48 | } 49 | 50 | sampler2D _MainTex; 51 | 52 | [maxvertexcount(3)] 53 | void geom(triangle v2f IN[3], inout TriangleStream triStream) 54 | { 55 | 56 | 57 | // Compute the normal 58 | float3 vecA = IN[1].vertex - IN[0].vertex; 59 | float3 vecB = IN[2].vertex - IN[0].vertex; 60 | float3 normal = cross(vecA, vecB); 61 | normal = normalize(mul(normal, (float3x3) unity_WorldToObject)); 62 | 63 | // Compute diffuse light 64 | float3 lightDir = normalize(_WorldSpaceLightPos0.xyz); 65 | 66 | for (int i = 0; i < 3; i++) 67 | { 68 | IN[i].light = dot(normal, lightDir);//v2f.light contain the flat shading illumination effect 69 | triStream.Append(IN[i]); 70 | } 71 | } 72 | 73 | fixed4 frag(v2f i) : SV_Target 74 | { 75 | 76 | 77 | fixed4 col = tex2D(_MainTex, i.uv); 78 | // compute shadow attenuation (1.0 = fully lit, 0.0 = fully shadowed) 79 | fixed shadow = SHADOW_ATTENUATION(i); 80 | // darken light's illumination with shadow, keep ambient intact 81 | fixed3 lighting = i.diff * shadow *i.light + i.ambient * i.light ; 82 | col.rgb *= lighting; 83 | return col; 84 | } 85 | ENDCG 86 | } 87 | 88 | // shadow casting support 89 | UsePass "Legacy Shaders/VertexLit/SHADOWCASTER" 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/Shaders/TerrainShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 365ec3c4dfbd50f48b3b261af9673b93 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/TerrainFlatImg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Javier-Garzo/Marching-cubes-on-Unity-3D/6c134ba410b9ca72c9ee977e75c66e6fa4ef07bc/Assets/Marching_Cubes/Materials/TerrainFlatImg.png -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Materials/TerrainFlatImg.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27c611cb5eeecff42a6aeb76b87c86a6 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 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 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 2048 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 2048 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 5e97eb03825dee720800000000000000 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3b1a59b446b8404a94c5d999a65818e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Constants.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d80d65dd99a159f428343cdab4bc8ac4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca814f85afa38d54bb4e05edc4e2e63a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Demo/FlyingCamera.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class FlyingCamera : MonoBehaviour 6 | { 7 | public float speed = 10; 8 | public float rotationSpeed = 10; 9 | public bool hideMouse = true; 10 | private float yaw = 0.0f; 11 | private float pitch = 0.0f; 12 | private Vector2 pitchClamp = new Vector2(-70,80); 13 | 14 | void Start() 15 | { 16 | if (hideMouse) 17 | { 18 | Cursor.visible = true; 19 | Cursor.lockState = CursorLockMode.Locked; 20 | } 21 | yaw = transform.eulerAngles.y; 22 | pitch = transform.eulerAngles.x; 23 | } 24 | 25 | // Update is called once per frame 26 | void Update() 27 | { 28 | var dir = Input.GetAxis("Vertical") * transform.forward + Input.GetAxis("Horizontal") * transform.right; 29 | transform.position += (dir * speed * Time.deltaTime); 30 | if(Input.GetKey(KeyCode.Space)) 31 | transform.position += Vector3.up * speed * Time.deltaTime; 32 | else if(Input.GetKey(KeyCode.LeftShift)) 33 | transform.position -= Vector3.up * speed * Time.deltaTime; 34 | 35 | yaw += rotationSpeed * Input.GetAxis("Mouse X"); 36 | pitch -= rotationSpeed * Input.GetAxis("Mouse Y"); 37 | pitch = Mathf.Clamp(pitch , pitchClamp.x, pitchClamp.y); 38 | 39 | transform.eulerAngles = new Vector3(pitch, yaw, 0.0f); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Demo/FlyingCamera.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb295955006ba09429e78608f95fbe06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6b8853a591c13049b2272741e97b7ca 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/BiomeAutoUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(Biome), true)] 7 | public class BiomeAutoUpdate : Editor 8 | { 9 | // Function executed each time user interact with the inspector 10 | public override void OnInspectorGUI() 11 | { 12 | 13 | //base.OnInspectorGUI(); 14 | if (DrawDefaultInspector() && Application.isPlaying)//If we changue some value inside a biome and there is a NoiseTerrainViewer we update the terrain 15 | { 16 | Biome obj = (Biome)target; 17 | NoiseTerrainViewer noiseViewer = obj.gameObject.GetComponent(); 18 | if (noiseViewer != null) 19 | noiseViewer.GenerateTerrain(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/BiomeAutoUpdate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e644813e28976494c848efee79c58a4e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/NoiseTerrainAutoUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(NoiseManager))] 7 | public class NoiseTerrainAutoUpdate : Editor 8 | { 9 | // Function executed each time user interact with the inspector 10 | public override void OnInspectorGUI() 11 | { 12 | 13 | //base.OnInspectorGUI(); 14 | if(DrawDefaultInspector() && Application.isPlaying)//If we changue some value in the NoiseManager and there is a NoiseTerrainViewer we update the terrain 15 | { 16 | NoiseManager obj = (NoiseManager)target; 17 | NoiseTerrainViewer noiseViewer = obj.gameObject.GetComponent(); 18 | if (noiseViewer != null) 19 | noiseViewer.GenerateTerrain(); 20 | } 21 | } 22 | } 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/NoiseTerrainAutoUpdate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 838467f3c7c2e924eb41b992b75d1d2c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/NoiseViewerAutoUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | 7 | [CustomEditor(typeof(NoiseTerrainViewer))] 8 | public class NoiseViewerAutoUpdate : Editor 9 | { 10 | // Function executed each time user interact with the inspector 11 | public override void OnInspectorGUI() 12 | { 13 | 14 | //base.OnInspectorGUI(); 15 | if (DrawDefaultInspector() && Application.isPlaying)//If we changue some value in the NoiseTerrainViewer and there is a NoiseTerrainViewer we update the terrain 16 | { 17 | NoiseTerrainViewer noiseViewer = (NoiseTerrainViewer)target; 18 | noiseViewer.GenerateTerrain(); 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/NoiseViewerAutoUpdate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a11632e71d86e244a79b217c1746d62 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/WorldManagerEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.IO; 6 | 7 | [CustomEditor(typeof(WorldManager))] 8 | public class WorldManagerEditor : Editor 9 | { 10 | public override void OnInspectorGUI() 11 | { 12 | DrawDefaultInspector(); 13 | 14 | EditorGUILayout.Space();EditorGUILayout.Space(); 15 | 16 | if (GUILayout.Button("Open worlds folder")) 17 | { 18 | if (!Directory.Exists(Application.persistentDataPath + WorldManager.WORLDS_DIRECTORY)) 19 | Directory.CreateDirectory(Application.persistentDataPath + WorldManager.WORLDS_DIRECTORY); 20 | EditorUtility.RevealInFinder(Application.persistentDataPath +WorldManager.WORLDS_DIRECTORY); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Editor/WorldManagerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a830b75e8c928a4f8dcfb6ea0fc82ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6161d2809c180f48825093cb5651896 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper/CompressHelper.cs: -------------------------------------------------------------------------------- 1 |  2 | //Code extracted from the https://stackoverflow.com/questions/40909052/using-gzip-to-compress-decompress-an-array-of-bytes stackoverflow question 3 | 4 | using System.IO; 5 | using System.IO.Compression; 6 | 7 | public class CompressHelper 8 | { 9 | public static byte[] Compress(byte[] data) 10 | { 11 | using (var compressedStream = new MemoryStream()) 12 | using (var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) 13 | { 14 | zipStream.Write(data, 0, data.Length); 15 | zipStream.Close(); 16 | return compressedStream.ToArray(); 17 | } 18 | } 19 | 20 | public static byte[] Decompress(byte[] data) 21 | { 22 | using (var compressedStream = new MemoryStream(data)) 23 | using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress)) 24 | using (var resultStream = new MemoryStream()) 25 | { 26 | zipStream.CopyTo(resultStream); 27 | return resultStream.ToArray(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper/CompressHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1aa3131a7d6e9d24f88c7265c47a6cd8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper/Singleton.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | /// 4 | /// Singleton. See Unity Singleton 5 | /// 6 | public abstract class Singleton : MonoBehaviour where T : Component 7 | { 8 | #region Fields 9 | /// 10 | /// The instance. 11 | /// 12 | private static T instance; 13 | 14 | #endregion 15 | 16 | #region Properties 17 | /// 18 | /// Gets the instance. 19 | /// 20 | /// The instance. 21 | public static T Instance 22 | { 23 | get 24 | { 25 | if (instance == null) 26 | { 27 | instance = FindObjectOfType(); 28 | if (instance == null) 29 | { 30 | GameObject obj = new GameObject(); 31 | obj.name = typeof(T).Name; 32 | instance = obj.AddComponent(); 33 | //DontDestroyOnLoad(instance); 34 | } 35 | } 36 | return instance; 37 | } 38 | } 39 | #endregion 40 | 41 | #region Methods 42 | /// 43 | /// Use this for initialization. 44 | /// 45 | public virtual void Awake() 46 | { 47 | if (instance == null) 48 | { 49 | instance = this as T; 50 | //DontDestroyOnLoad(gameObject); 51 | } 52 | else 53 | { 54 | Destroy(gameObject); 55 | } 56 | } 57 | 58 | //Destroy singleton instance on destroy 59 | public void OnDestroy() 60 | { 61 | if (instance == this) 62 | instance = null; 63 | } 64 | 65 | /// 66 | /// Check if singleton is already created 67 | /// 68 | public static bool IsCreated() 69 | { 70 | return (instance != null); 71 | } 72 | 73 | #endregion 74 | } -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper/Singleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce49898b3662a0445b4b7b876f045467 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper/WorldManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System.IO; 5 | using System.Linq; 6 | 7 | public class WorldManager : Singleton 8 | { 9 | [SerializeField]private string world = "default"; //World selected by the manager 10 | public const string WORLDS_DIRECTORY = "/worlds"; //Directory worlds (save folder, that contains the worlds folders) 11 | 12 | 13 | private void Awake() 14 | { 15 | base.Awake(); 16 | if (Instance == this) 17 | { 18 | DontDestroyOnLoad(gameObject); 19 | 20 | if (!Directory.Exists(Application.persistentDataPath + WORLDS_DIRECTORY))//in case worlds directory not created, create the "worlds" directory 21 | Directory.CreateDirectory(Application.persistentDataPath + WORLDS_DIRECTORY); 22 | 23 | if (!Directory.Exists(Application.persistentDataPath + WORLDS_DIRECTORY + "/" + world))//in case world not created, create the world (generate folder) 24 | Directory.CreateDirectory(Application.persistentDataPath + WORLDS_DIRECTORY + "/" + world); 25 | } 26 | } 27 | 28 | /// 29 | /// Create and select a new world (save/load folder), a worldConfig can be passed as second optional parameter for being used by the Noisemanager (or empty for default one). 30 | /// 31 | public static bool CreateWorld(string worldName, NoiseManager.WorldConfig newWorldConfig = null) 32 | { 33 | if (!Directory.Exists(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName)) 34 | { 35 | Directory.CreateDirectory(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName); 36 | Instance.world = worldName; 37 | if(newWorldConfig != null)//Use the WorldConfig passed as parameter 38 | { 39 | string worldConfig = JsonUtility.ToJson(newWorldConfig); 40 | File.WriteAllText(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName+ "/worldConfig.json", worldConfig); 41 | } 42 | else//Use the default world config 43 | { 44 | newWorldConfig = new NoiseManager.WorldConfig(); 45 | newWorldConfig.worldSeed = Random.Range(int.MinValue, int.MaxValue); 46 | string worldConfig = JsonUtility.ToJson(newWorldConfig); 47 | File.WriteAllText(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName + "/worldConfig.json", worldConfig); 48 | } 49 | return true; 50 | } 51 | else 52 | { 53 | Debug.LogError("folder already exists"); 54 | return false; 55 | } 56 | } 57 | 58 | /// 59 | /// Delete a world (save/load folder) and remove all related files. 60 | /// 61 | public static bool DeleteWorld(string worldName) 62 | { 63 | if (Directory.Exists(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName)) 64 | { 65 | Directory.Delete(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName, true); 66 | return true; 67 | } 68 | else 69 | { 70 | Debug.LogError("folder not exists"); 71 | return false; 72 | } 73 | } 74 | 75 | /// 76 | /// Select a world (save/load folder) which will load next time by the ChunkSystem. 77 | /// 78 | public static bool SelectWorld(string worldName) 79 | { 80 | if (Directory.Exists(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName)) 81 | { 82 | Instance.world = worldName; 83 | return true; 84 | } 85 | else 86 | { 87 | Debug.LogError("world (folder) not exists"); 88 | return false; 89 | } 90 | } 91 | 92 | /// 93 | /// Return the name of the selected world. 94 | /// 95 | public static string GetSelectedWorldName() 96 | { 97 | return Instance.world; 98 | } 99 | 100 | /// 101 | /// Return the path of the selected world. 102 | /// 103 | public static string GetSelectedWorldDir() 104 | { 105 | return Application.persistentDataPath + WORLDS_DIRECTORY + "/" + Instance.world; 106 | } 107 | 108 | /// 109 | /// Return WorldConfig of the selected world. 110 | /// 111 | public static NoiseManager.WorldConfig GetSelectedWorldConfig() 112 | { 113 | string selectedWorld = GetSelectedWorldName(); 114 | if (File.Exists(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + selectedWorld + "/worldConfig.json")) 115 | { 116 | string json = File.ReadAllText(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + selectedWorld + "/worldConfig.json"); 117 | return JsonUtility.FromJson(json); 118 | } 119 | else 120 | { 121 | Debug.LogError("No worldConfig.json exist, generating a new one, using the default parameters."); 122 | NoiseManager.WorldConfig newWorldConfig = new NoiseManager.WorldConfig(); 123 | newWorldConfig.worldSeed = Random.Range(int.MinValue, int.MaxValue); 124 | string worldConfig = JsonUtility.ToJson(newWorldConfig); 125 | File.WriteAllText(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + selectedWorld + "/worldConfig.json", worldConfig); 126 | return newWorldConfig; 127 | } 128 | 129 | } 130 | 131 | /// 132 | /// Return all the worlds as a string[]. 133 | /// 134 | public static string[] GetAllWorlds() 135 | { 136 | return Directory.GetDirectories(Application.persistentDataPath + WORLDS_DIRECTORY).Select(Path.GetFileName).ToArray(); 137 | 138 | } 139 | 140 | /// 141 | /// Return size of a world. 142 | /// 143 | public static long worldSize(string worldName) 144 | { 145 | if (Directory.Exists(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName)) 146 | return new DirectoryInfo(Application.persistentDataPath + WORLDS_DIRECTORY + '/' + worldName).GetFiles("*.*", SearchOption.TopDirectoryOnly).Sum(file => file.Length); 147 | else 148 | return 0; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/Helper/WorldManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b55408afa92d6774d8d860be3ca9e46f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/MarchingCubes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb2fe608d916c7d4caeb71cadb28ed00 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/MarchingCubes/BuildChunkJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b3311ecc063bfd4990a5be08b08cfbc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/MarchingCubes/CameraTerrainModifier.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class CameraTerrainModifier : MonoBehaviour 7 | { 8 | public Text textSize; 9 | public Text textMaterial; 10 | [Tooltip("Range where the player can interact with the terrain")] 11 | public float rangeHit = 100; 12 | [Tooltip("Force of modifications applied to the terrain")] 13 | public float modiferStrengh = 10; 14 | [Tooltip("Size of the brush, number of vertex modified")] 15 | public float sizeHit = 6; 16 | [Tooltip("Color of the new voxels generated")][Range(0, Constants.NUMBER_MATERIALS-1)] 17 | public int buildingMaterial = 0; 18 | 19 | private RaycastHit hit; 20 | private ChunkManager chunkManager; 21 | 22 | void Awake() 23 | { 24 | chunkManager = ChunkManager.Instance; 25 | UpdateUI(); 26 | } 27 | 28 | // Update is called once per frame 29 | void Update() 30 | { 31 | 32 | if (Input.GetMouseButton(0) || Input.GetMouseButton(1)) 33 | { 34 | float modification = (Input.GetMouseButton(0)) ? modiferStrengh : -modiferStrengh; 35 | if (Physics.Raycast(transform.position, transform.forward, out hit, rangeHit)) 36 | { 37 | chunkManager.ModifyChunkData(hit.point, sizeHit, modification, buildingMaterial); 38 | } 39 | } 40 | 41 | //Inputs 42 | if (Input.GetAxis("Mouse ScrollWheel") > 0 && buildingMaterial != Constants.NUMBER_MATERIALS - 1) 43 | { 44 | buildingMaterial++; 45 | UpdateUI(); 46 | } 47 | else if (Input.GetAxis("Mouse ScrollWheel") < 0 && buildingMaterial != 0) 48 | { 49 | buildingMaterial--; 50 | UpdateUI(); 51 | } 52 | 53 | if(Input.GetKeyDown(KeyCode.Plus) || Input.GetKeyDown(KeyCode.KeypadPlus)) 54 | { 55 | sizeHit++; 56 | UpdateUI(); 57 | } 58 | else if((Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus)) && sizeHit > 1) 59 | { 60 | sizeHit--; 61 | UpdateUI(); 62 | } 63 | 64 | } 65 | 66 | public void UpdateUI() 67 | { 68 | textSize.text = "(+ -) Brush size: " + sizeHit; 69 | textMaterial.text = "(Mouse wheel) Actual material: " + buildingMaterial; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/MarchingCubes/CameraTerrainModifier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af995e98c40ae8541a4c270732a4a74c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/MarchingCubes/MeshBuilder.cs: -------------------------------------------------------------------------------- 1 |  2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using Unity.Collections; 6 | using Unity.Jobs; 7 | using Unity.Mathematics; 8 | 9 | public class MeshBuilder : Singleton 10 | { 11 | [Tooltip("Value from which the vertices are inside the figure")][Range(0, 255)] 12 | public int isoLevel = 128; 13 | [Tooltip("Allow to get a middle point between the voxel vertices in function of the weight of the vertices")] 14 | public bool interpolate = false; 15 | 16 | 17 | /// 18 | /// Method that calculate cubes, vertex and mesh in that order of a chunk. 19 | /// 20 | /// data of the chunk 21 | public Mesh BuildChunk(byte[] b) 22 | { 23 | BuildChunkJob buildChunkJob = new BuildChunkJob 24 | { 25 | chunkData = new NativeArray(b, Allocator.TempJob), 26 | isoLevel = this.isoLevel, 27 | interpolate = this.interpolate, 28 | vertex = new NativeList(500, Allocator.TempJob), 29 | uv = new NativeList(100, Allocator.TempJob), 30 | }; 31 | JobHandle jobHandle = buildChunkJob.Schedule(); 32 | jobHandle.Complete(); 33 | 34 | //Get all the data from the jobs and use to generate a Mesh 35 | Mesh meshGenerated = new Mesh(); 36 | Vector3[] meshVert = new Vector3[buildChunkJob.vertex.Length]; 37 | int[] meshTriangles = new int[buildChunkJob.vertex.Length]; 38 | for (int i = 0; i < buildChunkJob.vertex.Length; i++) 39 | { 40 | meshVert[i] = buildChunkJob.vertex[i]; 41 | meshTriangles[i] = i; 42 | } 43 | meshGenerated.vertices = meshVert; 44 | 45 | Vector2[] meshUV = new Vector2[buildChunkJob.vertex.Length]; 46 | 47 | for (int i = 0; i < buildChunkJob.vertex.Length; i++) 48 | { 49 | meshUV[i] = buildChunkJob.uv[i]; 50 | } 51 | meshGenerated.uv = meshUV; 52 | meshGenerated.triangles = meshTriangles; 53 | meshGenerated.RecalculateNormals(); 54 | meshGenerated.RecalculateTangents(); 55 | 56 | //Dispose (Clear the jobs NativeLists) 57 | buildChunkJob.vertex.Dispose(); 58 | buildChunkJob.uv.Dispose(); 59 | buildChunkJob.chunkData.Dispose(); 60 | 61 | return meshGenerated; 62 | } 63 | 64 | //This old code was adapted in the "BuildChunkJob" script and don't used anymore. (Stay if someone want to use the ) 65 | #region Original code (Deprecated) 66 | 67 | /// 68 | /// Method that calculate cubes, vertex and mesh in that order of a chunk. 69 | /// 70 | /// data of the chunk 71 | public Mesh BuildChunkDeprecated(byte[] b) 72 | { 73 | List vertexArray = new List(); 74 | List matVert = new List(); 75 | for (int y = 0; y < Constants.MAX_HEIGHT; y++)//height 76 | { 77 | for (int z = 1; z < Constants.CHUNK_SIZE + 1; z++)//column, start at 1, because Z axis is inverted and need -1 as offset 78 | { 79 | for (int x = 0; x < Constants.CHUNK_SIZE; x++)//line 80 | { 81 | Vector4[] cube = new Vector4[8]; 82 | int mat = Constants.NUMBER_MATERIALS; 83 | cube[0] = CalculateVertexChunk(x, y, z, b, ref mat); 84 | cube[1] = CalculateVertexChunk(x + 1, y, z, b, ref mat); 85 | cube[2] = CalculateVertexChunk(x + 1, y, z - 1, b, ref mat); 86 | cube[3] = CalculateVertexChunk(x, y, z - 1, b, ref mat); 87 | cube[4] = CalculateVertexChunk(x, y + 1, z, b, ref mat); 88 | cube[5] = CalculateVertexChunk(x + 1, y + 1, z, b, ref mat); 89 | cube[6] = CalculateVertexChunk(x + 1, y + 1, z - 1, b, ref mat); 90 | cube[7] = CalculateVertexChunk(x, y + 1, z - 1, b, ref mat); 91 | vertexArray.AddRange(CalculateVertex(cube, mat, ref matVert)); 92 | } 93 | } 94 | } 95 | return buildMesh(vertexArray, matVert); 96 | } 97 | 98 | /// 99 | /// It generate a mesh from a group of vertex. Flat shading type.(Deprecated) 100 | /// 101 | public Mesh buildMesh(List vertex, List textures = null) 102 | { 103 | Mesh mesh = new Mesh(); 104 | int[] triangles = new int[vertex.Count]; 105 | 106 | mesh.vertices = vertex.ToArray(); 107 | if (textures != null) 108 | mesh.uv = textures.ToArray(); 109 | 110 | for (int i = 0; i < triangles.Length; i++) 111 | triangles[i] = i; 112 | 113 | mesh.triangles = triangles; 114 | return mesh; 115 | 116 | } 117 | 118 | /// 119 | /// Calculate the vertices of the voxels, get the vertices of the triangulation table and his position in the world. Also check materials of that vertex (UV position).(Deprecated) 120 | /// 121 | public List CalculateVertex(Vector4[] cube, int colorVert, ref List matVert) 122 | { 123 | //Values above isoLevel are inside the figure, value of 0 means that the cube is entirely inside of the figure. 124 | int cubeindex = 0; 125 | if (cube[0].w < isoLevel) cubeindex |= 1; 126 | if (cube[1].w < isoLevel) cubeindex |= 2; 127 | if (cube[2].w < isoLevel) cubeindex |= 4; 128 | if (cube[3].w < isoLevel) cubeindex |= 8; 129 | if (cube[4].w < isoLevel) cubeindex |= 16; 130 | if (cube[5].w < isoLevel) cubeindex |= 32; 131 | if (cube[6].w < isoLevel) cubeindex |= 64; 132 | if (cube[7].w < isoLevel) cubeindex |= 128; 133 | 134 | List vertexArray = new List(); 135 | 136 | for (int i = 0; Constants.triTable[cubeindex, i] != -1; i++) 137 | { 138 | int v1 = Constants.cornerIndexAFromEdge[Constants.triTable[cubeindex, i]]; 139 | int v2 = Constants.cornerIndexBFromEdge[Constants.triTable[cubeindex, i]]; 140 | 141 | if (interpolate) 142 | vertexArray.Add(interporlateVertex(cube[v1], cube[v2], cube[v1].w, cube[v2].w)); 143 | else 144 | vertexArray.Add(midlePointVertex(cube[v1], cube[v2])); 145 | 146 | 147 | const float uvOffset = 0.01f; //Small offset for avoid pick pixels of other textures 148 | //NEED REWORKING FOR CORRECT WORKING, now have problems with the directions of the uv 149 | if (i % 6 == 0) 150 | matVert.Add(new Vector2(Constants.MATERIAL_SIZE*(colorVert % Constants.MATERIAL_FOR_ROW)+ Constants.MATERIAL_SIZE-uvOffset, 151 | 1- Constants.MATERIAL_SIZE * Mathf.Floor(colorVert / Constants.MATERIAL_FOR_ROW)-uvOffset)); 152 | else if (i % 6 == 1) 153 | matVert.Add(new Vector2(Constants.MATERIAL_SIZE * (colorVert % Constants.MATERIAL_FOR_ROW) + Constants.MATERIAL_SIZE - uvOffset, 154 | 1 - Constants.MATERIAL_SIZE * Mathf.Floor(colorVert / Constants.MATERIAL_FOR_ROW)- Constants.MATERIAL_SIZE + uvOffset)); 155 | else if(i % 6 == 2) 156 | matVert.Add(new Vector2(Constants.MATERIAL_SIZE * (colorVert % Constants.MATERIAL_FOR_ROW) + uvOffset, 157 | 1 - Constants.MATERIAL_SIZE * Mathf.Floor(colorVert / Constants.MATERIAL_FOR_ROW) -uvOffset)); 158 | else if (i % 6 == 3) 159 | matVert.Add(new Vector2(Constants.MATERIAL_SIZE * (colorVert % Constants.MATERIAL_FOR_ROW) + Constants.MATERIAL_SIZE - uvOffset, 160 | 1 - Constants.MATERIAL_SIZE * Mathf.Floor(colorVert / Constants.MATERIAL_FOR_ROW) - Constants.MATERIAL_SIZE + uvOffset)); 161 | else if (i % 6 == 4) 162 | matVert.Add(new Vector2(Constants.MATERIAL_SIZE * (colorVert % Constants.MATERIAL_FOR_ROW) + uvOffset, 163 | 1 - Constants.MATERIAL_SIZE * Mathf.Floor(colorVert / Constants.MATERIAL_FOR_ROW) - Constants.MATERIAL_SIZE + uvOffset)); 164 | else if (i % 6 == 5) 165 | matVert.Add(new Vector2(Constants.MATERIAL_SIZE * (colorVert % Constants.MATERIAL_FOR_ROW + uvOffset), 166 | 1 - Constants.MATERIAL_SIZE * Mathf.Floor(colorVert / Constants.MATERIAL_FOR_ROW) - uvOffset)); 167 | 168 | } 169 | 170 | return vertexArray; 171 | 172 | } 173 | 174 | 175 | /// 176 | /// Calculate the data of a vertex of a voxel.(Deprecated) 177 | /// 178 | private Vector4 CalculateVertexChunk(int x, int y, int z, byte[] b, ref int colorVoxel) 179 | { 180 | int index = (x + z * Constants.CHUNK_VERTEX_SIZE + y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE; 181 | int material = b[index+1]; 182 | if (b[index] >= isoLevel && material < colorVoxel) 183 | colorVoxel = material; 184 | return new Vector4( 185 | (x - Constants.CHUNK_SIZE / 2) * Constants.VOXEL_SIDE, 186 | (y - Constants.MAX_HEIGHT / 2) * Constants.VOXEL_SIDE, 187 | (z - Constants.CHUNK_SIZE / 2) * Constants.VOXEL_SIDE, 188 | b[index]); 189 | } 190 | 191 | /// 192 | /// Overload of the CalculateVertex method but without material calculations. 193 | /// 194 | public List CalculateVertex(Vector4[] cube) 195 | { 196 | //Values above isoLevel are inside the figure, value of 0 means that the cube is entirely inside of the figure.(Deprecated) 197 | int cubeindex = 0; 198 | if (cube[0].w < isoLevel) cubeindex |= 1; 199 | if (cube[1].w < isoLevel) cubeindex |= 2; 200 | if (cube[2].w < isoLevel) cubeindex |= 4; 201 | if (cube[3].w < isoLevel) cubeindex |= 8; 202 | if (cube[4].w < isoLevel) cubeindex |= 16; 203 | if (cube[5].w < isoLevel) cubeindex |= 32; 204 | if (cube[6].w < isoLevel) cubeindex |= 64; 205 | if (cube[7].w < isoLevel) cubeindex |= 128; 206 | 207 | List vertexArray = new List(); 208 | 209 | for (int i = 0; Constants.triTable[cubeindex, i] != -1; i++) 210 | { 211 | int v1 = Constants.cornerIndexAFromEdge[Constants.triTable[cubeindex, i]]; 212 | int v2 = Constants.cornerIndexBFromEdge[Constants.triTable[cubeindex, i]]; 213 | 214 | if (interpolate) 215 | vertexArray.Add(interporlateVertex(cube[v1], cube[v2], cube[v1].w, cube[v2].w)); 216 | else 217 | vertexArray.Add(midlePointVertex(cube[v1], cube[v2])); 218 | } 219 | 220 | return vertexArray; 221 | 222 | } 223 | 224 | //HelpMethods 225 | 226 | /// 227 | /// Calculate a point between two vertex using the weight of each vertex , used in interpolation voxel building.(Deprecated) 228 | /// 229 | public Vector3 interporlateVertex(Vector3 p1, Vector3 p2,float val1,float val2) 230 | { 231 | return Vector3.Lerp(p1, p2, (isoLevel - val1) / (val2 - val1)); 232 | } 233 | /// 234 | /// Calculate the middle point between two vertex, for no interpolation voxel building.(Deprecated) 235 | /// 236 | public Vector3 midlePointVertex(Vector3 p1, Vector3 p2) 237 | { 238 | return (p1 + p2) / 2; 239 | } 240 | #endregion 241 | } 242 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/MarchingCubes/MeshBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a71d4d4994b362a4e8d7d105e9c0f33a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 370cc5e8c038ccd4080c8577a31940f4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cde47678038d74e49acb20d053e406da 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Desert.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class B_Desert : Biome 6 | { 7 | 8 | [Tooltip("The max deep and height of the snow dunes, low values")][Range(0, Constants.MAX_HEIGHT - 1)] 9 | public int maxHeightDifference = Constants.MAX_HEIGHT / 5; 10 | 11 | [Header("Texture generation")] 12 | [Tooltip("Number vertex (y), where the sand end and the rock start")][Range(0, Constants.MAX_HEIGHT - 1)] 13 | public int sandDeep = Constants.MAX_HEIGHT / 5; 14 | public override byte[] GenerateChunkData(Vector2Int vecPos, float[] biomeMerge) 15 | { 16 | byte[] chunkData = new byte[Constants.CHUNK_BYTES]; 17 | float[] noise = NoiseManager.GenerateNoiseMap(scale, octaves, persistance, lacunarity, vecPos); 18 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE; z++) 19 | { 20 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE; x++) 21 | { 22 | // Get surface height of the x,z position 23 | float height = Mathf.Lerp( 24 | NoiseManager.Instance.worldConfig.surfaceLevel,//Biome merge height 25 | (((terrainHeightCurve.Evaluate(noise[x + z * Constants.CHUNK_VERTEX_SIZE]) * 2 - 1) * maxHeightDifference) + NoiseManager.Instance.worldConfig.surfaceLevel),//Desired biome height 26 | biomeMerge[x + z * Constants.CHUNK_VERTEX_SIZE]);//Merge value,0 = full merge, 1 = no merge 27 | 28 | int heightY = Mathf.CeilToInt(height);//Vertex Y where surface start 29 | int lastVertexWeigh = (int)((255 - isoLevel) * (height % 1) + isoLevel);//Weigh of the last vertex 30 | 31 | for (int y = 0; y < Constants.CHUNK_VERTEX_HEIGHT; y++) 32 | { 33 | int index = (x + z * Constants.CHUNK_VERTEX_SIZE + y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE; 34 | if (y < heightY - sandDeep) 35 | { 36 | chunkData[index] = 255; 37 | chunkData[index + 1] = 4;//Rock 38 | } 39 | else if (y < heightY) 40 | { 41 | chunkData[index] = 255; 42 | chunkData[index + 1] = 6;//sand 43 | } 44 | else if (y == heightY) 45 | { 46 | chunkData[index] = (byte)lastVertexWeigh; 47 | chunkData[index + 1] = 6;//sand 48 | 49 | } 50 | else 51 | { 52 | chunkData[index] = 0; 53 | chunkData[index + 1] = Constants.NUMBER_MATERIALS; 54 | } 55 | } 56 | } 57 | } 58 | return chunkData; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Desert.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7273ccaa8df40dd4ead28bb0ae12586d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Ice.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class B_Ice : Biome 6 | { 7 | [Tooltip("The max deep and height of the desert dunes, low values")][Range(0, Constants.MAX_HEIGHT - 1)] 8 | public int maxHeightDifference = Constants.MAX_HEIGHT / 5; 9 | 10 | [Tooltip("Number vertex (y), where the snow end and the rock start")][Range(0, Constants.MAX_HEIGHT - 1)] 11 | public int snowDeep = Constants.MAX_HEIGHT / 5; 12 | 13 | [Header("Ice columns configuration")] 14 | [Tooltip("Scale of the noise used for the ice columns appear")][Range(0, 100)] 15 | public int iceNoiseScale = 40; 16 | [Tooltip("Value in the ice noise map where the ice columns appear")][Range(0, 1)] 17 | public float iceApearValue = 0.8f; 18 | [Tooltip("Ice columns max height")][Range(0, Constants.MAX_HEIGHT - 1)] 19 | public int iceMaxHeight = 5; 20 | [Tooltip("Amplitude decrease of reliefs")] 21 | [Range(0.001f, 1f)] 22 | public float IcePersistance = 0.5f; 23 | [Tooltip("Frequency increase of reliefs")] 24 | [Range(1, 20)] 25 | public float IceLacunarity = 2f; 26 | 27 | public override byte[] GenerateChunkData(Vector2Int vecPos, float[] biomeMerge) 28 | { 29 | byte[] chunkData = new byte[Constants.CHUNK_BYTES]; 30 | float[] noise = NoiseManager.GenerateNoiseMap(scale, octaves, persistance, lacunarity, vecPos); 31 | float[] iceNoise = NoiseManager.GenerateNoiseMap(iceNoiseScale,2,IcePersistance,IceLacunarity, vecPos); 32 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE; z++) 33 | { 34 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE; x++) 35 | { 36 | // Get surface height of the x,z position 37 | float height = Mathf.Lerp( 38 | NoiseManager.Instance.worldConfig.surfaceLevel,//Biome merge height 39 | (((terrainHeightCurve.Evaluate(noise[x + z * Constants.CHUNK_VERTEX_SIZE]) * 2 - 1) * maxHeightDifference) + NoiseManager.Instance.worldConfig.surfaceLevel),//Desired biome height 40 | biomeMerge[x + z * Constants.CHUNK_VERTEX_SIZE]);//Merge value,0 = full merge, 1 = no merge 41 | 42 | int heightY = Mathf.CeilToInt(height);//Vertex Y where surface start 43 | int lastVertexWeigh = (int)((255 - isoLevel) * (height % 1) + isoLevel);//Weigh of the last vertex 44 | 45 | //Ice calculations 46 | int iceExtraHeigh = 0; 47 | if (iceNoise[x + z * Constants.CHUNK_VERTEX_SIZE] > iceApearValue) 48 | iceExtraHeigh = Mathf.CeilToInt((1- iceNoise[x + z * Constants.CHUNK_VERTEX_SIZE] ) / iceApearValue * iceMaxHeight); 49 | 50 | 51 | for (int y = 0; y < Constants.CHUNK_VERTEX_HEIGHT; y++) 52 | { 53 | int index = (x + z * Constants.CHUNK_VERTEX_SIZE + y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE; 54 | if (y < heightY - snowDeep) 55 | { 56 | chunkData[index] = 255; 57 | chunkData[index + 1] = 4;//Rock 58 | } 59 | else if (y < heightY+ iceExtraHeigh) 60 | { 61 | chunkData[index] = 255; 62 | if(y <= heightY) 63 | chunkData[index + 1] = 3;//snow 64 | else 65 | chunkData[index + 1] = 5;//ice 66 | } 67 | else if (y == heightY+ iceExtraHeigh) 68 | { 69 | chunkData[index] = (byte)lastVertexWeigh; 70 | if (y <= heightY) 71 | chunkData[index + 1] = 3;//snow 72 | else 73 | chunkData[index + 1] = 5;//ice 74 | 75 | } 76 | else 77 | { 78 | chunkData[index] = 0; 79 | chunkData[index + 1] = Constants.NUMBER_MATERIALS; 80 | } 81 | } 82 | } 83 | } 84 | return chunkData; 85 | } 86 | } 87 | 88 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Ice.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 203436860b177a54ebd749e243c194b0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Mountains.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class B_Mountains : Biome 6 | { 7 | [Tooltip("The highest point of the surface")][Range(0, Constants.MAX_HEIGHT - 1)] 8 | public int maxSurfaceheight = Constants.MAX_HEIGHT - 1; 9 | 10 | [Header("Texture generation")] 11 | [Tooltip("Increase the effect of the hightMatMult")][Range(1, 20f)] 12 | public float heightMatOffset = 10; 13 | [Tooltip("Multiplier of the slope in dependence of the height")] 14 | public AnimationCurve hightMatMult; 15 | [Tooltip("Height where the grass change to snow")][Range(0, Constants.MAX_HEIGHT)] 16 | public int snowHeight = 35; 17 | [Tooltip("Slope vale where terrain start to be rock")][Range(0, 1f)] 18 | public float rockLevel = 0.6f; 19 | [Tooltip("Slope vale where terrain start to be dirt")][Range(0, 1f)] 20 | public float dirtLevel = 0.25f; 21 | 22 | 23 | public override byte[] GenerateChunkData(Vector2Int vecPos, float[] biomeMerge) 24 | { 25 | int surfaceStart = NoiseManager.Instance.worldConfig.surfaceLevel ;//Avoid too high value that generate bad mesh 26 | byte[] chunkData = new byte[Constants.CHUNK_BYTES]; 27 | float[] noise = NoiseManager.GenerateExtendedNoiseMap(scale, octaves, persistance, lacunarity, vecPos); 28 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE; z++)//start a 1 because the noise start at -1 of the chunk vertex 29 | { 30 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE ; x++)//start a 1 because the noise start at -1 of the chunk vertex 31 | { 32 | // Get surface height of the x,z position 1276120704 33 | float height = Mathf.Lerp( 34 | NoiseManager.Instance.worldConfig.surfaceLevel,//Biome merge height 35 | (terrainHeightCurve.Evaluate(noise[(x+1) + (z+1) * (Constants.CHUNK_VERTEX_SIZE + 2)]) * (maxSurfaceheight - surfaceStart) + surfaceStart),//Desired biome height 36 | biomeMerge[x + z * Constants.CHUNK_VERTEX_SIZE]);//Merge value,0 = full merge, 1 = no merge 37 | 38 | //557164096 39 | int heightY = Mathf.CeilToInt(height);//Vertex Y where surface start 40 | int lastVertexWeigh = (int)((255 - isoLevel) * (height % 1) + isoLevel);//Weigh of the last vertex 41 | float slope = CalculateSlope((x+1), (z+1), noise); 42 | 43 | for (int y = 0; y < Constants.CHUNK_VERTEX_HEIGHT; y++) 44 | { 45 | int index = (x + z * Constants.CHUNK_VERTEX_SIZE + y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE;//apply x-1 and z-1 for get the correct index 46 | if (y < heightY - 5) 47 | { 48 | chunkData[index] = 255; 49 | chunkData[index + 1] = 4;//Rock 50 | } 51 | else if (y < heightY) 52 | { 53 | chunkData[index] = 255; 54 | if (slope > rockLevel) 55 | chunkData[index + 1] = 4;//Rock 56 | else if (slope < dirtLevel && y > snowHeight)//Avoid dirt in snow areas 57 | chunkData[index + 1] = 3; 58 | else 59 | chunkData[index + 1] = 1;//dirt 60 | } 61 | else if (y == heightY) 62 | { 63 | chunkData[index] = (byte)lastVertexWeigh;// 64 | if (slope > rockLevel) 65 | chunkData[index + 1] = 4;//Mountain Rock 66 | else if (slope > dirtLevel) 67 | chunkData[index + 1] = 1;//dirt 68 | else 69 | { 70 | if (y > snowHeight) 71 | chunkData[index + 1] = 3;//snow 72 | else 73 | chunkData[index + 1] = 0;//grass 74 | } 75 | 76 | } 77 | else 78 | { 79 | chunkData[index] = 0; 80 | chunkData[index + 1] = Constants.NUMBER_MATERIALS; 81 | } 82 | } 83 | } 84 | } 85 | return chunkData; 86 | } 87 | 88 | /// 89 | /// Function that calculate the slope of the terrain 90 | /// 91 | private float CalculateSlope(int x, int z, float[] noise) 92 | { 93 | float minValue = 1000; 94 | for (int xOffset = x - 1; xOffset <= x + 1; xOffset += 1) 95 | { 96 | for (int zOffset = z - 1; zOffset <= z + 1; zOffset += 1) 97 | { 98 | float value = terrainHeightCurve.Evaluate(noise[xOffset + zOffset * (Constants.CHUNK_VERTEX_SIZE + 2)]); 99 | if (value < minValue) 100 | minValue = value; 101 | } 102 | } 103 | float pointValue = terrainHeightCurve.Evaluate(noise[x + z * (Constants.CHUNK_VERTEX_SIZE + 2)]); 104 | return (1 - (minValue / pointValue)) * (hightMatMult.Evaluate(pointValue) * heightMatOffset); ; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Mountains.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 119732525eb80e94c824d2b984aba8ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Plains.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class B_Plains : Biome 6 | { 7 | [Tooltip("The max deep and height of the plains, low values")][Range(0, Constants.MAX_HEIGHT - 1)] 8 | public int maxHeightDifference = Constants.MAX_HEIGHT/5; 9 | 10 | public override byte[] GenerateChunkData(Vector2Int vecPos, float[] biomeMerge) 11 | { 12 | byte[] chunkData = new byte[Constants.CHUNK_BYTES]; 13 | float[] noise = NoiseManager.GenerateNoiseMap(scale, octaves, persistance, lacunarity, vecPos); 14 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE; z++) 15 | { 16 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE; x++) 17 | { 18 | // Get surface height of the x,z position 19 | float height = Mathf.Lerp( 20 | NoiseManager.Instance.worldConfig.surfaceLevel,//Biome merge height 21 | (((terrainHeightCurve.Evaluate(noise[x + z * Constants.CHUNK_VERTEX_SIZE]) * 2 - 1) * maxHeightDifference) + NoiseManager.Instance.worldConfig.surfaceLevel),//Desired biome height 22 | biomeMerge[x + z * Constants.CHUNK_VERTEX_SIZE]);//Merge value,0 = full merge, 1 = no merge 23 | 24 | int heightY = Mathf.CeilToInt(height);//Vertex Y where surface start 25 | int lastVertexWeigh = (int)((255 - isoLevel) * (height % 1) + isoLevel);//Weigh of the last vertex 26 | 27 | for (int y = 0; y < Constants.CHUNK_VERTEX_HEIGHT; y++) 28 | { 29 | int index = (x + z * Constants.CHUNK_VERTEX_SIZE + y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE; 30 | if (y < heightY - 5) 31 | { 32 | chunkData[index] = 255; 33 | chunkData[index + 1] = 4;//Rock 34 | } 35 | else if (y < heightY) 36 | { 37 | chunkData[index] = 255; 38 | chunkData[index + 1] = 1;//dirt 39 | } 40 | else if (y == heightY) 41 | { 42 | chunkData[index] = (byte)lastVertexWeigh; 43 | chunkData[index + 1] = 0;//grass 44 | 45 | } 46 | else 47 | { 48 | chunkData[index] = 0; 49 | chunkData[index + 1] = Constants.NUMBER_MATERIALS; 50 | } 51 | } 52 | } 53 | } 54 | return chunkData; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/B_Plains.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf778f8e08e7a9f44b542b7976599454 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/Biome.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | abstract public class Biome : MonoBehaviour 6 | { 7 | [Header("Noise / terrain generation")] 8 | [Tooltip("Animation curve for attenuate the height in some ranges")] 9 | public AnimationCurve terrainHeightCurve = AnimationCurve.Linear(0,0,1,1); 10 | [Tooltip("Scale of the noise map")][Range(0.001f, 100f)] 11 | public float scale = 50f; 12 | [Tooltip("Number of deferents relief apply to the terrain surface")][Range(1, 5)] 13 | public int octaves = 4; 14 | [Tooltip("Amplitude decrease of reliefs")][Range(0.001f, 1f)] 15 | public float persistance = 0.5f; 16 | [Tooltip("Frequency increase of reliefs")][Range(1, 20)] 17 | public float lacunarity = 2f; 18 | 19 | protected int isoLevel; 20 | 21 | public virtual void Start() 22 | { 23 | isoLevel = MeshBuilder.Instance.isoLevel; 24 | } 25 | 26 | /// 27 | /// Generate the chunk data 28 | /// 29 | public abstract byte[] GenerateChunkData(Vector2Int vecPos, float[] biomeMerge); 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Biome/Biome.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 359e72d9c2632554394fccdd8beae844 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/ChunkSystem.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bf3abb7ebd3de047a1a3431ff241386 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/ChunkSystem/Chunk.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Chunk : MonoBehaviour 6 | { 7 | [Tooltip("Active gizmos that represent the area of the chunk")] 8 | public bool debug = false; 9 | private byte[] data; 10 | private int Xpos; 11 | private int Zpos; 12 | private Region fatherRegion; 13 | private bool modified = false; 14 | private bool changesUnsaved; 15 | 16 | /// 17 | /// Create a Chunk using a byte[] that contain all the data of the chunk. 18 | /// 19 | /// data of the chunk 20 | public Chunk ChunkInit(byte[] b, int x, int z, Region region, bool save) 21 | { 22 | data = b; 23 | Xpos = x; 24 | Zpos = z; 25 | fatherRegion = region; 26 | changesUnsaved = save; 27 | 28 | Mesh myMesh = MeshBuilder.Instance.BuildChunk(b); 29 | GetComponent().mesh = myMesh; 30 | 31 | //Assign random color, new material each chunk. 32 | //mat mymaterial = new mat(Shader.Find("Custom/Geometry/FlatShading"));//Custom/DoubleFaceShader | Specular 33 | //mymat.color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)); 34 | GetComponent().material = ChunkManager.Instance.terrainMaterial; 35 | gameObject.AddComponent(); 36 | 37 | return this; 38 | } 39 | 40 | public void Update() 41 | { 42 | if(modified) 43 | { 44 | modified = false; 45 | changesUnsaved = true; 46 | 47 | Mesh myMesh = MeshBuilder.Instance.BuildChunk(data); 48 | GetComponent().mesh = myMesh; 49 | GetComponent().sharedMesh = myMesh; 50 | 51 | } 52 | } 53 | 54 | /// 55 | /// Call depending of the type of modification to removeTerrain or addTerrain 56 | /// 57 | /// 58 | /// 59 | /// 60 | public void modifyTerrain(Vector3 vertexPoint, int modification, int mat = 0) 61 | { 62 | if (modification > 0) 63 | addTerrain(vertexPoint,modification, mat);//A little more costly 64 | else 65 | removeTerrain(vertexPoint,modification);//Less operations 66 | } 67 | 68 | /// 69 | /// Remove terrain in the chunk, 70 | /// 71 | public void removeTerrain(Vector3 vertexPoint, int modification) 72 | { 73 | int byteIndex = ((int)vertexPoint.x + (int)vertexPoint.z * Constants.CHUNK_VERTEX_SIZE + (int)vertexPoint.y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE; 74 | 75 | int value = data[byteIndex]; 76 | int newValue = Mathf.Clamp(value + modification, 0, 255); 77 | 78 | if (value == newValue) 79 | return; 80 | 81 | data[byteIndex] = (byte)newValue; 82 | modified = true; //Don't direct change because some vertex are modifier in the same editions, wait to next frame 83 | } 84 | 85 | /// 86 | /// Similar to the removeTerrain, but when we add terrain we need indicate a color. 87 | /// 88 | public void addTerrain(Vector3 vertexPoint,int modification, int mat) 89 | { 90 | int isoSurface = MeshBuilder.Instance.isoLevel; 91 | int byteIndex = ((int)vertexPoint.x + (int)vertexPoint.z * Constants.CHUNK_VERTEX_SIZE + (int)vertexPoint.y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE ; 92 | 93 | int value = data[byteIndex]; 94 | int newValue = Mathf.Clamp(value + modification, 0, 255); 95 | 96 | if (value == newValue) 97 | return; 98 | if (value < isoSurface && newValue >= isoSurface) 99 | data[byteIndex + 1] = (byte)mat; 100 | 101 | 102 | data[byteIndex] = (byte)newValue; 103 | modified = true; //Don't direct change because some vertex are modifier in the same editions, wait to next frame 104 | } 105 | 106 | /// 107 | /// Get the material(byte) from a specific point in the chunk 108 | /// 109 | public byte GetMaterial(Vector3 vertexPoint) 110 | { 111 | int byteIndex = ((int)vertexPoint.x + (int)vertexPoint.z * Constants.CHUNK_VERTEX_SIZE + (int)vertexPoint.y * Constants.CHUNK_VERTEX_AREA) * Constants.CHUNK_POINT_BYTE; 112 | return data[byteIndex + 1]; 113 | } 114 | 115 | /// 116 | /// Save the chunk data in the region if the chunk get some changes. 117 | /// 118 | public void saveChunkInRegion() 119 | { 120 | if(changesUnsaved) 121 | fatherRegion.saveChunkData(data, Xpos, Zpos); 122 | } 123 | 124 | #if UNITY_EDITOR 125 | //Used for visual debug 126 | void OnDrawGizmos() 127 | { 128 | if (debug) 129 | { 130 | //Gizmos.color = new Color(1f,0.28f,0f); 131 | Gizmos.color = Color.Lerp(Color.red, Color.magenta, ((transform.position.x + transform.position.z) % 100) / 100); 132 | 133 | 134 | Gizmos.DrawWireCube(transform.position,new Vector3(Constants.CHUNK_SIDE, Constants.MAX_HEIGHT * Constants.VOXEL_SIDE, Constants.CHUNK_SIDE)); 135 | } 136 | } 137 | #endif 138 | } 139 | 140 | 141 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/ChunkSystem/Chunk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 652f834a4792e624d90775b2e85d1c88 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/ChunkSystem/ChunkManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02dfafdeb5a90df46ab4078bb2288f7c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/ChunkSystem/Region.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System.IO; 5 | 6 | public class Region 7 | { 8 | private readonly string worldpath; 9 | /*REGIONS DATA = lookTable (REGION_LOOKTABLE_POS_BYTE * number of chunks in a region) + chunks data (2 byte per vertex in each chunk) 10 | lookTable: Indicate the start position of the chunk data in the region Data byte list +REGION_LOOKTABLE_POS_BYTE. Because the 0 it's reserved for indicate empty chunk. 11 | chunks data: Contains the data of all chunks saved in the region*/ 12 | private List regionData; 13 | private int regionX; 14 | private int regionZ; 15 | private bool modified = false; 16 | 17 | /// 18 | /// Load the data of a region from a file. 19 | /// 20 | public Region(int x, int z) 21 | { 22 | worldpath = WorldManager.GetSelectedWorldDir(); 23 | regionX = x; 24 | regionZ = z; 25 | if (File.Exists(DirectionChunkFile())) 26 | { 27 | if (Constants.REGION_SAVE_COMPRESSED) 28 | { 29 | byte[] compressedRegion = File.ReadAllBytes(DirectionChunkFile());//Load compressed region 30 | regionData = new List(CompressHelper.Decompress(compressedRegion));//Decompress the region data 31 | } 32 | else 33 | regionData = new List(File.ReadAllBytes(DirectionChunkFile()));//Load region from a file 34 | } 35 | else 36 | regionData = new List(new byte[Constants.REGION_LOOKTABLE_BYTES]);//Look table initialized, all 0 37 | 38 | } 39 | 40 | /// 41 | /// Return the byte[] from a chunk in the region. 42 | /// 43 | public byte[] GetChunkData(int index) 44 | { 45 | int startPos = Constants.REGION_LOOKTABLE_BYTES + (index-1)*Constants.CHUNK_BYTES; // index-1 because the lookTable start at 1. LookTable position 10 = chunk data position 9. 46 | byte[] chunk = new byte[Constants.CHUNK_BYTES]; 47 | 48 | for (int i = startPos, j = 0; i < (startPos + Constants.CHUNK_BYTES); i ++,j++) 49 | { 50 | chunk[j] = regionData[i]; 51 | } 52 | 53 | return chunk; 54 | } 55 | 56 | /// 57 | /// Get the index from the lookTable, the first section of the regionData list. 58 | /// 59 | public int GetChunkIndex(int x, int z) 60 | { 61 | 62 | int startPos = (x + z * Constants.REGION_SIZE) * Constants.REGION_LOOKTABLE_POS_BYTE + Constants.REGION_LOOKTABLE_POS_BYTE; 63 | int index = 0; 64 | 65 | for (int i = 0; i< Constants.REGION_LOOKTABLE_POS_BYTE; i++) 66 | { 67 | 68 | index |= regionData[startPos+ Constants.REGION_LOOKTABLE_POS_BYTE-i-1] << 8*i; 69 | } 70 | 71 | return index; 72 | 73 | 74 | } 75 | 76 | /// 77 | /// save a chunk byte[] data in the regionData list of the Chunk class. 78 | /// 79 | public void saveChunkData(byte[] chunkData, int x, int z) 80 | { 81 | int chunksDataStartPos = GetChunkIndex(x,z); 82 | if(chunksDataStartPos == 0)//Chunk no saved, assign a new position in the chunks data for the lookTable. 83 | { 84 | int lookTablePos = (x + z * Constants.REGION_SIZE) * Constants.REGION_LOOKTABLE_POS_BYTE + Constants.REGION_LOOKTABLE_POS_BYTE ; 85 | int increasePos = Constants.REGION_LOOKTABLE_POS_BYTE - 1; 86 | for (int i = Constants.REGION_LOOKTABLE_POS_BYTE-1; i >= 0; i--) 87 | { 88 | //First done the increase because the 0 is reserved for empty, the lookTable start at 1. 89 | if (i == increasePos) 90 | { 91 | if (regionData[i] == 255)//Reach 255, need return to 0 and change the previous byte. 92 | { 93 | regionData[i] = 0; 94 | increasePos--; 95 | } 96 | else 97 | regionData[i]++; 98 | } 99 | //Save the position of chunk in the chunks data inside the lookTable 100 | regionData[lookTablePos + i] = regionData[i]; 101 | } 102 | //Write chunks bytes in the regionData list 103 | regionData.AddRange(chunkData); 104 | } 105 | else 106 | { 107 | int startPos = (chunksDataStartPos - 1) * Constants.CHUNK_BYTES + Constants.REGION_LOOKTABLE_BYTES; 108 | // Write chunks bytes in the regionData list 109 | for(int i = 0; i < Constants.CHUNK_BYTES; i++) 110 | { 111 | regionData[startPos + i] = chunkData[i]; 112 | } 113 | } 114 | modified = true; 115 | } 116 | 117 | /// 118 | /// Save the region data in a file. 119 | /// 120 | public void SaveRegionData() 121 | { 122 | if(!modified) 123 | return; 124 | 125 | if(Constants.REGION_SAVE_COMPRESSED) 126 | { 127 | byte[] Compressed = CompressHelper.Compress(regionData.ToArray()); 128 | File.WriteAllBytes(DirectionChunkFile(), Compressed); 129 | } 130 | else 131 | File.WriteAllBytes(DirectionChunkFile(), regionData.ToArray()); 132 | 133 | } 134 | 135 | 136 | //Help function, get chunk file direction. 137 | private string DirectionChunkFile() 138 | { 139 | return worldpath + "/"+ regionX + "."+ regionZ + ".reg"; 140 | } 141 | 142 | 143 | } 144 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/ChunkSystem/Region.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d54e5885f5007e46806c32f6d35c31c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Noise.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public static class Noise 6 | { 7 | 8 | public static float [,] StandarNoise(int mapWidth, int mapHeight, float scale) 9 | { 10 | float[,] noiseMap = new float[mapWidth, mapHeight]; 11 | 12 | if (scale <= 0) 13 | { 14 | scale = 0.0001f; 15 | } 16 | 17 | for (int y = 0; y < mapHeight; y++) 18 | { 19 | for (int x = 0; x < mapWidth; x++) 20 | { 21 | float sampleX = x / scale; 22 | float sampleY = y / scale; 23 | 24 | float perlinValue = Mathf.PerlinNoise(sampleX, sampleY); 25 | noiseMap[x, y] = perlinValue; 26 | } 27 | } 28 | return noiseMap; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/Noise.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 291858a8b46058f4b86a2ae1ad117d8b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/NoiseManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class NoiseManager : Singleton 6 | { 7 | 8 | [Header("World configuration")] 9 | public WorldConfig worldConfig;//Current world configuration of the noiseManager 10 | [System.Serializable] 11 | public class WorldConfig 12 | { 13 | [Tooltip("Seed of the world (0 seed generate randoms different worlds -testing-)")] 14 | [Range(int.MinValue + 100, int.MaxValue - 100)] 15 | public int worldSeed = 0; 16 | [Tooltip("Biomes sizes")] 17 | public float biomeScale = 150; 18 | 19 | [Header("Biome merge configuration")] 20 | [Tooltip("biomes.appearValue difference for merge")] 21 | [Range(0.01f, 0.5f)] 22 | public float diffToMerge = 0.025f; 23 | [Tooltip("Surface desired level, height where biomes merge")] 24 | [Range(1, Constants.MAX_HEIGHT)] 25 | public int surfaceLevel = Constants.MAX_HEIGHT / 8; 26 | [Tooltip("Octaves used in the biome noise")] 27 | [Range(1, 5)] 28 | public int octaves = 5; 29 | [Tooltip("Amplitude decrease of biomes per octave,very low recommended")] 30 | [Range(0.001f, 1f)] 31 | public float persistance = 0.1f; 32 | [Tooltip("Frequency increase of biomes per octave")] 33 | [Range(1, 20)] 34 | public float lacunarity = 9f; 35 | } 36 | 37 | 38 | [Header("Biomes Array")]// Empty for get all Biomes of inside the GameObject 39 | public BiomeProperties[] biomes; 40 | 41 | [System.Serializable] 42 | public struct BiomeProperties 43 | { 44 | public Biome biome;//Biome child class 45 | public float appearValue;//1 to 0 value when the biome appears. Next biomePropertie.appear value is where this biome end 46 | } 47 | 48 | public void Start() 49 | { 50 | if (worldConfig.worldSeed == 0 && !WorldManager.IsCreated())//Generate random seed when use 0 and is scene testing (no WorldManager exists) 51 | { 52 | Debug.Log("worldSeed 0 detected, generating random seed world"); 53 | string selectedWorld = WorldManager.GetSelectedWorldName(); 54 | WorldManager.DeleteWorld(selectedWorld);//Remove previous data 55 | WorldManager.CreateWorld(selectedWorld, worldConfig);//Create a new world folder for correct working 56 | worldConfig.worldSeed = Random.Range(int.MinValue, int.MaxValue); 57 | } 58 | else if((Constants.AUTO_CLEAR_WHEN_NOISE_CHANGE) && !WorldManager.IsCreated())//If AUTO_CLEAR_WHEN_NOISE_CHANGE true and world manager not exist, we clear old world data (we assume we are using a debug scene) 59 | { 60 | string selectedWorld = WorldManager.GetSelectedWorldName(); 61 | WorldConfig loadedWorldConfig = WorldManager.GetSelectedWorldConfig(); 62 | //If worldConfig loaded is different to the current one, remove old data and save the new config 63 | if(loadedWorldConfig.worldSeed != worldConfig.worldSeed || loadedWorldConfig.biomeScale != worldConfig.biomeScale || loadedWorldConfig.diffToMerge != worldConfig.diffToMerge || loadedWorldConfig.surfaceLevel != worldConfig.surfaceLevel || 64 | loadedWorldConfig.octaves != worldConfig.octaves || loadedWorldConfig.persistance != worldConfig.persistance || loadedWorldConfig.lacunarity != worldConfig.lacunarity) 65 | { 66 | WorldManager.DeleteWorld(selectedWorld);//Remove old world 67 | WorldManager.CreateWorld(selectedWorld, worldConfig);//Create new world with the new worldConfig 68 | } 69 | 70 | } 71 | else if(WorldManager.IsCreated())//Load config of the world 72 | { 73 | worldConfig = WorldManager.GetSelectedWorldConfig(); 74 | } 75 | if(biomes.Length == 0) 76 | { 77 | Biome[] biomeArray = GetComponents(); 78 | biomes = new BiomeProperties[biomeArray.Length]; 79 | for (int i = 0; i< biomeArray.Length; i++) 80 | { 81 | biomes[i].biome = biomeArray[i]; 82 | biomes[i].appearValue = (float)(biomeArray.Length-i) / biomeArray.Length; 83 | } 84 | } 85 | ChunkManager.Instance.Initialize(); 86 | } 87 | 88 | public byte[] GenerateChunkData(Vector2Int vecPos) 89 | { 90 | byte[] chunkData = new byte[Constants.CHUNK_BYTES]; 91 | 92 | float[] biomeNoise = GenerateNoiseMap(worldConfig.biomeScale * biomes.Length, worldConfig.octaves, worldConfig.persistance, worldConfig.lacunarity, vecPos);//Biomes noise (0-1) of each (x,z) position 93 | float[] mergeBiomeTable;//Value(0-1) of merged with other biomes in a (x,z) position 94 | int[] biomeTable = GetChunkBiomes(biomeNoise, out mergeBiomeTable);//biomes index in the array of BiomeProperties 95 | 96 | byte[][] biomesData = new byte[biomes.Length][];//Data generate from biomes.biome.GenerateChunkData() 97 | 98 | for (int x= 0; x< Constants.CHUNK_VERTEX_SIZE; x++) 99 | { 100 | for(int z=0; z 122 | /// Get the index from the biomes array, the bool out is for get the merge biome 123 | /// 124 | private int[] GetChunkBiomes(float[] noise, out float[] mergeBiome) 125 | { 126 | float[] mergeBiomeTable= new float[Constants.CHUNK_VERTEX_AREA];//value of merge with other biome, 1 = nothing, 0 full merge 127 | int[] biomeTable = new int[Constants.CHUNK_VERTEX_AREA];//Value with the index of the biomes of each (x,z) position 128 | for (int z = 0; z< Constants.CHUNK_VERTEX_SIZE; z++) 129 | { 130 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE; x++) 131 | { 132 | int index = x + z * Constants.CHUNK_VERTEX_SIZE; 133 | for (int i = biomes.Length - 1; i >= 0; i--) 134 | { 135 | if (noise[index] < biomes[i].appearValue) 136 | { 137 | if (i != 0 && worldConfig.diffToMerge + noise[index] > biomes[i].appearValue)//Biome merged with top biome 138 | { 139 | mergeBiomeTable[index] = (biomes[i].appearValue - noise[index]) / worldConfig.diffToMerge; 140 | //Debug.Log("TOP: "+biomes[i].appearValue + " - " + noise[index] + " / " + diffToMerge + " = " + mergeBiomeTable[index]); 141 | } 142 | 143 | else if (i != biomes.Length - 1 && worldConfig.diffToMerge - noise[index] < biomes[i+1].appearValue)//Biome merged with bottom biome 144 | { 145 | mergeBiomeTable[index] = (noise[index] - biomes[i + 1].appearValue) / worldConfig.diffToMerge; 146 | //Debug.Log("BOT: "+noise[index] + " - " + biomes[i + 1].appearValue + " / " + diffToMerge + " = " + mergeBiomeTable[index]); 147 | } 148 | 149 | else 150 | mergeBiomeTable[index] = 1;//No biome merge needed 151 | 152 | 153 | /*if(noise[index]+ diffToMerge > 0.5f || noise[index] - diffToMerge < 0.5f) 154 | { 155 | Debug.Log(noise[index] + " " + mergeBiomeTable[index]); 156 | }*/ 157 | 158 | biomeTable[index] = i; 159 | break;//We get the texture, we exit from texture loop( i loop) 160 | 161 | } 162 | } 163 | } 164 | } 165 | 166 | mergeBiome = mergeBiomeTable; 167 | return biomeTable; 168 | } 169 | 170 | 171 | /// 172 | /// Calculate the PerlinNoise used in the relief generation, only the chunk size (no slope calculation). 173 | /// 174 | public static float[] GenerateNoiseMap (float scale, int octaves, float persistance, float lacunarity, Vector2Int offset) 175 | { 176 | float[] noiseMap = new float[Constants.CHUNK_VERTEX_AREA];//Size of vertex + all next borders (For the slope calculation) 177 | 178 | System.Random random = new System.Random(Instance.worldConfig.worldSeed);//Used System.random, because unity.Random is global, can cause problems if there is other random running in other script 179 | Vector2[] octaveOffsets = new Vector2[octaves]; 180 | 181 | float maxPossibleHeight = 0; 182 | float amplitude = 1; 183 | float frequency = 1; 184 | 185 | for (int i = 0; i < octaves; i++) 186 | { 187 | float offsetX = random.Next(-100000, 100000) + offset.x * Constants.CHUNK_SIZE; 188 | float offsetY = random.Next(-100000, 100000) + offset.y * Constants.CHUNK_SIZE; 189 | octaveOffsets[i] = new Vector2(offsetX, offsetY); 190 | 191 | maxPossibleHeight += amplitude; 192 | amplitude *= persistance; 193 | } 194 | 195 | float halfVertexArea = Constants.CHUNK_VERTEX_SIZE / 2f; 196 | 197 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE; z++) 198 | { 199 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE; x++) 200 | { 201 | amplitude = 1; 202 | frequency = 1; 203 | float noiseHeight = 0; 204 | 205 | for (int i = 0; i < octaves; i++) 206 | { 207 | float sampleX = (x - halfVertexArea + octaveOffsets[i].x) / scale * frequency ; 208 | float sampleY = (z - halfVertexArea + octaveOffsets[i].y) / scale * frequency ; 209 | 210 | float perlinValue = Mathf.PerlinNoise(sampleX, sampleY) ; 211 | noiseHeight += perlinValue * amplitude; 212 | 213 | amplitude *= persistance; 214 | frequency *= lacunarity; 215 | } 216 | 217 | noiseMap[x + z * Constants.CHUNK_VERTEX_SIZE] = noiseHeight / (maxPossibleHeight * 0.9f);//*0.9 because reach the max points it's really dificult. 218 | 219 | } 220 | } 221 | 222 | return noiseMap; 223 | } 224 | 225 | /// 226 | /// Calculate the PerlinNoise used in the relief generation, with a extra edge in each side of the chunk, for the slope calculations. 227 | /// 228 | public static float[] GenerateExtendedNoiseMap(float scale, int octaves, float persistance, float lacunarity, Vector2Int offset) 229 | { 230 | float[] noiseMap = new float[(Constants.CHUNK_VERTEX_SIZE + 2) * (Constants.CHUNK_VERTEX_SIZE + 2)];//Size of vertex + all next borders (For the slope calculation) 231 | 232 | System.Random random = new System.Random(NoiseManager.Instance.worldConfig.worldSeed);//Used System.random, because unity.Random is global, can cause problems if there is other random running in other script 233 | Vector2[] octaveOffsets = new Vector2[octaves]; 234 | 235 | float maxPossibleHeight = 0; 236 | float amplitude = 1; 237 | float frequency = 1; 238 | 239 | for (int i = 0; i < octaves; i++) 240 | { 241 | float offsetX = random.Next(-100000, 100000) + offset.x * Constants.CHUNK_SIZE - 1; 242 | float offsetY = random.Next(-100000, 100000) + offset.y * Constants.CHUNK_SIZE - 1; 243 | octaveOffsets[i] = new Vector2(offsetX, offsetY); 244 | 245 | maxPossibleHeight += amplitude; 246 | amplitude *= persistance; 247 | } 248 | 249 | float halfVertexArea = Constants.CHUNK_VERTEX_SIZE / 2f; 250 | 251 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE + 2; z++) 252 | { 253 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE + 2; x++) 254 | { 255 | amplitude = 1; 256 | frequency = 1; 257 | float noiseHeight = 0; 258 | 259 | for (int i = 0; i < octaves; i++) 260 | { 261 | float sampleX = (x - halfVertexArea + octaveOffsets[i].x) / scale * frequency; 262 | float sampleY = (z - halfVertexArea + octaveOffsets[i].y) / scale * frequency; 263 | 264 | float perlinValue = Mathf.PerlinNoise(sampleX, sampleY); 265 | noiseHeight += perlinValue * amplitude; 266 | 267 | amplitude *= persistance; 268 | frequency *= lacunarity; 269 | } 270 | 271 | noiseMap[x + z * (Constants.CHUNK_VERTEX_SIZE + 2)] = noiseHeight / (maxPossibleHeight * 0.9f);//*0.9 because reach the max points it's really dificult. 272 | 273 | } 274 | } 275 | 276 | return noiseMap; 277 | } 278 | 279 | /// 280 | /// Similar that GenerateNoiseMap but use only one octave, for that reason use less parameters and less operations 281 | /// 282 | public static float[] GenenerateSimpleNoiseMap(float scale, Vector2Int offset) 283 | { 284 | float[] noiseMap = new float[Constants.CHUNK_VERTEX_AREA];//Size of vertex + all next borders (For the slope calculation) 285 | 286 | System.Random random = new System.Random(NoiseManager.Instance.worldConfig.worldSeed);//Used System.random, because unity.Random is global, can cause problems if there is other random running in other script 287 | 288 | float offsetX = random.Next(-100000, 100000) + offset.x * Constants.CHUNK_SIZE ; 289 | float offsetY = random.Next(-100000, 100000) + offset.y * Constants.CHUNK_SIZE ; 290 | 291 | float halfVertexArea = Constants.CHUNK_VERTEX_SIZE / 2f; 292 | 293 | for (int z = 0; z < Constants.CHUNK_VERTEX_SIZE; z++) 294 | { 295 | for (int x = 0; x < Constants.CHUNK_VERTEX_SIZE; x++) 296 | { 297 | float sampleX = (x - halfVertexArea + offsetX) / scale; 298 | float sampleY = (z - halfVertexArea + offsetY) / scale; 299 | 300 | noiseMap[x + z * Constants.CHUNK_VERTEX_SIZE] = Mathf.PerlinNoise(sampleX, sampleY); 301 | } 302 | } 303 | 304 | return noiseMap; 305 | } 306 | } 307 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/NoiseManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbad037a5d2c2bb49a28280c74dffa83 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/NoiseTerrainViewer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class NoiseTerrainViewer : MonoBehaviour 6 | { 7 | 8 | [Tooltip("Number of chunks of the view area")] 9 | [Range(1, 20)] 10 | public int testSize = 1; 11 | [Tooltip("Offset from the chunk (0,0), move the whole map generation")] 12 | public Vector2Int chunkOffset; 13 | private Dictionary chunkDict = new Dictionary(); 14 | private NoiseManager noiseManager; 15 | private Region fakeRegion;//Used because chunks need a fahter region 16 | 17 | 18 | private void Start() 19 | { 20 | noiseManager = NoiseManager.Instance; 21 | fakeRegion = new Region(1000,1000); 22 | GenerateTerrain(); 23 | } 24 | 25 | /// 26 | /// Generate a terrain for preview the NoiseManager values. 27 | /// 28 | public void GenerateTerrain() 29 | { 30 | if(chunkDict.Count != 0) 31 | { 32 | foreach(Chunk chunk in chunkDict.Values) 33 | { 34 | Destroy(chunk.gameObject); 35 | } 36 | chunkDict.Clear(); 37 | } 38 | int halfSize = Mathf.FloorToInt(testSize / 2); 39 | for(int z= -halfSize; z< halfSize+1; z++) 40 | { 41 | for (int x = -halfSize; x < halfSize+1; x++) 42 | { 43 | Vector2Int key = new Vector2Int(x, z); 44 | GameObject chunkObj = new GameObject("Chunk_" + key.x + "|" + key.y, typeof(MeshFilter), typeof(MeshRenderer)); 45 | chunkObj.transform.parent = transform; 46 | chunkObj.transform.position = new Vector3(key.x * Constants.CHUNK_SIDE, 0, key.y * Constants.CHUNK_SIDE); 47 | 48 | Vector2Int offsetKey = new Vector2Int(x + chunkOffset.x, z+ chunkOffset.y); 49 | chunkDict.Add(key, chunkObj.AddComponent().ChunkInit(noiseManager.GenerateChunkData(offsetKey), key.x, key.y, fakeRegion, false)); 50 | } 51 | } 52 | } 53 | 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/Scripts/TerrainGenerator/NoiseTerrainViewer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9568358fb4a217469249723fa12e0e6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 100 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/WorldManager.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &8920863361534297784 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 3597939533522550203} 12 | - component: {fileID: 8899438211579135848} 13 | m_Layer: 0 14 | m_Name: WorldManager 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &3597939533522550203 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 8920863361534297784} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &8899438211579135848 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 8920863361534297784} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: b55408afa92d6774d8d860be3ca9e46f, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | -------------------------------------------------------------------------------- /Assets/Marching_Cubes/WorldManager.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc6b1eb5eb2ee224185708352ce8c425 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Javier Garzo Perez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ext.nunit": "1.0.6", 4 | "com.unity.ide.rider": "2.0.7", 5 | "com.unity.ide.visualstudio": "2.0.11", 6 | "com.unity.ide.vscode": "1.2.3", 7 | "com.unity.jobs": "0.8.0-preview.23", 8 | "com.unity.test-framework": "1.1.27", 9 | "com.unity.textmeshpro": "3.0.6", 10 | "com.unity.timeline": "1.4.8", 11 | "com.unity.ugui": "1.0.0", 12 | "com.unity.modules.ai": "1.0.0", 13 | "com.unity.modules.androidjni": "1.0.0", 14 | "com.unity.modules.animation": "1.0.0", 15 | "com.unity.modules.assetbundle": "1.0.0", 16 | "com.unity.modules.audio": "1.0.0", 17 | "com.unity.modules.cloth": "1.0.0", 18 | "com.unity.modules.director": "1.0.0", 19 | "com.unity.modules.imageconversion": "1.0.0", 20 | "com.unity.modules.imgui": "1.0.0", 21 | "com.unity.modules.jsonserialize": "1.0.0", 22 | "com.unity.modules.particlesystem": "1.0.0", 23 | "com.unity.modules.physics": "1.0.0", 24 | "com.unity.modules.physics2d": "1.0.0", 25 | "com.unity.modules.screencapture": "1.0.0", 26 | "com.unity.modules.terrain": "1.0.0", 27 | "com.unity.modules.terrainphysics": "1.0.0", 28 | "com.unity.modules.tilemap": "1.0.0", 29 | "com.unity.modules.ui": "1.0.0", 30 | "com.unity.modules.uielements": "1.0.0", 31 | "com.unity.modules.umbra": "1.0.0", 32 | "com.unity.modules.unityanalytics": "1.0.0", 33 | "com.unity.modules.unitywebrequest": "1.0.0", 34 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 35 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 36 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 37 | "com.unity.modules.unitywebrequestwww": "1.0.0", 38 | "com.unity.modules.vehicles": "1.0.0", 39 | "com.unity.modules.video": "1.0.0", 40 | "com.unity.modules.vr": "1.0.0", 41 | "com.unity.modules.wind": "1.0.0", 42 | "com.unity.modules.xr": "1.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.burst": { 4 | "version": "1.4.1", 5 | "depth": 2, 6 | "source": "registry", 7 | "dependencies": { 8 | "com.unity.mathematics": "1.2.1" 9 | }, 10 | "url": "https://packages.unity.com" 11 | }, 12 | "com.unity.collections": { 13 | "version": "0.15.0-preview.21", 14 | "depth": 1, 15 | "source": "registry", 16 | "dependencies": { 17 | "com.unity.test-framework.performance": "2.3.1-preview", 18 | "com.unity.burst": "1.4.1" 19 | }, 20 | "url": "https://packages.unity.com" 21 | }, 22 | "com.unity.ext.nunit": { 23 | "version": "1.0.6", 24 | "depth": 0, 25 | "source": "registry", 26 | "dependencies": {}, 27 | "url": "https://packages.unity.com" 28 | }, 29 | "com.unity.ide.rider": { 30 | "version": "2.0.7", 31 | "depth": 0, 32 | "source": "registry", 33 | "dependencies": { 34 | "com.unity.test-framework": "1.1.1" 35 | }, 36 | "url": "https://packages.unity.com" 37 | }, 38 | "com.unity.ide.visualstudio": { 39 | "version": "2.0.11", 40 | "depth": 0, 41 | "source": "registry", 42 | "dependencies": { 43 | "com.unity.test-framework": "1.1.9" 44 | }, 45 | "url": "https://packages.unity.com" 46 | }, 47 | "com.unity.ide.vscode": { 48 | "version": "1.2.3", 49 | "depth": 0, 50 | "source": "registry", 51 | "dependencies": {}, 52 | "url": "https://packages.unity.com" 53 | }, 54 | "com.unity.jobs": { 55 | "version": "0.8.0-preview.23", 56 | "depth": 0, 57 | "source": "registry", 58 | "dependencies": { 59 | "com.unity.collections": "0.15.0-preview.21", 60 | "com.unity.mathematics": "1.2.1" 61 | }, 62 | "url": "https://packages.unity.com" 63 | }, 64 | "com.unity.mathematics": { 65 | "version": "1.2.1", 66 | "depth": 1, 67 | "source": "registry", 68 | "dependencies": {}, 69 | "url": "https://packages.unity.com" 70 | }, 71 | "com.unity.nuget.newtonsoft-json": { 72 | "version": "2.0.0-preview", 73 | "depth": 3, 74 | "source": "registry", 75 | "dependencies": {}, 76 | "url": "https://packages.unity.com" 77 | }, 78 | "com.unity.test-framework": { 79 | "version": "1.1.27", 80 | "depth": 0, 81 | "source": "registry", 82 | "dependencies": { 83 | "com.unity.ext.nunit": "1.0.6", 84 | "com.unity.modules.imgui": "1.0.0", 85 | "com.unity.modules.jsonserialize": "1.0.0" 86 | }, 87 | "url": "https://packages.unity.com" 88 | }, 89 | "com.unity.test-framework.performance": { 90 | "version": "2.3.1-preview", 91 | "depth": 2, 92 | "source": "registry", 93 | "dependencies": { 94 | "com.unity.test-framework": "1.1.0", 95 | "com.unity.nuget.newtonsoft-json": "2.0.0-preview" 96 | }, 97 | "url": "https://packages.unity.com" 98 | }, 99 | "com.unity.textmeshpro": { 100 | "version": "3.0.6", 101 | "depth": 0, 102 | "source": "registry", 103 | "dependencies": { 104 | "com.unity.ugui": "1.0.0" 105 | }, 106 | "url": "https://packages.unity.com" 107 | }, 108 | "com.unity.timeline": { 109 | "version": "1.4.8", 110 | "depth": 0, 111 | "source": "registry", 112 | "dependencies": { 113 | "com.unity.modules.director": "1.0.0", 114 | "com.unity.modules.animation": "1.0.0", 115 | "com.unity.modules.audio": "1.0.0", 116 | "com.unity.modules.particlesystem": "1.0.0" 117 | }, 118 | "url": "https://packages.unity.com" 119 | }, 120 | "com.unity.ugui": { 121 | "version": "1.0.0", 122 | "depth": 0, 123 | "source": "builtin", 124 | "dependencies": { 125 | "com.unity.modules.ui": "1.0.0", 126 | "com.unity.modules.imgui": "1.0.0" 127 | } 128 | }, 129 | "com.unity.modules.ai": { 130 | "version": "1.0.0", 131 | "depth": 0, 132 | "source": "builtin", 133 | "dependencies": {} 134 | }, 135 | "com.unity.modules.androidjni": { 136 | "version": "1.0.0", 137 | "depth": 0, 138 | "source": "builtin", 139 | "dependencies": {} 140 | }, 141 | "com.unity.modules.animation": { 142 | "version": "1.0.0", 143 | "depth": 0, 144 | "source": "builtin", 145 | "dependencies": {} 146 | }, 147 | "com.unity.modules.assetbundle": { 148 | "version": "1.0.0", 149 | "depth": 0, 150 | "source": "builtin", 151 | "dependencies": {} 152 | }, 153 | "com.unity.modules.audio": { 154 | "version": "1.0.0", 155 | "depth": 0, 156 | "source": "builtin", 157 | "dependencies": {} 158 | }, 159 | "com.unity.modules.cloth": { 160 | "version": "1.0.0", 161 | "depth": 0, 162 | "source": "builtin", 163 | "dependencies": { 164 | "com.unity.modules.physics": "1.0.0" 165 | } 166 | }, 167 | "com.unity.modules.director": { 168 | "version": "1.0.0", 169 | "depth": 0, 170 | "source": "builtin", 171 | "dependencies": { 172 | "com.unity.modules.audio": "1.0.0", 173 | "com.unity.modules.animation": "1.0.0" 174 | } 175 | }, 176 | "com.unity.modules.imageconversion": { 177 | "version": "1.0.0", 178 | "depth": 0, 179 | "source": "builtin", 180 | "dependencies": {} 181 | }, 182 | "com.unity.modules.imgui": { 183 | "version": "1.0.0", 184 | "depth": 0, 185 | "source": "builtin", 186 | "dependencies": {} 187 | }, 188 | "com.unity.modules.jsonserialize": { 189 | "version": "1.0.0", 190 | "depth": 0, 191 | "source": "builtin", 192 | "dependencies": {} 193 | }, 194 | "com.unity.modules.particlesystem": { 195 | "version": "1.0.0", 196 | "depth": 0, 197 | "source": "builtin", 198 | "dependencies": {} 199 | }, 200 | "com.unity.modules.physics": { 201 | "version": "1.0.0", 202 | "depth": 0, 203 | "source": "builtin", 204 | "dependencies": {} 205 | }, 206 | "com.unity.modules.physics2d": { 207 | "version": "1.0.0", 208 | "depth": 0, 209 | "source": "builtin", 210 | "dependencies": {} 211 | }, 212 | "com.unity.modules.screencapture": { 213 | "version": "1.0.0", 214 | "depth": 0, 215 | "source": "builtin", 216 | "dependencies": { 217 | "com.unity.modules.imageconversion": "1.0.0" 218 | } 219 | }, 220 | "com.unity.modules.subsystems": { 221 | "version": "1.0.0", 222 | "depth": 1, 223 | "source": "builtin", 224 | "dependencies": { 225 | "com.unity.modules.jsonserialize": "1.0.0" 226 | } 227 | }, 228 | "com.unity.modules.terrain": { 229 | "version": "1.0.0", 230 | "depth": 0, 231 | "source": "builtin", 232 | "dependencies": {} 233 | }, 234 | "com.unity.modules.terrainphysics": { 235 | "version": "1.0.0", 236 | "depth": 0, 237 | "source": "builtin", 238 | "dependencies": { 239 | "com.unity.modules.physics": "1.0.0", 240 | "com.unity.modules.terrain": "1.0.0" 241 | } 242 | }, 243 | "com.unity.modules.tilemap": { 244 | "version": "1.0.0", 245 | "depth": 0, 246 | "source": "builtin", 247 | "dependencies": { 248 | "com.unity.modules.physics2d": "1.0.0" 249 | } 250 | }, 251 | "com.unity.modules.ui": { 252 | "version": "1.0.0", 253 | "depth": 0, 254 | "source": "builtin", 255 | "dependencies": {} 256 | }, 257 | "com.unity.modules.uielements": { 258 | "version": "1.0.0", 259 | "depth": 0, 260 | "source": "builtin", 261 | "dependencies": { 262 | "com.unity.modules.ui": "1.0.0", 263 | "com.unity.modules.imgui": "1.0.0", 264 | "com.unity.modules.jsonserialize": "1.0.0", 265 | "com.unity.modules.uielementsnative": "1.0.0" 266 | } 267 | }, 268 | "com.unity.modules.uielementsnative": { 269 | "version": "1.0.0", 270 | "depth": 1, 271 | "source": "builtin", 272 | "dependencies": { 273 | "com.unity.modules.ui": "1.0.0", 274 | "com.unity.modules.imgui": "1.0.0", 275 | "com.unity.modules.jsonserialize": "1.0.0" 276 | } 277 | }, 278 | "com.unity.modules.umbra": { 279 | "version": "1.0.0", 280 | "depth": 0, 281 | "source": "builtin", 282 | "dependencies": {} 283 | }, 284 | "com.unity.modules.unityanalytics": { 285 | "version": "1.0.0", 286 | "depth": 0, 287 | "source": "builtin", 288 | "dependencies": { 289 | "com.unity.modules.unitywebrequest": "1.0.0", 290 | "com.unity.modules.jsonserialize": "1.0.0" 291 | } 292 | }, 293 | "com.unity.modules.unitywebrequest": { 294 | "version": "1.0.0", 295 | "depth": 0, 296 | "source": "builtin", 297 | "dependencies": {} 298 | }, 299 | "com.unity.modules.unitywebrequestassetbundle": { 300 | "version": "1.0.0", 301 | "depth": 0, 302 | "source": "builtin", 303 | "dependencies": { 304 | "com.unity.modules.assetbundle": "1.0.0", 305 | "com.unity.modules.unitywebrequest": "1.0.0" 306 | } 307 | }, 308 | "com.unity.modules.unitywebrequestaudio": { 309 | "version": "1.0.0", 310 | "depth": 0, 311 | "source": "builtin", 312 | "dependencies": { 313 | "com.unity.modules.unitywebrequest": "1.0.0", 314 | "com.unity.modules.audio": "1.0.0" 315 | } 316 | }, 317 | "com.unity.modules.unitywebrequesttexture": { 318 | "version": "1.0.0", 319 | "depth": 0, 320 | "source": "builtin", 321 | "dependencies": { 322 | "com.unity.modules.unitywebrequest": "1.0.0", 323 | "com.unity.modules.imageconversion": "1.0.0" 324 | } 325 | }, 326 | "com.unity.modules.unitywebrequestwww": { 327 | "version": "1.0.0", 328 | "depth": 0, 329 | "source": "builtin", 330 | "dependencies": { 331 | "com.unity.modules.unitywebrequest": "1.0.0", 332 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 333 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 334 | "com.unity.modules.audio": "1.0.0", 335 | "com.unity.modules.assetbundle": "1.0.0", 336 | "com.unity.modules.imageconversion": "1.0.0" 337 | } 338 | }, 339 | "com.unity.modules.vehicles": { 340 | "version": "1.0.0", 341 | "depth": 0, 342 | "source": "builtin", 343 | "dependencies": { 344 | "com.unity.modules.physics": "1.0.0" 345 | } 346 | }, 347 | "com.unity.modules.video": { 348 | "version": "1.0.0", 349 | "depth": 0, 350 | "source": "builtin", 351 | "dependencies": { 352 | "com.unity.modules.audio": "1.0.0", 353 | "com.unity.modules.ui": "1.0.0", 354 | "com.unity.modules.unitywebrequest": "1.0.0" 355 | } 356 | }, 357 | "com.unity.modules.vr": { 358 | "version": "1.0.0", 359 | "depth": 0, 360 | "source": "builtin", 361 | "dependencies": { 362 | "com.unity.modules.jsonserialize": "1.0.0", 363 | "com.unity.modules.physics": "1.0.0", 364 | "com.unity.modules.xr": "1.0.0" 365 | } 366 | }, 367 | "com.unity.modules.wind": { 368 | "version": "1.0.0", 369 | "depth": 0, 370 | "source": "builtin", 371 | "dependencies": {} 372 | }, 373 | "com.unity.modules.xr": { 374 | "version": "1.0.0", 375 | "depth": 0, 376 | "source": "builtin", 377 | "dependencies": { 378 | "com.unity.modules.physics": "1.0.0", 379 | "com.unity.modules.jsonserialize": "1.0.0", 380 | "com.unity.modules.subsystems": "1.0.0" 381 | } 382 | } 383 | } 384 | } 385 | -------------------------------------------------------------------------------- /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 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/BurstAotSettings_StandaloneWindows.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "Version": 3, 4 | "EnableBurstCompilation": true, 5 | "EnableOptimisations": true, 6 | "EnableSafetyChecks": false, 7 | "EnableDebugInAllBuilds": false, 8 | "UsePlatformSDKLinker": false, 9 | "CpuMinTargetX32": 0, 10 | "CpuMaxTargetX32": 0, 11 | "CpuMinTargetX64": 0, 12 | "CpuMaxTargetX64": 0, 13 | "CpuTargetsX32": 6, 14 | "CpuTargetsX64": 72 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /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: 11 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: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /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 | - enabled: 1 9 | path: Assets/Marching Cubes/DemoScenes/FirstPersonLevel.unity 10 | guid: 44f1b522d161c5443a54ade00dee9724 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /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: 9 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /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: 13 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 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 43 | type: 0} 44 | m_CustomRenderPipeline: {fileID: 0} 45 | m_TransparencySortMode: 0 46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 47 | m_DefaultRenderingPath: 1 48 | m_DefaultMobileRenderingPath: 1 49 | m_TierSettings: [] 50 | m_LightmapStripping: 0 51 | m_FogStripping: 0 52 | m_InstancingStripping: 0 53 | m_LightmapKeepPlain: 1 54 | m_LightmapKeepDirCombined: 1 55 | m_LightmapKeepDynamicPlain: 1 56 | m_LightmapKeepDynamicDirCombined: 1 57 | m_LightmapKeepShadowMask: 1 58 | m_LightmapKeepSubtractive: 1 59 | m_FogKeepLinear: 1 60 | m_FogKeepExp: 1 61 | m_FogKeepExp2: 1 62 | m_AlbedoSwatchInfos: [] 63 | m_LightsUseLinearIntensity: 0 64 | m_LightsUseColorTemperature: 0 65 | m_LogWhenShaderIsCompiled: 0 66 | m_AllowEnlightenSupportForUpgradedProject: 1 67 | -------------------------------------------------------------------------------- /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/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /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: 4 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_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.3.17f1 2 | m_EditorVersionWithRevision: 2020.3.17f1 (a4537701e4ab) 3 | -------------------------------------------------------------------------------- /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 | skinWeights: 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 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | customRenderPipeline: {fileID: 0} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Low 47 | pixelLightCount: 0 48 | shadows: 0 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 0 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 0 66 | lodBias: 0.4 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 16 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 0} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: Medium 83 | pixelLightCount: 1 84 | shadows: 1 85 | shadowResolution: 0 86 | shadowProjection: 1 87 | shadowCascades: 1 88 | shadowDistance: 20 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 0 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 0 97 | softParticles: 0 98 | softVegetation: 0 99 | realtimeReflectionProbes: 0 100 | billboardsFaceCameraPosition: 0 101 | vSyncCount: 1 102 | lodBias: 0.7 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 64 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 0} 116 | excludedTargetPlatforms: [] 117 | - serializedVersion: 2 118 | name: High 119 | pixelLightCount: 2 120 | shadows: 2 121 | shadowResolution: 1 122 | shadowProjection: 1 123 | shadowCascades: 2 124 | shadowDistance: 40 125 | shadowNearPlaneOffset: 3 126 | shadowCascade2Split: 0.33333334 127 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 128 | shadowmaskMode: 1 129 | skinWeights: 2 130 | textureQuality: 0 131 | anisotropicTextures: 1 132 | antiAliasing: 0 133 | softParticles: 0 134 | softVegetation: 1 135 | realtimeReflectionProbes: 1 136 | billboardsFaceCameraPosition: 1 137 | vSyncCount: 1 138 | lodBias: 1 139 | maximumLODLevel: 0 140 | streamingMipmapsActive: 0 141 | streamingMipmapsAddAllCameras: 1 142 | streamingMipmapsMemoryBudget: 512 143 | streamingMipmapsRenderersPerFrame: 512 144 | streamingMipmapsMaxLevelReduction: 2 145 | streamingMipmapsMaxFileIORequests: 1024 146 | particleRaycastBudget: 256 147 | asyncUploadTimeSlice: 2 148 | asyncUploadBufferSize: 16 149 | asyncUploadPersistentBuffer: 1 150 | resolutionScalingFixedDPIFactor: 1 151 | customRenderPipeline: {fileID: 0} 152 | excludedTargetPlatforms: [] 153 | - serializedVersion: 2 154 | name: Very High 155 | pixelLightCount: 3 156 | shadows: 2 157 | shadowResolution: 2 158 | shadowProjection: 1 159 | shadowCascades: 2 160 | shadowDistance: 70 161 | shadowNearPlaneOffset: 3 162 | shadowCascade2Split: 0.33333334 163 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 164 | shadowmaskMode: 1 165 | skinWeights: 4 166 | textureQuality: 0 167 | anisotropicTextures: 2 168 | antiAliasing: 2 169 | softParticles: 1 170 | softVegetation: 1 171 | realtimeReflectionProbes: 1 172 | billboardsFaceCameraPosition: 1 173 | vSyncCount: 1 174 | lodBias: 1.5 175 | maximumLODLevel: 0 176 | streamingMipmapsActive: 0 177 | streamingMipmapsAddAllCameras: 1 178 | streamingMipmapsMemoryBudget: 512 179 | streamingMipmapsRenderersPerFrame: 512 180 | streamingMipmapsMaxLevelReduction: 2 181 | streamingMipmapsMaxFileIORequests: 1024 182 | particleRaycastBudget: 1024 183 | asyncUploadTimeSlice: 2 184 | asyncUploadBufferSize: 16 185 | asyncUploadPersistentBuffer: 1 186 | resolutionScalingFixedDPIFactor: 1 187 | customRenderPipeline: {fileID: 0} 188 | excludedTargetPlatforms: [] 189 | - serializedVersion: 2 190 | name: Ultra 191 | pixelLightCount: 4 192 | shadows: 2 193 | shadowResolution: 2 194 | shadowProjection: 0 195 | shadowCascades: 4 196 | shadowDistance: 150 197 | shadowNearPlaneOffset: 3 198 | shadowCascade2Split: 0.33333334 199 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 200 | shadowmaskMode: 1 201 | skinWeights: 4 202 | textureQuality: 0 203 | anisotropicTextures: 2 204 | antiAliasing: 0 205 | softParticles: 1 206 | softVegetation: 1 207 | realtimeReflectionProbes: 1 208 | billboardsFaceCameraPosition: 1 209 | vSyncCount: 1 210 | lodBias: 2 211 | maximumLODLevel: 0 212 | streamingMipmapsActive: 0 213 | streamingMipmapsAddAllCameras: 1 214 | streamingMipmapsMemoryBudget: 512 215 | streamingMipmapsRenderersPerFrame: 512 216 | streamingMipmapsMaxLevelReduction: 2 217 | streamingMipmapsMaxFileIORequests: 1024 218 | particleRaycastBudget: 4096 219 | asyncUploadTimeSlice: 2 220 | asyncUploadBufferSize: 16 221 | asyncUploadPersistentBuffer: 1 222 | resolutionScalingFixedDPIFactor: 1 223 | customRenderPipeline: {fileID: 0} 224 | excludedTargetPlatforms: [] 225 | m_PerPlatformDefaultQuality: 226 | Android: 2 227 | Lumin: 5 228 | Nintendo 3DS: 5 229 | Nintendo Switch: 5 230 | PS4: 5 231 | PSP2: 2 232 | Standalone: 5 233 | WebGL: 3 234 | Windows Store Apps: 5 235 | XboxOne: 5 236 | iPhone: 2 237 | tvOS: 2 238 | -------------------------------------------------------------------------------- /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 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | UnityAdsSettings: 27 | m_Enabled: 0 28 | m_InitializeOnStartup: 1 29 | m_TestMode: 0 30 | m_IosGameId: 31 | m_AndroidGameId: 32 | m_GameIds: {} 33 | m_GameId: 34 | PerformanceReportingSettings: 35 | m_Enabled: 0 36 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Marching-cubes-on-Unity-3D 2 | Terrain voxel engine with the use of Marching Cubes implemented in Unity 2020.3.17f1 (LTS). You can clone and run the project or download only the [Marching_cubes folder](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/Javier-Garzo/Marching-cubes-on-Unity-3D/tree/master/Assets/Marching_Cubes) and add to your project assets. 3 | 4 | ![GifEdition](https://user-images.githubusercontent.com/58559223/91642654-6b216500-ea2d-11ea-8f30-cee65a9864c1.gif) 5 | 6 |
7 |
8 | 9 | # Table of contents 10 | 1. [Introduction](#introduction) 11 | 2. [Unity scenes](#unityScenes) 12 | 3. [Configuration](#configuration) 13 | 1. [Constants](#subparagraph3-1) 14 | 2. [Managers](#subparagraph3-2) 15 | 5. [Biome system](#biomeSystem) 16 | 1. [Edit biomes](#subparagraph4-1) 17 | 2. [Create new biomes](#subparagraph4-2) 18 | 6. [World manager](#worldmanager) 19 | 7. [Future work](#futureWork) 20 | 8. [References](#references) 21 | 22 | ## Introduction 23 | The unity project is a implementation of the algorithm [Marching Cubes](http://paulbourke.net/geometry/polygonise/) for the generation of a voxel engine for generate a random and infinite terrain. The idea is try to offer a flexible solution for developers that want integrate a free Voxel engine in his game or give a base for develop your own Marching Cube engine. Some of the actual properties of the engine: 24 | * Marching cubes: Used in the terrain generation, support edition in real time and Job System + Burst for generate the chunks (it improve the efficiency). 25 | * Chunk System: Chunk system for load the terrain near the player. 26 | * Random terrain and biomes: The terrain have random generation (seed) and support different types of biomes for the generation. 27 | * Save system: The data saved in a .reg files inside the dir: Application.persistentDataPath + /worlds + [WorldName](#worldmanager) (Default one: "/default"). 28 | 29 | 30 |

31 | 32 |

33 |
34 | 35 | ## Unity scenes 36 | The unity project have a total of 3 different scenes: 37 | * FirstPersonLevel: An example of a first person level and the recommended test level for check the project. Load/generate a terrain where you can add voxels with the left click and remove voxels the right click. Controls: AWSD, mause and + - keys. 38 | * ChunkVisualization: Similar to FirstPersonLevel but the generated terrain use a material that give each chunk a color, for help to visualize them. 39 | * TerrainViewer: Used to debug terrain/biomes in real time, when you modify a data of the NoiseManager get update in the terrain. Controls: AWSD, mause and + - keys. 40 | 41 | ## Configuration 42 | You can configure the project to adapt it to your necessities. You have two type configurations: constants or managers. 43 | ### Constants 44 | The configurations of the constants used internally in the engine, all indicated in the "Constants" script. You can modify the region of "Configurable variables" (don't touch other regions). You have the explanation of each variable in the script or in the below list: 45 | * CHUNK_SIZE: The size of a chunk, all the chunks have the same x and z size. 46 | * MAX_HEIGHT: The total height of the chunk, also the max terrain height. 47 | * VOXEL_SIDE: The size of a voxel, now it's 1 so one voxel have 1x1x1 size. 48 | * REGION_SIZE: The number of chunks per region side. That indicate the dimension of a region, actual 32 x 32 (x,z). 49 | * REGION_LOOKTABLE_POS_BYTE: Used in the save .reg files. Number of byte needed for represent (REGION_SIZE * REGION_SIZE) +1. Example: (32 x 32) +1= 1025 = 2 bytes needed. MAX = 4. 50 | * NUMBER_MATERIALS: Total number of materials inside the material grid texture. 51 | * MATERIAL_FOR_ROW: The number of materials in each row of the grid texture. 52 | * SAVE_GENERATED_CHUNKS: Used for save generate chunks without modify (when true). Recommend: false, 53 | * REGION_SAVE_COMPRESSED:Compress the .reg files . -File size -write time +CPU cost of compress a file. Recommend: TRUE 54 | * AUTO_CLEAR_WHEN_NOISE_CHANGE: If World Manager not exists in the scene and the current noise change, we clear the old world data (this remove the old chunks which generate wrong connections with new chunks). 55 | 56 | ### Managers 57 | Each manager (GameObjects inside Unity scene) have some parameters that you can modify for get different results, the majority of them only apply changes when new chunks are loaded if not indicate the contrary. 58 | 59 | Mesh builder manager ("MeshBuilder"): 60 | * isoLevel: Indicate the value above which the vertices of the voxel are inside of the terrain (Not air). 61 | * Interpolate: Allow to generate a more organic terrain using interpolation when build the mesh. 62 | 63 |
64 | 65 | Noise manager ("NoiseManager"): 66 | * World Seed: Seed of the world, for pseudo-random terrain generation. 67 | * Biome Scale: Size of the biomes. 68 | * Diff To Merge: The biomes.appearValue difference for merge. 69 | * Surface Level: Surface desired level, height where biomes merge. 70 | * Octaves: Octaves used in the biome noise. 71 | * Persistance: Amplitude decrease of biomes noise per octave,very low recommended. 72 | * Lacunarity: Frequency increase of biomes per octave. 73 | * Biomes: Biomes class array. Empty for get all Biomes of inside the GameObject (recommend). 74 | 75 | ##### The noise manager also contains biomes that with parameters to modify but this is explained in the biome section. 76 |
77 | 78 | Chunk manager ("ChunkManager"): 79 | * Terrain Material: Terrain applied to all chunks of the terrain. The material of the terrain. 80 | * Chunk View Distance: Chunks load and visible for the player,number of chunks distance. (Render distance of chunks). Change in play mode supported. 81 | * Chunk maintain distance: Distance extra for destroy inactive chunks, this chunks consume ram, but load faster. 82 | 83 | ## Biome system 84 | The biome system allow you to generate different types of terrain generated in the infinite world. It used a value between 1 and 0 where each biome has appear range, so each biome can have 1 or 2 possible neighbors biomes. 85 | 86 | Desert-mountains biome and the "NoiseManager" with the biomes: 87 | 88 | ![Biome frontier](https://user-images.githubusercontent.com/58559223/91642278-555e7080-ea2a-11ea-9aa9-d8181c0b4b9c.png) 89 | 90 | Ice biome and plains biome: 91 | ![ice-grass biomes](https://user-images.githubusercontent.com/58559223/91643239-b9386780-ea31-11ea-833e-7a63fc70727e.png) 92 | 93 |
94 | 95 | ### Edit biomes 96 | For edit a biome you can use the TerrainViewer scene. You only need to remove all the biomes classes from the "NoiseManager" except the one which you want edit and then modify the values of the inspector. 97 | 98 | You can use the "NoiseTerrainViewer" for use a bigger or smaller test area or apply offset to the terrain. All the changes applied in this scene update the test terrain, so you need start the scene, apply the changes to the biome, copy the component, stop the scene and paste the component values to the biome. 99 | 100 | Example of edition of the "B_Mountains" biome: 101 | ![B_Mountains edition](https://user-images.githubusercontent.com/58559223/94999078-200fea00-05b7-11eb-8a27-ed4f774b4980.gif) 102 | 103 | ### Create custom biomes 104 | For create the a biome you need create a class that heir from the class "Biome" and that must have the function "public override byte[] GenerateChunkData(Vector2Int vecPos, float[] biomeMerge)" used for generate the biome texturization. For this process you can copy a paste the code of some actual biome and apply the necessary changes to the code for get your custom biome. 105 | 106 | When you have the new biome class create, use the [edit biome section](#subparagraph4-1) for edit the parameters in a real time test terrain. 107 | 108 | For apply this to other levels just add this new custom biome to the NoiseManager in the other scenes. Like in the image we add the new biome "B_NewBIome" to the NoiseManager: 109 | 110 | 111 |

112 | 113 | ## World Manager 114 | The world manager is a **optional** manager (if not exist "default" world name is selected) to support multiple worlds folder system, just to allow multiple games in different worlds. You can found the prefab in "Assets > Marching Cubes > WorldManager", this prefab contain a gameobject with the manager script. 115 | This manager supports: 116 | * Change default world when manager is instanced: You can change the public variable "World" on inspector for select the loaded world. The default name if not change the variable or the manager is not instanced is "default". 117 | * Fast access button to worlds data folder on script: Exists a button on the inspector at the end of the script, that allow you to open the computer folder where all data/worlds are stored. 118 | * Functions for menu: If you open the script you can see the multiple function that the manager support, get all the worlds created, get the current selected world, select/create a new world o see the data size of world. The idea is that you have all this functions for create a world menu or similar. 119 | 120 | 121 | ## Future work 122 | The priority of next update will be: 123 | * Fix the texturization system: The texturizations is not correct and can be visible in geometrical textures (ex: brick textures). Update: Some improvements but need some fixes. 124 | * ~~Support of multiple worlds in the ChunkSystem/file system (Actual only one word is used by all levels)~~ (WorldManager added). 125 | * Different types of terrain modifications. 126 | 127 | Others futures updates: 128 | * Upgrade the biome system for support 2D noise biome creator (Actual the biome is created using 1D noise from 0-1). 129 | * Add a vegetation system to the biome system. 130 | * Cave system suApport for NoiseManager/Biome system. 131 | * Extend the Job System and Burst to the NoiseManager (efficiency improvements). 132 | * Add support to filesystem to save entities (animals, monsters ...) 133 | * Add a LOD system for the far chunks of the player. 134 | 135 | 136 | 137 | ## References 138 | The Marching Cube algorithm: 139 | * Polygonising a scalar field (Paul Bourke): http://paulbourke.net/geometry/polygonise/ 140 | * Coding Adventure: Marching Cubes (Sebastian Lague): https://www.youtube.com/watch?v=M3iI2l0ltbE / https://github.com/SebLague/Marching-Cubes 141 | 142 | 143 | Noise system: 144 | * Procedural Landmass Generation (Sebastian Lague): https://www.youtube.com/watch?v=WP-Bm65Q-1Y&list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3&index=2 145 | 146 | * Making maps with noise functions (Red Blob Games): https://www.redblobgames.com/maps/terrain-from-noise/ 147 | 148 | Others: 149 | * Region file system (Seed Of Andromeda): https://www.seedofandromeda.com/blogs/1-creating-a-region-file-system-for-a-voxel-game 150 | 151 | * Textures used in the terrain (Hannes Delbeke): https://hannesdelbeke.blogspot.com/2012/10/handpainted-textures.html 152 | -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedScenePath-0: 9 | value: 22424703114646760c1c0f2a192d585035021a2f3f67023520262e30e7ee312badd039fbeb3e0c393507ec280d310f12f7041c45e305031f08 10 | flags: 0 11 | RecentlyUsedScenePath-1: 12 | value: 22424703114646760c1c0f2a192d585035021a2f3f67023520262e30e7ee312badc43efce93109352a17ee300d24002bfb050745e305031f08 13 | flags: 0 14 | RecentlyUsedScenePath-2: 15 | value: 22424703114646760c1c0f2a192d585035021a2f3f67023520262e30e7ee312badd333fbf53b36320f0bea2b012c4f2afc031d12 16 | flags: 0 17 | RecentlyUsedScenePath-3: 18 | value: 22424703114646760c1c0f2a192d585035021a2f3f67023520262e30e7ee312badc13ffbf42e0f392b11e032283b173afe441c05ff1f13 19 | flags: 0 20 | vcSharedLogLevel: 21 | value: 0d5e400f0650 22 | flags: 0 23 | m_VCAutomaticAdd: 1 24 | m_VCDebugCom: 0 25 | m_VCDebugCmd: 0 26 | m_VCDebugOut: 0 27 | m_SemanticMergeMode: 2 28 | m_VCShowFailedCheckout: 1 29 | m_VCOverwriteFailedCheckoutAssets: 1 30 | m_VCProjectOverlayIcons: 1 31 | m_VCHierarchyOverlayIcons: 1 32 | m_VCOtherOverlayIcons: 1 33 | m_VCAllowAsyncUpdate: 0 34 | --------------------------------------------------------------------------------