UtyMap is a library which provides highly customizable API for procedural world generation based on real vector map data, e.g. OpenStreetMap, NaturalEarth. Core logic is written on C++11 and can be used on many platforms as it has no dependency to specific game engine or application framework. It is designed for interactive world creation at different zoom levels, including globe and ground.
Current master branch has a very experimental version. It is recommended to use the latest release.
utymap can load your scene at different zoom levels: utymap can use various vector map data sources and file formats:- Mapzen (json)
- OpenStreetMap (pbf, xml)
- NaturalEarth (shape data)
Theoretically, you can extend utymap with any vector map data format support.
utymap encapsulates elevation processing internally to support different elevation data providers:- raw SRTM
- mapzen elevation data
- your own elevation data by conversion in simple text format.
area,relation|z16[building],
area,relation|z16[building:part] {
builders: building;
height: 12m;
min-height: 0m;
facade-color: gradient(#c0c0c0, #a9a9a9 50%, #808080);
...
}
area,relation|z16[roof:shape=skillion] {
roof-type: skillion;
}
area,relation|z16[building:color] {
roof-color: eval("tag('building:color')");
}
area,relation|z16[building:material=brick] {
facade-color: gradient(#0fff96, #0cc775 50%, #066139);
facade-texture-type: brick;
}
For example, you can have different styles for different seasons of year. Or you can vary textures based on region
utymap can consume map data to generate more complex tries via custom L-System implementation
If you want to build or use your own models, extend application logic (for example, by attaching MonoBehaviour to generated meshes), you can do it using custom scripts in Unity:
public GameObject Build(Tile tile, Element element)
{
GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
gameObject.name = GetName(element);
var transform = gameObject.transform;
transform.position = tile.Projection.Project(element.Geometry[0],
GetMinHeight(element) + element.Heights[0]);
transform.localScale = new Vector3(2, 2, 2);
gameObject.GetComponent<MeshFilter>().mesh.uv = GetUV(element);
gameObject.GetComponent<MeshRenderer>().sharedMaterial = GetMaterial(element);
return gameObject;
}
Map data is encapsulated via Element class which provides access to raw geometry and attributes.
You can build your own objects (buildings, roads, etc.) on top of generated objects:
IMapDataEditor editor = _compositionRoot.GetService<IMapDataEditor>();
var node = new Element(7,
new GeoCoordinate[] { new GeoCoordinate(52.53182, 13.38762) },
new double[] { 0 },
new Dictionary<string, string>() { { "name", "Near me" } },
new Dictionary<string, string>());
editor.Add(MapStorageType.InMemory, node, new Range<int>(minLevelOfDetail, maxLevelOfDetail));
This data can be stored in multiple data storages located on disk or memory to keep original map data untouched.
Project consists of two sub-projects:- core contains essential logic written on C++11 to build library for constructing of map based apps: terrain/buildings/osm-objects mesh generators, mapcss parser, spatial geo index, etc. It does not depend on any 3D render framework or game engine.
- unity contains examples written on C# which can be reused to build map oriented Unity3D apps using core library. It demonstrates basic use cases: globe zoom level rendering, 3D scene with all details.
Licensed under GPLv3