added export scripts for ortho and buildings

This commit is contained in:
2025-12-14 02:56:33 +01:00
parent da16f66d30
commit 22b5dd4fa5
4 changed files with 245 additions and 6 deletions

View File

@@ -12,15 +12,15 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
- `work/` — intermediates such as `dgm.vrt` and `_tmp.tif` files; safe to delete/regenerate.
- `export_unity/height_png16/` — final 16-bit PNG heightmaps for Unity import.
- `export_unity/tile_index.csv` — manifest mapping tile IDs to world bounds and global min/max used for scaling.
- `export_unity/ortho_jpg/` — cropped orthophoto tiles aligned to the terrain grid (JPEG + worldfiles).
- `export_unity/buildings_obj/` — per-tile clipped CityGML exports as OBJ meshes.
- `export_heightmaps.py` — main export script.
- `export_ortho_tiles.py` — exports orthophoto tiles from DOP JP2 inputs using the terrain manifest.
- `export_buildings.py` — clips CityGML LoD2 tiles per terrain tile and writes OBJ meshes.
- `AGENTS.md` — contributor guide.
### Quick Start
1. Build the VRT mosaic from raw tiles:
```bash
gdalbuildvrt work/dgm.vrt raw_dgm1/*.tif
```
2. Export Unity heightmaps and manifest:
1. Export Unity heightmaps and manifest (builds `work/dgm.vrt` automatically if missing):
```bash
python3 export_heightmaps.py
```
@@ -38,3 +38,19 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
- Large raw datasets are intentionally excluded from version control—document download sources or scripts instead of committing data.
- Additional inputs: `raw_dop/` contains an HTTPS download helper (`raw_dop/dlscript.sh`) that fetches JP2/J2W/XML orthophotos listed in `filelist.txt`; `3dgeblod1/` and `3dgeblod2/` hold zipped 3D building tiles with object lists for future use.
- Handoff to Unity: copy/sync `export_unity/height_png16/` and `export_unity/tile_index.csv` into `DTrierFlood/Assets/GeoData/` before running the Unity-side importer. Keep `OUT_RES` aligned with the importers expected resolution (currently 1025).
### Orthophotos (textures)
1. Ensure DOP JP2s are present in `raw_dop/jp2/` (use `raw_dop/dlscript.sh` if needed).
2. From `GeoData/`, run:
```bash
python3 export_ortho_tiles.py
```
This builds `work/dop.vrt` if missing and writes `export_unity/ortho_jpg/<tile>.jpg` + `.jgw` aligned to `tile_index.csv`.
### Buildings (CityGML LoD2 → OBJ)
1. Ensure LoD2 GML tiles live in `raw_3dgeb_lod2/` (unzipped from `3dgeblod2` bundle).
2. From `GeoData/`, run:
```bash
python3 export_buildings.py
```
This clips each GML to the terrain tile footprint and exports `export_unity/buildings_obj/<tile>.obj` (EPSG:25832 coordinates).