- Open Git Bash / Terminal at the project root
- Add submodule
git submodule add https://github.com/CukuPackages/Cuku.MicroWorld.git Packages/com.cuku.microworld
MicroVerse
MicroSplat
Foliage Renderer
Use TerraLand to download terrain data and satellite images:
Create main area terrain with high resolution height and texture maps:
- Area Size: 20 km
- Tile Grid: 5
- Heightmap Res: 1024 (adapt so that is not jagged)
- Texture Res: 8192
- Resample Mode: Down
- World Scale: 0.1 or less (for large areas)
- Draw Instanced: False
- Pixel Error: 1
- Splatmap Res: 4096
Create surrounding terrain with enough low resolution height and texture maps:
- Area Size: 200 km
- Tile Grid: 2
- Heightmap Res: 128
- Texture Res: 8192
- Resample Mode: Down
- World Scale: 0.1 (for large areas)
- Draw Instanced: False
- Pixel Error: 1
- Splatmap Res: 4096
- Move the generated Data folder from TPrefabs - InSceneData to the project Assets
- Select terrains parent in Hierarchy
- MicroWorld - Convert Terain to MicroVerse
- HeightStamp textures should be Red (if they're green, restart Unity to refresh the HeightStamps import)
- Adjust HeightStamps Scale.y so that it roughly matches the original terrain
- Select MicroVerse in Hierarchy
- Adjust HeightMap Resolution if required (also adjust HeightStamp textures resolution)
- Adjust AlphaMap Resolution if required
- Detail Resolution: 512
- Enable Terrain Culling: MicroVerse - Options - Settings - Use Scene Culling
- MicroVerse - Pixel Error: 1
- After MicroVerse is setup, remove TerrainData and Layer folders of the original terrain
When instantiating content prefabs from script, e.g. from MVBiome, MicroVerse calls RevisionAllStamps in MicroVerse.cs. This will set some Stamps properties, which break the direct relation to the source content prefab and so it's desired. To avoid this, comment out the only call to RevisionAllStamps in MicroVerse.cs.
- Select MicroVerse in Hierarchy
- Select Convert to MicroSplat
- Select MicroSplat material
- Features - MicroVersePreview
- Check Export MicroVerse Preview
- Select MicroVerse
- Proxy Renderer Mode: Proxy While Updating / Always Proxy
- Select MicroSplat material
- Features - Global Texturing
- Global Tint: Multiply 2X
- Sampling Mode: Linear
- Select Terrains Parent under MicroVerse
- MicroWorld - Set Tint Texture To MicroSplat Terrain
Use Procedural Texturing to immediately texture the terrain based on height, slope, and noise functions:
- Select MicroSplat material
- Features
- Procedural Texturing
- Check Procedural Texturing
Disable Texturing from MicroVerse:
- Select all CopyPaste Stamp objects
- Locate Copy Paste Stamp component
- Uncheck Apply Texturing
Set World Height Range:
- Select MicroSplat material
- Settings
- Procedural Texture
- World Height Range: X: 0, Y: terrain heighest point (Tip: use the reference cube)
Convert Surrounding Area terrain into mesh terrain:
- Create new scene
- Setup Terrain as above
- Add HeightStamps to better blend between main and surrounding area (after main HeightStamp)
- E.g. create HeightStamp same size as MainArea, Mode: Override, Falloff Type: Range
- Create other HeightStamps to better blend on the edges
- Apply similar global texturing settings as the main area
- Convert terrains to mesh with default settings
- Lower splat maps resolution to the minimum
- Delete terrain dataterrain data
- Window - FoliageRenderer - Validate Culling Shader
- GameObject - Create Foliage Renderer
- Select Foliage Renderer game object - Shader Patcher - Scan - Patch
- Add Indirect Camera component to the Camera
- HDRP Global Settings - Max Shadow Distance
- Main Directional Light - Shadows - Resolution
- Adjust Shadow Distance for Trees and Details in Terrain Foliage Renderer
- Keep a separate scene with only Vegetation Splines (must not go in build settings)
- Locate Features - MicroVerse - MVBiome prefab
- Drag it in the Scene
- Make sure the the Spline Container - Spline 0 - Closed is CHECKED
- Draw a closed spline (check unity Spline Package) that represents the Biome Area
- Add the Biome Prefab to MVBiome component - Biome
- Right Click MVBiome component - Spawn
- The Biome will be created and parented under MicroVerse
- Adjust it as desired
- Foliage Renderer - Uncheck Auto Refresh Terrains
- Window - FoliageRenderer - Disable Force Scene View Refresh
- Indirect Renderer - Enable Hi Z Occlusion if it helps
- Indirect Renderer - Increase Max Graphics Buffer Caches
OSM data can also be used to extract the vegetation areas, roads, buildings, etc.
- Use NuGet to install OsmSharp and OsmSharp.Geo
- Install MicroWorld
- Download .osm.pbf data from Geofabrik and add in [LOCAL] or anywhere on the PC, it will not be added in runtime
- Create Source asset: Right Click in Assets - Create - MicroWorld - OSMSource
- OSMSource - Select OSM Data to chose the OSM data .pbf file
- OSMSource - Center Coordinates: can be found from TerraLand settings when generating the terrain
- Area: the area where to extract data from (real world size, ignore TerraLand World Scale)
- Use https://www.openstreetmap.org/ to analyze elements to be extracted
- If Query features doesn't work, try and click on the feature boundary
- Create Vegetation scene to use it to store vegetation biome areas and make it Active
- Create vegetation Element assets as defined in OSM (e.g. landuse:forest): Right Click in Assets - Create - OSM - Element
- Create OSM data Extractor asset: Right Click in Assets - Create - MicroWorld - OSMExtractor
- Set Source asset (created when setting up OSM)
- Set vegetation Element assets
- Select OSMExtractor asset in Inspector - Click ⋮ - Extract (it will create a .json file on the same location)
- Create MicroWorldVegetation / MicroWorldBiome prefab variant (from MicroWorld - Runtime - MicroWorldArea - Prefabs)
- MicroWorldVegetation / MicroWorldBiome - Content: use one from Cuku.MicroWorld.Content or create a new one
- Use models from Library for TreeStamps, Biomes, etc.
- Select both Extractor and Biome / Vegetation
- MicroWorld - Setup Elements
- Select Biome Game Object/s in the scene - Click ⋮ - Spawn
Vegetation Areas can be reduced / filtered around a spline by a defined range.
Warning
Too Much Content to Spawn?!
If there's just too much content to spawn and not enough RAM, you're doomed, but it's worth trying the following:
- Enable MicroVerse - Options - Settings - Use Scene Culling
- Spawn and save the content in batches
- Don't focus to Scene and Game tabs
- When building, don't keep MicroVerse scene open
- Keep only LOD0 and LOD1
- Keep only LOD0 Game Objects
- Remove renderers from LOD1
- Set LOD0 Transition (% Screen Size): 10%
- Set LOD1 Transition (% Screen Size): 0.1%
- Remove Ccolliders from Game Objects
- If a pop-up shows select: Keep Converted Material (to reuse existing materials)
- Convert Collected Data (green box icon after Convert) and move to Library (Library - Asset Type - Publisher)
- Create a folder with prefab name on the same level to store settings and specific textures to that prefab
- Add Amplify Impostor component to Prefab
- Click the + button before Bake Impostor button to create new Impostor settings and add to the prefab folder
- Bake Type: Hemi Octahedron (for top down views)
- Bake Preset: TVE Hemi Octahedron
- Add Prefab to scene
- Click Bake Impostor
- Drag LOD0 object on newly created Impostor object - Material - Copy Settings From Object
- Apply prefab overrides