Skip to main content

Bulge and Pinch

Push image coordinates outward or pull them inward inside a circular region. bulgePinch simulates an adjustable local lens distortion without changing geometry or requiring scene depth.

GitHub

At a Glance

PropertyValue
ExportbulgePinch
BackendsWebGPU and WebGL2
Render passesOne fullscreen texture-sampling pass
Additional inputsNone

Usage

import {ShaderPassRenderer} from '@luma.gl/engine';
import {bulgePinch} from '@luma.gl/effects';

const renderer = new ShaderPassRenderer(device, {shaderPasses: [bulgePinch]});

renderer.renderToScreen({
sourceTexture: sceneColorTexture,
uniforms: {bulgePinch: {center: [0.5, 0.5], radius: 240, strength: 0.45}}
});

Parameters

ParameterDefaultRange or purpose
center[0.5, 0.5]Normalized image position at the center of the lens distortion.
radius200Circular effect radius in source-image pixels; minimum is 1.
strength0.5Distortion direction and magnitude, from -1 through 1.

Positive and negative strengths bend the sampling field in opposite directions; a zero strength preserves the original image geometry.

Composition and Cost

Bulge and pinch uses one texture-sampling pass and owns no intermediate history. Because it moves color coordinates without moving scene depth, normal, or velocity attachments, place it after scene-aware lighting, outlines, motion blur, and temporal reconstruction.

  • Magnify enlarges pixels inside an adjustable circular lens.
  • Swirl rotates sample positions around a focal center.
  • Zoom Blur produces radial motion streaks around a selected point.