Search Unity

World Building [RELEASED] CScape - advanced building generator

Discussion in 'Tools In Progress' started by olix4242, Mar 11, 2017.

  1. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Well, right now it randomizes from all possible variations. New version introduces many new variations (on shape and tiling), so it's quite useless to use random parameters for this.

    Section division is dependent on min/max block distance. So if you get this error, it means that buildings can't fit a block that is smaller than those buildings. This approcah is a little bit faulty, and right now I'm moving into raytrace mode that will be controlled by density value (as it happens for rooftops).
    If you get this error, it's enough to set block distance to some greater values.
    This is harmless error (due to different unity versions) - shaders should work without problem.

    It probably is too heavy on slower systems (mac = pun intended, ahaha). I will add a button and a checkbox so that you can disable realtime update.

    It uses adittive approach. You set your min and max building heights, and then, when you use curve, you are actually adding height to those min and max values. I'm not sure, but I will probably abandon this option and use two curves instead.
    right now, advertising panels use a advertising panel modifier, but in a future, it should be replaced with a new and more flexible CS array script that is now used to spawn balconies. Nevertheless, you can set a height of advertising panels with Building modifier - Prefab Configuration and a second rooftop elements array - height.
    BTW, thanks for your suggestions and ideas. They are giving me some new ideas!
     
    hopeful likes this.
  2. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Done! It willbe featured in a new version.
     
    hopeful and Stephen_O like this.
  3. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Right now there is no documentation. This is because I don't suggest to do those kind of modifications before final version. There are many things that I'm changing for sake of optimization and flexibility, so you could end in doing something that won't be campatible with final version - and i really don't want to make people loose their time. Once it hits 1.0 stage, I will make some tutorials on how to do this.
     
    hopeful likes this.
  4. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    thanks.

    this wasnt on the mac. so the option will be appreciated


    what about a way to not spawn buildings somewhere? is this achievable with the street templates of other types (like park)?
     
  5. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    This is in developement. A second update (not this one, but the one later) will work somewhat differently. It will place a structure of streets (so that it can be easily modified). So, there you will be able to set tags for each block.
     
  6. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    what about this? this means somewhere you are using a random with a different seed
     
  7. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    No.. unfortunately, random seed in unity doesn't work well in Editor. It requires time difference between executing different steps - so what happens is that random seed in a editor loop gives always a same result if a execution is fast enough - this lead to generating whole city parts that had same buildings without any difference. I had to add some steps on manualy changing a seed for each loop iteration, but this leads to some scripts running at different time rate, and generating different results each time. It seems that there is no way around - but I will have to check whole code to see if it can be corrected somehow. But, probably a new logic for street generation will behave correctly as it will have to work with smaller chunks of a city.
     
  8. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    There are editor tools that generate the same random output, so this should be possible.

    I just tried and initiated the random generator with the seed exposed in the inspector. and the result isnt that bad. I do now get the same street layout and buildings every time I regenerate the city. there is more repetition and less variation but thats not always bad. I will play around with this, but I would like to have predictable behavior when I generate a city

    EDIT: Another way that I can get the exact same city to generate is to not allow variation in the street/sidewalk sizes (set min/max to be the same)
     
    Last edited: Nov 23, 2017
    jovino and hopeful like this.
  9. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    You have nailed it!! I coudn't see the wood for the trees, but this helped me to track the issue easily. Bug is corrected. Thanks a lot!
     
    hopeful likes this.
  10. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    i have one idea that could be cool to implement: support for Text mesh Pro..so that buildings can have shop signs, street names and so on. this would require using text Mesh pro asset that is free. Not sure yeet how it will impact performance, but I think that this could be done.
     
  11. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    yes thats a good idea. not much really, well depending on how many signs youd want and how far away youd wanna show them
     
    Last edited: Nov 25, 2017
  12. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Well, I would implement LOD behaviour.. but it should increase a number of drawcalls as probably i can't put my hands on those shaders and use approach that I'm using for everything in Cscape.
     
  13. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    given how few drawcalls cscape produces by itself an optional feature which might increase them is not a problem. plus a few signs here and there will really add to the atmosphere.

    really love cscape and how fast it can create nice cities. the one thing that would make the cities more interesting would be different layouts.

    I created a small utility that works with cscape and places props on the sidewalks or the roads;

    Screenshot (289).png

    Screenshot (290).png

    Screenshot (291).png

    Screenshot (298).png

    Screenshot (300).png
     
    hopeful and blacksun666 like this.
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    Just a general question to those customers using CScape ... wanting to tap your brains on how best to go about having your CScape buildings get placed by other city-building plugins.

    Right now, CScape works by creating a certain number of buildings in a list in the scene hierarchy. These buildings have dimensions and textures dictated by the CScape algorithms.

    You could have your Dungeon Architect or Map-ity script grab the next building in the hierarchy list and overwrite the transform, thereby moving it to a new location, but getting the building to conform in other regards (floor size, height) is a little trickier.

    And trickier but not impossible, I think, would be trying to change the orientation of the roadways, as you'd have to deform meshes to fit them to terrain and introduce curves and non-right angles. I'm not sure you could ever do that to fit with the abovementioned plugins, but maybe for random cities or handmade creations in the editor.

    And maybe some of these changes would affect the new lighting features in CScape?

    Has anyone already looked into doing this? Any comments about what works and what doesn't?
     
  15. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    I think that should be possible. Dungeon architect was actually one of the plugins I considered when thinking about this. I dont have DA, and right now a grid layout will work for me, but I will likely get it in the future. Im not sure of the exact workflow of DA, but it should work with cscape. You would probably have to create roads other than L shaped (which is the only type in cscape right now) and feed those into DA. For buildings, Instead of getting them from the cscape city randomizer you could use some of the logic from there to create your own building generator/randomizer and then give those to DA. (Does dungeon architect work with procedurally generated content?) Or you could premake a few buildings and then once spawned, just randomize them with a script (textures, height)

    as for cities not on a plane, that would be a little trickier. when I have time I could experiment with easy roads pro or sentieri and see what happens (these shape the terrain for you, you would just use the cscape material for the generated mesh). but you would have to conform the terrain under the building yourself

    but if you don't own cscape you definitely want to get it if you need a city

    Screenshot (306).png Screenshot (309).png Screenshot (310).png
     
    Last edited: Nov 26, 2017
  16. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    and @olix4242 another plugin that would work well with cscape is https://www.assetstore.unity3d.com/en/#!/content/22867

    Screenshot (311).png



    also there are few occasions when placed items (ads, roof greebles) are placed slightly wrong, please have a look at this.
    in the image above the ads are too far in the building and in the image below the vents are rotated into the air

    Screenshot (283).png
     
  17. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I'm working into solwing all this issues by new physics raytracing that should be available for a 1.0 version. Unfotunately, sometimes it goees of - but i think that in a case of rooftop, it has something to do with a wrong mesh orientation) - as it happensrarely, and only with that same mesh. So, I will have to check this out.
    For now, you have to correct this all manually, and it's quite simple- just change random seed of CS advertising and CS rooftops.
     
  18. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Not sure how they work. But, one of ides is this:
    if, for example, dungeon city, makes a building that have it's own identity that incorporates in it's transform orientation and position, you can probably easily translate this to Cscape.
    -Find your 'other pack' building rotation.
    -look at the rotation of other building and set a same rotation to CScape building.
    -Check a bounding box of other building and round it to CS units (3 meters are 1 sc unit).
    -set a X and Z size of Cscape to approx. match dungeon building bounding box value.
    -Move a Cscape building localy for half of a bounding box value (or CScape building width multiplied by 3).
    -repeat this for X and Z and height.
    -Remove original model and keep only CScape model.
    -repeat this action for all buildings.
    Problem is if those plugins generate objects that are in groups without transforms (like mapbox or other plugins do).
    I'm researching some algorythms that will be able to do this, but it is only research - as there are so many things that i want to implement before this, i would like to concentrate to those problems. This is also a MUST, because I want to standardize everything, so that it can make scripting easy and consistent - and allow developers to make addons to Cscape easily - and even sell them on their own.
    As for 3d dimensional layout, this is somewhat tricky, and I can say that I didn't see any city system doing it right. They always end up in some heavy problems that aren't possible to solve. To be able to have a 3d dimensional positioning of streets, you have to use too many mesh divisions to fit streets and buildings and props - and you have to end into a non optimized solution. Try to use any of those solutions, and you will se that there must be many points that have Zfighting, that have physics that go crazy, that have some type of error or visual fault - that is impossible to correct. Sometimes, even Cscape generates some stupd solutions, but in this case, you can always correct them in one way or another, without coding anything.
     
  19. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I'm into making a decall system. Did some experimentation, but had some problems on performance that I will try to resolve with unity guys. Main problem is that I need some extended information on vertices, so that I can match texture shapes with physics hitting. But a physics hit 8unity default) gives information only on UV1 and UV2 in Vector2 format. But, Cscape meshes require UV1 and UV$ to be written and read in Vector4 format (it uses UV and colour channels that it has to pass to a shader as information on wich material and combination it has to use).
     
  20. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    BTW, nice rain shots of the city. Using Enviro for rain? Or something else?
     
  21. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274
    Nice work. I know how hard it is to make buildings look nice at long distances (too much detail being Mipmapped into mush). These look photorealistic.
     
    olix4242 likes this.
  22. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Nice that someone have noticed this ;) It was one of my main concerns from a start and I had to work really hard to acheive this result. I have made many variations on shaders te be able to do this, and two of them were: "rewriting almost everything from a start". Even so, there could be some aliasing and fringing, but right now, I think that it's possible to make better solution without rendering into higher screen resolution. On the other hand, fringing happens also in real life videos.
     
  23. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I hate to do this, but I have to do it from time to time :oops:
    If you like Cscape, please support it's developement by giving a small rating and review on Assetstore.
    (or even on social media by spreading a word)
    This means much for me, and helps me create user base that is essential for best and constant developement.
     
  24. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    what will the system do?

    yes, its enviro, but the actual rain is this:
    https://www.assetstore.unity3d.com/en/#!/content/41286


    what about nordlake? are you working on that as well right now, or is that paused?
     
  25. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Break windows and do some damages to buildings. But it can be probably customized also for some other elements like grafitti.
     
  26. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I'm also trying to implement some rain effects. But this is for now only internal.. and I will have to see if i can optimize this in Cscape style so that it doesn't impact performance too much.
     
  27. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    BTW, just bought Enviro, and I will try to see what can be done to integrate this into Cscape.
     
  28. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    off the top of the head, you use the light rotation in the light control script to control relighting. it would be better to use enviros time. but it would probably then make more sense for enviro (or other tod assets) to control relighting, so you could expose a method that would take time and based on that control relighting
     
  29. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I agree that it would be best to make it easy for hookup to other time of day type assets. (Like "Time of Day." ;) )
     
  30. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    214
    Last edited: Nov 27, 2017
  31. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I will have to check, but using a Time isn't probably the best way IMHO, as time doesn't have information about sunrise moment. Using Light rotation seems like a best way, as it makes possible to know exact position, and even a color of light, controlled by any other sky asset.
     
    hopeful likes this.
  32. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    the thing is that for example enviro always keeps the light at an angle towards the ground (if you light the world from the bottom it just looks bad). so the light is never rotated fully up so you would never really light up the city. you could let the users define the sunrise and sunset in for cscape
     
    olix4242 likes this.
  33. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    Any idea if the building prefabs will be a thing again ?

    I'm more interested in populating the scenes manually, since it's not very interesting from a level design perspective.

    Rated 5 stars (I was looking if it was going to have a steady development, and thankfully it is).

    It's really a very nice asset.
     
  34. Ioncloud

    Ioncloud

    Joined:
    Mar 21, 2016
    Posts:
    3
    just purchased and tried to get it up and running with enviro. Saw the post a few up about it not being integrated? Is there a work around to get night to work with building lighting? It starts to work but the moment the night sounds turn on the lights all go off... Maybe the city is Eco friendly? :)
     
  35. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    just leave the original light in the scene (and reference that in the cscape light control script), disable the the light and control this light through your script to control the city lights. then have enviro do whatever you want...
     
    olix4242 likes this.
  36. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Worked whole day on some new rooftop elements. Old rooftop elements were only a proof of programming concept, but I really never wanted to keep them like that. Now I'm moving into a photorealistic realm and trying to make some really nice greeble asssets. Hwere is a small preview of what to expect. They are still lo poly, but have more complex textures. img00002.jpg
     
    XyrisKenn, magique, rrahim and 3 others like this.
  37. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    Looks great! Are turbine vents and roof access doors going to be included?

    (Not a huge issue, of course, if we can easily add our own objects.)
     
  38. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Sorry, I think that I didn't understand a question.
     
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I was just listing two common rooftop elements that I didn't see in the picture above. One is a common form of air vent found on smaller buildings, and the other is a small enclosure for a stairway or even elevator access to a rooftop.




     
    Last edited: Nov 28, 2017
  40. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    What do you mean? Ability to just drop a prefab into a scene? You can do it even now, but you have to drop it into a Cscape hierarchy under Buildings object. This is because it has to track all changes to details and LOD.
     
    hopeful likes this.
  41. angelotokyo

    angelotokyo

    Joined:
    Apr 26, 2016
    Posts:
    10
    Hello Oliver

    I just purchased CScape , when i open the demo scene the buildings are completly black even in the editor

    any ideas ?

    i am running unity 2017.2 0f3

    thank you
     

    Attached Files:

  42. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Be sure to run configuratoon setting script. You will find instruction if you click on Cscape city object and look into City randomizer script.
     
  43. angelotokyo

    angelotokyo

    Joined:
    Apr 26, 2016
    Posts:
    10
    thank you for your answer ! i just test on virtual Pc it work well ! but not on my mac , i look the configuration settings and change the graphic API For mac from Metal to OpenGLcore and press ok but still black !
     
  44. angelotokyo

    angelotokyo

    Joined:
    Apr 26, 2016
    Posts:
    10
    Ohhh ! i figured out to make it work , i check metal API Validation on player setting then everything come back to normal !

    Hvala !






    Capture d’écran 2017-11-29 à 00.07.55.png
     
    hopeful and olix4242 like this.
  45. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    This is a new feature.. it looks like I've never saw it ..
     
  46. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Something like this? ;)
    roof.jpg
     
    hopeful likes this.
  47. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    yes, that looks good. Perhaps 1 short, 1 tall.

    I also like the antenna towers and water tanks that are in the current version. are you going to make those as well?
     
  48. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Yes, of course :) Antennas, towers (probably few of them) and some satelite dishes.
     
  49. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I'm trying to decign these greeble elements so that they can be eventually used also in other contests (not only as roof elements). Here is one test.
    Greebles.jpg
     
    rrahim likes this.
  50. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    another thing that comes to mind are fire escapes
     
    hopeful likes this.