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
    How do you mean? Are you packing a scene or prefab? If it's a scene, than it should be as you left it. I probably didn't understand a purpose of your action :(
     
  2. KSF

    KSF

    Joined:
    Mar 15, 2015
    Posts:
    4
    A scene.
    We have created a city in a new scene and now we need to load this city as scene to another scene.
    We dont need cscape's scripts in this city anymore, we just need created buildings. But when we load created city all of building's settings are default :(
     
  3. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Well, this seems quite strange. If you create a city and save it as a scene, it should load as it was at a state of saving. Does this happens in editor or in build? If it happens in editor, try to click on Refresh button and see what happens.
    -But I think that I need a exact description of what is happening..
     
  4. KSF

    KSF

    Joined:
    Mar 15, 2015
    Posts:
    4
    We created city and build scene into bundle via BuildPipeline. After that we need to load this bundle in other project. Unforunately, all building lighting was set to default.
     
  5. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    What do you mean by 'default' lighting? CScape doesn't have any default state. Can you provide some screenshots?
     
  6. MTDues

    MTDues

    Joined:
    Mar 27, 2014
    Posts:
    27
    can you give specific insturctions on adding custom buldings?
     
  7. MTDues

    MTDues

    Joined:
    Mar 27, 2014
    Posts:
    27
    i want to use my custom prefab buildings
    if anyone could help me i would apprechate it
     
  8. Neviah

    Neviah

    Joined:
    Dec 1, 2016
    Posts:
    235
    Any updates/features you working on now that your neon challenge project is complete?
     
  9. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I have submitte a new version right now. it should be available on assetstore as soon as Assetstore team aprooves it.

    With a new version, a standardization of building customization is done - so, in next few days I will be making a tutorial on how to make custom buildings and materials for them.
     
  10. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    version 0.9.5
    -WEBGL2.0 support
    -Fixed bug with OSX not displaying city.
    -Improoved Re-Lighten. Now it's possible to have nice daytime lit city with a single directional light, without any GI baking.
    -Improoved textures
    -Improoved material shader. I have spent many hours on trying to calibrate materials and improove overall look.
    -Better glass rendering - now reflections get's distortedlike it would in real world
    -Better nightime building illumination
    -Better management of blinds
    -Improved Street shader and materials
    -added option on using graffiti on low floors
    -added optional Save menu item for reducing .scene file size when saving files (will save only parametrization values, without dynamically generated meshes
    -Added new rooftop models and materials (hi-quality)
    -Added ability to add bus stations
    -fixed random seed generation consistency issue
    -Deprecated Update Colliders option. Mesh colliders are now always generated and auto updated.
    -Introducing experimental feature for generating slated (slated and T form angled) street layouts. This feature is experimental - but will become a default generation method in final version. Right now it can be broken in some random cases, and it needs some manual corrections. This will be fixed in future versions.
    -With a slated city support generation, now it will be possible to controll cities by block. Also, some functionalities doesn't work, like generating bus stations in this mode.
    -Many things are refactored, and all of this is to allow future improovements.
     
    Aaron2348 and hopeful like this.
  11. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    New version is available online.
     
    hopeful likes this.
  12. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    I think you may have forgotten Plugins/...(someting/something) / HxVolumetricLight.cs in the package
     
    olix4242 likes this.
  13. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Any way to get location of windows and doors on the buildings?
     
  14. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Thanks for reporting this. Looks like Assetstore exporttool exported some third party scripts that shouldn't be there. Just delete HxVolumetricLighting scripts that are giving you an error.
     
  15. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    No, it should be complicated to make to work reliably (as I would have to translate/simulate a great part of a shading process to a C# script) , and also, this would be extremely processor intensive. What would be your typical usage? If I know this, Maybee I can think of some sort of hack hor this...
     
  16. Neviah

    Neviah

    Joined:
    Dec 1, 2016
    Posts:
    235
    Curious, what are you working on feature-wise for the future?
     
  17. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515

    Window shutters and other items like that that would extrude out
     
  18. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I'm working on windows shatters.. not on a top of priority list, but this can be done eventually.. main problem is that unity doesn't have any method for getting UV coordinates (raycast) in vector4 format (the one that cscape uses).
    As for object extrudes.. this can be really complicated as you would have to check all pixels of a procedural shader.. so I think that this one is quite impossible for now.
     
  19. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    The Add Bus Stops button errors because busStopsHolder is never assigned.

    I added this to line 346 in CityRandomizerEditor.cs:
    Code (CSharp):
    1.                     ce.busStopsHolder = EditorGUILayout.ObjectField("Holder", ce.busStopsHolder, typeof(GameObject), true) as GameObject;
    2.  
    After that, I dragged the "BusStops" child gameObject and assigned "BusStop" into the BusStop field and then they worked.
     
    olix4242 likes this.
  20. NicoFlows

    NicoFlows

    Joined:
    Feb 23, 2016
    Posts:
    5
    Support question:
    I am new to unity so I am probably missing something simple. The import from the asset store seems to work fine. However When I drag the CScapeDemo2 scene into the hierarchy A city generates but I get errors in the console :


    Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricLight.cs(11,5): error CS0246: The type or namespace name `HxDummyLight' could not be found. Are you missing an assembly reference?

    Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricLight.cs(22,12): error CS0246: The type or namespace name `HxDummyLight' could not be found. Are you missing an assembly reference?

    Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricLight.cs(75,12): error CS0246: The type or namespace name `HxVolumetricCamera' could not be found. Are you missing an assembly reference?

    Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricLight.cs(1357,5): error CS0246: The type or namespace name `HxOctreeNode' could not be found. Are you missing an assembly reference?

    Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricLight.cs(1475,27): error CS0246: The type or namespace name `HxDensityVolume' could not be found. Are you missing an assembly reference?
     
  21. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Delete the HxVolumetricLighting folder
     
    olix4242 likes this.
  22. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    ops.. looks like I forgot something. I will fix this issue ASAP (and another issues).
     
    hopeful likes this.
  23. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    hopeful likes this.
  24. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Ok so nice update.
    A few bugs to add to your list:

    BuildingModifier.cs, line 537, the csRooftops was null and caused errors upon generation.
    When creating slanted streets, there were a number of buildings in overlapping into the roads.
    The parks seem to overspill a bit and the material is not set up.
    The foliage generation just created a small patch of about 18 trees, not everywhere.
    The streetlights seem to work however, there were quite a few with the point lights in way off the grid and not in the city.
    Turning off graffiti does not seem to work too.

    However - well done, keep going!
    :)
     
  25. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    I found that I could not perform a build because the CScape.CityRandomizer class was encapsulated in #IF UNITY_EDITOR. I put in some #IF UNITY_EDITOR and [ExecuteInEditor] stuff in StreetModifier.cs, BuildingModifier.cs and I also moved the #IF UNITY_EDITOR inside the CityRandomizer definition so that it always at least exists.
     
    olix4242 likes this.
  26. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    I think that removing #If UNITY EDITOR in CityRandomizer should be enough. Will have to try. One of the added features in new CScape is a possibility to generate buildings at runtime, and load prefabs (and reducing build sizes), so there were a lot of changes from this standpoint.
    I will check if there is something else.
     
    Neviah and hopeful like this.
  27. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    The Add street details function was playing up a bit - setting the parent transform in CSInstantiator just after the creations of ' newObject' and not after its been translated seems to set the detail objects in the correct position.

    Also instancesZ does not seem to be used anywhere. Using it for the second loop, and changing the translate line to ' newObject.transform.Translate(new Vector3(0, 0, j * -offsetZ));' now puts the details round 2 sides the streets.. getting there..

    To add details around all 4 sides of a block, it would need 4 loops in total, offsetting for top, bottom, left and right. Of course it add the number of instances evenly over the length of each side currently. Ideally a bit of randomness could be added here with a min/max for a number being placed on any sidewalk and not in exactly the same position - useful for things like garbage/bins/boxes/phonesboxes ect. On my one I have also added an option to not merge meshes. This is needed for things which have rigid bodies, an option to use
    PrefabUtility.InstantiatePrefab instead of Instantiate which breaks the connection, and some extra random shift in any direction, and tilt (people like driving into lampposts! -look at the ones in GTAV, they are all bent as hell)
     
    Last edited: Jan 26, 2018
  28. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
    hi when you think you plant to add Building Styles Packs, like Sci-Fi city, ’20’s New York, Italian city, Cartoon City, Apocalyptic City, Soviet City?

    as written in the description
     
  29. Neviah

    Neviah

    Joined:
    Dec 1, 2016
    Posts:
    235
    God I hope he does scifi first hah
     
    olix4242 likes this.
  30. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Yes, You are right :) Sci-Fi will be the first one.
     
    Neviah likes this.
  31. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    As soon as I finish a final CScape version.. right now we are at 0.9.5.. the nest release shoul come next week (fixing some issues introduced in new version), and then probably few weeks for poishing slated streets layout generation. also, don't forget that I will have to make some tutorials before version one hits the store.
     
    hopeful likes this.
  32. Runner88

    Runner88

    Joined:
    Mar 7, 2013
    Posts:
    3
    Why is it that .i first have found this city-generator now....I have searched every where .I could not find in the asset-store With searches..like city-gen/generator builder etc.But ok IM sold ...ill will buy within some days.
    But anyway im new here...But not with unity 3d.
    I hope this asset is the right deal for me :)
     
    olix4242 likes this.
  33. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    does it work for Mobiles ? if yes can u please add android build to test it thanks
     
  34. PrincipleZ

    PrincipleZ

    Joined:
    Jan 29, 2018
    Posts:
    2
    On Mac with Unity 2017.3
    Whenever I click generate city, it gives error

    IndexOutOfRangeException: Array index is out of range.
    CScape.CSArray.UpdateElements () (at Assets/CScape/Scripts/CSArray.cs:222)
    CScape.BuildingModifier.ModifyBuilding () (at Assets/CScape/Scripts/BuildingModifier.cs:494)
    CScape.BuildingModifier.AwakeCity () (at Assets/CScape/Scripts/BuildingModifier.cs:157)
    CScape.CityRandomizer.Generate () (at Assets/CScape/Scripts/CityRandomizer.cs:428)
    CScape.CityRandomizerEditor.OnInspectorGUI () (at Assets/CScape/Editor/CityRandomizerEditor.cs:423)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1245)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    and only several buildings will be generated. I didn't change anything but here is the random setting:


    The line of error is
    Code (CSharp):
    1.                                         if (!sparseRemove[i]) boolValue = true;
    2.  
    where length of sparseRemove is 0.

    Also there are hundreds of errors saying

    NullReferenceException: Object reference not set to an instance of an object
    CScape.BuildingModifier.OnDestroy () (at Assets/CScape/Scripts/BuildingModifier.cs:537)

    Does anyone know what's happening? Thanks.
     
    Last edited: Jan 29, 2018
  35. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Buildings width and depth are too high. While min block distances is too small for this setting. Min block distance has to be at least a sum of max street size * 2 + max sidewalk size + max depth (or width, which ever is larger) * section division max.
     
  36. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Question:
    For a building modifier - you can set the Lightness front/back and sides - however there is no extra RGB shift - currently they are all kind of grey/black, an RGB shift could give them a bit of color - so how would that be done?
    Thanks.
     
  37. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    You can controll this from a Material setup. Look at a bulding material Megacity1 and set DESATURATE value to something small like 0.
     
  38. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    ok thanks, I think its because its on Gamma color space too, which makes things very dark.
     
  39. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Hey I've been looking at the cdk documentation and I want to know would it be possible to make the mask work on the street or ground so that you could Mask out areas for Terrains to make Parks or Gardens? Hope this makes sense
    It would be similar to the mask in HorizonOn
    ahttps://youtu.be/DcdPw6raeeE
     
  40. PrincipleZ

    PrincipleZ

    Joined:
    Jan 29, 2018
    Posts:
    2
    Hi Thanks for the reply. I have adjusted the random setting to make sure it satisfies this but it still shows the same error.
     
  41. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Also, be sure that a max block distance is greater than min block distance.
    Does this happen if you import a fresh CScapecity?
    What mode are you using? Can you give me screenshot of whole city randomizer script?
     
  42. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Right now it comes to mind that you should try to reimport whole CScape (after deleting it). Sometimes some references get lost and this is a unity serialization bug that happens also with other assets).
     
    Last edited: Jan 30, 2018
    hopeful likes this.
  43. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    is it possible to control what windows have their lights on?
     
  44. angelotokyo

    angelotokyo

    Joined:
    Apr 26, 2016
    Posts:
    10
    Hello
    i have problem when i try to build even with the demo scene on a fresh project
    there the console messages
    can you help ?
    thanks you :)
     

    Attached Files:

  45. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Ops.. it looks like I have restored some scripts, and this kept definitions that shouldn't be there anymore. I will check this and let you know.
     
  46. angelotokyo

    angelotokyo

    Joined:
    Apr 26, 2016
    Posts:
    10
    Ok thank you :)
     
  47. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Issue was fixed and submitted to assetstore. It will be online in few days.
     
    hopeful likes this.
  48. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    version 0.9.5.3
    -fixed player build issue
    -fixed problem with some buildings that use grafitti even if they have disabled graffiti option
    -Added automatic UV mapping option - when making building templates, now you don't have to worry about correct UV mapping.
    -fixed bug with lighting poles not appearing on two sides.
    -fixed default building colors saturation
    -added parks texture and material
    -fixed import error
     
  49. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    FYI, i have been seeing this warning on unity 2017.3.0f3:

    Code (CSharp):
    1. Shader warning in 'CScape/CSBuildingShader': floating point division by zero at line 230 (on d3d11)
    2.  
    3. Compiling Fragment program with SHADOWS_DEPTH _GRAFFITI_ON _USE_SNOW_MOSS_DIRT_ON UNITY_PASS_SHADOWCASTER
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    5.  
     
  50. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Don't worry about this. It is a simple warning about a possible divide by zero case inside shader. Something that is impossible to happen in our case as the data stream can't contain zeroes (but unity shader compiler doesn't know this). This spam message could be avoided, but it would require another operation in shader that would impact performance (in small amount, but it is always some impact) so we are skipping this one.
     
    hopeful likes this.