flag-cloth

Rendering and materials

Native WebGL2 geometry, lighting, shadows, presets, alpha, and texture behavior.

The renderer owns one indexed grid and updates its position buffer in place. Vertex normals are recalculated into reused typed arrays, with a configurable update interval.

Presets

quality defaults to capped 1.5 pixel ratio, per-frame shading updates, highlights, and cloth shadows. performance defaults to pixel ratio 1, every-second-frame shading, no highlight pass, and no shadows.

Preset values are actual profiles. Switching from performance back to quality restores quality defaults. Explicit overrides such as shadows: true still win.

renderer: {
  preset: 'quality',
  alpha: true,
  maxPixelRatio: 1.5,
  shadows: true,
  shadingUpdateInterval: 1,
}

Material

Ambient, diffuse, specular, shininess, fold contrast, and shadow parameters are mutable without recreating geometry. Transparent PNG, WebP, and SVG textures retain alpha when transparent is enabled.

On this page