Class ViewConstants
Namespace: ValveResourceFormat.Renderer.Buffers
Assembly: Renderer.dll
Uniform buffer containing camera transforms, fog, and per-frame view state.
public class ViewConstantsInheritance
object ← ViewConstants
Constructors
ViewConstants()
Initializes a new ViewConstants with identity matrices and default values.
public ViewConstants()Fields
CameraDirWs
World-space forward direction of the camera.
public Vector3 CameraDirWsField Value
CameraPosition
World-space position of the camera.
public Vector3 CameraPositionField Value
CameraUpDirWs
World-space up direction of the camera.
public Vector3 CameraUpDirWsField Value
CubeFogActive
When true, cube-mapped sky fog is active.
public bool CubeFogActiveField Value
bool
CubeFogCullingParams_ExposureBias_MaxOpacity
Cube fog culling parameters, exposure bias, and maximum opacity.
public Vector4 CubeFogCullingParams_ExposureBias_MaxOpacityField Value
CubeFogSkyWsToOs
Transform from world space to the cube fog sky's object space.
public Matrix4x4 CubeFogSkyWsToOsField Value
CubeFog_Height_Offset_Scale_Exponent_Log2Mip
Cube fog height offset, scale, exponent, and log2 mip parameters.
public Vector4 CubeFog_Height_Offset_Scale_Exponent_Log2MipField Value
CubeFog_Offset_Scale_Bias_Exponent
Cube fog offset, scale, bias, and exponent parameters.
public Vector4 CubeFog_Offset_Scale_Bias_ExponentField Value
EnvWetness
Wetness coverage, drying amount, rain strength and puddle ripple strength.
public Vector4 EnvWetnessField Value
EnvWetnessRipple
Puddle ripple direction in X, over 0 to 1 for a full turn.
public Vector4 EnvWetnessRippleField Value
GradientFogActive
When true, height-based gradient fog is active.
public bool GradientFogActiveField Value
bool
GradientFogBiasAndScale
Bias and scale applied to the gradient fog density.
public Vector4 GradientFogBiasAndScaleField Value
GradientFogColor_Opacity
Color (RGB) and maximum opacity (A) for gradient fog.
public Vector4 GradientFogColor_OpacityField Value
GradientFogCullingParams
Near/far culling distances for gradient fog evaluation.
public Vector2 GradientFogCullingParamsField Value
GradientFogExponents
Horizontal and vertical density exponents for gradient fog.
public Vector2 GradientFogExponentsField Value
InvProjRow3
Third row of the inverse projection matrix, used for depth linearization.
public Vector4 InvProjRow3Field Value
InvViewportSize
Reciprocal of the viewport dimensions in pixels.
public Vector2 InvViewportSizeField Value
IsSkybox
Whether this view draws the 3D skybox rather than the world.
public bool IsSkyboxField Value
bool
LightCull
Cull mask layout of the scene being drawn, from its LightBinner.
public LightCullConstants LightCullField Value
PixelRemapIdentity
A view remapped against itself: unit scale, no bias.
public static readonly Vector4 PixelRemapIdentityField Value
ProjectionToWorld
Inverse of the projection matrix alone, mapping clip space back to view space.
public Matrix4x4 ProjectionToWorldField Value
RenderMode
Active render mode override; 0 means normal shading.
public int RenderModeField Value
int
SceneDepthFetchScale
Scene depth texels per pixel of the target being drawn: one, except in a pass drawn below the scene's resolution.
public Vector2 SceneDepthFetchScaleField Value
SceneIndex
Index of the drawn scene in Renderer.Scenes, which replacement shaders can write out.
public uint SceneIndexField Value
uint
SunLightShadowBias
Depth bias applied when sampling the sun light shadow map.
public float SunLightShadowBiasField Value
float
SunShadowsEnabled
Whether this view samples the sun shadow cascades.
public bool SunShadowsEnabledField Value
bool
Time
Current scene time in seconds, used for animated effects.
public float TimeField Value
float
ViewToProjection
Projection matrix transforming camera-space positions into clip space.
public Matrix4x4 ViewToProjectionField Value
ViewportMaxZ
Maximum window-space depth of the viewport depth range (the near plane under reverse-Z).
public float ViewportMaxZField Value
float
ViewportMinZ
Minimum window-space depth of the viewport depth range (the far plane under reverse-Z).
public float ViewportMinZField Value
float
ViewportSize
Viewport dimensions in pixels.
public Vector2 ViewportSizeField Value
VolumetricFogActive
When true, volumetric fog is active and evaluated in the shader.
public bool VolumetricFogActiveField Value
bool
VolumetricFogDepthWarp
Warp of the volumetric fog slices and one over its log2, or zero for slices along a square.
public Vector2 VolumetricFogDepthWarpField Value
VolumetricFogNearRange
Distance of the volumetric fog volume's first slice and the distance from it to the last slice.
public Vector2 VolumetricFogNearRangeField Value
VolumetricFogPadding
Keeps the view constants a multiple of 16 bytes.
public Vector2 VolumetricFogPaddingField Value
WorldToProjection
Combined world-to-clip transform (view * projection).
public Matrix4x4 WorldToProjectionField Value
WorldToProjectionPrev
World-to-clip transform from when the depth pyramid was last generated, used for GPU occlusion culling.
public Matrix4x4 WorldToProjectionPrevField Value
WorldToShadow
Transform matrix from world space into shadow map texture space, for the first sun cascade. Forms g_matWorldToShadow[0] in the shader.
public Matrix4x4 WorldToShadowField Value
WorldToShadowCascade1
Transform into the second, wider sun shadow cascade. Forms g_matWorldToShadow[1].
public Matrix4x4 WorldToShadowCascade1Field Value
WorldToShadowCascade2
Transform into the third, widest sun shadow cascade. Forms g_matWorldToShadow[2].
public Matrix4x4 WorldToShadowCascade2Field Value
WorldToView
View matrix transforming world-space positions into camera space.
public Matrix4x4 WorldToViewField Value
Properties
FarPlane
Gets the far plane distance, or float.PositiveInfinity when there is none.
public float FarPlane { get; }Property Value
float
Remarks
See ViewConstants.NearPlane for where these come out of the matrix.
NearPlane
Gets the distance to the near plane this view was projected with.
public float NearPlane { get; }Property Value
float
Remarks
Recovered from the projection, so it adds nothing to the GPU layout. The reverse Z form Camera.CreateProjectionMatrix() builds has M33 = near / (far - near) and M43 = near * far / (far - near), which inverts to this exactly and reduces to M43 when far is infinite.

