STL Deformer

A Sine Falcon Millennium
Note

This project is under constant development.

This project demonstrates a real-time STL deformation tool using Three.js. It allows you to load an STL file, apply various deformation effects (Noise, Sine Wave, Pixelate, IDW Shepard, plus advanced and topology-altering methods), and visualize the deformed model. It’s a tool for pushing the boundaries of what you expect from a 3D model. The goal is to create subtly unsettling, oddly beautiful, and deliberately weird transformations of STL objects. Think of it as a digital sculpting playground.

Tip

Transform your 3D models into something unexpected, unsettling, and strangely beautiful. This experimental tool lets you push the boundaries of what’s possible with STL files, creating deliberate distortions and abstract variations of your models. Think of it as a digital sculpture lab where mathematical chaos meets artistic expression.

Motivation & Creative Exploration

  • Subversion of Form: This project isn’t about perfect realism. It’s about deliberately distorting the familiar, creating unsettling or intriguing shapes.
  • Algorithmic Abstraction: Explore how mathematical functions (noise, sine waves, inverse distance weighting) can be used to transform 3D geometry and change the practicality of 3d shapes.
  • Visual Metaphors: Consider how different deformations might represent abstract concepts – chaos, tension, growth, decay.

Features

  • STL Loading: Loads STL files using the Three.js STLLoader. (Start with simple objects – boxes, spheres, basic shapes – to get the basics working).
  • Deformation Effects:
    • Noise: Applies a noise-based deformation, introducing chaotic movement and distortion.
    • Sine Wave: Generates a sinusoidal wave deformation, producing rhythmic, flowing changes – potentially creating mesmerizing, pulsating effects.
    • Pixelate: Pixelates the model by snapping vertices to a grid, offering a stark, fragmented aesthetic.
    • IDW Shepard: Advanced organic deformation using multiple control points distributed throughout the model’s volume via Poisson disk sampling.
    • Inflate / Twist / Bend / Ripple / Warp / Hyperbolic Stretch: Expressive surface operators for swelling, rotating, arcing, undulating, noise-based offsets, and elastic stretching.
    • Tessellate / Boundary Disruption / Menger Sponge: Topology-oriented transformations for subdividing, fraying edges, and carving porous structures.
  • Real-time Deformation: Updates the deformation in real-time, allowing for interactive experimentation.
  • Parameter Controls: Interactive sliders and checkboxes for adjusting deformation parameters.
  • Adaptive Parameter Ranges: Parameters automatically scale based on model size to ensure consistent effects across different STL scales.
  • Visual Feedback: Displays the deformed model in 3D space with control point visualization for IDW deformation.
  • Axis Gizmo: On-screen X/Y/Z labels for orientation.
  • Multi-Axis Selection: Axis-based deformations (twist, bend, ripple, hyper) can target multiple axes.
  • Parallel Processing: Uses Web Workers for efficient processing of large STL files with thousands of vertices.
  • Preprocess Options: Optional cleanup before deformation (Decimate, Vertex Merge) for dense models or faster iteration.
  • Import/Export Settings: Reuse deformation presets across STLs; exported settings include preprocess parameters.
  • Stats HUD: Displays vertex/triangle counts and deformation time.
  • Export: Exports the deformed model as an STL file – save your weird creations!

Deformation Examples

Original

Noise Deformation

Sine Wave Deformation

Pixelated Deformation


Pixelated Deformation

IDW Shepard Deformation

The IDW (Inverse Distance Weighting) Shepard deformation uses multiple control points placed throughout the model’s interior volume for organic, localized shaping.

Key Features

  • Poisson Disk Sampling: Evenly distributed control points to prevent clustering
  • Volume-Constrained Placement: Points are guaranteed inside the mesh volume
  • Seed-Based Generation: Deterministic point placement for reproducible results
  • Manual Control Points: Optional manual list of points (single or multi-point)
  • Sampling Rays Control: Adjustable inside-mesh sampling for speed/robustness
  • Adaptive Influence: Inverse distance weighting with customizable power falloff
  • Visual Feedback: Wireframe spheres show control point positions and influence
  • Scalable Effects: Parameter ranges scale to model size for consistent output

Technical Implementation

  • Multi-Point IDW: Each vertex is influenced by all control points
  • Parallel Processing: Web Workers handle heavy computation for large meshes
  • Real-time Visualization: Control points scale with model size (5% of largest dimension)
  • Robust Volume Detection: Advanced ray casting ensures points are truly inside the mesh

