Vixen
02b45cc4
csharp
public static class BrdfLut

The other half of the split sum: what the BRDF does, with no environment in it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The specular integral splits into the environment convolved with the GGX lobe — which EnvironmentPrefilter bakes per scene — and the BRDF's own response, which depends only on the viewing angle and the roughness. The second is the same function for every scene ever rendered, so it is a two-channel lookup table: red scales the material's F0 and green is added to it.

Across the table, x is the cosine of the viewing angle and y is roughness. The first column is a grazing angle, where the shading is most sensitive and the integration is least well behaved; nothing samples exactly zero, because at zero there is no reflection to integrate.

At roughness zero the two channels sum to exactly one. The GGX lobe collapses to a mirror, the geometry term becomes one, and what is left is Schlick's Fresnel split into its two pieces — so red is 1 − (1 − cosθ)⁵ and green is (1 − cosθ)⁵. That is an analytic answer this can be checked against rather than compared to itself, which is the whole reason the test exists.

Fields and properties (2)

  • public const int DefaultSize

    How wide and tall the table is unless the caller says otherwise.

  • public const int DefaultSamples

    How many samples each cell integrates over unless the caller says otherwise.

Methods (3)

  • public static TextureData Generate(int size = 128, int samples = 1024)

    Integrates the table.

  • public static (float Scale, float Bias) Read(TextureData table, int x, int y)

    Reads one cell.

  • public static (float Scale, float Bias) Integrate(float cosine, float roughness, int samples)

    Integrates one cell.

Used by (1)

  • IblTestsVixen.Core.Imaging.Tests