Skip to content
Table of contents

WearTrailsExperiments

WearTrailsExperiments gathers browser prototypes that turn the contact between a sliding body and the ground into persistent wear and flow maps. They explore, in JavaScript, the idea behind the ÉTS master’s research on wear in texture space: contact patches, tangential velocity and traction written into a texture where contact actually happened. The repository is published under ETSim for graphics researchers who want to try those ideas without building a native simulator.

Web experiments
JavaScriptthree.jsAmmo.jsWebGLglTF / GLB
  • Updated

1. Overview

There are two parts.

docs/, the modular application. docs/index.html loads three.js 0.158 and Ammo.js from a CDN and starts js/main-clean-complete.js. A body (cube, soft volumetric cube, sphere, torus puck, cylinder puck, cone or custom GLB) is dropped on a plane with chosen gravity, friction, restitution, speed and force. Each frame:

  • js/contacts.js samples contact points and their centre;
  • js/bounding-box/ fits the contact patch with AABB, PCA-based OBB, rotating-calipers OMBB, KDOP-8 or a hybrid method;
  • js/pip/ renders eight picture-in-picture views: top, bottom and intersection masks, tangential velocity, instant traction (τ = μ σn), accumulated sliding distance, local sliding distance with direction vectors, and local wear;
  • js/managers/flow-accumulation-manager.js accumulates wear as K × traction × velocity on the ground, keeps a time-smoothed sliding direction and encodes both as HSVA or RGBA;
  • js/managers/ground-variant-manager.js loads a GLB ground with material variants and blends them with the wear map, rotating textures along the flow direction;
  • js/shaders/wear-map-shader.js colours the sliding-distance map with optional logarithmic scaling.

experiments/, single-file prototypes. Nine standalone HTML pages named after their content: contact masks, dynamic paint with UV trails and OBB hulls, slip vector fields, multi-layer paint with GLB support, directional and hardness-based wear simulations, and GLB/flow-field blending. docs/glb_khr_variants_blend.html is a smaller test of blending glTF material variants with a grayscale map.

2. Use cases

Browser experiments that turn rigid-body contact and sliding into wear and flow maps on a ground texture.

Use-case diagram for WearTrailsExperiments: Slide a body on the ground; Compare contact bounding boxes; Inspect contact field views; Accumulate wear on the ground; Blend GLB material variants; Export wear maps as PNGWearTrailsExperimentsSlide a body on the groundCompare contact bounding boxesInspect contact field viewsAccumulate wear on the groundBlend GLB material variantsExport wear maps as PNGGraphics researcher«system»Web browser (WebGL)«system»three.js/Ammo.js CDN
People on the left, external systems on the right; each oval is a use case backed by the files cited below.
Slide a body on the ground
Graphics researcherWeb browser (WebGL)three.js/Ammo.js CDN

docs/index.html loads three.js 0.158 and Ammo.js from a CDN, then main-clean-complete.js drops a cube, sphere, puck, cone, soft cube or custom GLB on a plane with set speed, force and friction.

Compare contact bounding boxes
Graphics researcherWeb browser (WebGL)

docs/js/bounding-box/ fits the contact patch with AABB, PCA-based OBB, rotating-calipers OMBB, KDOP-8 or a hybrid method.

Inspect contact field views
Graphics researcherWeb browser (WebGL)

Eight picture-in-picture canvases show top, bottom and intersection views, tangential velocity, instant traction, accumulated sliding distance and local wear.

Accumulate wear on the ground
Graphics researcherWeb browser (WebGL)

FlowAccumulationManager adds K x traction x velocity into ground buffers and keeps the sliding direction, encoded as HSVA or RGBA.

Blend GLB material variants
Graphics researcherWeb browser (WebGL)

GroundVariantManager loads a GLB ground with material variants and uses accumulated wear as the blend map and flow direction to rotate textures.

Export wear maps as PNG
Graphics researcherWeb browser (WebGL)

Export Wear Map and Save Stamps write the ground canvases to PNG files through a download link.

2.1. Scenario: Record the wear trail of a sliding cube

  1. Serve the docs/ folder with python -m http.server 8000 and open http://localhost:8000.
  2. Choose Cube (subdiv 10), the OBB (PCA-based) algorithm and a friction value, then click Start.
  3. Use Pause, Step Frame and Apply Angular Impulse to follow the contact patch in the PiP views.
  4. Switch the wear encoding between HSVA (Direction + Wear) and RGBA to read direction and amount.
  5. Click Export Wear Map to save the accumulated ground map as a PNG.

