s&box docs
GuidesRenderingShadersReference

Global Variables

The global namespace has a bunch of useful variables.

The global namespace has a bunch of useful variables.

I don't love these names but they're not going to go anywhere, so you're free to use them. In all likelihood in the future we'll get together and create a bunch of nicer #define's for them, so g_flTime will be accessible viaTime.Now, or just time etc.

Time

TypeNameDescription
floatg_flTimeCurrent time

Camera

TypeNameDescription
float4x4g_matWorldToProjection
float4x4g_matProjectionToWorld
float4x4g_matWorldToView
float4x4g_matViewToProjection
float3g_vCameraPositionWsCamera position in world space
float3g_vCameraDirWsCamera direction in world space
floatg_flViewportMinZ
floatg_flViewportMaxZ
float2g_vViewportSize
float2g_vViewportOffset
float2g_vRenderTargetSize

Referenced API

Canonical API pages mentioned in this guide.

Created at:
Updated at:

On this page