---
id: "real-time-glints"
title: "Real-time glints (distributed binomial laws)"
domain: "materials"
stage: "material"
realtime: "realtime"
platforms: [webgpu, desktop-gpu, unreal, unity]
year_introduced: 2023
inputs: [material-params, normals, uv-atlas]
outputs: [radiance]
style: "photoreal"
dynamic: "both"
cost: "medium"
authority: "Deliot & Belcour, 2023"
url: "https://texelatlas.vercel.app/t/real-time-glints/"
sources_verified_at: "2026-11-29"
---
# Real-time glints (distributed binomial laws) (Deliot & Belcour, 2023)

> Renders sparkly surfaces such as glitter, metallic flakes and snow in real time by statistically evaluating how many discrete microfacets in a pixel footprint reflect toward the viewer. Deliot and Belcour use binomial laws over an anisotropic grid.

## Reach for it when

- car paint flakes should sparkle
- glitter, snow and sand look dull and smooth
- metallic flakes need to glint while moving
- sequins and pearlescent surfaces lack sparkle
- discrete micro-reflections inside a pixel

## How it works

Smooth GGX hides the fact that bright sparkle comes from individual facets. Instead of storing a million microfacet normals, the method divides texture space into cells over an anisotropic grid in (position, slope) space aligned with the pixel footprint. In each cell the number of facets that point inside the half-vector footprint follows a binomial distribution whose parameters come from the surface's normal distribution. A hash gives a stable pseudo-random count per cell, so sparkles stay fixed to the surface and animate with the view. Tests across overlapping cells are combined with a closed-form cost independent of footprint size, avoiding per-facet loops. The glint lobe is added to or replaces the smooth specular lobe.

## When to use it

Choose it for car paint with metallic flakes, glitter, sand, snow, sequins and pearlescent surfaces where a smooth GGX looks lifeless. Prefer plain [GGX / Trowbridge-Reitz normal distribution](https://texelatlas.vercel.app/t/ggx-trowbridge-reitz.md) with a normal map for gentle roughness. Prefer [Anisotropic GGX](https://texelatlas.vercel.app/t/anisotropic-ggx.md) for brushed surfaces without discrete sparkle.

## Cost

medium — Several hashed grid lookups plus binomial evaluations per pixel; heavier than GGX but real-time.
Measured GPU Weight: 21.45× baseline (heavy) — 0.7057 ms median / 0.7252 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 18.64× baseline (moderate) — 0.2964 ms median (2.38× faster on L4).
Ampere A100 scaling: 13.83× baseline (moderate) — 0.3983 ms median (1.77× faster on A100).

## Failure modes

- Temporal flicker when facets enter and exit the footprint under motion unless accumulated carefully
- Hash correlations show as visible grid patterns at extreme minification
- Facet density parameter has no direct mapping from measured flake data
- Increased cost on mobile GPUs; fewer samples cause noisier sparkles

## Engine support

- unreal: builtin — `Substrate Slab > Glint Density / Glint UVs; requires r.Substrate.Glints=1` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/overview-of-substrate-materials-in-unreal-engine, checked 2026-12-01) — Substrate materials only; off unless console variable is set.

## Dataflow

- Inputs: material-params, normals, uv-atlas
- Outputs: radiance
- Platforms: webgpu, desktop-gpu, unreal, unity

## Presets

### Stochastic microfacet glints — discrete metallic flake sparkles over smooth clearcoat (glsl-fragment; rendered 2026-11-30)

```json
{
  "FLAKE_DENSITY": 52,
  "ROUGHNESS": 0.24,
  "GLINT_INTENSITY": 3.2,
  "MICRO_ROUGH": 0.045
}
```