Files readREADME.mddocs/README.mddocs/index.htmldocs/js/main-clean-complete.jsdocs/js/bounding-box/index.jsdocs/js/pip/pip4.jsdocs/js/pip/pip5.jsdocs/js/pip/pip6.jsdocs/js/pip/pip7.jsdocs/js/pip/pip8.jsdocs/js/managers/flow-accumulation-manager.jsdocs/js/managers/ground-variant-manager.jsdocs/js/shaders/wear-map-shader.jsexperiments/Contact_mask.html

3. Getting started

The pages use ES modules, so they need a local web server. From the README in docs/:

cd docs
python -m http.server 8000
# open http://localhost:8000

Click Start, adjust the controls in the left panel and watch the PiP views. Pause, Step Frame and Apply Angular Impulse help follow one contact, and Export Wear Map or Save Stamps save the ground maps as PNG. The pages in experiments/ open the same way. An internet connection is required for the CDN libraries.

4. Repository guide

  • docs/index.html is the main application page with its control panel.
  • docs/js/main-clean-complete.js is the entry module. docs/js/main.js is an alternative entry module that index.html does not load.
  • docs/js/bodies/ creates the physics bodies, docs/js/body-manager.js handles their lifecycle.
  • docs/js/bounding-box/ holds the contact-patch fitting algorithms.
  • docs/js/pip/ holds the eight picture-in-picture renderers.
  • docs/js/managers/ holds the scene, physics, ground, stamping, field/flow, wear accumulation and GLB variant managers.
  • docs/js/shaders/wear-map-shader.js is the GLSL wear-map shader.
  • experiments/ holds the standalone HTML prototypes.

5. Features

  • Rigid and soft bodies on Ammo.js physics, including custom GLB models.
  • Five contact-patch fitting methods, with velocity-based OBB alignment.
  • Live views of contact masks, tangential velocity, traction, sliding distance and wear.
  • Persistent wear accumulation on the ground, cleared only on demand, with a time-smoothed sliding direction.
  • GLB material-variant blending driven by accumulated wear.
  • PNG export of stamps, wear and flow maps.

6. Limits

  • These are research prototypes: the wear model is a visual heuristic in canvas buffers, not a calibrated tribology model.
  • docs/README.md describes an older layout (stamp/, field-flow/, six PiP views) that no longer matches the files, and the top-level README is one sentence.
  • Libraries are loaded from CDNs, including Ammo.js from a moving branch (@HEAD or @main) in several pages, so results can change without a code change.
  • Most experiments use three.js 0.160 while the application uses 0.158.
  • The README notes that the OBB angle can jitter at low speed and that custom GLB models should be convex.
  • There are no tests or build step.

7. Sources

8. CI/CD pipeline

No CI/CD pipeline in the repository. The code is built and run by hand, as described above.

Generated from the source at commit 065ad38.

9. Deployment diagram

Mermaid Deployment diagram
flowchart LR
  repo[("GitHub repository")]
  local["Local machine"]
  repo -->|"clone and run"| local

The repository has no Dockerfile, Compose file or hosting configuration, so the code runs on the machine that clones it.

10. External dependencies

The repository declares no external packages: it has no manifest such as pyproject.toml, requirements.txt, package.json or pom.xml.

11. Glossary

Repository

The versioned source files, configuration, and history of a project.

README

The repository’s entry document, usually covering its purpose and initial setup.

Dependency

A library, tool, or service that another component needs to build or run.

HTTP

A request-and-response protocol used by browsers and web services. A method, path, headers, and optional body describe a request.

Volume and bind mount

A volume is storage managed by the container platform; a bind mount exposes a chosen host path inside a container.

CLI

A text interface in which commands and arguments select operations. Exit codes let scripts detect success or failure.

Build

The steps that turn source files and dependencies into a runnable program or distributable artifact.

GPU

A processor designed for parallel workloads, including graphics rendering and many numerical operations.

Shader

A program executed at a stage of a graphics or compute pipeline, for example to transform vertices or calculate pixel colors.

12. References

  1. ETSim. (2026, November 5). [Web page] github.com.
  2. ETSim. (2026, November 5). WearTrailsExperiments. [Software repository] github.com.
  3. ETSim. (2026, November 5). README. [Source file or documentation] github.com.
  4. ETSim. (2026, November 5). docs/README.md. [Source file or documentation] github.com.
  5. ETSim. (2026, November 5). docs/js/main-clean-complete.js. [Source file or documentation] github.com.
  6. ETSim. (2026, November 5). docs/js/managers/flow-accumulation-manager.js. [Source file or documentation] github.com.
  7. ETSim. (2026, November 5). docs/js/managers/ground-variant-manager.js. [Source file or documentation] github.com.

Sources without a publication date show the date they were last checked, November 5, 2026. File links retain the inspected revision where available.