Class SceneViewState
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Culling results and draw lists for drawing a scene through one view.
public sealed class SceneViewStateInheritance
object ← SceneViewState
Constructors
SceneViewState(Scene)
Initializes a camera view of an already initialized scene.
public SceneViewState(Scene scene)Parameters
scene Scene
Properties
HasBloomAmount
Gets whether any opaque draw that overrides its bloom amount is queued this frame.
public bool HasBloomAmount { get; }Property Value
bool
HasEffectsBloom
Gets whether anything is queued to draw into the effects bloom map this frame.
public bool HasEffectsBloom { get; }Property Value
bool
HasScreenSpaceEffects
Gets whether anything is queued to draw in the screen-space layer this frame.
public bool HasScreenSpaceEffects { get; }Property Value
bool
HasSkyOccluders
Gets whether a sky occluder is in view.
public bool HasSkyOccluders { get; }Property Value
bool
HasTranslucentDepthDraws
Gets whether any surface is queued for SceneViewState.RenderTranslucentDepthLayer(RenderContext, Shader) this frame.
public bool HasTranslucentDepthDraws { get; }Property Value
bool
HasWater
Gets whether any water surface is queued to draw this frame.
public bool HasWater { get; }Property Value
bool
HasWaterEffects
Gets whether anything is queued to draw into the water effects map this frame.
public bool HasWaterEffects { get; }Property Value
bool
LightBinner
Gets the tile and depth bin cull passes for this view of the scene.
public LightBinner LightBinner { get; }Property Value
Pvs
Gets or sets the PVS bitfield this view culls with, empty to cull nothing.
public ReadOnlyMemory<byte> Pvs { get; set; }Property Value
ReadOnlyMemory<byte>
Scene
Gets the scene this state draws.
public Scene Scene { get; }Property Value
ToolsRenderList
Gets the nodes the last culling found that draw in the tools pass, which the editor draws over the final image.
public IReadOnlyList<MeshBatchRenderer.Request> ToolsRenderList { get; }Property Value
IReadOnlyList<MeshBatchRenderer.Request>
VisibilityBoxes
Gets the info_visibility_box volumes this view culls with, split for its eye.
public VisibilityBoxCuller VisibilityBoxes { get; }Property Value
WantsSceneColor
Gets whether anything drawn after the framebuffer grab samples the scene color.
public bool WantsSceneColor { get; }Property Value
bool
WantsSceneDepth
Gets whether anything drawn after the framebuffer grab samples the scene depth.
public bool WantsSceneDepth { get; }Property Value
bool
WantsSsao
Gets whether anything queued to draw samples the screen space ambient occlusion.
public bool WantsSsao { get; }Property Value
bool
Methods
CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?)
Frustum-culls the scene and populates the per-pass render lists for the upcoming frame.
public void CollectSceneDrawCalls(Camera camera, Frustum? cullFrustum = null, TextureStreamingHelper? textureDemand = null)Parameters
camera Camera
The camera used to sort translucent draw calls by distance.
cullFrustum Frustum?
An optional override frustum for culling; defaults to the camera frustum.
textureDemand TextureStreamingHelper?
When given, receives the draws that are kept, as the demand on the streamed textures they use.
CompactIndirectDraws()
Packs non-zero indirect draw commands together on the GPU to avoid empty draw calls.
public void CompactIndirectDraws()Delete()
Deletes the GPU buffers of this view.
public void Delete()GetFrustumCullResults(Frustum, bool)
Returns all scene nodes whose bounding boxes intersect the given frustum, caching static results across frames when the frustum is unchanged.
public List<SceneNode> GetFrustumCullResults(Frustum frustum, bool includeStatic = true)Parameters
frustum Frustum
The view frustum to test against.
includeStatic bool
Whether to include static nodes.
Returns
A list of scene nodes in the frustum, before the PVS and visibility box tests (valid until the next call to this method).
MeshletCullGpu(Frustum)
Dispatches the GPU frustum (and optional occlusion) culling compute shader.
public void MeshletCullGpu(Frustum frustum)Parameters
frustum Frustum
The view frustum used to cull meshlets.
RenderBloomAmountLayer(RenderContext)
Renders the draw calls that fill the bloom amount map; the caller owns the render target.
public void RenderBloomAmountLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderEffectsBloomLayer(RenderContext)
Renders the draw calls that fill the effects bloom map; the caller owns the render target.
public void RenderEffectsBloomLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderNodes(RenderContext, IReadOnlySet<SceneNode>)
Draws the requests the last collection queued for the given nodes again, each node all at once, with the replacement shader of the render context. Nodes the collection left out, such as those out of view, are not drawn.
public bool RenderNodes(Scene.RenderContext renderContext, IReadOnlySet<SceneNode> nodes)Parameters
renderContext Scene.RenderContext
The render context, with the shader to draw with.
nodes IReadOnlySet<SceneNode>
The nodes to draw.
Returns
bool
Whether anything was drawn.
RenderOpaqueLayer(RenderContext, Shader?, Action<Framebuffer>?)
Renders the opaque pass, optionally with a depth prepass, followed by aggregate indirect draws and static overlay geometry.
public void RenderOpaqueLayer(Scene.RenderContext renderContext, Shader? depthOnlyShader = null, Action<Framebuffer>? afterDepthPrepass = null)Parameters
renderContext Scene.RenderContext
The render context for this pass.
depthOnlyShader Shader?
Optional depth-only shader; null for a pass that replaces material shaders.
afterDepthPrepass Action<Framebuffer>?
Called with the framebuffer of the pass once the depth prepass has drawn, before the layer is shaded.
RenderOpaqueRefractLayer(RenderContext)
Renders depth-writing geometry that samples the scene color, collected during SceneViewState.CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?). Runs after the framebuffer grab but before water and translucents, so those still sort against its depth.
public void RenderOpaqueRefractLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderScreenSpaceLayer(RenderContext)
Renders the draw calls of the screen-space layer; the caller binds the screen-space view.
public void RenderScreenSpaceLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderSkyOccluderDepth(RenderContext, Shader)
Writes the depth of the sky occluders once the sky has drawn, so what draws after it is hidden behind them.
public void RenderSkyOccluderDepth(Scene.RenderContext renderContext, Shader depthOnlyShader)Parameters
renderContext Scene.RenderContext
The render context for this pass.
depthOnlyShader Shader
The shared depth-only shader.
RenderSkyOccluderMask(RenderContext, Shader)
Marks the samples where a sky occluder is in front of what has been drawn, and moves their depth to the far plane so the sky draws over the world there.
public void RenderSkyOccluderMask(Scene.RenderContext renderContext, Shader depthOnlyShader)Parameters
renderContext Scene.RenderContext
The render context for this pass, whose framebuffer has a stencil buffer.
depthOnlyShader Shader
The shared depth-only shader.
RenderTranslucentDepthLayer(RenderContext, Shader)
Lays down the depth of the surfaces the refract, water and translucent layers draw over the opaque scene, collected during SceneViewState.CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?), each through its material's own depth mode where it has one.
public void RenderTranslucentDepthLayer(Scene.RenderContext renderContext, Shader depthOnlyShader)Parameters
renderContext Scene.RenderContext
The render context for this pass, bound to a depth buffer that already holds the opaque depth.
depthOnlyShader Shader
The shader for materials without a depth mode of their own.
RenderTranslucentLayer(RenderContext)
Renders all translucent draw calls collected during SceneViewState.CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?).
public void RenderTranslucentLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderViewmodelOpaqueLayer(RenderContext, Shader?)
Renders the opaque first-person viewmodel layer collected during SceneViewState.CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?). Rendered after the main scene and its translucents. A reserved near depth range keeps the layer in front of world geometry.
public void RenderViewmodelOpaqueLayer(Scene.RenderContext renderContext, Shader? depthOnlyShader = null)Parameters
renderContext Scene.RenderContext
The render context for this pass, expected to use the dedicated viewmodel camera and depth range.
depthOnlyShader Shader?
Optional depth-only shader; null for a pass that replaces material shaders.
RenderViewmodelTranslucentLayer(RenderContext)
Renders the translucent first-person viewmodel layer collected during SceneViewState.CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?). Rendered after the main scene (and 3D sky) translucent passes so it composites correctly on top of them.
public void RenderViewmodelTranslucentLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass, expected to use the dedicated viewmodel camera and depth range.
RenderWaterEffectsLayer(RenderContext)
Renders the draw calls that fill the water effects map; the caller owns the render target.
public void RenderWaterEffectsLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderWaterLayer(RenderContext)
Renders water draw calls collected during SceneViewState.CollectSceneDrawCalls(Camera, Frustum?, TextureStreamingHelper?).
public void RenderWaterLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.

