Blender CityJSON Plugin
This plugin was originally developed by Konstantinos Mastorakis (konmast3r) as part of their research orientation project for the MSc Geomatics programme of TU Delft.
A Blender plugin to import 3D city models encoded in the CityJSON format. All building attributes and semantic surfaces are stored and can be accesed via Blender's layout.
- Blender Version >=2.80
You can find sample datasets at the official CityJSON website. In case you have 3D City Model datasets encoded in CityGML you can use the free Conversion Tool to convert to and from CityGML and CityJSON.
Trying to import really big datasets such as
New York will take several minutes because of the amount of information contained. With the rest sample CityJSON files everything should work noticeably faster. Depending on your machine, it could take some seconds up to few minutes minute to import the 3D City Model.
Download this repository as zip (through GitHub this can be done through the
Clone or download>
Blenderand go to
Edit > Preferences > Add-onsand press the
Select the downloaded ZIP and press
Install Add-on from File....
Enable the plugin from the list, by ticking the empty box next to the add-on's name. (Optional: If this is an update, un-tick and tick again the plugin to reload it!)
File > Import > CityJSON (.json) and navigate to the directory where the CityJSON file is stored and open it.
*Important: Make sure
Blender's viewport is in
Object Mode before importing a new cityjson file.
The following options are available during file selection:
Surfaceswill create materials according to semantic surfaces (e.g. RoofSurface, WallSurface), if present, and load their attributes.
City Objectswill create materials per city object and according to the city object's type (e.g. Building, Road).
Reuse materials: Enable this if you want semantic surface materials to be reused when they share the same type. For example, all
RoofSurfacefaces will have the same materials. This only work when
Surfacesare selected as
*Important: Greatly improves speed of loading, but semantic surfaces' attributes can be lost, if present!
Clean scene: Enable this if you want the script to clean the scene of any existing object prior to importing the CityJSON objects.
In case you run
Blenderthrough the console, useful feedback is given in it, informing about the progress of the import procedure.
After a successful import, you should be able to see the model somewhere close to the axis origin. Rotation of the scene and zooming in and out might prove useful at this point, to locate the model. In case you can't see the model, select an object from the
Object Mode) and click
View > Frame Selected.
*Important: Make sure the object you are selecting is a
mesh object. You can check that from the small pointing down triangle icon next to the object's name.
Collectionsare created for
LoD 0 to 3respectively. In case more than 1 geometries exist for the objects -representing different
LODs(level of detail)-, every geometry is stored under the appropriate
Collection, under the parent object (if there is any). You can display different
Collectionsby clicking on the
eye iconin the
Outlinerat the top right of the interface (see screenshot below). By default all the
LOD_xcollections should be visible right after importing the 3D City Model. In case you see any artefacts that is the reason! Choosing only one visible collection should remove all artefacts.
In case you want to visualize a certain area, click
Shift + Band draw a rectangle with your mouse to zoom into that specific area of the 3D City Model. This also moves the rotation center at that poin, which will come handy when you want to rotate the model for further inspection.
To see the attributes of each object, simply select the object on the screen and click on the
Context.Objecttab on the bottom right (Blender 2.80 interface). Then click
Custom Propertiesdrop down menu (see screenshot below).
To see the semantics of each surface, select an object in
Object Mode, hit
Edit Modeand click
Face Select(top left of the viewport between the
Edit Modeand the
Viewbutton). Select a face of the object and click on the
Context.Materialtab at the bottom right. Scroll down and click on
Custom Properties(see screenshot below).
Clone this repository and have fun!
If you are using Visual Studio Code, you may: