Streaming

Cullpoint Info

The cull point is the origin for the surrounding entities (by default, it’s a child of the camera). The cull state of the surrounding entities varies depending on the distance to the culling point (example). You can change the distances in the cull config.

States

  • Culled : entity is far away (by default, the entity is destroyed or disabled).

  • CloseToCamera : entity is enabled but with limited or modified functionality for better performance.

  • PreInitInCamera : state between to CloseToCamera and InViewOfCamera, currently used to activate static physics objects [optional].

  • InViewOfCamera : entity is fully enabled.

Default State List

The default list is used for most objects, contains Culled, Close to camera, In view of camera states.

_images/CullStateExample1.png

Default state list example.

Note

  • States add to the prefab entity by CullComponentsExtension.CullComponentSet extension method.

Extended State List

The extended state list is used for objects that require a pre-init state before viewing in camera state, but earlier than the close to camera state, contains Culled, Close to camera, Pre-init in camera, In view of camera states.

_images/CullStateExample2.png

Extended state list example.

Note

  • States add to the prefab entity by CullComponentsExtension.PreinitCullComponentSet extension method.

  • It is used in the project for static physics objects to load them earlier than the dynamic physics objects to avoid dips through static surfaces.

Scene Streaming

Road Streaming

Road Streaming is needed to split the map into chunks to create huge maps, so that road entities: TrafficNodes, PedestrianNodes, etc. are only loaded where the player is.

Youtube tutorial.

How To Adjust

  1. Enable streaming in the Road Streaming Config to load road sections at the runtime.

  2. Adjust load/unload distance and section cell size.

  3. TrafficNode, PedestrianNode, TrafficLightHandler automatically attaches to related RoadSegment.

  4. Traffic lights has a SectionObjectAuthoring component.

  5. If you want to add your own section object, add the SectionObjectAuthoring component and select the appropriate Section object type.

  6. Debug streaming distance and section size.

    _images/RoadStreamingExample.png

    Road streaming example.

Section Object Authoring

_images/SectionObjectAuthoring.png
Section object type:
  • Attach to closest : attach to nearest road section.

  • Create new if nessesary : create a new road section if doesn’t exist with the currently computed section hash.

  • Provider object : object has a component that implements the IProviderObject interface, that provides a reference to the associated object section.

  • Custom object : user’s own associated object section.

Include childs : all child objects are included in the section of the parent object.

Scene Streaming

You can split the scene content into chunks for partial loading at runtime.

Youtube tutorial.

How To Create

  1. Create a new empty GameObject and add the SubSceneCreator component.

  2. Adjust the chunk settings.

  3. If necessary, enable post process settings [optional step].

  4. Press the Create button.

  5. Adjust the Streaming Level Config to load/unload subscenes at the runtime.

SubScene Chunk Creator

Content chunking tool to split the scene into chunks. Old objects remain disabled in the old scene and are used to create duplicates in the chunk sub-scenes.

_images/subSceneCreator.png

Assigments

Custom parent : custom parent of subscene.
Scene name : subscene template name.
Create path : create subscenes path.

Chunk Settings

Chunk size : chunk size.
Position source typesource position of the object to be assigned to the chunk.
  • Object position

  • Mesh center

Destroy previous created : destroy previously created chunks.
Object find methodmethod for finding an object to add to a chunk.
  • By tag : by Unity tag.

  • By layer : by Unity layer.

Target tag : search tag.
Disable old source objects : turn off the source objects.
Disable source object type
  • Mesh renderer : disable meshRenderers of source objects.

  • Parent : disable parents of source objects.

  • Parent if no mesh : disable the meshRenderer, but if not, disable the parent.

Assign new layer : assign new layer to objects created from new chunks.

Post Process Settings

Copy physics shape : on/off PhysicsShape Transfer tool.
Post process new object : on/off post processing of the object.
Component type name : target component name.
Post process type:
  • Delete component : the component found will be deleted.

  • Delete object : the object with the found component will be de.

Chunk Data

Buttons

Create : create subscene chunks.
Enable/disable scene objects : enable/disable source scene objects.
Enable/disable sub scene objects : enable/disable created subscene objects.
Reset save path : reset save path of the subscenes.
Clear : clear created subscene chunks.

Configs

Cull Config

Config of the cull point.

_images/CullConfig.png
Has cull:
  • Max distance : maximum distance to activate entities.

  • Visible distance : distance to activate visual features of entities.

Show debug : on/off visual culling circle in the scene.

Road Streaming Config

Config for load/unload road sections from the entity subscene.

_images/RoadStreamingConfig.png
Streaming is enabled : on/off streaming.
Ignore Y : ignore calculation of distance to road section for Y axis.
Distance for streaming in : distance at what the road section is loaded.
Distance for streaming out : distance at what the road section is unloaded.
Section cell size : cell size of the road section.
Node cell size : node size for TrafficNode and PedestrianNode in order to compute a unique position hash for them.

Streaming Level Config

Config for load/unload content subscenes.

_images/StreamingLevelConfig.png
Streaming is enabled:
  • Distance for streaming in : distance at what the subscene is loaded.

  • Distance for streaming out : distance at what the subscene is unloaded.