Search Unity

[RELEASED] SECTR COMPLETE: Spaces, and the Connections Between Them

Discussion in 'Assets and Asset Store' started by MakeCodeNow, Feb 21, 2014.

  1. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    This is pretty much working as intended. Occluders have a normal and if you are on the wrong side then it doesn't have any effect. I usually recommend people have an occluder that only orient around Y inside the building. That creates a cylinder rather than a box, but it's cheap and often good enough. Alternatively you can have occluders that don't rotate on each side of the building.
     
    MoribitoMT likes this.
  2. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    293
    Thanks. I finally understand the that only one side of occluder is effective. I did your "Alternatively you can have occluders that don't rotate on each side of the building." and it works great.
     
    hopeful likes this.
  3. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    293
    Hi,

    I have one more question. I have around 80 - 100 occluders in my city which are carefully placed ( I am making a mobile game for iOS / Android ). And the performance is just great, batches reduced from 33 to 25 and vertices reduced from 200k to around 100k with only 3-4 ms exchange with CPU.

    However Sectr creates around 3kb to 5kb memory ( Garbage Collection / GC Alloc ) every frame. I am not garbage collection master however for every frame 3-5kb sounds high, is there way to decrease this ?
     
    Last edited: Oct 27, 2017
  4. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Glad you're happy with the overall result but the GC is higher than I'd expect. Can you post an image of the profiler expanded to see which calls are generating the most garbage?
     
    MoribitoMT likes this.
  5. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    293
    In editor it is like 3 to 5kb, however I profiled it in my iPhone it is around 128b which is normal and acceptable. I will do more tests and get back to you,
     
  6. BV123

    BV123

    Joined:
    Dec 7, 2016
    Posts:
    33

    Awesome, worked like a charm. Thanks! :)
     
  7. BV123

    BV123

    Joined:
    Dec 7, 2016
    Posts:
    33
    Cool, really grateful for the help! :)
     
  8. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    I'm having issues with the terrain sectorizing tool. I spawn all of my trees, rocks, etc. using Gena, make sure they are set to static and they still don't get included when I check the "Include statics" check box. I even checked "include dynamic objects" just to be safe. I've tried it with the objects parented to the terrain and without and it doesn't work either way. I've tried it with splitting the terrain and without splitting. Still nothing.

    What am I missing, @MakeCodeNow? Do the objects have to be painted on the terrain using the terrain editor itself? If so, this is going to be a bit of a problem for me. All of my trees and rocks have scripts making them "mineable" and painting them with the terrain tools tends to much that up.

    My terrain is 8192x8192 and needs to be split 16x16 which means I get 256 chunks. I really don't want to have to go chunk by chunk and spawn things with Gena.
     
  9. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Okay. Trying again. Went about it a bit differently and now it's taking a super long time to build the sectors which I think is a good sign... *fingers crossed*

    Edit: Fail. All trees, rocks, etc. have disappeared again. I think I might be overloading it so I'm going to try again with fewer objects. Also, I noticed that if I have "dynamic objects" checked it does parent things like my player, game controller, and UI to sectors so that's working. o_O
     
    Last edited: Nov 9, 2017
  10. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Okay, it looks like overloading the sectorizing process was the issue. I tried it with only 250 objects and most of them got parented to their respective sectors.
     
  11. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Are the objects very large? SECTR will only touch objects that fit inside the bounds of the sector. Anything that extends outside of a single sector will be ignored by design.
     
  12. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    No, they are mostly smaller trees and rocks. Some are getting left out and that's fine. I imagine they overlap sectors so I expect that to happen. I just tested again w/ over 1k objects and it worked. That was just with sectorizing though. Now I'm testing to see what happens when I split the terrain in the same pass. Even if this doesn't work I can make two scenes, place the objects and create the sectors in one. Then actually split the terrain in the other scene and assign those chunks to the ones sectors with the objects attached in the other scene. It's still not a "perfect" solution but it's a lot faster and effective than having to use GeNa to spawn objects in every chunk post-split. That's good enough for me.

    I'm just trying to streamline my work-flow as much as possible and so far I'm pretty happy with the progress.

    Edit: Worked with splitting too. Now to undo and add more stuff till I hit the limit. :)
     
    Last edited: Nov 9, 2017
  13. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Consider me your un-official stress-tester. ;-)
     
  14. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Ok! There should be no limit to the number of objects either. It'll just take longer the more objects you have.
     
  15. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Yeah, that seems to be the case. I think the issue only arises when you split the terrain in the same operation. I don't think it's a flaw in your asset. I think Unity just can't handle it. I've tried it with over 10k objects now and it works fine. I suppose I'll have to split the terrain in another scene w/o the objects now and then link those chunks to the sectors in the one that includes the object and delete the main terrain but that's not really a big deal. Perhaps in a future update you could add an option to split the terrain w/o creating sectors to get around this?
     
  16. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Also, just as a note to others - it doesn't seem to work if the objects are parented to the terrain. Whether or not it works if all of a certain type of object are parented to a master empty object - I'm not sure. Since the whole thing has been so time-consuming I haven't tried it that way. I kept all of the objects in the scene, unparented.
     
  17. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Providing an option to split without creating sectors would be very easy to add. I'll look into adding that soon.
     
  18. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Awesome, thanks! That would save me a lot of time!
     
  19. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Okay, just for clarification for other users, statics cannot be parented to empty objects to be picked up by the add SECTRs function. You might want to make a note of that in the docs.

    I also found a little workaround for the issue with SECTRs not including statics if they are split in the same process. Make SECTRs w/o splitting first and check 'include statics'. Then go back in and split the terrain. This will make duplicate SECTRS with the split terrain pieces parented to them. I then open another Hierarchy tab and lock both tabs.

    Have your SECTRS with the statics on one side and the SECTRS with the split terrains in the other hierarchy tab. Then simply go SECTR by SECTR parenting the statics to the split terrain pieces in the newly created statics. Once your done, ensure that all the SECTRs and portals that were first made in the 'include statics' pass are empty and then delete them.

    I'm currently in the process of exporting so I'm not 100% sure the statics are going to be included but it looks like they will be because the export process is taking much longer than normal and I'm just using 8x8 SECTRs on a 4096² terrain.

    I will update this post when I am certain it worked properly. It looks like that could be a while. o_O

    Edit: It worked. I should probably write a short tutorial on doing this correctly/most efficiently (if you're not using terrain tools to place your stuff) and post it over in the STREAM forum. It took me quite a bit of trial and error to get it straight.
     
    Last edited: Nov 11, 2017
  20. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    That's all very strange. The code for reparenting should have nothing to do with splitting or not. I just checked the code and don't see any obvious flaws along these lines, but will try to repro myself soon.
     
  21. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    No biggie. I probably just did something wrong. At this point I'm just using GeNa to spawn all of my stuff on each chunk anyway. It's time to revise my quick and dirty "just see if it works" saving and loading methods and currently I'm thinking that having it handled via lists on each chunk will be the way to go.
     
    boysenberry likes this.
  22. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,101
    On upgrading to Unity 2017.3f3 has an error in the core : SECTR_Member.cs(112,79): error CS1061: Type `UnityEngine.Light' does not contain a definition for `isBaked' and no extension method `isBaked' of type `UnityEngine.Light' could be found. Are you missing an assembly reference?

    I'll downgrade to 2017.2f3 for now, as there has been changes to lighting and other areas that may have issues.
     
  23. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Thanks for the bug report. I'll take a look and get back to you.
     
    julianr likes this.
  24. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I'll upload a proper fix soon, but if you want to hack in a quick fix, just change .isBaked to .bakingOutput.isBaked
     
    boysenberry and julianr like this.
  25. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,101
    Thank you - much appreciated.
     
  26. jlpeyton

    jlpeyton

    Joined:
    Dec 22, 2017
    Posts:
    19
    Since I'm wanting a large open terrain, what would be the best method to go about doing this? In the quick start video you have "chunks" which are basically game object rooms which SECTR can turn on and off. Do I just create multiple 1km x 1km terrains in the same scene?
     
  27. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    The easiest solution is to create a full size terrain and then use the included terrain window tool to split it into smaller chunks.
     
    GamerPET likes this.
  28. jlpeyton

    jlpeyton

    Joined:
    Dec 22, 2017
    Posts:
    19
    Well...that sounds incredibly easy with SECTR. Nice! Is there any performance improvements during scene editing once the terrain is split? I'm using a LOD vegetation package and Gaia to generate the terrain. When I generate the terrain size I'm going for (about 16K). My computer slows way down and it becomes impossible to work in scene view. This is before adding anything other than just a terrain object.
     
  29. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Once you've split the terrain you can export it for streaming. Then you can import individual tiles to work on them. Loading just one or two tiles will be much faster than having the whole map loaded.
     
  30. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    642
    When building (desktop windows) the included open worl streaming example the build fails because of this error:
    Code (CSharp):
    1. Assets/SECTR/Code/Core/Scripts/SECTR_Member.cs(816,16): error CS1061: Type `UnityEngine.Light' does not contain a definition for `isBaked' and no extension method `isBaked' of type `UnityEngine.Light' could be found. Are you missing an assembly reference?
    Something I can do to get this fixed? Using Unity 2017.3.0p1

    Edit: changing the line to 'childLight.bakingOutput.isBaked && ' did fix my issue, not sure it is covering all unity versions above 5.4 though.
     
    Last edited: Jan 27, 2018
  31. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    The latest version of SECTR should have an official fix for that, though the change you made is fine for 2017.3.
     
  32. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    642
    I'm on Sectr 1.3.5, is there a newer version? This isn't showing up in the asseet store though.
     
  33. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I see the problem. 1.3.5 was pushed with only half the fix for that bug. I'll push 1.3.6 in a bit, but for now looks like you have a local fix.
     
  34. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    642
    Indeed, it works so not urgent by any means. Thanks!
     
  35. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    167
    What would be the best way to pause Sectr Stream functionality? For instance, I have a character running around and he dies. His body and region loader is replaced by a ragdoll so the terrains are being unloaded. Do you know where I can start to look?
     
  36. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You need to keep the region loader around. Maybe just disable the other components rather than destroying the object entirely.
     
    voncarp likes this.
  37. Poopaloop

    Poopaloop

    Joined:
    Aug 1, 2013
    Posts:
    20
    Thinking of getting SECTR, but my terrains use Megasplat. Will the terrain component of SECTR work ok with Megasplat? It's a bit different to texturing than the usual method.

    Thanks
     
  38. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I'm not sure, honestly. I haven't tried it with MegaSplat.

    The streaming should work fine as long as the terrain is already split up.

    If you need to use SECTRs terrain splitting tool, that's only guaranteed to work on regular unity terrain, so it probably won't work if MegaSplat uses a bunch of custom components and rendering methods. This tool is included in SECTR core which is free, so you could try it for yourself if you like.
     
  39. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    61
    Is there a recommended practice for loading scenes and spawning player character dynamically. Most of the examples I have seen include the player in the scene already.

    I have an issue where my player spawns and falls through the ground that has not yet been streamed in :(
     
  40. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    521
    i have that issue since i bought the asset from their first release never was able to use it as it was promoted contacted them many times never got anything solved i'm really jealous how other say it works perfectly for them
     
  41. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,855
    Seems like you need to know when the streaming has finished, and then spawn your character. Is there no way to know when the streaming has finished?
     
  42. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Is there a loader component on your player? The default behavior is that it tries to freeze any physics on your player until the initial sectors are loaded in. If the loader is on another game object that could be the problem. Or do you maybe use a custom solution for player physics?
     
  43. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    61
    I am using the Camera as an observer, not the character. This is because the camera can be detached from the player and move independently in certain game modes.
     
  44. Brodal

    Brodal

    Joined:
    Jan 26, 2013
    Posts:
    8
    Ive been looking into Sectr and it looks really nice. One question i have though, is there an easy way to handle different LODs in chunks based on distance? From my understanding the built in LODing in unity has quite a high CPU overhead when working with thousands of objects. Our workflow so far has been chunking everything into manageable pieces then combining each chunk into 1 mesh each. Currently we load differently LODed chunks based on distance, meaning we dont use the built in unity loding. We've however found critical flaws in the system we use now, which is why we're looking into using SECTR. I can't however find a good way of handling LODs in a big open world.

    So in short, we currently dont use the unity LODing, but just load in different scenes based on how far the chunk is from the player. We also do this for terrain, just loading in scenes with low poly terrain mesh at a distance from the player, only loading unity terrain which is close to the player. I'm wondering what the best approach for this would be in SECTR?
     
    Last edited: Jun 13, 2018
  45. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Sorry for the slow response, but you basically need to either delay the spawn of your player until the chunks are loaded or spawn them with their physics disabled. You can see examples of the latter by looking into the SECTR_Loader.cs class.
     
  46. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    The closest analog to what you want in SECTR STREAM is the Proxy feature. This allows you to define a mesh that appears when a Sector is unloaded. When that Sector is loaded, the mesh is hidden. Usually this proxy mesh is a much simplified version of the real asset, so you can think of it as a very basic kind of single level LOD. If you wanted the Proxy system to have multiple levels of detail you could probably add that without too much trouble.
     
  47. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    167
    I have a terrain that is chunked. It had a script on it but it didn't seem to survive the export. Where would I look to be able to add this script at runtime?
     
  48. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    167
    This seems to work under FindChunkRoot

    chunkRoot.transform.GetChild(0).gameObject.AddComponent<NavMeshSourceTag>();
     
  49. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Yeah . That should be fine. The other option is to add it to a game object that is the parent of the sector.
     
  50. Zenithin

    Zenithin

    Joined:
    Jun 7, 2016
    Posts:
    13
    Hey ! Does Sectr works with Asset Bundles?
    We need to load a big enough map on Webgl using Asset Bundles . Would Sectr work in that sector?