Class Renderer
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Main renderer for Source 2 scenes with support for shadows, post-processing, and multiple render passes.
public class RendererInheritance
Constructors
Renderer(RendererContext)
Initializes a new renderer with the given context.
public Renderer(RendererContext rendererContext)Parameters
rendererContext RendererContext
Shared context providing loaders and caches.
Properties
BarnLightShadowBuffer
Depth-only framebuffer atlas used for barn light shadow mapping.
public Framebuffer? BarnLightShadowBuffer { get; }Property Value
BaseBackground
Default background used when no skybox is available.
public SceneBackground? BaseBackground { get; protected set; }Property Value
Camera
Active camera used for view and projection transforms.
public Camera Camera { get; set; }Property Value
DefaultSunAngles
Default sun angles for lighting used by viewers without lighting information
public static Vector2 DefaultSunAngles { get; }Property Value
DefaultSunColor
Default sun color for lighting used by viewers without lighting information
public static Vector4 DefaultSunColor { get; }Property Value
DeltaTime
Time elapsed since the last frame, in seconds.
public float DeltaTime { get; set; }Property Value
IsWireframe
When true, geometry is rendered as wireframe lines.
public bool IsWireframe { get; set; }Property Value
LockedCullFrustum
When not null, culling uses this frustum instead of the camera frustum, freezing the cull state.
public Frustum? LockedCullFrustum { get; set; }Property Value
LockedCullPosition
When not null, PVS queries use this position instead of the camera position, freezing the PVS state.
public Vector3? LockedCullPosition { get; set; }Property Value
MainFramebuffer
Target framebuffer for the main scene render; must be set before calling .
public Framebuffer? MainFramebuffer { get; set; }Property Value
Postprocess
Post-processing renderer handling tone mapping, bloom, and MSAA resolve.
public PostProcessRenderer Postprocess { get; set; }Property Value
RendererContext
Shared renderer context containing loaders and caches.
public RendererContext RendererContext { get; }Property Value
ResolvedSceneColor
Resolved (non-MSAA) scene color in rgba16f format, used for refraction, bloom input, and luminance computation. Filled by .
public RenderTexture? ResolvedSceneColor { get; }Property Value
ResolvedSceneDepth
Resolved (non-MSAA) scene depth in R32F format, used for the depth pyramid and occlusion culling. Filled by .
public RenderTexture? ResolvedSceneDepth { get; }Property Value
Scene
The main scene to render.
public Scene Scene { get; set; }Property Value
ShadowDepthBuffer
Depth-only framebuffer used for directional (sun) light shadow mapping.
public Framebuffer? ShadowDepthBuffer { get; }Property Value
ShadowTextureSize
Width and height in texels of the shadow depth buffers.
public int ShadowTextureSize { get; set; }Property Value
ShowSkybox
When true, the skybox is included in scene rendering.
public bool ShowSkybox { get; set; }Property Value
Skybox2D
Optional 2D skybox rendered as the scene background.
public SceneSkybox2D? Skybox2D { get; set; }Property Value
SkyboxScene
Optional 3D skybox scene rendered behind the main scene.
public Scene? SkyboxScene { get; set; }Property Value
Textures
Named textures bound to reserved slots for all render passes.
public List<(ReservedTextureSlots Slot, string Name, RenderTexture Texture)> Textures { get; }Property Value
List<(ReservedTextureSlots Slot, string Name, RenderTexture Texture)>
Timings
GPU timing queries for profiling render passes.
public Timings Timings { get; }Property Value
Uptime
Total time elapsed since the renderer was started, in seconds.
public float Uptime { get; set; }Property Value
ViewBuffer
GPU uniform buffer containing per-view constants such as view-projection matrices.
public UniformBuffer<ViewConstants>? ViewBuffer { get; set; }Property Value
Methods
Dispose()
Releases GPU resources owned by this renderer.
public void Dispose()DrawMainScene()
Renders the opaque and translucent layers of the main scene to .
public void DrawMainScene()GrabFramebufferCopy(Framebuffer, bool, bool)
Resolves MSAA and copies color and/or depth from the framebuffer into and .
public void GrabFramebufferCopy(Framebuffer framebuffer, bool copyColor, bool copyDepth)Parameters
framebuffer Framebuffer
copyColor bool
copyDepth bool
Initialize()
Allocates GPU resources required for rendering; must be called once before .
public void Initialize()LoadDefaultLighting(Scene, Resource)
Load default lighting, used by viewers without lighting information
public static void LoadDefaultLighting(Scene scene, Resource ibl)Parameters
scene Scene
ibl Resource
LoadRendererResources()
Loads embedded or game-provided BRDF LUT, cube fog, and blue noise textures into .
public void LoadRendererResources()PostprocessRender(Framebuffer, Framebuffer, bool)
Multisampling resolve, postprocess the image, and convert to gamma.
public void PostprocessRender(Framebuffer inputFramebuffer, Framebuffer outputFramebuffer, bool flipY = false)Parameters
inputFramebuffer Framebuffer
outputFramebuffer Framebuffer
flipY bool
Render(Framebuffer)
Renders the scene to the specified framebuffer. The result will be in linear space.
public void Render(Framebuffer framebuffer)Parameters
framebuffer Framebuffer
Framebuffer with hdr color support.
Render(RenderContext)
Renders shadows and then the full scene using the provided render context.
public void Render(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
RenderSceneShadows(RenderContext)
Renders opaque shadow casters for the directional (sun) light into .
public void RenderSceneShadows(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
RenderScenesWithView(RenderContext)
Renders the main and skybox scenes using the camera and framebuffer specified in the render context.
public void RenderScenesWithView(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
Update(UpdateContext)
Advances the simulation, updates scene draw calls, and prepares shadow data for the next frame.
public void Update(Scene.UpdateContext updateContext)Parameters
updateContext Scene.UpdateContext

