Class ViewConstants
Namespace: ValveResourceFormat.Renderer.Buffers
Assembly: Renderer.dll
Uniform buffer containing camera transforms, fog, and per-frame view state.
public class ViewConstantsInheritance
Constructors
ViewConstants()
Initializes a new 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
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
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
PixelRemapIdentity
A view remapped against itself: unit scale, no bias.
public static readonly Vector4 PixelRemapIdentityField Value
ProjectionToWorld
Inverse of , mapping clip space back to world space.
public Matrix4x4 ProjectionToWorldField Value
RenderMode
Active render mode override; 0 means normal shading.
public int RenderModeField Value
SunLightShadowBias
Depth bias applied when sampling the sun light shadow map.
public float SunLightShadowBiasField Value
Time
Current scene time in seconds, used for animated effects.
public float TimeField Value
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
ViewportMinZ
Minimum window-space depth of the viewport depth range (the far plane under reverse-Z).
public float ViewportMinZField Value
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
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
WorldToView
View matrix transforming world-space positions into camera space.
public Matrix4x4 WorldToViewField Value
_ViewPadding1
Padding to maintain 16-byte struct alignment.
public Vector2 _ViewPadding1Field Value
_ViewPadding2
Padding to maintain 16-byte struct alignment.
public float _ViewPadding2Field Value
Properties
FarPlane
Gets the far plane distance, or when there is none.
public float FarPlane { get; }Property Value
Remarks
See 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
Remarks
Recovered from the projection rather than carried as a field, so it costs nothing in the layout this class is marshalled to the GPU with. The reverse Z form
builds hasM33 = near / (far - near) andM43 = near * far / (far - near), which inverts to this exactly and collapses to plain M43 when the far plane is infinite.

