Search Unity

[RELEASED] SECTR STREAM: Seamless Scene Streaming

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

  1. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    Yes, this is currently an issue with the new prefab system. We are working on an update to SECTR to support this, unfortunately I have no ETA for that update yet.
     
  2. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    It seems that you were right! Running the profiler connected to a build has a much smaller hitche, and it all seems to be stemming from:

    postlateupdate.enlightenruntimeupdate

    So, I'm guessing that the actual loading might be ok, but something it happening with the lighting that is causing the hitch? I will do a little research into this.

    Thanks for your advice!

    EDIT:

    This is a picture of the profiler (attached to a build, not the editor) when the issue occurs:

    https://imgur.com/YQZdQEP
     
    Last edited: Jan 8, 2019
  3. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    This is probably a bug, but the intent is that sectors can have children that are prefabs but they should not be prefabs themselves.
     
  4. alexrau

    alexrau

    Joined:
    Mar 1, 2015
    Posts:
    80
    Just trying SECTR complete in Unity 2018.3R2 using the Lightweight render pipeline.
    When I use the Terrain Separate tool to break into sectors and portals, the terrain splatmap gets turned into the purple color. Does anyone have suggestion on how to resolve (or if one of the other render pipelines does not have the issue)? I tried my typical Lightweight Render Pipeline solves (1. update all materials 2. reimport terraine objects (3) rebake lighting, but none seemed to work.

    Before SECTR Terrain tool:
    upload_2019-1-20_11-28-51.png

    After SECTR Terrain:
    upload_2019-1-20_11-30-6.png
     
  5. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    I assume SECTR might create the terrain chunks with the built in standard material which defaults to the unity built-in rendering. Can you please select one of the terrain chunks and check what material is assigned in the terrain settings? If Material is set to "Built-in Standard" you need to assign the same Custom rendering pipeline material you have assigned in your original terrain.
    If that fixes the problem, we need to extend the terrain split tool to copy the custom material over to the terrain chunks as well when splitting the terrain in the next update.
     
  6. alexrau

    alexrau

    Joined:
    Mar 1, 2015
    Posts:
    80
    SECTR does break the terraine into multiple little terrains (and puts bounding boxes around them to autoload in segements), however when I look at the individual terrain it seems that their shader is set right, but still showing purple.

    Thought that maybe updating the LightWeight Render Pipeline to the latest version 2.8 and restarting would solve problem, but that doesn't seem to work either.

    One of the segments that SECTR creates and the shader it sets to use.
    upload_2019-1-20_13-29-37.png
     
  7. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    Thanks for supplying the screenshots! The shader listed in the Terrain Layer inspector can differ from the actual material / shader used on the terrain. Can you please check if the correct material is referenced in the terrain material setting under the cogwheel icon? I suspect that it will show "Built In Standard" for the terrain chunks, but it would need to be the same material that is used on the original terrain.

    material.JPG
     
  8. alexrau

    alexrau

    Joined:
    Mar 1, 2015
    Posts:
    80
    Peter - Thank you very much, that sorted my issue.
    Very excited to use SECTR.
     
  9. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    isnt there any way to fix floating point errors while using sectr? maybe there is a workaround and i'm missing it?
     
  10. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    SECTR currently has no built-in solution for handling floating point errors, but we plan to add this in a future release.
     
  11. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    thanks, how much future we're talking about? 1-2 months, 6 months or more?
     
  12. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    We don't have an ETA for that yet, the next update for SECTR should definitely arrive well before 6 months. I cannot 100% guarantee the floating point fix will be in it as we have not fully evaluated it yet. In theory it should be no problem to add it, but it might turn out that there is some unknown technical issue along the road that might delay things.
     
  13. alexrau

    alexrau

    Joined:
    Mar 1, 2015
    Posts:
    80
    Having the same issue as @SureSight but mine just hangs during export of the demo of neighborStream Demo.
    The initial error message in console is "Can't remove SECTR_Member (Script) because SECTR_Hibernator (Script) depends on it"
    Is there an ETA on when Unity 2018r3 Stream?
     
  14. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    No, unfortunately we do not have an ETA for that yet.
     
  15. Mikekan13

    Mikekan13

    Joined:
    May 30, 2015
    Posts:
    90
    Does this work with VR? I have been trying to find a solution for making an open world spaceship with no loading. Steam VR always pops back into the compositor when loading a level.
     
  16. alexrau

    alexrau

    Joined:
    Mar 1, 2015
    Posts:
    80
    Is the expect
    Is the expectation that it will be fixed (1) I should setup my levels with Sectors/Portals and when asset is updated I can drop in or (2)will it be a pre-2018 asset and I should look for alternative (though inferior) solutions or (3) too early to tell?
     
  17. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    I currently do not know of any issues with VR in general, however we have not tested Steam VR ourselves yet. The Streaming works mainly by asynchronous scene loading calling SceneManager.LoadSceneAsync(), I would be surprised if that was an issue with Steam VR as this would affect many projects then.
     
  18. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    Strong (1), we will release an update that fixes these issues and we also plan to continue supporting SECTR for future Unity versions.
     
  19. alexrau

    alexrau

    Joined:
    Mar 1, 2015
    Posts:
    80
    :) Excellent. Also, have and love, CTS and Gaia from you folks, and assume Path Painter is in my future.
     
    PWPeter likes this.
  20. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Hi, I have a question.

    I have 3 split scenes, and 1 small maps on each one. How should create lighttmaps ?
    1. Should I import all scenes to main scene and bake the lightmaps all together into 1 ?
    2. Should I open each scene one by one and create their own lightmaps ?
    How is the memory managed when I load an additive scene ?
     
  21. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    You should do 1., open your scenes additively in the editor in the base scene, and bake the lightmaps. See "Baking Lightmaps with multiple scenes" here for more information: https://docs.unity3d.com/Manual/MultiSceneEditing.html

    Can you elaborate a bit more on this question? Sectr uses SceneManager.LoadSceneAsync from the Unity API to load scenes in the background, so the memory management is handled by Unity basically.
     
    MoribitoMT likes this.
  22. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    I mean how is tge lightmap data loaded unloaded with new scene, but i got my answers, thank you.
     
    PWPeter likes this.
  23. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
  24. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    65
    I have an issue where I spawn the player that has components SECTR_Member and SECTR_NeighbourLoader. The Sector then streams in, but the player has started falling with gravity.
    The player then launches into the sky as the player collides with the ground.

    Is there a way to get a callback from a Sector as it streams in or does the Member expose something I can hook so that I know when it's safe to enable the player's Rigidbody?
     
  25. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    188
    Not sure about the SECTR_NeighbourLoader, but the RegionLoader has a isLoaded(I think) bool thats "supposed" to check once all the the sectors all loaded.

    However, the timing has always been inconsistent for me.

    A solution I've found to work much better is to just to turn the gravity on once your player instantiates and check if there is a collider below. Pseudo below should work somewhere in your Start or Init:

    Code (CSharp):
    1.          
    2. //For Grounded. No Garbage
    3. RaycastHit[]  results = new RaycastHit[1];
    4.  
    5. bool grounded = false;
    6.  
    7. while (!grounded)
    8. {
    9. if (Physics.SphereCastNonAlloc(myPlayer.position + new Vector3(0, .5f, 0), 1, Vector3.down, results, .8f, groundLayers) > 0)                
    10. {
    11. //Debug.Log("hit something");
    12. grounded = true;
    13. }
    14. }
    15. //Turn gravity on
    16.  
     
    SureSight likes this.
  26. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    @SureSight @voncarp I have been asked this multiple times so far on our discord server, and I suggested the following:

    1. keep gravity off on player
    2. look up which sector the player is in with SECTR_Sector.GetContaining()
    3. check if that sector is enabled by checking if that sector is contained in SECTR_Sector.All.
    4. Turn on gravity (as the sector containing the terrain should be loaded now.)

    You could additionally look up the terrain in that sector then, get the height of the terrain at the players coordinates with TerrainData.GetHeight and place them nicely on the terrain before you enable gravity.

    I did not get around to test this procedure but I think it should work this way. If you try it and it works good for you or if there are issues it would be nice if you could report it back here.
     
  27. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    65
    Thanks for the fast reply.

    I wrote some crude code in my GameController to implement your suggested algorithm. This actually stops any sectors from streaming in at all now.
    I attempted putting inserting the Sectr_Sector above the GameController in the execution order without any luck
    Code (CSharp):
    1.  
    2. PlayerTransform = CharacterPoolUtility.SpawnPlayer(startPosition, startRotation, false);
    3. SECTR_Member member = PlayerTransform.GetComponent<SECTR_Member>();
    4. List<SECTR_Sector> sectors = member.Sectors;
    5. SECTR_Sector.GetContaining(ref sectors, PlayerTransform.position);
    6. SECTR_Sector currentSector = sectors[0];
    7. Debug.Log("Sectors found: " + sectors.Count);        //1 found
    8.  
    9. Debug.Log("Total sectors: " + SECTR_Sector.All.Count);    //3 found
    10. //Wait for the sector to stream in
    11. while (!SECTR_Sector.All.Contains(currentSector))
    12. {
    13.     //Do nothing
    14. }
    15.  
    16. Debug.Log("Sector has streamed in so enable gravity.");
    17. PlayerTransform.GetComponent<Rigidbody>().isKinematic = false;
    18. PlayerTransform.GetComponent<Rigidbody>().useGravity = true;
    It blows me away that there is no demo scene to demonstrate this common requirement.
     
  28. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    65
    I like this approach. It keeps the PlayerController and GameController more modular as they don't need to be aware of the SECTR modules.

    I have altered the way the PlayerController intialises.


    Code (CSharp):
    1. public void Initialise()
    2. {
    3.   //Force SECTR to reassess the current sector
    4.   _sectorMember.enabled = false;
    5.   _sectorMember.enabled = true;
    6.  
    7.   StartCoroutine(InitialiseGravity());
    8. }
    9.  
    10. //Waits for the level to stream in before enabling gravity so player does fall into infinity
    11. private IEnumerator InitialiseGravity()
    12. {
    13.   //Check there is a ground beneath the player
    14.   while (!Physics.Raycast(transform.position, transform.up * -1, 3))
    15.   {
    16.     yield return new WaitForEndOfFrame();
    17.   }
    18.  
    19.   _rigidbody.isKinematic = false;
    20.   _rigidbody.useGravity = true;
    21.  
    22.   _isInitialised = true;
    23. }
    The only real thing that bothers me is that I have to Disable and then Re-enable the SECTR_Member to get SECTR Stream to re-evaluate current SECTR_Sector when loading from a saved game.
    I feel dirty doing it this way.

    I thought calling the SECTR_Member.ForceUpdate() would do the trick, but it does not work as expected.

    Is there a better way to force the update of the current sector for the player's location
     
  29. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    I set up an example scenario for myself and checked, the following is working for me:

    Code (CSharp):
    1. List<SECTR_Sector> possibleSectors = new List<SECTR_Sector>();
    2. SECTR_Sector.GetContaining(ref possibleSectors, transform.position);
    3. if (possibleSectors.Count > 0)
    4. {
    5.    SECTR_Chunk chunk = possibleSectors[0].GetComponent<SECTR_Chunk>();
    6.    if (chunk && chunk.IsLoaded())
    7.    {
    8.       rigidbody.useGravity = true;
    9.    }
    10. }
    The information about SECTR_Sector.All containing only the loaded sectors was not correct, I misinterpreted the API reference in this regard, sorry about that.
    I think the Sectors stopped loading for you because you were using the list from the member to call GetContaining, resulting in the list getting overwritten due to the ref keyword.
     
    SureSight likes this.
  30. borrowedLadder

    borrowedLadder

    Joined:
    Feb 11, 2015
    Posts:
    21
    I have this working now with static objects in my scene, but I'm still confused if its even possible with dynamic objects?

    I have some rigidbody/movable props in my scene that I would also like to be unloaded (if the sector they are in is unloaded). This isn't the hibernator functionality right? (as that just disables rather than unloads?)
     
  31. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Hey everyone,

    We are very pleased to announce the next iteration in the life of the SECTR suite with the release of SECTR COMPLETE 2019.

    After observing the way in which SECTR was being sold and used, we have decided only to continue only with a SECTR COMPLETE package, and to deprecate the others. There were not enough sales of the other packages to warrant the overhead of keeping and supporting them as separate packages, however, they are still actively being supported as part of the new SECTR COMPLETE SUITE.

    We have invested considerable time and effort into upgrading, adding support for the changes imposed by changes in the engine, and in particular have focused on improving and expanding on streaming and large world support, as this fits perfectly with our world creation suite of products.

    The biggest new features and enhancements in the latest version include:
    • Unity 2018.3 and Unity 2019.x support
    • Floating Point Origin Support (extra large world support)
    • Orders of magnitude improvements in the speed of the sectorization process
    • Seamless integration with Gaia, GeNa 2 and CTS (end to end integrated world building)
    • Many easy of use enhancements
    • Many documentation enhancement (including a terrain streaming guide).
    For a more detailed description of all the enhancements we have made please check out the release notes on the asset itself.

    In line with our commitment to continue to develop and our ongoing support the SECTR suite of products we will be charging a nominal upgrade fee. This fee is not being taken out of the business, it is ALL being invested back into growing the Procedural Worlds team, and pays for our development support resources.

    Upgrade pricing is:
    • SECTR Core -> SECTR COMPLETE 2019 $47
    • SECTR Audio -> SECTR COMPLETE 2019 $17
    • SECTR VIS -> SECTR COMPLETE 2019 $17
    • SECTR STREAM -> SECTR COMPLETE 2019 $17
    • SECTR COMPLETE -> SECTR COMPLETE 2019 $17
    And for anyone who purchased in the past 90 days, the upgrade is free.

    In addition to the enhancements we have made to the documentation we are also in the process of making a bunch of new video tutorials, and these will come online in the next few days and weeks.

    We hope that the community sees the upgrades we are making and change in direction to be the positive thing it is for the future of the SECTR Suite of products.

    This forum will no longer be actively monitored - for updates please head over to the SECTR COMPLETE forum.

    Cheers,
    Adam.
     
  32. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    So I'm finally dusting SECTR Complete off and trying to figure out how to use STREAM. I did not start off my project with it integrated (I have my own scene loader and game manager) so my question is...When I hit my trigger collider and activate Streams Trigger Loader, I believe, how does SECTR Stream know that I want to go to my next Level?

    I may have missed it but it appears Stream easily handles chunks WITHIN a scene but how does it work ACROSS scenes?

    Thx
     
  33. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    130
    Peter,

    I had to modify your code in order for it to work. Your code only loaded the first sector in the list for me, when in a co-routine. My code below loads all sectors.


    Code (CSharp):
    1. List<SECTR_Sector> possibleSectors = new List<SECTR_Sector>();
    2.         SECTR_Sector.GetContaining(ref possibleSectors, FPScontroller.transform.position);
    3.  
    4.         if (possibleSectors.Count > 0)
    5.         {
    6.             //how many SECTRs need to load
    7.             while (j <= possibleSectors.Count)
    8.             {
    9.                
    10.                 SECTR_Chunk chunk = possibleSectors[j - 1].GetComponent<SECTR_Chunk>();
    11.                 while (!(chunk && chunk.IsLoaded()))
    12.                 //wait for this one to complete loading  
    13.                 {
    14.                     yield return null;
    15.                 }
    16.                 //move on to check the next one
    17.                 j += 1;
    18.             }
    19.             //all of them have completed loading
    20.             j = 1;
    21.             yield break;
    22.  
    23.         }
    24.         else
    25.         {
    26.  
    27.            //no sectors to load
    28.             yield break;
    29.         }
    30.  
    31.     }
    32.  
    33.  
     
    PWPeter likes this.
  34. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    Thanks for posting your solution for this, my example did indeed assume the player / camera is only in a single sector at the scene start, so your code is the more complete solution for this issue.
     
  35. helgarddebarros

    helgarddebarros

    Joined:
    May 10, 2014
    Posts:
    169
    When my game starts, the player loads before the scene, so he falls through the floor. My solution to this is to have an invisible plane under the point where the character loads, so he stands on the invisible plane until the scene is loaded. On save, it reads the position of the player, and moves the plane to that position, and saves it. So when the game loads again, the player is standing on the invisible plane.

    Does anyone else have a more elegant solution to this?
     
  36. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Create some sort of manager, once everything else is loaded Spawn in the player. Just so your player doesn't appear as if by magic, have a poster/screenshot covering, then fade in to the game once the player has spawned into the game. By that time everything has loaded and your player will not fall through the terrain. Or the quick and dirty solution, same thing with a poster covering the screen, with a timer to delete the gameobject that shows the image. Spawn the player in after a certain time has been met and then remove the image. But bear in mind, that certain PCs will have faster hard disk, or processing power, so I'd go for the better option to check that the scene has been loaded, before spawning the player/AI.
     
  37. helgarddebarros

    helgarddebarros

    Joined:
    May 10, 2014
    Posts:
    169
    Thanks. I do have a loadscreen image that only goes away after everything is loaded. I will try your method and see if I like it more. Thanks for the siggestion.