stride3d/stride · error · ArgumentOutOfRangeException
SigmaRatio cannot be < 0.0f
Error message
SigmaRatio cannot be < 0.0f
What it means
Thrown by the GaussianBlur.SigmaRatio setter when the assigned value is less than 0. SigmaRatio converts the radius into the Gaussian sigma (sigma = radius / SigmaRatio); a negative ratio yields an invalid sigma and an unusable blur kernel, so the setter rejects it with ArgumentOutOfRangeException.
Solutions
- Clamp: SigmaRatio = Math.Max(0f, value)
- Fix the source formula/config producing the negative value
- Use the default ratio by not setting the property
Example fix
// before blur.SigmaRatio = ratio; // after blur.SigmaRatio = Math.Max(0f, ratio);
Defensive patterns
Strategy: validation
Validate before calling
if (ratio < 0f) ratio = 0f; blur.SigmaRatio = ratio;
Type guard
bool IsValidSigmaRatio(float r) => r >= 0f && !float.IsNaN(r);
Try / catch
try { blur.SigmaRatio = value; } catch (ArgumentOutOfRangeException) { blur.SigmaRatio = 0f; } Prevention
- Clamp ratio to >= 0 before assignment
- Validate tuning constants coming from config or UI
- Check sign of computed values (e.g. after negation or subtraction)
When it happens
Trigger: Assigning a negative value to GaussianBlur.SigmaRatio, e.g. via a sign error in a formula or a config that accepts signed numbers.
Common situations: Loading sigma ratio from user/config data without validation; inverting a value that shouldn't be inverted; template parameters propagating a negative tuning constant.
Related errors
- Radius cannot be < 1
- DoF configuration needs at least one blur level!
- Last blurriest level must have a CoC of 1.0!
- levelCoCValues and levelDownscaleFactors must be arrays of…
- Radius cannot be < 0
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/52f3d235bc815dd6.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Rendering/Rendering/Images/GaussianBlur/GaussianBlur.cs:82
/// <summary>
/// Gets or sets the sigma ratio. The sigma ratio is used to calculate the sigma based on the radius: The actual
/// formula is <c>sigma = radius / SigmaRatio</c>. The default value is 2.0f.
/// </summary>
/// <value>The sigma ratio.</value>
/// <userdoc>The sigma ratio of the Gaussian. The sigma ratio is used to calculate the sigma of the Gaussian.
/// The actual formula is <c>sigma = radius / SigmaRatio</c></userdoc>
[DataMember(20)]
public float SigmaRatio
{
get
{
return sigmaRatio;
}
set
{
if (value < 0.0f)
{
throw new ArgumentOutOfRangeException("SigmaRatio cannot be < 0.0f");
}
sigmaRatio = value;
}
}
public void Collect(RenderContext context)
{
}
protected override void DrawCore(RenderDrawContext context)
{
// Find gaussian blur shader (if same radius has already been used)
GaussianBlurShader matchingGaussianBlurShader = null;
foreach (var gaussianBlurShader in shaders)
{
if (gaussianBlurShader.Radius == Radius)
{View on GitHub (pinned to 96fad776d2)