Requirements

Browser

  • Modern web browser (Chrome, Firefox, Safari, Edge)
  • JavaScript enabled

Dependencies

  • Three.js (r121, bundled)
  • FileSaver.js (included)
  • Web Workers (required for parallel processing)

Setup

Files

The project consists of:

  • index.html
  • sketch.js
  • Required JavaScript libraries

Installation

  1. Place all files in a directory
  2. Open index.html in your web browser

Usage

  1. Load STL: Click the “File Input” button to select an STL file.
  2. Deformation Type: Choose the deformation type from the radio buttons (Noise, Sine Wave, Pixelate, IDW Shepard).
  3. Adjust Parameters: Use the sliders and inputs to control the deformation parameters. IDW parameters adapt automatically to model size.
  4. Generate Deformation: Click the “Generate Deformation” button.
  5. Visualize: The deformed model will be displayed in the 3D view.
  6. Export (Optional): Click the “Export Current STL” button to save the deformed model as an STL file.

Controls

  • File Input: Select an STL file.
  • Radio Buttons: Choose the deformation effect (Noise, Sine Wave, Pixelate, IDW Shepard).
  • Sliders: Adjust the parameters of the chosen effect.

Noise Controls

  • Intensity: Controls the strength of the noise deformation (0.1 - 5.0)
  • Scale: Controls the frequency/size of noise features (0.005 - 0.5)
  • Axis: Choose which axes to apply noise to (All, X, Y, Z, or combinations)

Sine Wave Controls

  • Amplitude: Controls the height of the sine waves (1 - 100)
  • Frequency: Controls how many waves fit in the model (0.01 - 0.2)
  • Driver Axis: Which axis provides the input to the sine function (X, Y, Z)
  • Displacement Axis: Which axes the sine wave displaces (X, Y, Z, or combinations)

Pixelate Controls

  • Voxel Size: Size of the pixelation grid (0.5 - 50)
  • Axis Lock: Which axes to pixelate (All, X, Y, Z, or combinations)

IDW Shepard Controls

  • Number of Points: How many control points to generate (3 - 50)
  • Seed: Numeric seed for reproducible control point placement (0 - 10000)
  • Weight: Strength of attraction/repulsion at control points (adaptive range by model size)
  • Power: Influence falloff with distance (0.5 - 6.0)
  • Global Scale: Overall deformation scaling (adaptive range by model size)
  • Generate Deformation: Apply the deformation.
  • Export Current STL: Export the deformed model.

Code Structure

  • index.html: The main HTML file that sets up the Three.js scene, UI elements, and event listeners.
  • main.js: Core logic for loading the STL, applying deformation, rendering, and UI. Includes Poisson disk sampling, volume detection, and adaptive parameter scaling.
  • worker.js: Web Worker for parallel processing of vertex deformations (especially IDW).
  • libraries/: Three.js, p5.js, and other required libraries.

Important Notes

WarningPerformance Considerations
  • The performance depends on the complexity of the STL model and chosen deformation algorithm
  • The rendering process can be slow with complex models
  • Web Workers improve responsiveness for large meshes and multi-point IDW
ImportantPost-processing Required

After deformation, process the model in Meshlab using these filters:

  1. Filters -> Cleaning and Repairing
  2. Remove Zero Area Faces (twice)
  3. Repair Non-manifold Edges (split)
Note

This is a basic demonstration that can be extended with more advanced features.

Notes

  • IDW Shepard deformation works best with solid, manifold meshes. Complex or thin-walled models may produce unexpected results.
  • Some STLs may require normal regeneration to avoid black/incorrect shading (handled in recent builds).

Changelog

0.6.0 (2026-02-10)

  • Added importable deformation settings and axis gizmo with X/Y/Z labels
  • Added multi-axis selection for twist/bend/ripple/hyper
  • Improved Menger sponge, tessellation range, settings export, and UI/camera performance
  • Fixed shading issues by ensuring valid vertex normals, plus assorted robustness fixes

0.5.0 (2026-02-08)

  • Updated GUI and camera behavior
  • Fixed P0, P1, P3, and P4 issue sets

0.4.0 (2025-10-28)

  • Added settings workflow groundwork and Web Worker processing
  • General refinements and cleanup

Contributing

Feel free to contribute to this project! You can:

  • Submit bug reports
  • Suggest feature requests
  • Create pull requests

License

This project is licensed under the MIT License.