Class DOFRenderer
Namespace: ValveResourceFormat.Renderer.PostProcess
Assembly: Renderer.dll
Depth-of-field post-processing renderer using a bokeh scatter approach.
public class DOFRendererInheritance
Constructors
DOFRenderer(RendererContext)
Initializes a new using the given renderer context.
public DOFRenderer(RendererContext rendererContext)Parameters
rendererContext RendererContext
The renderer context providing shader loading and mesh buffer access.
Fields
GOLDEN_ANGLE
Golden angle in radians used to distribute bokeh samples in a spiral pattern.
public const float GOLDEN_ANGLE = 2.3999631Field Value
MAX_DOF_SAMPLES
Maximum number of spiral bokeh samples.
public const int MAX_DOF_SAMPLES = 256Field Value
Properties
BlurredResult
Gets the framebuffer that holds the DOF-blurred output.
public Framebuffer? BlurredResult { get; }Property Value
CurrentDofParams
Gets the DOF shader parameters used for the most recently rendered frame.
public DOFRenderer.Dof2InputParams CurrentDofParams { get; }Property Value
Enabled
Gets or sets a value indicating whether depth-of-field is active.
public bool Enabled { get; set; }Property Value
FarBlurry
Gets or sets the world-space depth at which the far blur is fully blurred.
public float FarBlurry { get; set; }Property Value
FarCrisp
Gets or sets the world-space depth at which the far blur begins.
public float FarCrisp { get; set; }Property Value
FocalDistance
Gets or sets the world-space focal distance from the camera.
public float FocalDistance { get; set; }Property Value
MaxBlurSize
Gets or sets the maximum bokeh radius in pixels (r_dof2_maxblursize).
public float MaxBlurSize { get; set; }Property Value
MsaaResolveDof
Gets a lazily-created MSAA resolve shader variant that encodes circle-of-confusion in the alpha channel.
public Lazy<Shader> MsaaResolveDof { get; }Property Value
MsaaSamples
Gets or sets the MSAA sample count passed to the DOF resolve shader.
public byte MsaaSamples { get; set; }Property Value
NearBlurry
Gets or sets the world-space depth at which the near blur becomes fully blurred.
public float NearBlurry { get; set; }Property Value
NearCrisp
Gets or sets the world-space depth at which the near blur becomes fully sharp.
public float NearCrisp { get; set; }Property Value
RadScale
Gets or sets the initial bokeh spiral radius scale (r_dof2_radiusscale).
public float RadScale { get; set; }Property Value
Methods
Render(RenderTexture)
Applies depth-of-field blur. Returns the blurred color texture.
public RenderTexture Render(RenderTexture input)Parameters
input RenderTexture
Returns
SetDofResolveShaderUniforms(Shader, Camera, RenderTexture)
Sets depth and lens-plane uniforms on the MSAA resolve shader for circle-of-confusion encoding.
public void SetDofResolveShaderUniforms(Shader shader, Camera camera, RenderTexture msaaDepth)Parameters
shader Shader
The MSAA resolve shader to configure.
camera Camera
The active camera providing view/projection matrices and position.
msaaDepth RenderTexture
The MSAA depth texture used to reconstruct world-space depth.
SetShaderParams()
Uploads DOF shader uniforms if the current parameters have changed since the last call.
public void SetShaderParams()
