Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] CityGen3D - Procedural Scene Generation From Real World Map Data

Discussion in 'Assets and Asset Store' started by CityGen3D, Jul 8, 2020.

  1. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    I will, thanks!

    Actually I think I need to bother a bit more :) After I initiate download, it just idle at 10% and doesn't move on.
    I suspect that it may be issue with NASA account I just created, maybe it needs time to be fully active.
    I changed user name and password for a random and wrong one to check, and yes, it has the same 10% idle like with correct user/pass.

     
  2. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    There are quite a lot of errors in your console, so it may be worth checking those to see if they can shed any light.
    What version of Unity are you on?

    But as twobob indicated, for a quick fix you can manually download and extract the required file from the NASA server using your credentials.
    The Download process just identifies missing HGT files that it needs for your location and attempts to download and unzip them for you. Unity may just be having temporary issues connecting directly to the server for some reason, but your browser may be fine.

    Once the unzipped HGT file is in the HGT folder, you can just Apply Heightmaps and CityGen3D will process this for you and you wont need the Download step.
     
    jerry_unity172 likes this.
  3. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    Spot on - all works fine now.
    The problem (and ignored by me error in console) was that I moved the CityGen3D folder to my special asset store folder within project, and it seems that HGT files are stored in hardcoded path at Assets/CityGen3D/Resources/Data... which was resulting in directory not found exception. Now all works great.

    I will soon post some screen-grabs from our simulator.
     
    CityGen3D likes this.
  4. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Oh yeah, I have made quite a few output folder paths customizable (eg Database, Terrains).

    I think the only reason I didn't with the HGT files initially was that I supply an HGT for the default location so have a fixed location within the asset's directory structure that points in the right place.
    But I'll probably change this at some point to be consistent with the other data.
     
    jerry_unity172 likes this.
  5. zorrobyte

    zorrobyte

    Joined:
    Sep 6, 2021
    Posts:
    2
    I'm trying to use this in an area that doesn't have OSM buildings defined, is this tool able to randomly add houses and such, or will they need to be added in OSM?

    Also, is there an easy way to add traffic and pedestrians to the map?

    I'm using this tool to try and do some VR exposure therapy and would like to import my neighborhood :)

    If not, could you use this dataset for building data?
    https://github.com/Microsoft/USBuildingFootprints

    Check this link:
    https://mapwith.ai/rapid#background...tures=boundaries&map=17.17/39.78232/-85.95314
     
    Last edited: Oct 21, 2021
  6. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    The simplest way of getting houses to appear where they are not mapped in OSM is via the Roadside tab of the Generator.
    You’ll notice some houses already listed there, but they are not assigned a Surface by default so won’t show up on your terrain.
    If you change this so the assigned Surfaces is Everything then these house prefabs will be spawned all over the map when you Generate Roadside Objects (or you can limit it to specific mapped regions like Residential).

    Another alternative is to use the Map Editor to add your own building shapes, which may be nice for particular buildings of interest where you want to get real life position and shape. Then they can be procedurally generated as if the data came from OSM.

    It is also possible to create map objects in script so you can hook CityGen3D up to other data sets, but this will require some coding.
    If you need help with that I can point you in the right direction regarding useful CityGen3D API functions.
     
  7. zorrobyte

    zorrobyte

    Joined:
    Sep 6, 2021
    Posts:
    2
    I've really gone down the rabbit hole LOL


    After failing to try and convert/merge the microsoft dataset into the osm dataset using flat files, I setup a local postgis instance and I'm importing both the microsoft buildings geojson and the osm file for my state into the database. I hope then to export to an osm/xml file for use with citygen3d. Then I should have ALL the buildings for my state.

    I wish there was an OSM server out there that had both datasets to just pull from. I was using mapwith.ai to add buildings to my neighboorhood 50 at a time.. but it was annoying.

    So cool there's automatic house placement in the generator! I was looking at the manual I found online for version 1.0. Is there an updated manual around?
     
  8. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    The Documents folder in the CityGen3D installation always has the latest manual in it. It's also available any time from www.citygen3d.com by clicking the PDF icon near the feature list on home page.
    Unfortunately, it doesn't talk about the Roadside spawner very much :)

    It's still worth skimming through the latest version of the doc though just in case you pick up anything else that's useful.

    But for more info on Roadside use, another user kindly describes the basic functionality here:
    https://forum.unity.com/threads/cit...eal-world-map-data.927984/page-5#post-6702199

    And I describe how to set up custom prefabs for use with it here:
    https://forum.unity.com/threads/cit...eal-world-map-data.927984/page-5#post-6702412

    But initially I'd just activate the default house prefabs by changing the Surface and Roads drop down both to Everything so they spawn everywhere, as shown in this image.

    roadside_houses.png

    Then you can making it more realistic by trying it with house prefabs to Residential areas and Shop prefabs to Commercial areas, and such like. (either by drawing these areas yourself on the 2D Map, or in some cases these will be mapped already in OSM).
     
  9. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    Hello again :)
    Here are some promised examples of sample data we create using CityGen3D



    But I have also a question:

    I need to automate generating maps, basically imitating clicking the editor buttons and waiting for it to finish.
    :DD==done, :mad:==not done, o_O==not tested)
    :DFirst I need to set the origin of the random coordinates.
    :DThen I need to (press button) download to fetch the map data.
    :mad:Then I need to process the map.
    o_OAnd finally I need to run the generator - later my script will do custom stuff with generated landscape.

    Code (CSharp):
    1.  private static IEnumerator ExportingMaps()
    2.     {
    3.         float maxLatitude = 51.256355f;
    4.         float minLatitude = 49.693386f;
    5.  
    6.         float maxLongitude = 7.410722f;
    7.         float minLongitude = 4.304363f;
    8.  
    9.         double lat = (double)UnityEngine.Random.Range(minLatitude, maxLatitude);
    10.         double lon = (double)UnityEngine.Random.Range(minLongitude, maxLongitude);
    11.  
    12.         CityGen3D.EditorExtension.EditorData ed = new CityGen3D.EditorExtension.EditorData();
    13.         ed.SetOrigin(new CityGen3D.GeoCoord(lat, lon));
    14.         yield return ed.StartCoroutine(ed.DownloadLocationMapTiles());
    15.         yield return ed.StartCoroutine(ed.RefreshMapTile(1));
    16.         // HELP!!!
    17.         yield return ed.StartCoroutine(ed.RunGenerator());
    18.     }
    So as you can see for now I don't know how to imitate pressing this button:


    It works nice so far, just I cannot find editor function for that button.

    This is all needed for us since generating maps is available only in editor mode, but as you can see I am close to going around the issue :)

    Cheers
     
    CityGen3D likes this.
  10. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    Thanks for sharing!

    At the moment there's no single function call for the Process action, so I'll tidy the API up a bit when I can to wrap this into one function call.
    However, in the meantime, the code performed when that button is pressed is shown below for reference:

    Code (CSharp):
    1. // auto show map view
    2. EditorMap.ShowMapView();
    3.  
    4. if( EditorProcessing.UpdateProgressBar( 0.05f, "start" ) ) return;
    5.  
    6. if ( Map.Instance.data.autoClear )
    7. {
    8.     // clear existing data objects
    9.     Clear();
    10.     if( EditorProcessing.UpdateProgressBar( 0.1f, "cleared" ) ) return;
    11. }
    12.  
    13. Map.Instance.mapSurfaces.Process();
    14. if( EditorProcessing.UpdateProgressBar(0.2f, "surfaces") ) return;
    15.  
    16. Map.Instance.coastline.Process();
    17. if( EditorProcessing.UpdateProgressBar(0.3f, "coastline") ) return;
    18.  
    19. Map.Instance.mapRoads.Process();
    20. if( EditorProcessing.UpdateProgressBar(0.5f, "roads") ) return;
    21.  
    22. if ( Map.Instance.data.process.HasFlag( PROCESSING_FILTER.Buildings ) )
    23. {
    24.     Map.Instance.mapBuildings.Process();
    25.     if( EditorProcessing.UpdateProgressBar(0.6f, "buildings") ) return;
    26. }
    27. else
    28. {
    29.     if( EditorProcessing.UpdateProgressBar(0.6f, "buildings (ignored)") ) return;
    30. }
    31.  
    32. if ( Map.Instance.data.process.HasFlag( PROCESSING_FILTER.Entities ) )
    33. {
    34.     Map.Instance.mapEntities.Process();
    35.     if( EditorProcessing.UpdateProgressBar(0.7f, "entities") ) return;
    36. }
    37. else
    38. {
    39.     if( EditorProcessing.UpdateProgressBar(0.7f, "entities (ignored)") ) return;
    40. }
    41.  
    42. if ( Map.Instance.data.process.HasFlag( PROCESSING_FILTER.Features ) )
    43. {
    44.     Map.Instance.mapFeatures.Process();
    45.     if( EditorProcessing.UpdateProgressBar(0.8f, "features") ) return;
    46. }
    47. else
    48. {
    49.     if( EditorProcessing.UpdateProgressBar(0.8f, "features (ignored)") ) return;
    50. }
    51.  
    52. if ( Map.Instance.data.process.HasFlag( PROCESSING_FILTER.Trees ) )
    53. {
    54.     Map.Instance.mapTrees.Process();
    55.     if( EditorProcessing.UpdateProgressBar(0.9f, "trees") ) return;
    56. }
    57. else
    58. {
    59.     if( EditorProcessing.UpdateProgressBar(0.9f, "trees (ignored)") ) return;
    60. }
    61.  
    62. EditorProcessing.UpdateProgressBar(1.0f, "finished");
    63. EditorUtility.DisplayDialog( Data.GetAppNameAndVersion(), "Processing complete.", "OK" );
     
    jerry_unity172 likes this.
  11. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    Perfect, thank you, that should work :)

     
    CityGen3D likes this.
  12. hommes_doutant

    hommes_doutant

    Joined:
    Mar 12, 2021
    Posts:
    6
    Hi, I've just purchased your asset, and it's really great !

    I'm currently trying to find a way to edit map data at a larger scale than what the map editor allows, because I need to shrink a city to a size usable for my game.

    The closest I am to making this work, is to edit map data with JOSM and exporting it as a .osm file of the zone I'm looking to import in citygen3D. I thought it would work, but it seems that the resulting file causes an error when parsing it as an xml in citygen3D. (josm can export .osm and geojson files, but I didn't find an xml export function).

    So I'd like to know if there's a way to import .osm files, or if there are plans to extend the map editor in the near-future ?
     
    CityGen3D likes this.
  13. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi, thanks for purchasing CityGen3D, I'm happy to hear you are enjoying it.

    Changing Data Source to XML Import on the Location window should allow you to import custom OSM data, although it was written for the format as created by the Overpass API.

    The main limitation with this import system at the moment is that you should still enter a suitable Lat/Lon origin on the Location window, because it won't automatically infer a suitable location for you from the file, so if you are reading in data from outside your specified location bounds it will be clipped.

    If you don't have any luck getting that to work, please send me a sample JOSM file and I'll be happy to look into this further.
     
  14. hommes_doutant

    hommes_doutant

    Joined:
    Mar 12, 2021
    Posts:
    6
    Hi, I don't have a JOSM file on hand, but there are difference between the overpass-api XML format and the "standard" OSM format (http://overpass-api.de/output_formats.html), which would explain the errors I have been getting.

    I'm continuing work on my project and exploring the asset further, and I'm currently having a bug when generating the highways where the sidewalks are generated without any height information (everything else is generated on the terrain, even other highway features).

    Also, one thing that would be more of a feature request for the map editor, would be to show the bounds of the current landscape. My map is made of 5x4 landscapes, and not seeing where each landscape begin and end, makes the workflow a bit more complicated for regenerating things.
     
  15. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Thanks for the info. I'll do some further investigation and development in this area, because I would like to support OSM import more widely in future, so I'll take a look and see how much work is involved.
    Up to now the existing Import implementation was introduced as a quick work around for rare situations (perhaps due to firewall settings) where a user could not access the Overpass server from within Unity, but could do so via their browser. So they could paste the CityGen3D Overpass request in their browser instead and import the downloaded file (which otherwise all gets done automatically in normal workflow).
    But being able to import standard OSM format would be good, so I'll add this to the roadmap.

    Do you have a screenshot that demonstrates this issue, because it's not something that's been brought up before?
    Does this happen in all locations for you? In other words if you generate the default West Hendon location what happens?

    A white square currently outlines the active Area. I'll improve this for next release so it also outlines each individual terrain, that's a good idea.
     
  16. hommes_doutant

    hommes_doutant

    Joined:
    Mar 12, 2021
    Posts:
    6
    That's good to hear. I haven't had that much time to play with JOSM, but it would be cool to have a more user friendly map editor based on OSM, better suited for fantasy and video game maps. (it's not necessarily related to the plugin, but it would be a great addition to an OSM-based workflow).

    Deleting the Library folder/ and reopening unity fixed the issue, so I don't have a screenshot sadly. But the pavement was generated 50 units under the terrain, as if it couldn't read the height data (but every other highway feature could read it and was generated in the right place).

    Great !

    Thanks for the quick answers !
     
    CityGen3D likes this.
  17. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    If you are setting up your own camera in CityGen3D, remember to disable the Map layers from the Culling Mask.
    This will prevent these layers from showing up in your Game view, as they are only intended for rendering the interactive 2D map.

    CityGen3D toggles them on/off when you activate/deactivate Map View with Ctrl+M

    Note that you don't have to worry about any of this if you are using the supplied FreeCam because this is setup correctly already, but often you'll want to add new cameras in your project, so this is quite a useful tip.

    If you have ever started a CityGen3D environment without loading the New City scene, you'll see the 2D Map layers in scene view for this reason, because the default Unity camera will not have these layers culled. The New City scene has the FreeCam already in the scene with correct settings.

    culling_mask.png
     
    Last edited: Dec 28, 2021
  18. Apposl

    Apposl

    Joined:
    Nov 27, 2017
    Posts:
    50
    Every lat/long coordinate I put in gives me some place in China or Russia. Can only right-click and scroll the map a few swipes away before it locks up. Look up how TerraWorld does this and let us just search using words, maybe. Edit: Got it working. Not the lat/long bit though. Tried to join the Discord, but after entering my # and receiving the verification code it then wanted me to enter my password to verify changes and that's just a lot of steps to get into your channel and so I'm here. A little clunky. A little outdated - like how am I supposed to sign up for an account for the NASA data from a broken URL? https://e4ftl01.cr.usgs.gov/MEASURES/NASADEM_HGT.001/2000.02.11/NASADEM_HGT_

    I've added the NASA info, and the Mapbox info. Seems to be generating most of what I want but I'm only getting about 15 buildings in my town.
     
    Last edited: Feb 13, 2022
  19. tj_hooka

    tj_hooka

    Joined:
    Jul 4, 2019
    Posts:
    4
    Seems either Nasa moved the HTG or I'm doing something wrong for the heightmap... I am using the proper login but the link that you have in citygen3d is no longer valid or hates me, dunno...
     
  20. Apposl

    Apposl

    Joined:
    Nov 27, 2017
    Posts:
    50
    Pretty sure this is the new link. https://urs.earthdata.nasa.gov/home

    I've got this kind of working for my town with trees and streets and streetlamps. But only 15 buildings when there should be quite a bit more. Unsure what I'm missing now.
     
  21. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi, Thanks for purchasing CityGen3D.

    The location map can feel a bit clunky and I'm currently working on several improvements in this area for next months update, including a search facility, but also more generally to improve navigation and usability.
    There are no known issue with using Lat/Lon input directly though, so if you still have problems with that please give me an example and I'll be happy to see if I can reproduce that issue.

    Regarding the Discord server, there are no additional sign-up restrictions placed on that from me, so it should be the same steps that you would need to do for any Discord room.

    The URL you quoted is not the sign-up location for NASA data, it's the server address. (You can leave that as it is).
    The sign-up URL is shown above it

    nasa_signup.png

    CityGen3D uses data from OpenStreetMap. You can see what data is present for any given location here: https://www.openstreetmap.org/
     
  22. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi, Occasionally the NASA server is down, but this is quite rare. I just tried it myself and had no issues, so with the correct credentials it should be fine.
    Please take a look at your Console output for heightmapping messages. When its working you'll get output like shown here, but if its not working for some reason there may be an error code reported back by the server.
     

    Attached Files:

  23. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    If your location has a lack of mapped buildings in OSM it's possible to use the Roadside spawner to fill out areas with prefabs instead.

    Here's a screenshot showing the default West Hendon location using Roadside prefab spawning for houses instead of mapped OSM buildings.

    roadside_houses.png
     
    Apposl likes this.
  24. KnowledgeCenter

    KnowledgeCenter

    Joined:
    Jul 24, 2020
    Posts:
    2
    Hi !
    First thank you for your work, this plugin is awesome !

    I have a question : do you plan on implementing more heightmap format/sources ? Actually SRTM HGT is a fairly outdated format, and NASA is not really maintaining their server anymore.
    In addition, more and more countries are open-sourcing high resolution topography data, example : Switzerland is providing open-source 0.5m topo data, Uk between 1 and 0.25m, etc.

    I know we can directly use Unity terrains, but when you have a large amount of tiles in CityGen, it's adding time hungry extra steps who is not really good at production levels.

    It could be nice if you can add at least GeoTIFF import, or other widely used GIS format. Thank you !
     
    Last edited: Feb 23, 2022
    CityGen3D and newguy123 like this.
  25. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Where can I download the UK data from?
     
  26. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    116
    You used to be able to get it from the OS Ordnance Survey website, but they move stuff around all the time, so best bet is go to data.gov.uk and search for LIDAR.
     
    newguy123 likes this.
  27. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    116
    I don't know if Rich will be adding any other formats to work natively with CityGen3D, but I've had some success in writing code to re-apply the terrains from better resolution GeoTiff files by making calls via GDAL plugins. If you do that after creating the basic NASA ones but before running the rest of CityGen3D's generation, then things like roads and buildings will for the most part respect the altered topology. I can't share the code unfortunately as it's proprietary to the project I'm working on, but it isn't too hard to write if you use the Map conversion API calls listed further up somewhere in this thread to convert between points, and if you want to get really accurate, take a lerp between the four elevations bounding your precise map point. Also note the TIF should be in WGS94 (you can translate beforehand in QGIS if it isn't) so that you don't need to mess about with CRS conversions. Good luck!
     
  28. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Thanks for your comments, I'm pleased to see that you are enjoying CityGen3D!

    One of the big problems with heightmap data is that it's often contaminated with data from large man made structures, which is completely undesirable for terrain generation because you get unwanted elevation changes where tall buildings are present.

    The default Sampling mode of "Filtered" in CityGen3D (Generator->Heightmap window) fixes this to some extent at the expense of some detail on the heightmap by averaging out the data a bit.
    You may wish to try the "Raw" setting for greater detail, especially if your location is away from urban areas, to get better definition on mountains and hills.
    (The only thing to keep in mind is to retain the same setting here for all terrain tiles you want to seamlessly join up with each other in the same environment, so worth trying on built-up areas you intend to include in the same environment first).

    It's unlikely additional heightmap formats will be supported in the very near future, mainly because the feature set for the next few months is already very busy. But it's something I can revisit in time, especially if there's a practical use for a generic data format that could be useful, like you suggested.
    What's perhaps more likely is focusing on API improvements and documentation to make it easier for you to hook up alternative data sources.

    But I thought I'd mention the above considerations just because in my experience of practical implementation, higher resolution heightmap data can often mean more problems and more manual work to fix it up, if the end goal is simply good looking terrains.

    What I often prefer doing is to increase visual detail through shaders. Microsplat works very well with CityGen3D and has loads of options for improved texturing and even tessellation, meaning you can get higher visual fidelity without higher resolution raw data and it's associated issues.
     
  29. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    I think the point is that, for a lot of us we use CityGen3D for AEC presentation/film purposes and not for games, therefore its important to have the most accurate terrain we can get (as artists, since we're not coders), even if hampers performance.
     
  30. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Sure, my point wasn't about performance, but the practical implications of using higher resolution data for the purposes of terrain generation.

    In my experience it's often less suitable in its raw form because (depending on the source and data collection method) you'll often get more unwanted artifacts making it less realistic.
    This makes it much harder to procedurally fix it up in the same way CityGen3D already does for the 30m NASA data (when filtered sampling is on).

    So I just wanted to highlight that high res source data wasn't a quick route to more realistic looking terrains in many instances.

    I found this post from @chmodseven where he kindly reported back on his findings when playing around with very high resolution data in CityGen3D, which may help to explain some of the challenges.

    https://forum.unity.com/threads/rel...tion-from-map-data.514677/page-8#post-5606263
     
    newguy123 likes this.
  31. KnowledgeCenter

    KnowledgeCenter

    Joined:
    Jul 24, 2020
    Posts:
    2
    I have considered using RAW, but the map I'm actually working on is 20x15km. If I use the highest terrain setting (1024x1024m if I remember), it represent around 300 tiles I have to manually remplace with RAW files. This is not possible in a production workflow.

    Best for my usage is if I could skip all the terrain part (actually importing my own unity terrains) and just generating buildings/trees/roads/props/etc on top of it, based on OSM data. But that's not what CG3D is mean for at the moment I think =D
     
    Last edited: Feb 24, 2022
  32. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    I was referring to this Sampling option in CityGen3D, which is set to Filtered by default and attempts to remove erroneous data caused by buildings contaminating the data, at the expense of losing a bit of detail.
    You may wish to experiment a bit with the Raw setting here, which may give you a bit more definition on the heightmap, but doesn't attempt to identify and resolve potentially erroneous data.

    (So this doesn't have anything to do with RAW file format and uses the same NASA HGT data source. It could just as easily be called Unfiltered, which may have been less confusing!)

    raw_height.png

    A CityGen3D terrain is just a normal Unity Terrain in the Landscape layer and a Landscape component attached to it, so with a bit of setup I think third party generated Unity Terrains will work fine as long as they are the same size and using the same Mesh Resolution and Texture Resolution settings that CityGen3D would use for that Terrain Size.

    So while it wasn't designed with in mind initially, I'm aware that some users have used CityGen3D on top of Gaia Terrains, for instance.
     
  33. Apposl

    Apposl

    Joined:
    Nov 27, 2017
    Posts:
    50
    I really love this and have gotten a little better at using it since I initially posted. I do have another seriously newbie question, though. I've had no problem generating areas and playing around in them. But I do have a scene I'd like to use it in, and the terrain keeps generating above and off to the side (altitude in my plane on the runway is at 1800ft) - is there a specific section that lets me move the whole landscape manually as one? Everything I try moves individual chunks so far... EDIT: I figured this out, thought I was highlighting everything, and wasn't. Though I think this method will cause problems if I try to import another section/tile.

    I have one other weird issue I can't quite figure - I have two cameras on my vehicle, exterior, and interior. I only have about 20 buildings and a desert but the camera stutters when looking around on the interior view. Exterior view still scrolls around smooth. I've tried with other bigger terrains and etc and the cameras work fine so I'm not sure what's stressing it with CityGen, it's all I have in addition to my vehicle prefab. I tried culling out everything but the default HUD on my interior camera but the problem remained. DIsabled everything from CityGen in the Inspector and the problem went away and camera moved around smoothly again. It's not a heavy scene and doesn't impact the exterior camera so I'm a little stumped and any help would be so appreciated because the environment looks great.

    Also:

    This would be a fantastic addition to the documentation, maybe near the Quick Start section.

    Happy weekend!
     
    Last edited: Mar 13, 2022
  34. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    I'm happy to hear you are enjoying CityGen3D!

    You should be able to move your entire environment by multi-selecting your Landscape objects and moving the resulting transform handle.
    As you alluded to, if you want to create additional tiles, it's best to reset them to their original positions again to avoid issues, and then move them all again afterwards.

    Stuttering on cameras will almost certainly be caused by the way they are configured in relation to the scene.
    I'm guessing that you may have camera movement logic in an Update method when you perhaps want it in LateUpdate, so it occurs after all the physics objects in your scene have moved in the frame.

    Layers has its own section in the manual: 2.2 Installation - Layers
     
    Apposl likes this.
  35. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @CityGen3D !!! I'm interested in your asset but I have a question that I can't solve...

    Can CityGen spawn own prefabs of houses/buildings with interiors created by me or purchased from the asset store? like for example these houses for an urbanization: https://assetstore.unity.com/packag.../suburb-neighborhood-house-pack-modular-72712

    Can CityGen spawn 3d objects (lampposts, road signs, traffic lights, kiosks, etc) from its own or from the asset store?

    We need to make a AAA quality city for a game using 3d objects, houses and 3d buildings with high quality interiors.

    Greetings
     
  36. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681

    Yes as an alternative to the procedural buildings, CityGen3D supports the spawning of prefab buildings and these can have interiors if you want.
    CityGen3D also has a roadside prefab spawning system for spawning prefabs at intervals along the road such as streetlights.
    There's also a prefab spawning system for matching up OSM objects with appropriate 3D models (eg. to have a Bus Stop appear where there is one mapped in OpenStreetMap).

    CityGen3D doesn't have a built-in way of spawning things like street signs and traffic lights yet. Although this is being looked at for the proposed traffic add-on pack.
     
    ftejada and newguy123 like this.
  37. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    Is there a way to prevent CityGen3D from renaming existing layers? When I try to setup the layers and assign to similar layers that I already have setup, it goes through and renames them.

    Also, would it be possible to make it so that CityGen3D uses fewer layers? Maybe just one layer for all the Map stuff? I'm already pushing up against the limit of available layers for my game.

    I'm wondering if a better approach might be to set up CityGen3D in a separate project and then just transfer the resulting scene to my game's project?
     
    Last edited: Apr 20, 2022
  38. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    Yes you can assign CityGen3D layers to other slots using the Layer Manager.
    This is best done immediately after installation, because it won't retrospectively reassign layers to the new slots for objects already present in your scene.
    So straight after loading your New City scene, locate the CityGen3D object in your hierarchy and view it in the Inspector. This is where you'll find the Layer Manager component.
    From here you can assign the CityGen3D layers to different slot numbers to avoid conflicts and then press Setup Layers.

    Once you have generated your environment there is no runtime dependency on the layers.
    For example the layers prefixed "Map" are purely used to identify different object types on the 2D Map so once you scene are created you can use them for other things.
     
  39. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    I've run into an issue where CityGen3D is not generating water for a lake, it's just showing up as grass when processing the downloaded data.

    The lake data is in OSM, I verified with OSM: https://www.openstreetmap.org/relation/11563382#map=15/45.2579/-74.1469

    And the lake data shows up in the Overpass API Query (using the url provided when setting Data Source to XML):
    https://www.overpass-api.de/api/interpreter?data=(node(45.2161034662822,-74.203873657307,45.3006888310811,-74.083708740154);rel(bn)-%3E.x;way(45.2161034662822,-74.203873657307,45.3006888310811,-74.083708740154);node(w)-%3E.x;rel(bw););out%20meta;


    However, as seen below, the actual lake Water features aren't created.


    upload_2022-6-25_15-30-32.png
     
  40. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Hi,

    Please try the following (on v1.08 or later):

    1) Click the Location tab of the Data window.
    2) Select "Download" as the Data Source.
    3) Click the Settings tab of the Data window.
    4) Select Completed Ways and Relations for the Recursion drop-down list.
    5) Select location as normal, click Download, and then Process.

    Note that the downloading and processing of the map may take longer, but this should hopefully resolve the missing water and it should be then visible in the 2D map.
    Please see the Settings chapter in the manual for more info on the need for this option in some circumstances, such as processing of very large lakes.

    Let me know how you get on and if this doesn't help I'll be happy to investigate the issue further.
     
  41. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    @CityGen3D I followed your steps, but the lake still does not show up.
     
  42. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Please click on your CityGen3D object in the scene and view the Inspector.
    Increase the MaxWaysInRelation setting from 100 to 1000 to accommodate this huge lake. I think it is made up of 316 OSM ways, so it was previously being skipped.

    If you Download and Process again with Completed Ways and Relations active, as detailed previously, that should now work for you as shown in the attached image.

    max_ways_in_relation.png

    In most cases a lower value of 100 is a sensible default to avoid processing unwanted large OSM relations, but the large lakes of Canada are certainly an exception to this!
    I'll expose this MaxWaysInRelation option on the Data->Settings window as well when I can, so it's not so hidden away.
     
    hopeful likes this.
  43. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    @CityGen3D Aha, that did the trick! Thank you very much.
     
    hopeful and CityGen3D like this.
  44. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    @CityGen3D Would it be possible to allow entering custom terrain sizes? The Very Small, Small, Medium, and Large settings are rather limiting. I'd like to be able to make them larger than 1024 as I typically only used 4 terrains max in my older scenes which would range anywhere from 2 to 6km per tile.

    Also, is it possible for each tile to have the same splatmap layers in the same order. I use MicroSplat for my terrain textures and ran into some issues with the layers not aligning across the tiles.
     
  45. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    I may be able to support up to 2048x2048 metre terrains, so I'll run some tests and look into it further.
    I wont be able to go higher than that given the current design where heightmaps are always double the terrain resolution to provide half-metre resolution, and I think Unity supports maximum of 4097x4097 heightmaps.

    Regarding splatmaps, until fairly recently that is actually how it worked, but was optimized after user feedback so each Landscape only stores splat layer data for used textures.
    This saves memory, although I understand why it may be preferable to retain consistency in some situations (eg. Microsplat use)
    With that in mind, I'll see if I can reintroduce that as an option in a future release.
     
    skaughtx0r likes this.
  46. sumioka

    sumioka

    Joined:
    Sep 26, 2018
    Posts:
    8
    Thanks for a great asset. It has been a month since I purchased it.
    I've tried many different assets.
    CityGen3D is the best suited to fulfill my ideal.

    I have a few questions.

    1, I want to remove the textures from all the materials as shown in the next image.
    At the moment, if I remove the textures, the mesh will not be created, so I am applying a single color texture.
    Is there a better way?

    2, When will the bridge be supported?
    I can't get a clean connection even if I use EasyRoads3D for completion. is there any way to make bridges in EasyRoads?

    3, I want to delete the intersection lines. What is the best way to do this?
    At the moment, I erase the center line of a road by overwriting it with a road without a line.
    Is there a better way?

    4,Are there any plans to support crosswalks?
    For now, we are using Entities and placing board polygons. Is there a better way?

    thanks.

    cityGen_crosswalk.png
     
  47. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    Thanks, I'm happy to hear you are enjoying using it!

    1. If you use the CityGen3D/Surface shader you can then just select a color for the object using the Tint color picker.
    Please see the FacadePrimitive materials (eg FacadePrimitive Commercial) for examples.

    2. This is being actively worked on, but it's still in prototyping stage, so no ETA yet.

    3. This old forum post describes how you can control which roads have lane markings drawn at intersections:
    https://forum.unity.com/threads/rel...ion-from-map-data.514677/page-10#post-5758048

    4. It's certainly on the todo list, along with other road marking decals. For now your solution seems fine.
     
    hopeful likes this.
  48. sumioka

    sumioka

    Joined:
    Sep 26, 2018
    Posts:
    8
    1. thanks, the default material issue has been resolved.
    2. looking forward to your ETA.
    3. it still seems to be best to override with a higher priority road, but this is time consuming where multiple roads intersect.
    If you can, it would be very helpful if there is a setting in the road setup to specify where the line starts and ends, as shown in the next image.
    4. I will try this method.

    Thank you.

    cityGen_lineSettingRquest.png
     
    CityGen3D likes this.
  49. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    681
    NASA have recently changed their system for accessing heightmap data, which is causing heightmap download issues in CityGen3D.
    So if you are getting "Unauthorized" error messages despite entering a valid NASA username and password, please make the changes shown here to fix it:

    esa_heightmaps.png

    1) View the Heightmap child object of the Generator in the Inspector.
    2) Change NASA Source to: https://step.esa.int/auxdata/dem/SRTMGL1/
    3) Change NASA File Type to: .SRTMGL1.hgt.zip (note the full stop before the "S")
    4) Untick NASA File Lower Case checkbox so its disabled.

    You may also want to make these changes in your Generator prefab as well as any instance, so these settings are used when loading a new Generator in the same project.

    The next CityGen3D update will have a more permanent solution, but this should get heightmap downloads working again in the meantime.
     
    HeadClot88, hopeful and ftejada like this.
  50. hubertstruminski

    hubertstruminski

    Joined:
    Jul 7, 2021
    Posts:
    2
    I would like to generate bottom of the lake or sea with real time data. So I want generate lake terrain with real depth with real data. Is it possible to make it with this package ? If yes can anyone explain how make it ?