```glsl
const float FLAKE_DENSITY = 52.0; // P
const float ROUGHNESS = 0.24; // P
const float GLINT_INTENSITY = 3.2; // P
const float MICRO_ROUGH = 0.045; // P

vec3 hash32(vec2 p) {
  vec3 q = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
  q += dot(q, q.yxz + 33.33);
  return fract((q.xxy + q.yzz) * q.zyx);
}

float D_GGX(float nh, float a) {
  float a2 = a * a;
  float d = nh * nh * (a2 - 1.0) + 1.0;
  return a2 / (3.14159265 * d * d + 1e-5);
}

// Multi-cell hashed discrete microfacet glint evaluator in tangent slope space
vec3 evalGlints(vec2 uv, vec3 hTan, float density, float macroRough, float microRough) {
  float dScale = max(density, 4.0);
  vec2 gUv = uv * dScale;
  vec2 cell = floor(gUv);
  vec2 frac = fract(gUv);
  vec2 targetSlope = hTan.xy / max(hTan.z, 0.15);
  float mSig = max(microRough, 0.012);
  float macSig = max(macroRough, 0.08);

  vec3 glint = vec3(0.0);
  for (int j = -1; j <= 1; j++) {
    for (int i = -1; i <= 1; i++) {
      vec2 cid = cell + vec2(float(i), float(j));
      vec3 rnd = hash32(cid);
      vec3 rnd2 = hash32(cid + vec2(37.2, 91.7));
      vec2 center = vec2(float(i), float(j)) + 0.18 + 0.64 * rnd.xy;
      float dist2 = dot(frac - center, frac - center);
      float spatial = exp(-dist2 * 14.0);

      // Discrete flake normal drawn from macro Gaussian slope distribution
      float rAng = rnd.z * 6.2831853;
      float rMag = sqrt(-2.0 * log(max(rnd2.x, 1e-4))) * macSig * 0.52;
      vec2 flakeSlope = vec2(cos(rAng), sin(rAng)) * rMag;
      vec2 ds = targetSlope - flakeSlope;
      float angular = exp(-dot(ds, ds) / (2.0 * mSig * mSig));

      // Subtle prismatic car-paint / metallic flake iridescence
      vec3 tint = mix(vec3(0.92, 0.96, 1.0), 0.55 + 0.45 * cos(6.28318 * (rnd2.y + vec3(0.0, 0.18, 0.42))), 0.55);
      glint += tint * spatial * angular * (0.7 + 0.6 * rnd2.z);
    }
  }
  return glint;
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  vec3 ro = vec3(0.0, 0.12, 2.55);
  vec3 rd = normalize(vec3(uv, -1.55));

  vec3 bg = mix(vec3(0.02, 0.025, 0.04), vec3(0.07, 0.09, 0.14), clamp(uv.y + 0.5, 0.0, 1.0));
  // Ray-sphere studio specimen
  float rad = 0.84;
  float b = dot(ro, rd), c = dot(ro, ro) - rad * rad, h = b * b - c;
  if (h < 0.0) {
    fragColor = vec4(pow(clamp(aces(bg), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
    return;
  }

  float t = -b - sqrt(h);
  vec3 p = ro + rd * t;
  vec3 n = normalize(p);
  vec3 v = -rd;

  // Rotate sphere surface coordinates slowly (or via mouse)
  float rot = iTime * 0.28;
  if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
    rot = (iMouse.x / iResolution.x - 0.5) * 3.14159;
  }
  float cr = cos(rot), sr = sin(rot);
  vec3 pr = vec3(cr * n.x - sr * n.z, n.y, sr * n.x + cr * n.z);
  // Cubemap-like triplanar UV avoids pole pinching
  vec2 surfUv = vec2(atan(pr.z, pr.x) * 0.31831, asin(clamp(pr.y, -0.999, 0.999)) * 0.63662);

  vec3 up = abs(n.y) < 0.95 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);
  vec3 T = normalize(cross(up, n));
  vec3 B = cross(n, T);
  mat3 worldToTan = transpose(mat3(T, B, n));

  vec3 l1 = normalize(vec3(0.65 * cos(iTime * 0.4) + 0.2, 0.68, 0.65));
  vec3 l2 = normalize(vec3(-0.75, 0.42, 0.55));
  vec3 baseCol = vec3(0.08, 0.22, 0.54);
  float rough = clamp(ROUGHNESS, 0.06, 0.95);
  float ndv = max(dot(n, v), 0.001);
  float fres = 0.04 + 0.96 * pow(1.0 - ndv, 5.0);

  vec3 col = baseCol * (0.08 + 0.12 * (n.y * 0.5 + 0.5));
  // Key light + fill light: smooth GGX + clearcoat + stochastic microfacet glints
  for (int k = 0; k < 2; k++) {
    vec3 L = (k == 0) ? l1 : l2;
    vec3 lCol = (k == 0) ? vec3(1.85, 1.72, 1.55) : vec3(0.65, 0.85, 1.25);
    float nl = max(dot(n, L), 0.0);
    vec3 H = normalize(L + v);
    float nh = max(dot(n, H), 0.0);
    float specSmooth = D_GGX(nh, rough * rough) * 0.22;
    float coat = D_GGX(nh, 0.045) * fres * 0.45;
    vec3 hTan = worldToTan * H;
    vec3 glints = evalGlints(surfUv, hTan, FLAKE_DENSITY, rough, MICRO_ROUGH) * max(GLINT_INTENSITY, 0.0);
    col += lCol * nl * (baseCol * 0.65 + vec3(0.55, 0.72, 1.0) * specSmooth + coat + glints);
  }
  // Subtle studio rim environment reflection
  vec3 R = reflect(-v, n);
  vec3 env = mix(vec3(0.05, 0.08, 0.14), vec3(0.55, 0.68, 0.92), smoothstep(-0.2, 0.8, R.y));
  col += env * fres * 0.65;
  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index

## Combination ideas

- [Sun glitter from horizon to bow](https://texelatlas.vercel.app/ideas/sun-glitter-ocean/)

## Sources

1. [primary] T. Deliot, L. Belcour (2023) Real‐Time Rendering of Glinty Appearances using Distributed Binomial Laws on Anisotropic Grids. Computer Graphics Forum. https://doi.org/10.1111/cgf.14866 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Real-time glints (distributed binomial laws)." https://texelatlas.vercel.app/t/real-time-glints/ (accessed 2026-12-01).
