cityjson / cjio

CityJSON/io: Python CLI to process and manipulate CityJSON files
MIT License
125 stars 32 forks source link

Add support for exporting textures to .obj #164

Closed bbeaucamp closed 1 year ago

bbeaucamp commented 1 year ago

I've managed to export the textures to .obj for my use case so I'm also submitting the code here, if it can help someone. I used this data for my tests https://data.grandlyon.com/jeux-de-donnees/maquettes-3d-texturees-2018-communes-metropole-lyon/donnees, that I converted to CityJSON with citygml-tools.

I tried not to change how the export2obj is used in case there are no textures. The test related to the obj export still passes, let me know if you want me to add one for the texture export (which also creates a .mtl file), or if you want me to change some things. There are probably many improvements that can be made for more flexibility, but I don't need more for now so I'll leave the code as is.

Resolves #163

Maitrihamburg commented 1 year ago

Amazing contribution, can confirm it to be working for Hamburg, New York, Amsterdam datasets. Some fiddling needed and the textures appear "empty" in some cases but they can easily be updated to actually display the images correctly in software like blender.

hugoledoux commented 1 year ago

I honestly don't know why it took us so long to merge that great PR: merci beaucoup!

I tested it on a few files and works great, feel free to improve it in the future if you want, I'm happily merge PR like those :)