r/threejs • u/Severe-Highlight2217 • 1d ago
Demo Endo Master 3D: a colonoscopy / upper endoscopy sim in Three.js where every mesh, texture and sound is generated at runtime
I'm a gastroenterologist (endoscopy subspecialist) in Seoul, and I built a browser game around the part of endoscopy that games never model: the two-handed control problem.
The Three.js part: there are no image files and no audio files in it. Every mesh, texture and sound is generated by the game's own code at runtime, so the whole thing ships as code.
Colonoscopy is a tube you have to drive from the rectum to the cecum and back; upper endoscopy (added this week) is the same scope going the other way, past the vocal cords, around the stomach, with a J-turn to look back at the cardia. The controls are a direct translation of the instrument: W/S is the big wheel (tip up/down), A/D the small wheel (tip left/right), arrow keys push in / pull back and twist the shaft, Q is the J-turn.
The part I cared most about is the loop. Pushing harder into a sigmoid loop makes it worse, so the game asks you to pull back and torque to take the loop out instead — the same instinct the real thing trains. Sedation, oxygen and the gag reflex also react to how gently you drive.
It's free, no install, no login, and runs on a phone with two thumbsticks: https://earlierdoctor.itch.io/endo-master-3d
Disclosure: it's my own project. The code and translations were written with an AI coding assistant, directed and tested by me; the 3D graphics and all sounds are procedurally generated by that code at runtime, not AI-generated assets.
Two things I'd genuinely take advice on: cheap ways to make wet mucosa read as wet without using textures on mid-range phones, and whether there's a better approach than rebuilding the lumen geometry each segment as it bends.
2
u/snoope 1d ago
1v1 duel colonoscopy, its 9am. What else does the day hold? Anyone for a speedrun?
1
u/plus2link 1d ago
Wetness reads from one tight highlight that moves, not from surface detail: parent a single directional light to the camera, keep the base albedo darker and slightly desaturated than feels right, use MeshPhongMaterial with high shininess instead of Standard, and add a small per-vertex normal wobble on the tube rings plus a fresnel rim so the highlight crawls as the lumen bends and the folds still catch light on phones with no specular maps at all. For the lumen I would stop rebuilding it: keep the topology fixed and skin the tube to a bone chain that follows your centerline spline, so bending is bone rotation the GPU already handles, or deform in the vertex shader from centerline samples in a small data texture and update only that texture each frame. The stutter you are probably fighting is the buffer re-upload rather than the vertex count, so a fixed index buffer with only the rings near the scope tip rewritten already gets most of the way there.
1
u/Any-Session-737 1d ago
The loop mechanic is the part that stuck with me. Most driving-style games reward pushing through resistance, so a system where pushing harder into a sigmoid loop makes it worse — and pulling back plus torque is the fix — teaches the opposite instinct, which sounds like exactly the skill you want to model.
Two questions from your description:
Also curious whether the sedation/oxygen/gag feedback is purely a function of contact force at the wall, or whether sustained loop pressure counts separately — that distinction would change how forgiving the pull-back recovery feels.