{"id":2216,"date":"2018-11-14T05:14:22","date_gmt":"2018-11-14T05:14:22","guid":{"rendered":"https:\/\/www.migenius.com\/?p=2216"},"modified":"2020-11-02T21:29:10","modified_gmt":"2020-11-02T21:29:10","slug":"scopes-in-realityserver","status":"publish","type":"post","link":"https:\/\/www.migenius.com\/articles\/scopes-in-realityserver","title":{"rendered":"Scopes in RealityServer"},"content":{"rendered":"

A core concept in RealityServer which many new users have some difficulty understanding is Scopes<\/em>. The use of scopes is critical in making effective use of RealityServer in a production environment where multiple users or multiple independent operations are happening at once. In this article we will go into more depth on what scopes are and how to use them.<\/p>\n

<\/p>\n

Terminology<\/h3>\n

Before diving into scopes you really need to understand some of the terms we will use in relation to how data is stored and used in RealityServer. These terms are utilised throughout the documentation and it is important to have an understanding of what they mean. The main three you need to know are Database<\/em>, Elements<\/em> and Attributes<\/em>.<\/p>\n

Database<\/h4>\n

RealityServer includes a unique, in-memory database which holds all of the information that is loaded and used at any given time. Unlike a traditional database, this resides entirely in server memory and is not persisted to disk. You will not see the database referred to in the documentation often except for the C++ and Iray API since you rarely need to directly manipulate it when using RealityServer normally.<\/p>\n

It is difficult to stress just how unique RealityServer’s database system is and much of which relates to its handling of scopes. We are not currently aware of any other similar database for 3D applications which operates in this way and it is one of the reasons that adapting other renderers for deployment as a multi-user web service doesn’t really work. Once you’ve seen the power of scopes below it should become clear why this is needed.<\/p>\n

Element<\/h4>\n

The RealityServer database stores Elements<\/em>. An element is an instance of a specific type of data which RealityServer can use. You can always find all of the supported element types in the documentation for the create_element<\/em> command. Some examples of common element types are:<\/p>\n