Search Unity

World Building [RELEASED] CityGen3D | Procedural city generation from map data

Discussion in 'Tools In Progress' started by CityGen3D, Jan 28, 2018.

  1. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    1. Intended workflow is that you should be able to copy the Generator prefab (Assets\CityGen3D\Resources\) and make changes to it. Then reference it in the Generator Profile on Location panel so it gets loaded into the scene when you click the Load Generator button. So you could have different Generators for different locations, themes, and art styles just by having different copies of the prefab.
    One day I'll demo this by setting up a Generator to use low-poly cartoon style assets instead of the defaults.
    With the CityGen3D map data, you just have to copy the CityGen3D prefab and drag it into the scene at the start.

    Making copies of these two prefabs is a good thing to do, because naturally if you download a CityGen3D update, the defaults will be overwritten.

    I hope this helps give you some ideas with organization, but let me know how you get on, or if you think there is still scope for improvements.

    2. It may not make v0.9 but I am developing a mechanism for modifying building instances after generation. I really want to able to do this for all the reason you mention, so it's high priority. So although options may be limited initially in this regard, it will be something being actively worked on.

    3. Yeah so the last time CityGen3D is aware of the raw OSM data is when you click Process to generate the 2D map. After that, it gets all the data from the gameobjects parented to the CityGen3D root object. It's from this data that the 2D map is created.

    Long term, you'll be able to edit the 2D map at this point to modify surfaces and roads, or add features and entities.
    There are some limited editing capabilities already present for some objects. For instance, if you click a surface on the map like "Farmland" and view the Inspector, you'll be able to change it to a different surface type via the listbox and the changes will be reflected immediately in 2D map view. Likewise you can change some road attributes on the map as well and see the changes in 2D.

    This is quite limited at the moment, and is just proof of concept, but after v1.0 there'll be a toolbar for adding new objects and you'll be able to move and add nodes to change the shape of objects.
     
    Astirian and chmodseven like this.
  2. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Here's a procedurally generated supermarket from OpenStreetMap data.
    I manually added the "Supermarket" sign after generation, which is really easy to do with Unity's TextMeshPro.

    Also wrote a quick prefab spawner for some shopping cart fun! :)

    screenshot2.png
     
  3. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    120
    Looks like my local Sainsburys on a normal day. :D
     
    Astirian and CityGen3D like this.
  4. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Funnily enough the building was actually generated from a Sainsbury's in UK, hence I went with the orange trim. :D
     
  5. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    Status report on next version of CityGen3D? I think that the landscapes are already loaded in the scene before playing the game, the truck lands on the terrain as expected. If the landscapes are set for "scene streaming", the truck falls to flat roads without terrains.
     
    Last edited: Apr 1, 2020
  6. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    We should be able to debug this by finding out the following:
    • What is your trucks world space position?
    • What landscape should be loaded at this position?
    • Is the landscape present and added to the build settings?
    There is a debug checkbox on the Landscape Manager to help us.
    When enabled this should show the camera position and the landscape it thinks should be at this location.
    While game is running look at top left and top right of screen for this information.

    So please can you send me screenshot of your game running with this debug option on, your Landscape Manager component setup, and any console output generated during loading.

    As I recall I think the console will report if a scene can't be found by the Landscape Manager so there may be a clue there as to what is going on if you try it in the Editor.

    As soon as I get chance I'll also try and do a demo video showing how to set this up more clearly.
     
  7. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Definitely coming this month, hopefully around Easter.

    It's going to be an even bigger update than originally planned with more content and features.
    Here you can see a building with flat roof that was generated from building rules being modified afterwards in the Inspector and rebuilt on demand.

    The red gizmo indicates the change of roof shape which updates in real time when you change the settings.
    Each level of the building has it's own component from which you can replace sections of it using a drop-down.

    Whichever façade section you are interacting with is also outlined with the gizmo when you mouse over it, and I've just changed one of the facades to be a door.
    Then I click Rebuild, and the building is regenerated with your customizations.

    I will release a video once v0.9 is ready for release to show this more clearly, but this will allow you to customise your building quite a bit after generation, which will be really useful for door placement.

    before.png
    after.png
     
    Astirian, Santa36, Scarfell and 2 others like this.
  8. ebellumat

    ebellumat

    Joined:
    Aug 26, 2019
    Posts:
    3
    Hello, CityGen3d, i'm using Unity 2019.3.7f1 on a Mac OS Catalina, when i open the Generator toolbar, after process the Data, i have this error.

    Code (CSharp):
    1. CityGen3D.EditorExtension.EditorGenerator.ShowHeightmapModifiersPanel () (at C:/Dev/CityGen3D/CityGen3D Editor/Editor/EditorGenerator_Heightmap.cs:423)

    The latitude and longitude is, Vila Velha - ES, Brazil, Latitude: -20.3305, Longitude: -40.2922
     

    Attached Files:

  9. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    After I download and process OSM data, I press CTRL-M keys to bring up 2D map. Where are the 2D maps located in Windows Explorer?
     
  10. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    Thanks for your message, I’ll try and get you back on track.

    First thing to try if you’ve not already would be to simply delete the Generator gameobject from your Hierarchy, go back to Data window and click Load Generator to reload it.

    If you still have issues then check that you have definitely setup the Unity Layers as detailed in the manual. (Most reported errors can be traced back to this).

    If they aren’t you may want to try a fresh project, installing the packages, and setting up layers, just to be sure everything is setup correctly.

    If these are setup correctly, please try again by loading the New City scene and trying the steps to generate a location again.

    If none of the above helps please take a screenshot of your Inspector with the Generator gameObject selected, and also one with the child Heightmap object selected.

    This should help me identify exactly what’s going on.
     
  11. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    The 2D map exists only as a collection of game objects. It doesn’t exist anywhere outside of the Unity scene.

    What file format were you hoping to find it in?
     
  12. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    I thought that the 2D map is an image. I need the building footprints that are not shown on 3D terrains but shown on 2D maps. I want to create temporary 3D buildings until you release the next version of CityGen3D. I tried to use the "Raise or Lower Terrain" tool but I can't lower part of the terrain because the position of the terrains are at X,0,Z. I created flat terrains because of weird problems between terrains - the roads just drop from height of terrain to X,0,Z (I think) between terrains.
     
  13. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    The 2D map that appears in the Map view after processing data is clickable. You can select any object in it, and in some cases basic editing functionality is supported such as changing surface types (with more to come).

    Note that it's already possible to process Building data in v0.82, so rather than an image, I think you just want to access this data.

    Before you click Process to create the map, ensure Buildings (or "Everything") is selected as filter in the Processing listbox. Building processing may be off by default until the Generator can work with it.
    Although from your description it sounds like you've already done that and you can see buildings on the 2D map.

    The following code shows you how you can access the building data, either to get a world position of the building, or more accurately, the world position of each node in the building shape.

    Code (CSharp):
    1. using CityGen3D;
    2.  
    3. // loop through each building in turn
    4. foreach (MapBuilding mapBuilding in Map.Instance.mapBuildings.GetMapBuildings() )
    5. {
    6.     //loop through shapes that define building (a building may be more than one shape, but in most cases there'll just be one)
    7.     foreach( Shape shape in mapBuilding.GetComponents<Shape>() )
    8.     {
    9.         // find centre of shape - this will essentially give you building position in Unity world space
    10.         Vector3 worldPos = shape.GetCentre();
    11.  
    12.         // get each node position for more detailed building shape
    13.         foreach( Vector3 node in shape.GetPositions() )
    14.         {
    15.         }
    16.     }
    17. }
    Then with this data you can do what you want with it.
    As discussed previously I'll be doing a more detailed demonstration of the CItyGen3D API a bit later, using it to hook-up to BuildR, in the hope this will provide a useful example so coders can start experimenting with using CityGen3D data with other third-party tools.
    So while the above code snippet isn't a fully working example, there may be enough there to get started with and hopefully it shows how easy it is to access the OpenStreetMap data through the API.
     
  14. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    I already enabled Buildings in the Processing listbox. Where should I put the code above? Will I generate low-poly buildings?
     
  15. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    The code posted above won’t do anything on its own, it’s just an example of how to get the building data from CityGen3D to code your own solution.

    For example you could use it to spawn a prefab at building location, or to extrude a mesh in the actual shape of a building, if you already know how to do those things.

    However the upcoming building generator will do all this for you so you don’t need to code anything.

    So if you can hold off for just another week or so, I promise you’ll have some buildings to play with :)
     
  16. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    120
    Does that mean BuildR functionality is coming in 0.9? What advantages would BuildR have over (or in addition to) your own building functionality in CityGen3D? I haven't bought BuildR yet, so knowing what the added value might be will be good to know in deciding whether to get it or not.

    I'm looking forward to seeing the API details. I'm hoping things are coded in such a way as to use interfaces/polymorphism so that we can potentially add in our own map or data type importers and have CityGen3D work with those - for example swapping out OSM for OpenZoomstack, as long as the interface signature matches.
     
    Astirian and Santa36 like this.
  17. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    The API will mainly provide a code interface to the parsed OSM data, rather than providing an interface between different data inputs.
    Once you start coding AI for your project you may need to know things like:
    What surface is below my character/car?
    Where's the nearest bus stop?
    What's the speed limit on this road?
    What are the waypoints for lanes on roads?

    Access to this data is largely already possible in CityGen3D, it's just a case of documenting it and tidying the API up a bit.
    Up to now focus has been on getting the UI sorted so non-coders can use CityGen3D via the Generator window.
    But much of the tool's power comes from being able to use the data yourself in scripts, even at run-time.
    Here's a very simple example of a component that uses the GetMapRoadAtWorldPosition function.
    If you attach it to a gameobject (eg camera) it will tell you the road at the objects location in the Inspector.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace CityGen3D
    4. {
    5.     // attach to gameobject to get road data at its location
    6.     public class RoadInfo : MonoBehaviour
    7.     {    
    8.         public MapRoad road; // the road at current location
    9.         public float checkRadius = 1.0f; // how far away from location do we consider to be within bounds
    10.         public float checkFrequency = 1.0f; // how often should be check for change (seconds)
    11.  
    12.         void Start()
    13.         {
    14.             InvokeRepeating( "RefreshRoad", 0.0f, checkFrequency );
    15.         }
    16.  
    17.         void RefreshRoad()
    18.         {
    19.             road = Map.Instance.mapRoads.GetMapRoadAtWorldPosition( transform.position.x, transform.position.z, checkRadius );
    20.         }
    21.     }
    22. }
    So I imagine users being able to eventually search the CityGen3D API for public functions online and have little code examples like this to show you how to use it.

    The BuildR integration will just be a more elaborate example, showing you how you could write your own Generator that hooks up the data CityGen3D already has to another asset.

    Please see this thread for more info on BuildR. The next version is in active development so I wont be releasing the BuildR integration demo until after that is out properly, but it's not far away either.

    Jasper is about to close the open beta but you may still be able to get on it if you want to try that asset out.
     
    Astirian, Santa36 and hopeful like this.
  18. Denzellz

    Denzellz

    Joined:
    Apr 2, 2016
    Posts:
    8
    Usually how long does it take until approved after purchase.
     
  19. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Not very long, the 24 hour approval window is just a worst case scenario, it’s normally done within an hour.

    You should be ready to go now, but let me know if you need any help.
     
    Santa36 likes this.
  20. Denzellz

    Denzellz

    Joined:
    Apr 2, 2016
    Posts:
    8
    Anyone know and great locations for a street racing game? would love get some opinions.
     
  21. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    I can’t really give specific locations, although it will be interesting to see if anyone else has some suggestions. But I can answer your question more generally.

    What I have enjoyed about racing around CityGen3D environments in testing is the organic European style roads, where junctions are less likely to be at right angles.

    The way the road networks are generated from OSM data allows these winding roads to be created just as easily as grid based American style city layouts, which otherwise are quite time consuming to create manually because they don’t lend themselves well to modular assets.

    Coupled with undulating terrain, this type of environment can be lots of fun!

    But it really depend on the type of game you want to make and what atmosphere you are looking to create, whether it’s high speed motorway pursuits or close urban street racing.

    The great thing is, with CityGen3D you’ll be able to prototype different types of road layout and environments very easily! :)
     
    Denzellz and StevenPicard like this.
  22. Denzellz

    Denzellz

    Joined:
    Apr 2, 2016
    Posts:
    8
    thanks for the great information ill start testing around that area :)
     
    CityGen3D likes this.
  23. Denzellz

    Denzellz

    Joined:
    Apr 2, 2016
    Posts:
    8
    Idk what im doing wrong but my terrain is all black and all objects and roads are placed under the map.


    upload_2020-4-8_22-53-44.png upload_2020-4-8_22-54-37.png upload_2020-4-8_22-55-12.png
     
  24. Denzellz

    Denzellz

    Joined:
    Apr 2, 2016
    Posts:
    8
  25. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Thanks for the screenshots, I suspect this is a setup issue.
    Did you setup the Unity Layers in your project as detailed in setup instructions?

    Here's a brief rundown of what you need to do to set everything up in a new project:

    • Create a new 3D project as normal (eg via Unity Hub).
    • Install required packages if not already installed (Burst, Editor Coroutines, Mathematics, and any others mentioned in the manual although it's just these three at time of writing).
    • Copy TagManager.asset into your project's ProjectSettings folder (to replace existing one).
    • Install CityGen3D Unity package.
    Once you've done that you should be ok.
    Let me know if you still have problems getting up and running.
     
    Santa36 likes this.
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    @CityGen3D - I was browsing the documentation PDF prior to purchasing, and I see it says that Unity version 2019.1 or later is the target of the asset.

    Does this mean it won't work with 2018 LTS?

    I'm curious because I only develop with LTS for stability reasons.

    Hopefully, the 2019 LTS comes out soon, but especially with the COVID-19 situation, I can see where it might be months before it arrives.

    EDIT: I guess I can answer my own question. I'd develop my city in a 2019.1 project and then export it to whatever version I'm using for the rest of my game. Right?
     
  27. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    Thanks for your query.

    2019.1 is the earliest supported version because it’s built on top of new Unity tech (and some Unity packages still in Preview).

    I should perhaps emphasise that CityGen3D itself is still considered Beta as well.

    You may have some joy porting over scenes and objects to earlier Unity versions if you are only interested in scene geometry, but that’s not been tested.
    Also, run-time components (such as scene streaming) would probably not be useable if you went down that route, so I would advise against it.
     
  28. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    It's not a great situation, I suppose, but I blame Unity. They should publish the LTS at the end of every year, IMO.
     
  29. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Presumably any project you start now won’t be finished until long after the LTS release?
    The LTS release is intended to reassure you that you wont have to update to a relatively unstable 2020 to get any critical fixes for your 2019 project.
    So I think the idea is that you can start a project at any time because you are assured long term support for that version. It’s supposed to remove the need for waiting, if you see what I mean.

    That said, even if LTS was out now, CityGen3D is still in beta and reliant on Unity packages in Preview, so that’s probably a bigger reason to hold off, if you are particularly concerned about everything being production ready now.

    Although it’s a good investment to get CityGen3D now because the price will be going up in due course to reflect all the improvements and fixes. Back in 2018 I said I’d put the price up as I added new stuff and I’ve not done that up to now, but it still stands that the v1.0 will likely be around $100. So everyone please keep in mind that the introductory price is coming to an end soon!
     
  30. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    I already picked up CityGen3D (earlier today). I'm using it in 2019.2.19. Now I'm trying to figure out how to get it to generate a sample sector. :)

    As for the LTS, I use assets from the store, and it can be difficult to get everyone compatible with the same Unity versions. There are Unity changes/bugs in every point release, changing lighting, shadows, shaders, etc. But all store assets, generally, are compatible with the LTS versions. So I much prefer to just use the LTS versions now that we have them.

    I'm not a fan of the tech releases at all. I don't download them. IMO, they are a waste of time for game development, even if you are just making playable demos. But I realize they may be necessary in order to preview or test certain tools or features. And I know CityGen3D is in beta. I've been following this thread since it started. :)

    I've been working with 2018 LTS since last summer, and the city modeling with CityGen3D is not my starting point. It's just a possibility for the environment. If 2019 LTS ever comes along, and if it's not too painful to migrate to it, I will.

    I'm just starting in with this, but thanks for putting so much time in on this particular project. I'm hoping it has the right features for me. :)
     
    Last edited: Apr 11, 2020
    CityGen3D likes this.
  31. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Cool, if you need help with any specifics, please let me know.
     
    hopeful likes this.
  32. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Goodbye Watton-at-Stone, hello West Hendon!
    The new default location in CityGen3D when v0.9 is released, hopefully later this week.

    I wanted somewhere with as much diversity in half a kilometre that I could find
    This has residential, commercial, industrial, construction, forest, and water.
    As well as a railway, motorway and selection of different types of buildings mapped in 2D.

    I've actually been using it for ages myself, as a testing ground for most of the features, and it works rather nicely in that regard.
    I'll be updating the walkthrough video as well...

    west_hendon_preview.png
    west_hendon.png
     
    Santa36, IJas13, Stephen_O and 2 others like this.
  33. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    @CityGen3D - There isn't already an automated way of generating an array of tiles, is there?

    If it doesn't presently exist, will that feature be coming?

    I would like to have many small tiles, as a smaller granularity seems like it would be better for streaming type management. However, if I have to do it by hand, I think I want to use a much bigger tile. ;)
     
  34. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    The Area slider on the Data-Location panel controls how many terrains are generated at any one time, but you need to select that appropriately before starting project.
    You want to find a nice balance between not overloading the Unity Editor with loads of data and too many terrains at once though.

    I tend not to go over 2km at one time, so something like Medium terrain size (512m), and Area size of 4 would generate 16 terrains at once (4x4) for area of 2048m x 2048m.
    Then you could do the next batch of 16 terrains in another session, etc
     
  35. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Okay, cool. I'll give that a shot. :)
     
    CityGen3D likes this.
  36. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    CityGen3D v0.9 out now!

    Here's an updated demo video showing how you can create a scene based off real world map data in just 5 minutes, complete with terrain, roads, buildings, trees, grass, and other prefabs.



    This is the first release of the building generator, so it still needs some TLC before v1.0, but I think it has a lot of potential.

    Obvious things to add will be door placement AI (some are clearly too high for the terrain!), and there's a few UI improvements and glitches to iron out.
    So lots more to add to it over coming releases and I'll share my long term vision for it a bit later, but it would be good to get some feedback on it in the meantime.

    Here's another video focusing on some of the building editing functionality available to you.
    This comes in handy to remove unwanted doors and such like.



    The general concepts of building generation should be fairly familiar just from using the other modules in that you simply match up building types to blueprints that define what they look like in 3D.
    Please bear with me while I document some of the less obvious parts of this new feature. I imagine releasing v0.91 in just a few weeks with more documentation and a few fixes, but I thought it worth getting it out there for you to play with and provide feedback.
     
    IJas13, chmodseven, Scarfell and 2 others like this.
  37. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    120
    Hi, I've given it a try - the new building stuff works well and looks really promising.

    In my test, I've noticed the right-hand side of the map is missing some detail and the terrain is dipped down. This is also causing some of the objects in Map mode that were created by Data to go missing. See below the arrow shows where a church should have generated - it's there in MapBuildings - however the terrain has dipped and the building wasn't created.

    2020-04-18 12_37_56-Clipboard.png

    Not sure if this is the cause, but with some of the similar prototypes I've done in the past, I've run across this issue where the data downloaded comes in 1000x1000 cells but the Unity terrain resolution is a 1025x1025 implementation, so the dips in my prototypes were caused by truncating off the bottom/right sides accordingly. Is that what's going on here, perhaps?

    On the topic of the MapBuildings (and MapRoads etc) objects generated by the Data tab - I see that in the Inspector, even in Debug mode, these are locked down and can't be moved or resized (or duplicated, to create new objects before going into Generator). The levels/heights for buildings, and lanes/curbs for roads are editable in the inspector already, but it would be really handy to be able to adjust the transform values of a MapRoads or MapBuildings object manually, and also to be able to adjust the footprint points. Also to be able to create and position new ones would be handy - even if that's just duplicating an existing one and editing the position/points, would be good enough.

    The use case I'm thinking of for that is that the city section I'm working with is poorly represented in OSM and is missing a lot of buildings and some of the roads aren't correct, so being able to top it up with additional houses added manually would be particularly useful. Do you think that's a possibility with the way you've implemented the Data generated objects - to have a way to unlock the positioning and footprint points for user editing?

    Anyway, great work so far. I'll keep playing with it when I get a chance, and let you know if I have any other feedback. The building editing/rebuild feature looks really good so far from the little time I've spent with it.
     
    hopeful likes this.
  38. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Thanks for the feedback, and I'm glad you think the building generator shows some promise :)

    One of the more exciting additions to the building generator I'm planning is to allow you to supplement your building facades and roofs with prefabs for the LOD0 mesh such as stairs (for those high doors!), balconies, air-con units, TV dishes, chimneys and such like. This will help bring the buildings to life a bit more. But I don't want to feature creep too much before Asset Store release, so this will likely all come a bit later on.

    I think the bug you demonstrate with the screenshot is probably linked to an issue with Unity height map smoothing. Both the Flattening and Levelling functions (and obviously the Smoothing function) on the Heightmap panel use it so they can result in this annoying behaviour as detailed here: https://forum.unity.com/threads/smooth-height-tool-behavior-at-edge-of-terrain.665500/#post-4501195

    I will look at this again to see if there's something I can fix my end or whether I need to nudge Unity about it again.

    So the missing 3D houses on the edge will likely just be because of the dipped terrain bug, because CityGen3D won't generate it if it can find terrain to put it on. If you look at CityGen3D 2D map it should always be slightly bigger than the selected data to ensure continuity with adjacent terrains.

    2D Map editing (including making them completely from scratch), is going to be a big focus after v1.0
    It's probably the area of development I'm most excited about. So while there is currently limited editing capabilities, you will end up being able to edit waypoints and plot your own roads, buildings and surfaces.

    I'm also aware the pivot points for objects (eg generated buildings) are always [0,0,0] in world space which is really annoying for repositioning (and especially rotating). This will be fixed before v1.0.
     
    Astirian, chmodseven and hopeful like this.
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    @CityGen3D - This update looks great, and I can't wait to try it. :)

    Two things I keep in mind with city modeling: 1) design from the beginning for night lighting and turn that off during the day, and 2) plan for decimating and mesh combining to create simple high performance models of each whole tile.

    I also plan to switch from Unity terrain to mesh terrain, in urban areas if not elsewhere. So mesh terrain would be part of the decimated and combined tile.

    Anyway, just sharing my thoughts on that. I imagine if those features aren't eventually included as part of CityGen3D, they'll be things I can apply on my own.
     
  40. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    I definitely want CityGen3D to be useable for night scenes, so if you try it out and hit any blockers, please let me know.

    Please keep in mind CityGen3D currently only supports Unity terrain workflow and is not able to generate scenes on mesh terrains at this stage. Although I do intend to experiment with an alternative workflow with mesh terrains and vertex painting later this year, to provide support for low-poly stylistic environments (but nothing concrete in this area at the moment).

    Just for reference, I left the frame rate counter on the new demo video. So as I fly around the scene at the end you can see I get an average frame rate of around 130fps (with real-time lighting and no occlusion culling).

    CityGen3D batches a lot of geometry automatically. For example each building is only one mesh (per LOD). All the sidewalk meshes are batched together, and such like.

    As a side note, there are a few useful tools buried in the asset at the moment such as mesh batching and slicing. They are currently only really intended for use by the Editor automatically in creating your CityGen3D scenes, but in some cases I'll be able to tidy them up a bit, so you'll be able to use them manually as well.
     
    hopeful likes this.
  41. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    How do I get tracks to show up in 2D Map and on SplatMaps?
     
  42. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi Jeff,
    If you have a particular OpenStreetMap way in mind I can take a look and give you a few tips.
     
  43. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    On Open Street Map website, enter the lat/lon coords:
    Top: 40.51416
    Left: -74.25230
    Right: -74.24856
    Bottom: 40.51256

    You should see Staten Island Railway.

    I tried to create 3D terrains but there are problems. I create a group of 16 terrains (4x4) and go through generating 3D terrains, roads, and buildings. I created another group of 16 terrains (4x4) and go through generating 3D terrains, roads, and buildings. There are "gaps" between groups of terrains where terrains and roads fall into the "gaps". I drove the truck from Vehicle Physics Pro and the truck fell into the "gap". I forgot to take screenshot of the "gap" before starting over with flat terrains. Is it possible to fix the problem?
     
  44. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    If something appears on OSM and isn't being processed by CityGen3D, you just have to find out what key/tag combo to use.
    By default, CityGen3D will find all railways mapped as "railway-rail", but as you can see in this screenshot, much of Staten Island railway is mapped as "railway-subway".

    Railways are generated in 3D using the Features window, so we add one of these key/value combos into the Data-Features window to get CityGen3D to process it as a railway.

    I've added the "railway-subway" combo in the example screenshot. So if you were to do the same and then Process the data again, all railways mapped in this way would appear in CityGen3D.
    Then you could generate them in 3D with the Generate Features button.

    railway_subway.png
    features.png

    It's difficult to understand what issue you are facing regarding the terrains without a visual example.
    If it's only happening when using heightmaps then this is possibly the result of the smoothing bug at terrain edges referred to a few days ago in this thread. I'm looking into this as priority so hopefully a fix wont be too far away.
     
    hopeful likes this.
  45. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    In post #437, chmodseven complained about the weird problem with 3D terrain. I have the same problem that he's having. I thought I have railway-subway-railway combo in the "Features" button. I didn't know that i have to process the data again. Processing the data takes a long time!
     
  46. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Yeah as I indicated in my reply to him, I think this is a long standing issue with the way the Unity Terrain smoothing implementation works.
    You can avoid it for now by not using any of the heightmap functions that use smoothing.
    But I’m Investigating this as priority at the moment and will post in this thread when I have more news on this.

    I can improve processing workflow a bit by allowing you to process just one map module (eg Features) instead of the whole thing again.
    You can already do this with the filter, but clicking Process also runs the clear function for everything, when Clear should also obey the filter.

    Aside from that, the processing speed is largely dependant on how densely mapped a location is.
    I will run some tests on Staten Island though and see if I can optimise the processing further. I think this is a good test case as I’m aware this location is particularly slow.
     
  47. IJas13

    IJas13

    Joined:
    Jul 27, 2017
    Posts:
    19
    Somehow, the sidewalks aren't generated . Even after defining it in the Generator-Tab it is not working. Am I missing something? - V 0.9, 2019.3.7
     
  48. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    Clicking the Generate Highways button creates the sidewalk meshes and they are all parented to a Sidewalks gameobject in the Landscape.

    Please could you send me a screenshot of your scene with the sidewalks missing, thanks.
     
  49. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    Some of the sidewalks are missing, too.
     
  50. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    In builds only or in scene view?
    Does this reproduce on default location?

    Please can you send me a screenshot or reproduction steps so I can look into this further.

    In better news, I believe I have fixed the terrain drop issues at terrain edges after using Heightmap functions for v0.91, expected in a week or so.

    Also made some exciting progress with 2D map editing. I’ll do a dedicated post on that soon, probably this weekend.
     
    Astirian and hopeful like this.