# Overview

“Stream Cache” is the internal data format of HOOPS Communicator designed for fast model streaming and client/server interaction. It is a highly compressed format derived from our own PRC standard with support for the full breadth of geometry and product structure information found in CAD models.

Frequently, a Stream Cache model will be the result of a CAD conversion via our conversion tools, but you can also author your own Stream Cache data from scratch. For more information on how to convert your own CAD data into the SC format or to author data in the SC format, please see the links below:

- Converter

- SC Authoring

## Format variants

A Stream Cache model can come in different forms depending on the use case: It can be a file or multiple files on disk, or it can be just a memory buffer transferred from the server. The SC format variants that HOOPS Web Viewer supports are described below. For more information on how to load an SC model please see the Configuration section of the Programming Guide.

## SC directory

By default, the conversion tools generate a directory containing all the relevant parts of an SC model directly accessible to the server. The directory also contains data useful for model editing and serialization workflows, though such workflows are currently not fully supported by the HOOPS Web Viewer. You should choose this format if associating multiple files to a model is not an issue for your server backend and you don’t want to incur a performance penalty for a decompression step:

See above for the typical content of an SC model. The content of an SC directory is for “internal” use only and should be regarded as a single unit. However, if you are not interested in editing workflows you can delete the _meshes.sci file, which contains the uncompressed mesh data of the model.

To generate an SC model as a folder use the `--output_sc` in the Converter application.

### SCZ

The SCZ file is a single file version of the above SC directory. It is a useful format if you want to maintain a one-to-one relationship between the converted (or authored) CAD model and the SC model on your backend. It comes in two different flavors:

- Compressed SCZ

  > By default, an SCZ file is the content of the SC directory compressed into a single file during the authoring/conversion stage. Before a compressed SCZ can be accessed, the server must decompress the file into a temporary directory. For very large models this can take a bit of time.

  > To generate an SCZ file, use the –sc_create_scz command-line option in combination with the –-output_sc option.

- Uncompressed SCZ

  > An uncompressed SCZ stores all files in the SC directory relevant for viewing into a single file that the server can randomly access without having to decompress it first. This means that the server can access and use this file directly and no temporary directory is required. The downside is that the file will generally be larger than a compressed SCZ.

  > It is important to note that - despite their name - uncompressed SCZ files are still internally compressed, especially when it comes to the mesh data. In general, the size difference between compressed and uncompressed SCZ files will not be significant.

  > To generate an uncompressed SCZ, use the –sc_create_scz command-line option in combination with the -–output_sc option along with `--sc_compress_scz=false`.

### SCS

While all the above-mentioned variants of the Stream Cache format support server-side streaming, SCS files are specifically designed to be directly readable by HOOPS Web Viewer in the browser without a server connection. They cannot be read by the server and are meant for viewing scenarios where no server is present.

When we first designed HOOPS Communicator, having quick access to models was one of the key design goals but we quickly realized that it can be challenging to set up the server infrastructure to manage many simultaneous streaming sessions. To help simplify deployment of the HOOPS Web Viewre, we introduced the SCS format. In addition to reducing server complexity, SCS files will often be cached in the browser, so if an SCS file is already cached locally, viewing the model might actually be faster with this method than streaming it via the server.

The downside is that an SCS file must be completely downloaded to the HOOPS Web Viewer before it can be viewed. It is organized in a way that as soon as it is downloaded it will have a similar streaming behavior as a regular SC model served by the HOOPS Server. However, as opposed to server-based streaming, all the data within an SCS file will be fully parsed and added to the HOOPS Web Viewer database, so there is no camera-dependent streaming when loading SCS files.

To generate an SCS file, use the `--output_scs` command-line option.

NOTE: SC models streamed from the server (either as a directory or in the two SCZ variants) cannot be mixed with SCS file loading, so it is not possible to add an SCS file into a viewing session with a server connection and vice versa. HOOPS Web Viewer is either in server-based streaming mode or it is not connected to the server - it cannot switch modes after initialization.