-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer as Java library (for buildings) #171
Comments
What are your thoughts on this, @tordanik? Do you think this is realistic? Is there any better alternative than outputting it as a string (or writing it into a file) in some data format? |
Some thoughts:
I think using an existing exchange format for models would be preferable over rolling our own, and OBJ is ok for that. (GLTF would be the more modern choice, but #157 is a larger task that I'm not going to get around to in the near future.) In the simplest case, a model can just be a String, but that stops being a possibility if we need to handle additional files/resources, such as textures. If textures aren't needed and plain colors are sufficient, we can ignore these complications. @westnordost: What's the visual appearance you're going for, do we need to look into textures etc.? Do you already know how you're going to feed the model to OpenGL – an existing library/component/...? – and which capabilities that will offer us? |
That's great news!
For what is osm4j used? All of it, or certain modules only?
I am going to feed it to GL10 or something. The plan is to use the library just to preview the building roof's shape and orientation, so a simple shape, maybe with the roof tinted red and the rest tinted white. I can use up to GL ES 2.0 at the moment and when/if I set the minimum Android SDK version to 5.0, I can use up to GL ES 3.0. The issue with textures in general is that since then we exit the realm of abstract shapes towards a more realistic look, much more is needed to make it look good, just texturing the surfaces is not enough: Roofs need to extend past the walls, they need a rain gutter, other details such as a chimney, the building's wall become 3-dimensional as well, with balconies, embellishments etc and other random details and variations. Since all this decoration is then mostly not based on actual data, I consider this quite the separate project which would maybe take the abstract shape data as a starting point. I recently saw a demo of a fly-through through some neighbourhood (in unity I think) supposedly based on OSM data, I think I got the link from OSM Weekly. It looked really good, but it had little to do with a simple 3d-extraction like OSM2World does anymore. |
Simple colored shapes are easy to do, so that's fine with me. (You're right that truly life-like visuals can't be achieved without procedural techniques, i.e. adding a lot of details that aren't actually mapped in OSM.)
I'm using the osm4j-core, osm4j-pbf and osm4j-xml modules to read OSM data. It's then immediately converted to OSM2World's own representation of OSM data that's more convenient for me to work with. So osm4j is not necessary for your use case, seeing how you are going to pass in the geometry yourself, but atm I see no good way to split it off. |
Once this is implemented streetcomplete/StreetComplete#1063 should be reopened (feel free to ping me if I will somehow miss it) |
I’ve started a javascript based project that might fill this niche. It uses the three-js library. https://beakerboy.github.io/OSMBuilding/ Given a way_id, the script pulls any building parts that are within the bounding box and renders them. So far it just supports domed roof shape, and simple ways, no multi-polygons or relationships. I’d love to borrow any code from here that creates hipped, gabled, or any other types of roofs. I’m willing to take help from anyone who knows more about javascript or 3D graphics than I. |
(Follow up of streetcomplete/StreetComplete#1063 (comment))
It would be very useful if OSM2World would be offered as a Java library available on maven central. This way, other apps, such as StreetComplete, JOSM or Vespucci could easily show a 3D preview of a building when tagging.
As far as the interface is concerned, maybe something like this (example in kotlin)
The text was updated successfully, but these errors were encountered: