Package limn.render3d

Class IrradianceSh

java.lang.Object
limn.render3d.IrradianceSh

public final class IrradianceSh extends Object
Order-2 (9-coefficient) spherical-harmonic irradiance baked from an Environment, the diffuse half of image-based lighting (Ramamoorthi & Hanrahan 2001). The environment radiance is projected onto the SH basis over a deterministic Fibonacci-sphere sampling and convolved with the cosine lobe, so evaluate(limn.math.Vec3)(n) gives the average irradiance reaching a surface with normal n (multiply by albedo for diffuse). Deterministic: same input → identical coefficients, so it is unit-testable headless.
  • Method Details

    • coefficients

      public Vec3[] coefficients()
      The 9 SH coefficients (for uploading to a shader as vec3[9]).
    • bake

      public static IrradianceSh bake(Environment environment)
      Projects an environment into spherical harmonics: done once, not per frame.
    • bake

      public static IrradianceSh bake(Environment environment, int samples)
      Bakes with samples deterministic directions (higher = smoother).
    • evaluate

      public Vec3 evaluate(Vec3 normal)
      Irradiance for a surface normal (clamped non-negative).