Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Assets [BETA RELEASED] CityGen3D | Procedural city generation from map data

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

  1. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    I get quite a lot of requests for third-party asset support. I'm certainly happy to consider adding support if there's something specific that I can do to make it easier to use with CityGen3D.
    With BuildR2 for example, there's an obvious interface I can provide to make the process easier and remove the need for coding.
    In some cases, it may be a case of just trying it out and seeing how you get on with it though.

    Something like MicroSplat already works quite well with CityGen3D because both are designed to work on Unity terrain with no coding.
    I just use the CityGen3D Splatmap panel to texture the terrain as normal, effectively using them as control textures. Then drop Microsplat into the project and let it do it's thing. I can then use features via the MicroSplat interface to add detail to these control textures, such as changing one grass texture into several using the built in features of MicroSplat.
    All the MicroSplat add-ons should work with CityGen3D as normal, but if there is something specific I can do to make the workflow better with these assets, please let me know, and if it's feasible I can certainly try.

    One of the key features of CityGen3D is that it gives you a lot of data you can use in code however you want to use it.
    Up to now the whole focus has been on the UI so you can use CityGen3D with no coding at all, but there's loads of cool stuff you can do in code too.
    I think in a lot of cases, once the BuildR2 integration is released and you can see how relatively easy the CityGen3D API can be used to return waypoints for building shapes, then I hope that will encourage a few others to try integrations of other assets too.

    For instance, it's also fairly trivial to get all waypoints for rivers.
    CityGen3D has built-in functions for spline generation so you could get the OSM waypoints from a river in CityGen3D, create a higher resolution spline, then pass the spline into RAM, and then set flow maps etc as normal.
    I'm speaking from a point of view of not having used RAM yet, but any asset that can work from inputs via an API instead of manually through the Editor, then basic integration is broadly fairly simple.
    If you know your favourite asset does have an API then integration should definitely be doable.
    Hopefully just needs an example like BuildR2 to get things going... :)
     
    Santa36 likes this.
  2. Santa36

    Santa36

    Joined:
    Dec 1, 2018
    Posts:
    22
    Hey there, another idea. Just to post it here before i forget it. Just ignore it for now. If someday the AI module will be developed I think it would be great to have a built in Zoning/Spawning System. Like I said its just another idea, like you can zone in City Skylines except here you also can input which type of AI Entity should spawn in the designated area. Maybe it saves time. Like: The area is zoned and another menu pops up and you tick the entity you like too spawn in the designated area.

    And as always thanks for your time.
     
    CityGen3D likes this.
  3. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Beta 0.5 is now available:-

    • Faster heightmap generation via Unity Jobs and GPU Terrain processing.
    • Heightmap interpolation setting: Bilinear (faster) or Bicubic (smoother).
    • New heightmap smoothing options.
    • Option for applying heightmap offsets only if far enough away from highways as not to distort them.
    • Road markings now generated as part of highway generation where rules say they should be applied.
    • Fix for UnityEngine.ExitGUIException when attempting to select Database or Coastline JSON via pop-up.
    • Max area now 16x16 terrains.
    • MapQuest now available as heightmap data source (key required), in addition to Bing Maps.
    • Buttons for shifting data location 1024 metres (1 terrain tile) in any direction.

    There's a known issue when working with very large multi-terrain environments where heightmapping can fail.
    Both Bing and MapQuest servers get a bit upset if you make lots of data requests in a short amount of time and CityGen3D needs to make one request per terrain.
    This can result in "Too Many Requests" or "Gateway Timeout" errors when you have lots of terrains.

    What I want to do is remove the reliance on third party servers for the heightmap data and provide a solution that works with NASA's Shuttle Radar Topography Mission data directly, which is freely available for download.
    The interface would basically be the same as it is now where you simply click the button and CityGen3D does all the work.
    But instead of getting elevation data from Bing or MapQuest servers in real time, CityGen3D would be able to read SRTM files from your PC and use that as the source data for the heightmaps.

    The good news is I basically have this working already, just not quite in time for last update.
    So hopefully not long to wait for that fix.
     
  4. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    FormatException: Input string was not in a correct format.
    System.Number.ParseSingle (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    System.Single.Parse (System.String s) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    CityGen3D.MapBuildings.Process () (at <e0089ef0bbd24fa09f044dae3cc42393>:0)
    CityGen3D.EditorData.ShowLocationProcessingPanel () (at <e0089ef0bbd24fa09f044dae3cc42393>:0)
    CityGen3D.EditorData.OnGUI () (at <e0089ef0bbd24fa09f044dae3cc42393>:0)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
    UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401)
    UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511)
    UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
    UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
    UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
    UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

    I'm trying to create 3D model of Staten Island, NY with US coastline. I disabled automatic light mapping.
     
  5. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    607
    Something I'd like to see improved in CityGen3D is the forest creation. As it is now, I can have four trees and they all have the same scale and rotation. It would be great to have more options for generating more realistic and diverse forest and woodlands. Also, when generating details there's an option for outputting prefabs but that doesn't seem to be working for me.

    Thanks for the great work you've put into it so far!
     
    Santa36 and CityGen3D like this.
  6. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Looks like it’s having problems processing one of the buildings.
    In the short term if you untick the Buildings checkbox on the Location panel it won’t process the buildings, which should bypass the issue. (You can always process them later once the bug is fixed).

    Please could you indicate the Lat/Lon location you are using and the map Area size so I can reproduce.
     
  7. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Each tree instance should have a different height and scale within the ranges specified for the tree type on the Data->Trees panel.
    The downside to this approach is that you have to decide before processing. I'll see how I can give you more freedom on the Generator->Trees panel to make changes.

    The default Unity shader used for detail mesh rendering is very selective about what prefabs you can use with it so you may just be experiencing that.
    I commented on a thread about it here, which includes some tips on how to setup prefabs to use with it:
    https://forum.unity.com/threads/does-terrain-detail-mesh-work.629176/#post-4221541

    I think it’s likely it will be improved as part of their Terrain improvements eventually, but for now if you want to use detail prefabs a third party shader is probably best bet.
    I’ve had good results with GPU Instancer where I use CityGen3D to auto paint the detail and GPUI for the actual rendering.
     
  8. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    I think I know what this is, so it should be fixed in next release.
    Thanks for reporting it.

    In the meantime I'm fairly sure it's specific to processing the Buildings so you should be able to avoid the error by turning that off in the meantime.
     
  9. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Beta v0.51 is available now:
    • Automatically create terrain heightmaps from NASA's Shuttle Radar Topography Mission data.
    • Fix for parsing error when processing some OSM buildings.

    NASA SRTM requires manual download of NASA’s Shuttle Radar Topography Mission data, but is the most reliable method as it doesn’t require communication with a third party server each time you use it.

    SRTM data is freely available from several online sources, but the easiest way to identify the files you need is to download via this website: http://dwtkns.com/srtm30m/

    You will need to register for free on the NASA website in order to access the files. Once you have signed in, simply find your location on the map and download the required data files.

    After downloading the zip files you need, you should unzip them and put them in your Unity project here: Assets\CityGen3D\Resources\Data\SRTM

    Then all you need to do after Generating Terrains is click Apply Heightmap and CityGen3D will create heightmaps for all your terrains from the SRTM data using specified interpolation method.

    With recent optimisations you can have a terrain heightmapped and textured really quickly now, in just a few clicks. I'm going to try and release a new video soon showing the workflow as the existing one is quite dated.
     
  10. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    If I create 4X4 terrain, it works. If I try to create huge terrain, Unity 3D "locks up". After creating a group of 4X4 terrain, I moved the gray box 4 times and create new group of 4X4 terrain, the old group disappears. Am I supposed to see 3D buildings?
     
  11. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Hi,

    Which version of CityGen3D are you running and what’s the total size of environment you wish to create?

    Each time you Process the data on Location panel you will lose what was there previously.
    You’ll probably want to create a separate scene for each 4x4 chunk each with its own data set, save it, then move position and create another one.

    With the aim of supporting world steaming tools (and hopefully having a built in solution for this one day), CityGen3D can also split your environment into scenes automatically.
    The Save As Scenes button will save each Landscape as it’s own scene which can then be loaded and unloaded at runtime (because once an environment gets too big it’s not feasible to have it all in memory at same time).

    The Roadside panel in the Generator allows you to spawn prefabs on different surfaces. By default it is setup to instantiate houses and street lights with the provided prefabs.
    Note that houses are set only to be spawned over surfaces marked as residential, so you may want to change that in order to get results in locations that don’t have residential areas mapped.

    Work is being done on BuildR2 integration which will support generation of buildings based more specifically on OSM map data.
    This should be available fairly soon. It was delayed a bit to implement recent optimisations based on Unity Burst and Terrain GPU processing.
     
  12. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    I'm using version 0.51. I tried to use 16X16 terrain but Unity3D "locked up". I'll try the "Save as Scenes" after generating 4X4 terrain.
     
    CityGen3D likes this.
  13. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    607
    Do you have "Auto-Generate" disabled for Lighting? I have that problem when I forget to uncheck that.
     
    CityGen3D likes this.
  14. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    I believe I may be able to switch it off in code to prevent this problem using
    Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand;

    I will test this and add it to next release if all is well.

    If your lock-up isn't related to auto generating lightmaps while using CityGen3D, please can you confirm your lat/lon settings and exactly when the lock-up occurs. Is it after you click Process, Generate Terrains, or something else?
     
    Last edited: Apr 3, 2019
    StevenPicard likes this.
  15. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    I generated 4X4 group of terrain, saved the group as scenes, moved the gray box to new group of terrain, generated new group of terrain, and try to save the new group but I got error messages and the new group couldn't be saved. Do I have to create a new scene for each group of terrain? If so, how can I do that? How can I merge the scenes into one new scene?
     
  16. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Staten Island is really densely mapped, with quite a lot of detail.
    I had a go at creating a 16x16km area (Lat: 40.579, Lon: -74.145), which is very nearly big enough for the whole island.
    Download took a few mins, but processing did take a little over an hour, even with buildings, entities and trees switched off.
    I will see if I can optimize this further but there is loads of data to process. But at minimum I can improve the progress bar feedback so you know if the Editor is still alive.
    Here's a screenshot of the 2D map:
    staten island.png

    Intended workflow when CityGen3D was conceived was that you select an Area big enough for your entire world so you end up processing just one data set (as above) and create your 3D environment from that.
    Originally I had in mind using CityGen3D to create environments up to around 8km, which is comparable to a large Battle Royale map, and this approach works really well for environments up to this size.
    Naturally though, you give people a tool like CityGen3D and they want to start creating even bigger worlds! :)

    So I do think there's a need to be able to support working on smaller chunks at a time and being able to join them up later.
    This will allow you to download smaller data sets (say 4km as you suggested), process the data, generate the terrains, and move into adjacent location and repeat the process (infinitely if you wanted to).
    As I've stated before, when working with really large worlds you will need either a custom solution to world streaming or a third party tool for this. I hope to build in a world streaming solution into CityGen3D a bit later on, but we are not there yet.

    The Save As Scenes was the first step towards that in that splitting up your world into individual terrains should make a world streaming solution viable in that terrains around the player could be loaded in and terrains far away are unloaded, all at run-time.

    But the current approach still requires a massive data set to start with (and that's limited to 16km at the moment).
    So how to get around that?
    Well first step was to implement the location offset buttons, the little arrows next to the Lat/Lon selection.
    These move the location 1024km in each direction, the size of one CityGen3D terrain.

    The idea is that you could work with smaller Area sizes (eg 4km) by processing the data, generating the terrains and other 3d objects and save it.
    Then shift position 4km along and process a new data set and repeat the process.

    I tried this workflow which you can hopefully replicate in your project:

    • Load "New City" scene
    • Give appropriate name in Location-Settings (eg "Location1")
    • Select area size and starting location
    • Click Download
    • Click Process
    • Click Load Generator
    • Save Scene eg "Location1"
    • Click Generate Terrains (and texture them, add trees, etc)
    • Click Save As Scenes (will give you new scenes name "Location1 0", "Location1 1", "Location1 2", etc).
    • After CityGen3D has split all the terrains into different scenes, unload them from Hierarchy (Right Click - Remove Scene)
    • Shift location over using arrow buttons to adjacent location
    • Give appropriate name in Location-Settings (eg "Location2")
    • Click Download
    • Click Process
    • Save Scene eg "Location2"
    • Click Generate Terrains (and texture them, add trees, etc)
    • Click Save As Scenes (will give you new scenes name "Location2 0", "Location2 1", "Location2 2", etc).

    This approach basically works, but there are some issues with alignment that will need fixing (so its not really production ready at the moment).

    When done the original way (one big data set and generate all your terrains from it), each terrain lines up seamlessly with the next.
    The problem with the new way (multiple smaller data sets, shift position with buttons, and repeat), is that the terrains don't line up seamlessly at the edges of one chunk to another.
    Also the origin of each chunk is 0,0,0 so they need to be moved manually to be in correct place.
    This is something I need to look at further to improve the end result.

    BuildR2 integration is main priority this month, but after that I really want to see if I can nail down a really good workflow for making unlimited size worlds and even get to a point where I can start experimenting with run-time scene streaming to make this as easy as possible.
    So at the moment the workflow for making really big environments (using the smaller chunk method) is a bit work-in-progress and it does have it's limitations, but further improvements should be coming soon.
     
  17. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Making some good progress with the updated interface for managing massive multi-terrain environments.

    Up to now, seamless tiling of terrains is only guaranteed when you create them from the same data set, which is a problem when you want to create really big environments because you have to download and process one really large OSM database.

    These changes are about ensuring that if, for example, you create a 4x4km environment and want to create another 4x4 environment adjacent to it, that both groups tile seamlessly with each other even though you downloaded two smaller data sets and processed them separately (or even had different users working on them).

    New workflow will be that you click the map to set your location origin, the bottom-left most position of your environment, and create your first group of terrains as normal.
    Then you click the arrow buttons to move around the map and download a new data set.
    But because the stored origin is the same, any other terrains you create in this way will be positioned correctly and have seamless texturing and heightmapping to adjacent terrains in a previously generated group.

    A few issues I need to fix, but overall really pleased with the progress.
    These changes will hopefully make a build later this month.
     
    Santa36 and StevenPicard like this.
  18. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Beta v0.6 is now available!

    Although the UI is familiar there are quite big changes underneath it all to support the new terrain tiling system as mentioned previously.
    So it's recommended to only upgrade for new projects, unless it's feasible to regenerate your environment again in your existing project (because existing landscapes wont contain required data that the new system needs in order to function properly).

    Here's a video showing how I download data for a single terrain environment and then extend it by shifting position using the arrow buttons and downloading another data set for another terrain. This ensures the new terrain aligns with the previous one.


    Because CityGen3D generates a lot of objects I've also added in code to disable automatic light baking when CityGen3D windows are active. This prevents Unity from constantly restarting the light mapping while CityGen3D is busy making changes to your scene.

    As you can see from the video I've updated to Unity 2019.1 and CityGen3D seems to largely work fine with it.
    The only known issue is the Heightmap Smoothing function doesn't work properly, hence I avoided using it in the video.
    I think Unity have made some changes to the GPU smoothing system in 2019.1 so I'll need to take a look and update the code accordingly.

    Please report bugs as normal indicating whether you are already on 2019.1 or still on 2018.3, thanks.
     
    Last edited: Apr 24, 2019
  19. Santa36

    Santa36

    Joined:
    Dec 1, 2018
    Posts:
    22
  20. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Historically, working with real world heightmaps in game dev can be a bit tricky and time consuming, because you manually have to calculate what you need from an image and apply it to you terrains.

    CityGen3D now does all the work for you just from the raw HGT file, so you don't specifically need an image file, although the website at http://dwtkns.com/srtm30m/ also allows you to download an image preview of your chosen segment for reference as well.

    From the HGT file, CityGen3D will take the appropriate portion of the heightmap for each of your terrains and apply interpolation when you click Apply Heightmap. So there's no manual work required other than downloading the file, although I may automate that in a future release so it downloads any missing files for you from within Unity, if possible.
     
    StevenPicard likes this.
  21. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    I tested CityGen3D with Unity3D 2019.1 and it worked but train tracks don't show up. Did I do something wrong?
     
  22. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Hi Jeff,

    No you haven’t done anything wrong. This isn’t in the current build, but will be included before we are out of Beta.

    The main reason the highway generation is slow is that the current mesh extrusion system in CityGen3D needs improving.
    I’m working on this right now, which in turn will help with adding features such as railways, walls and fences.

    So where Entities panel is for spawning prefabs at a OSM node position, a new Features panel will be used for extruding meshes along a OSM way (series of nodes).

    A very early test of this can be seen in some screenshots where road barriers, fences, bushes, and railways have been extruded. But unfortunately it’s not quite up to scratch for release yet.

    It’s something I’m really excited about and hope to have more news on soon, because adding this extra geometry to cities really brings them to life.
    So all being well an up-coming update will have faster road generation as a result of improving the underlying tech, before introducing the Features panel soon thereafter.

    Meanwhile I’ve also been working on BuildR2 integration, although I’m aware Jasper is working on a big update so will likely tie-in release of that with his update.
     
  23. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    If I have to stop generating the city, quit Unity3D, turn off the computer before going to bed, will Unity3D remember where I was working on after turning on the computer and running Unity3D tomorrow morning?
     
  24. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    Yes, as long as you save the scene you are working on you can load the scene back up again and resume where you left off.
     
  25. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    I don't know why Unity3D stops responding when trying to process data for a city the size of Staten Island, NY. My computer has 16GB of system memory.
     
  26. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    The progress bar feedback isn't great at the moment when processing really large areas and it can look like it's frozen. I will look to fix that for next update.

    As mentioned previously, I did manage to process 16km of Staten island but it did take around an hour (16mb, i7-6700k 4Ghz).

    There's a lot going on when you click Process to identify objects from the XML, which in a OSM file that big will contain hundreds of thousands of individual OSM nodes and thousands of OSM ways.

    The last update made it possible to work on smaller areas and have them align with each other. So the recommended workflow is to work on smaller areas at a time and build up your city that way.
    The latest manual has more info on this in: "4.2 Location - Settings".
    I also want to speed up this processing as much as possible before coming out of Beta. Recent updates have seen massive improvements on terrain heightmapping and texturing speeds through the use of Unity Burst/Jobs. So it may be possible to refactor some of the data processing to utilise this as well.
     
  27. Santa36

    Santa36

    Joined:
    Dec 1, 2018
    Posts:
    22
    How many tiles have you used? I had a similar thing with 64 tiles, I converted them all to scenes that seem to work better, but as Richard said if you want to be on the save side try the new workflow like postet in the Video.
    Don't forget to save once in while so that you don't lose your progress.

    After I used Splatmap the RAM was at 8 to 13 gigs, after some time it got back to roundabout 5 to 6 gig. Just open the Taskmanager to see how much RAM is occupied and close Programm like Browsers or other things before generating.
     
  28. Santa36

    Santa36

    Joined:
    Dec 1, 2018
    Posts:
    22
  29. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    I'm working on automatic terrain flattening under buildings for the next update.
    Here's a "Before & After" example:

    The terrain slopes down from left to right, so the back of the house isn't touching the terrain in the first screenshot.
    But with Flattening applied, the terrain is aligned to the bottom of the house.

    without.png
    with.png
    Note that modifying terrain in this way will be completely optional, of course.
    It's perhaps better suited to larger buildings and was developed mainly for upcoming procedural building generation where CityGen3D will generate larger buildings direct from OSM data, but this shows it working with the roadside house prefabs.

    For smaller buildings you can approach it in a different way and not use terrain flattening at all.
    Below is an old screenshot where a building has been designed with a lower level and steps to the doors. Every house in the screenshot is the same mesh.

    When spawning roadside objects, CityGen3D will always align them to the terrain across the prefabs y-axis at local 0.
    So here I designed steps leading up to the doors of the house so there's never any gap between the houses and the terrain, and no need to modify original heightmap.

    steps.png

    Hopefully this gives you a few ideas on how you can approach the issue of aligning buildings on uneven terrain.
    But having the terrain flattening option should be very useful in future and give you more options, especially for larger buildings.
     
  30. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    170
    When the next update of CityGen3D?
     
  31. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    155
    0.63 was released earlier this month. That has the terrain flattening feature and faster road generation.

    Next update will be 0.7 and will include a new module for mesh extrusion, to create railway, walls, fences, hedges, etc.
    So it's quite a big update and will likely come out early next month. But I'll give out more info on that before next release so you can see progress.

    If you are asking for a particular bug fix or feature please let me know and I'll try and include in next update if possible.

    Note that both the terrain flattening and mesh extrusion features are prerequisites for getting CityGen3D to be able to generate buildings direct from OSM data. So that's being worked towards as well.
    We also have the BuildR2 integration in progress, but a big update is planned for BuildR2 so just seeing how that pans out before first release. However there'll definitely be a OSM to 3D building solution for CityGen3D over the summer, one way or another.