Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    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. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    478
    If you replace the prefab houses with your own, it will spawn them. You can also change the "Outputs" (#1 below) beside the houses and add your own additionally. If they are a different size than the prefabs, you will have to adjust the "Interval" (#2 below) to keep them from overlapping. Delete them using #3, the little "X".

    upload_2021-1-8_4-56-11.png

    You can easily update the roadside objects by regenerating them in the Data tab. Make sure you have the scenes active in the hierarchy, and selected, and in the Generator tab select Remove Roadside Objects. After they are deleted, generate them.
    upload_2021-1-8_5-0-1.png

    I hope that helps!
    Mark
     

    Attached Files:

    MorpheusXI and CityGen3D like this.
  2. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Hi,

    For spawning your own prefabs, it is currently intended to use the Roadside spawning system (like @Mad_Mark just kindly demonstrated) because this does important stuff like ensuring they don't overlap roads and orientates the buildings in a realistic manner so the door faces the road.

    The supplied House prefabs are also set up ready for this, it's just a case of assigning a suitable surface type to them (eg Residential) on the Roadside window.

    This screenshot shows the type of results that can be achieved with this approach:

    screenshot4.png

    But it sounds like your objective is to spawn prefab buildings where there's a building mapped in OSM.
    This isn't currently possible via the UI, but is very easy to do with a small script.

    The following function finds building positions on the 2D map for a Landscape and instantiates a prefab at this location, putting them as child objects of the Buildings object in the Landscape.
    It assumes "prefab" is a reference to the gameobject you want to spawn.
    You could very easily expand this to select a different prefab based on building type.

    Code (CSharp):
    1. public void Generate( Landscape landscape )
    2. {
    3.     foreach ( MapBuilding building in Map.Instance.mapBuildings.GetMapBuildings() )
    4.     {
    5.         // get building position
    6.         Vector3 pos = building.GetCentre();
    7.    
    8.         // ignore if not over this terrain
    9.         if( !landscape.IsPositionOverLandscape( pos ) )
    10.         {
    11.             continue;
    12.         }
    13.    
    14.         // get terrain height
    15.         float height = Generator.Instance.GetAltitudeAtWorldPosition( pos );
    16.         pos.y = height;    
    17.    
    18.         // instantiate a prefab at this location
    19.         Instantiate( prefab, pos, Quaternion.identity, landscape.transform.Find("Buildings").transform ) as GameObject;
    20.     }
    21. }
    I've recently had a few requests to add this functionality into the interface so you can expect this to be available soon as well.
    There are obviously complexities with this approach regarding potential overlapping onto roads and other features, because the prefab wont match the shape of the building (hence the availability of roadside spawning feature, which handles some of this collision detection and avoids it).
    But hopefully this will get you started on the right track if you want to go down that route.

    To make changes to generation ensure you have one or more Landscapes selected, which will enable the action buttons.
     
    Last edited: Jan 8, 2021
    Recon03 likes this.
  3. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    478
    @CityGen3D It strikes me looking at your art-shot, that a bit more detail around prefab creation would be useful. What makes the prefabs "ready for this"? For instance:
    • How should the prefab be situated to ensure it faces the right way and the right distance from the sidewalk and road?
    • How do you place a fence in the front yard so that it doesn't overlap roads or other fences?
    • What is the relationship between Interval and prefab dimensions?
    • Can I somehow space the houses so that they line up realistically (no gaps between fences, no overlaps, etc.)
    • How can I mix houses and larger objects, like apartments?
    I imagine that I would need to define areas for multi-family dwellings as a "Surface Type" and then draw them on the 2D map where I need them, then assign the correct prefabs as a separate roadside object. Is there any other way that you can think of that doesn't involve manual drawing on the map? (I am building over 100 Areas, each with 16 Landscapes.)

    Mark
     
  4. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    That is actually a very old screenshot done before any custom map editing features were available (hence the jagged road corners and lack of road markings).
    But it was all procedurally generated using the Roadside spawning system, no manual placement of buildings.
    Now you can add your own surfaces to the 2D map you certainly can define your own regions to get more control over the types of buildings placed in certain areas.

    Perhaps the best tip I can provide you with is to utilise the priority order of the rules.
    CityGen3D goes through the rules from top to bottom, so you can get cool results by having bigger buildings in rules near the top and smaller buildings spawned on the same surface type further down the rule list, which will result in them filling in gaps left by the previous rule where there wasn't space for a big building but is for a smaller one.

    To set up a custom building prefab for roadside spawning you can follow this approach.
    Apologies for the crude image, it will look nicer when it's in the manual :)

    roadside_prefab.png

    Here I'm setting up a custom house prefab.
    Note that there is just one root object ("House 06") which serves as an empty container for all the meshes associated with this prefab.
    This is at transform position [0,0,0], indicated by the Unity handles (red/green/blue arrows).
    The position of your meshes relative to [0,0,0] is important and you should follow these rules:

    You want everything on positive X axis and negative Z axis (and usually at 0 Y axis)
    In other words, note that with this prefab and all the other house prefabs, there is no geometry in the red zone, it's all in the green zone on the other side of the orange line.

    You want the front of the house facing the direction of the blue arrow (Z-axis). This is how CityGen3D understands what the front of the building is for road alignment.
    So imagine the red X arrow is where the road would be and positive Z axis is further into the road.
    Therefore if we wanted a much larger front garden or drive way we'd move the house further away (negative Z axis).

    As such, the yellow line in the screenshot indicates your chosen gap between the front of the house and the edge of the road.

    The length of the pink line is the width of your biggest prefab and you use this value as the Interval setting for this prefab on the Roadside rules.
    For terraced houses you'd likely want this value to be only slightly bigger than the actual width of the house.
    For detached houses you will want to add a few metres to provide a suitable gap between buildings.

    Once you get into the habit of following these rules it's actually really easy to set a prefab up, but there is a bit of a learning curve and it's obviously not well documented at the moment - I'll add this info into a Roadside chapter of the manual as soon as I can. Just finishing off some Procedural Building documentation first for v1.04.
     
    Last edited: Mar 24, 2021
  5. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    So I will admit I should of asked, in a different way. SO not blaming you of course. I should of asked you in a different way, to those reading this, it seems still like a great tool . I would still recommend it . But it won't work for me, right now..since I can ALREADY spawn objects, draw 2D shapes in Maya, and Modo the same way this tool already does....... So i'm disappointed is all. I will give it a look in the future.
     
  6. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    Not really what I'm looking for, I can make a residental, 2d Shape and spawn houses, etc.. Ya I get that. but I bought this to be able to change out the procedural ones based on OSM data. The 2d shapes, I can already do that for over 10+ years in Maya, I created scripts that done this years ago, and use for clients for years... So as its good for those that need or don't have access to Maya, its useless to me. Thanks though Mark for replying.
     
    Last edited: Jan 8, 2021
  7. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825


    Thanks for the info here. I will give it another look once you add this. What you could do for those buildings, having issues due to over lapping, is just allow the user to switch buildings, let the user handle this, or allow them to edit those areas. You can use a curve with a 2d shape so that the modular model can be adjusted according. We do this in Maya all the time.

    Have you ever seen an very known developer, for Maya? He makes some of this stuff which is not using OSM, but being able to edit the shapes which editable . Ninja Dojo. Give that a look. If you need it sent I would be happy to, it was what gave me my idea to make mine in Maya years back since I used Ninja Dojo before I had my own scripts to handle spawning my modular models. If you want a direct link I would be happy to send it though a PM. Keep up the good work other wise, it looks very useful for Racing, Flying games and for those that aren't using OSM data for custom spawns.
     
    Last edited: Jan 8, 2021
  8. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Sorry if a miscommunication has led to you being a bit disappointed. As I say, I hope to provide the specific functionality I think you mean in the very near future anyway.
    It probably wont make v1.04 but I think v1.05 is a realistic target (Feb/Mar time).

    Have you seen the Entity tab in CityGen3D's Generator?
    This allows the easy match up of OSM nodes (bus stops, post boxes, ATM machines, etc) to a prefab and a button that spawns them.
    My understanding is that is essentially what you want to be able to do, but for buildings. Please correct me if that's not the case.

    Instantiating a prefab at a location is a relatively trivial thing to do in Unity, which you seemed to acknowledge.
    In the meantime my code sample shows how the CityGen3D API makes this even easier by providing access to the OSM building data, automatically approximating a building position (GetCentre) from its shape, and a helper function for aligning to terrain height.
    Then there's the automated heightmap levelling under buildings and various other trickery that you can utilise via the UI.
    So while I understand your disappointment that you can't currently achieve this via the UI directly, there's still lots of functionality there to help you if you need to do it.


    You seemed to dismiss the Roadside spawning in your review, so I'll try and explain why this is useful.
    Some users really like this feature because it allows them to automatically spawn building prefabs in an urban environment over a large area in a fairly realistic manner.
    Keep in mind that many towns and cities do not have individually mapped buildings in OSM, and this is a really good way of filling in gaps, even if you still use another approach for larger buildings or landmarks.


    Thanks for your feedback, the main thing I've learnt over the last few years is that everyone wants to use CityGen3D in a different way, for different things (and not just in the games industry).
    Which is cool, as it gives me lots of fun stuff to add in, it's just a case of juggling priorities and responding to constructive feedback, which I always try to take on board.
     
    Recon03 likes this.
  9. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    No reason to be sorry, it was my fault, for not asking more in depth questions. I was pretty vague.
     
  10. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    yes I seen it. You have the procedural buildings, which aren't really meant for most games. I just wanted to be able to replace those models where they stand with prefabs. the OSM ones made, so being able to swap them. So for example, you have your scene that create OSM data, builds buildings . This is fine. I do this in Houdini all the time. Next what I do, is i'm able to edit those buildings with my own modular models/Prefabs. now I'm not asking you have this. but just being able to swap out the procedural buildings, for my own, or a users own, which be fine. even if we had to go through each one. You have the ability to change materials through BP this way, but being able to do that to replace the current buildings , to prefabs, would be a great start.
     
  11. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    ya, I wasn't dismissing it, but is it not just for custom data??? from 2D shapes? That is what I reviewed that on. be sure to re-read my review. I was sure to not blame you of course, and said if someone needs it to a non Maya user, that is great. but I already can do this already for over a decade in Maya, so its pointless to me. sorry if that came off as dismissing, but I have to be fair, it is useless to me, but to a non Maya user, who may or may not have access to customs scripting, or the asset I stated in a private message, then sure it could be useful to them.
    as I said a few times... but its completely useless to me. I have used yours, and I can already do this in Maya, ( I would be happy to share privately, if that made you happy, and I can actually do a lot more. So that part of the asset is not what interest me, since I already can do that. What interest me was that it was OSM in Unity, and that I THOUGHT I could use my own Prefabs to spawn them....


    Like I said a few times, I can already do this, and have for over 10 years I even linked you something in PM, to give you an idea of what I can create which is just like that with 2d shapes. I can even edit the actually plane in Maya to my liking...... So that feature i'm sure folks like, its useless to myself. and not why I bought this, if it was just for that I would of never bought that since I already have this feature. ( and no offense, the one I have in Maya, I can edit it much further.

    I can't share to much about my ( game) I made plenty of these over my 28 years with OSM data, I normally use Houdini and other tools. but I like having other tools, i'm a Maya, Modo user, so I'm a fan of leveraging tools and use pros of each. So I wanted to see if City Gen did more than Houdini already did. and again I wanted something for Unity use. So that I/we can make games and replicate some areas IRL.


    PS: to be clear i'm not mad or anything, disappointed. I will keep my eyes open for updates. and say you cant get this going, its not a big deal, I will just take it as a lesson learned. Normally I try to be more in depth with questions, so. its my fault.... I just hope to turn this around, to me liking the tool. For what it does, I do feel though it does a good job, if that person is making THAT kind of games.... I personally don't make those kind of games, and if I did. ( we have a tool for that already to anyways.)

    The only tool I have for OSM is Houdini, which is fantastic too......Looking forward though to what ever you decide or add in the future. best of luck. and check my review History, I have a very long one, I used Unity for over a decade. ( I had another account before. )

    so I try and be fair with ALL asset devs. and still gave you a 4 star, even though this asset , prolly will end up possible, rotting like the other 200 or so I bought over the years. ( main reason I use Unreal, I own 1, and I bought recently after nearly two decades. lol.... So be sure to read all reviews I have ever done, I even stick up for years, for assets devs who get pounded, so I feel I been pretty fair to you. :)
     
    Last edited: Jan 8, 2021
  12. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Ouch! :D

    I hope I can get you enjoying the tool eventually as well, which is why I'm really keen to understand exactly what you need.
    I say this because I thought the code sample I provided to you was essentially what you were after.
    So if it's purely the fact that prefab spawning at OSM building location is not integrated into the UI then I intend to provide this anyway in the very near future.
    Although I'm still unconvinced this approach, when used widely, gives good results.

    In my experience, through the fairly long Beta release to six months after Asset Store release, CityGen3D customers tend to fall into two camps:

    Either they are interested in accurate real world representation, often outside the games industry such military, automotive, or other simulation.
    They tend to use the procedural building workflow to generate buildings in an accurate shape based on OSM data.
    CityGen3D achieves this either via the built-in procedural building system, or via third party integration so users can easily utilize the OSM data with their own building extrusion asset of choice.

    On the other side of the fence, often in game dev, there are users that aren't necessary bothered about accurate real world representation (buildings in a certain position), but like the idea of procedurally generating a game world from 2D data, and with the ability to customize it.
    The Roadside spawning of prefabs tends to work well for them because it can give good results in built-up areas, especially where you have rows of terraced houses and such like (where simply spawning a building at a location isn't going to work very well at all due to overlapping of meshes and rotation issues).

    However, I do see value in spawning of building prefabs at a mapped location for certain types of building that can't easily be procedurally generated from a 2D shape, such as spawning a landmark model (eg Eiffel Tower) in the correct place, or spawning a Gas Station prefab where OSM has one mapped.
    Naturally these type of objects are well suited to custom prefabs instead of procedural extrusion from a 2D shape.

    With many projects I think users tend to use a combination of approaches so certainly this feature will add another useful approach to the tool set.
    But anyway, I'll reach out again to you once this is integrated into the UI, so you can try it out, if you aren't keen on playing with the code sample I gave you in the meantime.

    Thanks again for your feedback.
     
  13. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    Ya, with having tools like Houdini now, which costs about 279$ a year, it provides just this, which I already use. So, I already have what I need. But it would of been nice to have it directly in Unity, I can use Houdini Unity tools to handle OSM, with it editing the models.
    I even go a step further . and replace the entire building. But ya I understand what your saying. but I been in this industry a few decades, and the type of game you are speaking of, is really not that common base on what you are providing. Clients, want to be able to customize. I'm retired after 28 years as I was saying before, so I don't have to worry about that. but I know for myself, I'm working on a game based on Detriot. So OSM is important, but so is the over all look. ( I don't need simulation., if I did I wouldn't be using Unity. I would use Unigine which is way better for that, but that is another subject. So these are things I would keep in mind.

    I know folks would want City Gen more, if they could do some of the things i'm explaining. This is even based on info I get asked, when I do work with Houdini when I did client work and worked with other contractors, and game developers all over. So, see what you can do. as I said, Take it one step at a time. You could even work with folks like 3d Forge, and others . That would also help City Gen x10 more. anyways I normally don't post this much here. but I wanted you to hear some feed back and thoughts.

    Thanks again .
     
    CityGen3D likes this.
  14. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    The CityGen3D equivalent to that Houdini video is probably this, which shows the level of editing capabilities currently in place in CityGen3D for OSM buildings, where you can swap out windows and doors very easily. It's also very easy to change the number of floors and shape of the building.



    As noted on the roadmap, there are already plans for additional editing options for procedural buildings though, such as being able to easily add chimneys, balconies, air-con units and such like, so I think we are broadly on the same page there.

    CityGen3D also supports mesh extrusion and it's used in other areas such as the creation of walls and fences via the Features panel.
    So it's quite possible a more mesh based approach to buildings will be offered in future where it's preferred to the material based approach CityGen3D currently provides for it's procedural building system.
    I've even experimented a bit with interior generation during the Beta.

    The asset has funding for many years of development, so lots of exciting things planned for the future.
    But yeah, one step at a time, like you said.

    Short term goals are getting URP support out (to accompany the recent HDRP release), long awaited integrations with other popular assets, and terrain height-mapping improvements.

    Regarding auto spawning of building prefabs at OSM locations, I did a bit of testing in that area over the weekend and made some good progress, so that should make its way into an update in the near future.
     
  15. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    *Cough* Track BuildR *Cough* Loop the loop, just saying ;)
     
    newguy123 likes this.
  16. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    Status report on next version of CityGen3D?
     
  17. CityGen3D

    CityGen3D

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

    An issue with custom map editing on Mac has held things up a little, but hoping to submit to the Asset Store in a few days once this is resolved.

    Changelist is expected to be something like this:
    • Easy downloading of SRTM heightmap data from within Unity.
    • Faster heightmap generation with optimized NativeArray to SetHeights memory copy.
    • Filtered heightmap sampling option to improve heightmaps in urban locations.
    • Nearest-Neighbour interpolation option for visualizing raw heightmap data.
    • Fix for random prefab/texture selections only selecting first in list.
    • Improved building editor interface with more info on buildings in manual.
    • Cancel button on progress bars to terminate scheduled actions.
    • Improved Location Map shading for environment bounds and current region.
    The Vegetation Studio Pro integration is to be distributed separately, probably a few days after v1.04 release.
     
    Last edited: Feb 3, 2021
    hopeful likes this.
  18. chmodseven

    chmodseven

    Joined:
    Jul 20, 2012
    Posts:
    109
    I've been mucking about lately with NASADEM data, which is effectively a remaster of SRTM:

    https://lpdaac.usgs.gov/news/release-nasadem-data-products/

    Not sure if it's worth the trouble, but the portal to access it is the same, so might be worth a look.
     
    CityGen3D likes this.
  19. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    825

    you are aware of 2020 VSP? that I believe is in beta... and InfiniGrass v2. InfiniGrass V2,(release soon)
    actually is better in actually all platforms. VSP not so much PC only, or very HIGH end mobile... I understand wanting to support VSP, but I used it since V1, and I stopped, due to the mess of actually real development and not being able to work between versions of VS...what a nightmare.. for actually released games, or deep development.. Great masking tools, but I know many folks are moving away other than people who like to play around. Now if you never move from VSP, and PC only, those folks are fine. but if you want to move VS to VSP, you can't, or VSP to VSP 2020 you cant.

    . Just something to keep in mind.


    PS: but great for those PC only folks who stay within one version of VS.

    I would be talking to Adam at PW, his products are very stable, for all users. not just one type. and used in released games. This is what many folks look for, this could benefit, this asset I believe. ( I see some talking about this asset there alot.)
     
    Last edited: Feb 3, 2021
  20. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Thanks for the heads up.
    The improved implementation makes CityGen3D a bit more flexible in this regard, so CityGen3D can download NASADEM data from within Unity for your selected terrains.

    You'll just need to supply a valid NASA EarthData username and password which are freely available from here, for those that don't already have one.
    So once you have log-in credentials you don't have to leave Unity for automated heightmap downloads anymore.
    (CityGen3D even handles the unzipping of the download as well).

    As this supersedes the SRTM data set I'll probably make this the default now, but you'll be able to point CityGen3D to older SRTM HGT datasets if you want to.
     
    hopeful and chmodseven like this.
  21. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    CityGen3D v1.04 is now available for download :)

    screenshot4.png

    screenshot8.png

    screenshot10.png
     
    IrishDev, Bartolomeus755 and hopeful like this.
  22. SimonStojanovski

    SimonStojanovski

    Joined:
    Aug 24, 2017
    Posts:
    11
    Congrats on the new version release, will update and check out the new stuff :)
    I have a bit of a weird request/question, Is there any possibility to scale the maps but preserve the proportions of the roads and all the other elements. We are making an open world game where we want to use a real city but taking a second look, real life size is too big. I am hoping to make the city four times smaller while preserving the real life scale of all the generated elements. Any idea of what's the best way to do this if it's possible?

    Currently I am generating everything with roads and lanes set at 7m then scaling down the landscape parent to 0.5 and tweaking the terrain at half size. It looks like it's working but I really don't feel comfortable doing this this way.
     
    hopeful likes this.
  23. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Hi,

    Thanks very much!

    It's not clear to me how scaling down a real world map would work if you intended to retain realistic proportions for objects.
    If you scale the roads down by 50%, but retain building sizes, you'll just end up with buildings overlapping each other and such like.
    But maybe that's a very UK centric point of view where I'm imagining rows of houses next to each other along a road.
    I guess a scaling down approach could work in some areas where you have detatched buildings far apart from each other over a wide expanse of land, but there's no built-in way to achieve it (other than using normal Unity tricks like you are doing).
    So even if it feels a bit dirty, if your current approach is working for you then I'd stick with it.

    The concept of compressing things into a smaller space for games is a common one though.
    WatchDogs Legion is set in London, but was remapped to include familiar landmarks in a smaller space, and roads were changed to improve the level design and natural flow between different areas of the map.

    I see the Custom Map editor in CityGen3D as a long term solution here. It's probably not mature enough yet to do extensive level design in, but notable future improvements will include things like easy joining of road nodes and general quality of life improvements that will allow you to more easily make changes.
    But just nudging you in the direction of the 2D map editor in case you hadn't looked at it yet.
    I'm relying on feedback for the Map Editor in order to know where to focus future development on it and taking a real world map and wanting to make changes to it in a WatchDogs Legion type of way is where I want to identify workflow issues for future improvement.
     
  24. SimonStojanovski

    SimonStojanovski

    Joined:
    Aug 24, 2017
    Posts:
    11
    Thank you for the fast and detailed reply.
    I forgot to mention that we are using Citygen3d only for the terrain, highways and roadside generators. We place the building by hand to have more control over the level design.
    I haven't actually created a map from scratch with the custom editor, but have used it to tweak existing maps. It's definitely an option to go with but will be tricky, guess we will have to overlay an image over the editor and trace the roads :D
     
    CityGen3D likes this.
  25. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,571
    I assume that the right approach would be to enable shrinking on the X and Z, but not on the Y, on selected objects, like streets and buildings? That way doors, streetlights, and all are still the correct height.
     
    SimonStojanovski likes this.
  26. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Oh that makes sense. Yes just for roads and surfaces I can see how scaling could work. Then spawning objects appropriately afterwards.
    I'll try and put some time aside to look at adding a scaling option for map objects to help with this workflow.

    I think any scaling option would apply only to the 2D map data, which is independent of any texturing done by the 3D Generator. Likewise streetlights would be unaffected by scaling as they are just single positions for a prefab.
    It's mainly buildings where simply scaling the 2D world down doesn't make sense because you'd end up with unrealistically small wall lengths in some instances, even though the CItyGen3D Generator would still apply realistic heights and textures at the correct size. (Especially when a lot of games do the opposite and oversize indoor spaces compared to real life).
     
    hopeful likes this.
  27. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276


    Something went wrong! The tan area is supposed to be ocean/rivers. The sample city that came with CityGen3D worked fine.
     
  28. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Thanks for reporting this. I believe it's an issue with the new Filtered sampling option on Heightmap panel when close to large water bodies.
    I'll release a hotfix for this as soon as possible, but in the meantime please use the Raw sampling option, or manually lower affected areas using the Unity Terrain Tools after generation.

    Edit: I know what the problem is here and intend to submit a v1.04.1 hotfix today.
     
    Last edited: Feb 10, 2021
    hopeful likes this.
  29. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    v1.04.1 is now available to download, which includes a fix for this issue.
     
    hopeful likes this.
  30. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Here are some handy CityGen3D API calls for converting between Geographic locations and Unity world space:


    There’s a GeoCoord class which allows you to define a Latitude/Longitude location:

    GeoCoord location = new GeoCoord( lat, lon );


    You can then convert to Unity world space like this:

    Vector3 pos = location.GetMapCoord( Map.Instance.data.GetOrigin() ).GetPosition();


    By default pos.y will be zero, because its faster to only query terrain height when you really need it, but you can explicitly get a terrain altitude value by doing this:

    pos.y = Generator.Instance.GetAltitudeAtWorldPosition( pos );



    This gives you the Lat/Lon location of [0,0,0] in Unity:

    GeoCoord location = Map.Instance.data.origin;


    So you can find out any Unity world space location by providing the x/z coords

    GeoCoord location = Map.Instance.data.origin.GetLocation( x, z );
     
    hopeful, Edy and chmodseven like this.
  31. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    CityGen3D now has a single unified package for all render pipelines. So whether you are working in HDRP, URP, or the older Built-In pipeline, you can now install v1.05 in your project without having to extract and install a separate package.

    v1.05 Changelist
    • Updated shaders to support HDRP and URP without the need to install a separate package.
    • Some new terrain textures.
    • Road markings no longer generate new material instances for each mesh to help with scene exporting and general performance.
    • New leaves shader for animated trees.
    • Improved facade shader for building rendering.
    • Improved water shader.
    • Fix for feature processing sometimes getting stuck on specific map objects.
    • Fix for saving Blueprint and Plan edits, where sometimes object wasn't marked as dirty and changes not saved.
    • Fix for individually mapped tree positioning when working on terrain away from world origin.
    • Some prep work for upcoming Vegetation Studio Pro integration.
    screenshot1.png

    screenshot3.png

    screenshot4.png

    screenshot5.png

    screenshot8.png

    There are quite a lot of underlying changes to support all render pipelines in a single package, so as always, please back-up your project before applying an update.
     
    Bartolomeus755, StevenPicard and Edy like this.
  32. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    719
    Super happy I purchased this a while back. :)
     
    CityGen3D likes this.
  33. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Thanks, I'm happy to hear that :)

    With the initial SRP compatibility sorted, there are lots of exciting new features and content planned as well in the coming months.
    Firstly...
     
  34. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    ...The Vegetation Studio Pro integration is not far away now.

    I thought Royal Musselburgh Golf Course in Scotland provided quite a nice setting for testing it, using foliage assets from NatureManufacture.
    So here are some screenshots from the test:

    screenshot0.png

    screenshot1.png

    screenshot3.png

    screenshot5.png

    screenshot6.png

    All your existing VSP Biome packs will work without any additional setup.

    The CityGen3D integration is fairly simple in scope (although very useful) in that it matches up CityGen3D mapSurfaces to VSP Biomes (BiomeType enum) and automatically creates biome masks for you.

    So lets say you have a NatureManufacture woodland biome all set up, either the one provided, or a custom one you have made. You would add that to your Vegetation Studio Pro instance as normal and assign it a biome slot (eg Boreal Forest).
    Then in the CityGen3D integration window you could assign Woodland mapSurface to this Boreal Forest biome, so anywhere an OpenStreetmap woodland appears, a Boreal Forest biome mask is created.

    Therefore what gets spawned and where within a biome is still controlled via normal Vegetation Studio Pro interface and workflow.

    Another handy feature is that Vegetation Line Masks can also be auto spawned to mask out vegetation where roads are.

    I'll be putting a video together around the time of release.
     
    Last edited: Apr 2, 2021
  35. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,209
    Would be nice to see some HDRP screenshot with proper ligthing...
    (for non gaming scenarios)
     
  36. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    835
    This is awesome! Looks like it's worth me upgrading to VS Pro.
     
    CityGen3D likes this.
  37. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Yeah I've not spent a lot of time with HDRP (aside from compatibility work for the integration), so I haven't actually posted many HDRP screenshots yet.
    So if anyone has any cool HDRP screenshots using CityGen3D to share, I'd also love to see them.

    There is now a Showcase room on the CityGen3D Discord, so I'd encourage everyone to show off their CityGen3D environments (HDRP or otherwise) in there.

    Eventually I also want to put a Gallery section on the website to show off peoples best work.


    Both URP and HDRP now have their own "New City" scene templates, so as long as you remember to use the correct one when starting your CityGen3D scene, your camera will be set up with a basic Global Post Processing Volume to work with the chosen SRP, which you can easily edit to achieve desired results.
    (On Built-In you install the Post Processing package before importing CityGen3D, and this will also give you a default set up using the New City scene).

    For the future, I do like the idea of auto spawning Post Processing volumes for different mapped surfaces one day, that would be pretty cool. So you could pre define a misty swamp volume with fog and particle effects and it would automatically appear in the correct placed based on mapped swamp areas, etc.
     
  38. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    68
    Looks like I'll also be upgrading to VS Pro.

    Also looking forward to the Building prefab replacement ref OSM data for cities so I can use other assets I have etc. There's probably many ways you could do a size check of prefab before instantiating from Folders, Tags or code to check prefab size.

    Have seen notes in forum ref the village/town buildings...

    For other integrations on roadmap, I already have those :)

    One thing to mention ref Easy Road Pro should that be integrated, I see
    iTS - Intelligent Traffic System has recently created an integration so that traffic is pre set on Easy Roads. So ERP integration also does traffic with ITS.

    Thanks for great asset.
     
    Last edited: Apr 28, 2021
    CityGen3D likes this.
  39. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Thanks very much!

    I'm just finishing off some bug fixes for a v1.05.2 CityGen3D update ahead of the VSP Integration release.

    For sure, the new building prefab spawning system should be a great way to more easily add third party building assets to CityGen3D scenes.
    The Roadside spawner does this to some extent, but there's definitely a space for an alternative where you can be more specific about instantiating a prefab at mapped location.

    It's not possible to use EasyRoads to procedurally generate all types of road networks, you need custom junction geometry for all the edge case scenarios that real world data often has. So a CityGen3D Map to EasyRoads just isn't technically possible (as good as it would be!).

    However, EasyRoads already has it's own OSM import feature, so you can use that on top of CityGen3D terrains if you want to instead of using Generate Highways.
    But I think, depending on the data you throw at it, there'll be some manual 3D modelling work required afterwards.

    Anyway, I promise the next official integration wont be as long a wait as the first!
    Both BuildR (buildings with interiors) and MapBox (satellite imagery for terrains), are quite far into development too.
     
    MorpheusXI and StevenPicard like this.
  40. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    The 1.05.2 update has been released. Here's the changelist:
    • New batching mode for building generation to automatically combine building meshes sharing same material on one terrain to reduce draw calls.
    • Improved 3D building generation to accommodate holes in larger shapes.
    • Fix for Location Map shading when not at world origin so it correctly shows the Area position within Axis bounds.
    • Fixes for reflection and tessellation in HDRP.
    Please note that if you have a Generator set up in an existing project that you want to retain you'll need to click it and assign these prefabs to these slots after importing the update into your project.

    building_prefabs.png

    Otherwise, just delete existing Generator in your main scene and Load it again and it will be done for you from the prefab. Likewise, starting a new project using the New City scene should have this set up correctly, so this step is only for existing projects.

    The Vegetation Studio Pro integration will be available from the CityGen3D website next week. I'll post a link once it's available.
     
  41. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Hi,

    Just doing a soft launch of the Vegetation Studio Pro integration for CityGen3D before making it more widely available via the website.

    So if anyone wants to try it out ahead of the tutorial video being released, feel free to download here.
    More info available on the Discord channel.

    biomes_window.png

    screenshot0.png
     
    hopeful likes this.
  42. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    222
    Bummer... I just encountered this issue too. Any new ideas on this since October 2020?

    upload_2021-6-22_15-18-49.png
     
  43. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    I'm pleased to say that v1.06 is available for download now!

    This includes an exciting new feature that provides a connection to Mapbox for downloading satellite imagery for your terrain.
    You can use this instead of, or in addition to, splatmap textures.

    screenshot0.png

    Just like the NASA heightmapping, this functionality is fully embedded into CityGen3D v1.06 and doesn't require any additional download or install.

    To get this working you can do the following:

    1) Get a Mapbox API key and enter it on the Settings tab of the Data window.
    data_settings.png

    2) Download and Process your location as normal.

    3) Use the "Generator - Mapbox" instead of the normal "Generator", which is configured to download and use this imagery.
    generator_mapbox.png

    4) Run Generator as normal to generate terrains with Mapbox imagery.

    You can also easily modify an existing Generator to use Mapbox imagery.
    All you need to do is configure the Splatmap interface so that one or more surface types have "[Image]" as an output instead of a splatmap texture reference.

    Then click the Download Terrain Imagery button before the Texture Base Surfaces button, to apply this to your selected Landscapes.

    screenshot3.png
     
  44. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    Hey, I cannot make the heightmap to work.
    I created user on nasa site, and I pasted correct user and pass, yet I cannot download heightmap.
     
  45. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I have never even looked at this data. OR this app.
    However, might I inquire if you are certain that is the correct name formatting.
    Having had a glance a the folder it certainly seems available to the public.
    upload_2021-9-28_10-28-52.png
     
    jerry_unity172 likes this.
  46. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Hi,
    On rare occasions their server has been known to be down, but it's working ok for me just now.
    What happens when you try it?
    Please send me the output from your Unity Console around the time you try.
    When all is well you get output like this:

    heightmap_output.png

    If it all appears to be working as above but you don't see the heightmap on the terrain as expected, then please make sure your Peak setting is high enough to accommodate highest elevation and try again. (But keep Peak and Nadir as small range as possible for best results, because heightmaps have a finite height resolution).
     
    jerry_unity172 likes this.
  47. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    Thank you guys - the problem is that the "download" button is greyed out and not clickable, just like in my screenshot.
    So I cannot try it - maybe I am doing some simple mistake, I just don't know how to make HeightMap module to update user/pass info or passing ity into inspector is enough? Maybe the standard URL "https://e4ftl01.cr.usgs.gov/MEASURES/NASADEM_HGT.001/2000.02.11/NASADEM_HGT_" is not complete or wrong - I try to apply heightmap to terrain generated in one of the Swiss cities.
     
  48. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    If you hover over a disabled action button, a tooltip should indicate why it's greyed out.
    In most cases, actions are only available if one or more Landscapes are selected.
     
    jerry_unity172 likes this.
  49. jerry_unity172

    jerry_unity172

    Joined:
    Jul 9, 2020
    Posts:
    7
    Snap, that is the thing - I didn't know I need to have the Landscape selected - sorry, me being silly :)
    Case closed - BTW - the asset is great, we use it to train NN for drones. Cool stuff.
     
    hopeful and CityGen3D like this.
  50. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Great no probs, thanks for letting me know.

    Your project sounds like a really cool use of CityGen3D!
    If you have more info to share at any time such as screenshots or videos, I'd love to see.

    Reminder to everyone that you are free to post about your CityGen3D project's in this thread, or there's also the Showcase section of the Discord to show off projects that use CityGen3D.

    I'm constantly amazed at the different use cases for it, and it's great to hear what people are up to with it, as well as it helping to shape future development.
     
    twobob, jerry_unity172 and newguy123 like this.