Skip to content

Shader Globals

The following contains an overview of shader global variables provided by default in ChilloutVR, enabling dynamic shaders that respond to player states, hardware info, and system features.


Runtime and Client State

These globals expose the current system time, instance data, user hardware status (e.g., FBT or controller battery), and client UI state.

Global Type Description
CVRTime vec4 x: System Time Seconds
y: UTC Seconds
z: DayOfYear
w: IsLeapYear (0 or 1)
CVRGlobalParams1 vec4 x: Ping
y: Players in instance
z: Left Controller Battery
w: Right Controller Battery
CVRGlobalParams2 vec4 x: FullbodyActive (0 or 1)
y: Left Foot Battery
z: Right Foot Battery
w: Hip Battery
CVRIsUsingVr float Whether the client is in VR mode (0 or 1)
CVRPlayerUpVector vec3 Up vector of the local player
CVRQuickMenuOpen float Whether the Quick Menu is open (0 or 1)
CVRMainMenuOpen float Whether the Main Menu is open (0 or 1)

Camera Rendering

Provides information about the currently rendering camera.

Global Type Description
CVRRenderingCam float 0: Normal Camera
1: Portable Camera
2: CVRMirror Camera

Player Positions

These globals expose bone and positional tracking data for players in the instance. The local player is always at index 0. The order of remote players is not guaranteed and cannot be relied upon for identification.

Global Type Description
_CVR_PlayerRootPositions vec4[] x, y, z: Root Position
w: Avatar Height (meters)
_CVR_PlayerHipPositions vec4[] Hip Position
_CVR_PlayerHeadPositions vec4[] Head Position
_CVR_PlayerChestPositions vec4[] Chest Position
_CVR_PlayerLeftHandPositions vec4[] Left Hand Position
w: Left Hand Gesture Value
_CVR_PlayerRightHandPositions vec4[] Right Hand Position
w: Right Hand Gesture Value
_CVR_PlayerLeftFootPositions vec4[] Left Foot Position
_CVR_PlayerRightFootPositions vec4[] Right Foot Position

Tip

These arrays are capped at 255 entries. Use CVRGlobalParams1.y to retrieve the number of players in the instance.


Custom Global Parameters

Provided by the CVRGlobalShaderUpdater CCK World Component that allows you to define custom global parameters outside of Scripting.

Global Type Description
CVR_CCK_Global_1 vec4 Custom value from CVRGlobalShaderUpdater
CVR_CCK_Global_2 vec4 Custom value from CVRGlobalShaderUpdater
CVR_CCK_Global_3 vec4 Custom value from CVRGlobalShaderUpdater
CVR_CCK_Global_4 vec4 Custom value from CVRGlobalShaderUpdater

Tip

Custom global textures can also be defined via CVRGlobalShaderUpdater. These textures are then accessible via the CVRTexturePropertyParser CCK Component.