惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
L
LangChain Blog
Jina AI
Jina AI
爱范儿
爱范儿
C
Check Point Blog
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
月光博客
月光博客
GbyAI
GbyAI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题

Codrops

Drawing With Light: An Exploration of Lit GPU Tubes with TSL and WebGPU | Codrops Building a Real-Time 3D Face Mask with MediaPipe, Threlte and Three.js | Codrops Building an Infinite Loom: Unravelling Images into Threads with Three.js | Codrops Beyond the Luminance Ramp: A Shape-Aware ASCII Renderer in Three.js | Codrops From Rays to Meshes: Building Vercel’s Prism with vgpu | Codrops More Three.js Speakers, More Ideas from Paris | Codrops Breaking the Frame: Building a Real-Time Datamosh Effect with Three.js | Codrops Bend, Aim, Fling: Turning the Eiffel Tower into a Catapult with Three.js | Codrops Goodgrowth: Boot Sequences, Spinning Discs, and the Art of the Portfolio | Codrops Building a Mouse-Following Square Lens Effect with Three.js and GLSL | Codrops Blender to Three.js and Back: 10 Tips for a Better Workflow | Codrops Sixty Frames for the Record: A Three.js Game, Seven Fly-Throughs, and a Wall of CRTs | Codrops Run Rob Run: Building a Music-Reactive Goo with Three.js and WebGPU | Codrops Relighting Images with Depth Maps and Three.js | Codrops Building an Animated Testimonial Hero Using the GSAP Timeline and Dynamic CMS Data | Codrops Creativity at Enterprise-Scale, Without Compromise: The OFF+BRAND. Story | Codrops Inside HAOQI.DESIGN: Letting DOM and WebGL Share a Retro-Futurist Stage | Codrops From Motion to Meaning: Denis Avramenko’s Approach to Interactive Design | Codrops Creating an Interactive 3D Cluster with Three.js, TSL and Three Start | Codrops Exploring Procedural Geometry with Three.js and WebGPU | Codrops From Brand Systems to Cultural Worlds: Inside Antinomy and 27b | Codrops Designing a Flexible Digital Archive for Chems.Studio’s Creative Practice | Codrops The Department Is Open: Building the PX PUSH Website | Codrops Garden Anomaly: A Tiny WebGPU and TSL Experiment | Codrops A Canvas for Individuality: Creating Websites That Feel Unmistakably Human with Readymag | Codrops Building an Endless Interactive Glass Xylophone with Three.js | Codrops The Story Is in the Interaction: Bonhomme’s Digital Experiences for Luxury Brands | Codrops Building an Infinite GSAP Scroll Gallery with Parallax and Flip Transitions | Codrops Studio Freight: Moving Missions Forward | Codrops Between Print and Digital: The Making of MERSI’s Website | Codrops
Volatile Nexus: Tinkering with Glass, Caustics, Cubes and...
By Frank Reitberger · 2026-08-31 · via Codrops

A mesmerizing Three.js experiment where glass, wandering cubes, caustics, refractions, and sound come together in a fluid, interactive scene.

3D particles Three.js WebGL

Editor’s Note: As part of our celebration of the first Three.js Conference, we’ve been sharing creative experiments throughout the month, and this week we’re back with more! Today we’re happy to showcase another demo by Frank. In Volatile Nexus, he dives into glass, caustics, refractions, wandering cubes, reflections, and sound, bringing them all together into one mesmerizing experiment.

🇫🇷 The countdown is on! The very first Three.js conference is getting closer, and there are still tickets available if you’re thinking about making the trip to Paris. Use code CODROPS for 15% off and grab your ticket →

What started as “Can I produce a nice glassy ring with colorful caustics?” ended up in unsteady, almost-fluid glass, caustics, refractions, why not adding some cubes (or lots of them), reflections, sound, and many more things.

At the beginning…

…I just wanted to achieve colorful glass with sort of caustics. Like, can I control the caustics and iridescence? Let’s add some lens flare and be fine with it. I already liked the outcome then, as it looked sort of like an “80s album metal cover” or alike.

Adding floor reflections just made this look and feel even more complete.

So what about cubes?

Wouldn’t it be fun to add lots of cubes wandering on some defined paths just because we can? And, whilst working on this, let’s not forget to refract those in the glass given.

Easier said than done, as glass refraction was a tricky one. It’s a nice rabbit hole when working with Three.js and its “as is” implementation.

Lastly, I switched to having the refracted layer weighted by a facing term — strong when you look through the glass face-on, fading at grazing angles where real glass turns mirror-like. That kills the additive “wash” and makes the refracted cubes sit inside the glass instead of glowing on it.

Meanwhile…

…wouldn’t it even be nicer if we added some user interactions for the cubes and glass?

Adding some mouse proximity repulsion for the cubes — the cursor is unprojected into a 3D pick ray every frame, transformed once into the swarm’s local space (much cheaper than transforming 1000 cubes to world space). Any cube within the repel radius of that ray gets pushed away perpendicular to it with a squared falloff, driven by a damped spring — so cubes burst aside as your mouse sweeps near them and flow smoothly back into formation about half a second after it leaves.

Displacement is capped so nothing can be flung out of the scene. This works while hovering and while dragging to orbit.

For the ring, I set up a 12-slot impulse pool as uniform arrays, some wavefront math (Gaussian shell at age · 1.4, cos(dist · 9 − age · 11) oscillation, exp(−2.6 · age) decay), central-difference normal reconstruction with the same 0.7 blend, a 30ms spawn throttle, and the cursor-speed → strength mapping (fast strokes hit harder, clamped to 0.4–1.8).

I brought it all in from an earlier experiment called Unstable solid.

What’s adapted for the ring: the displacement direction is the torus analog of the sphere’s radial — each vertex pushes outward from the nearest point on the ring’s tube center-circle (radius 0.78 in the lathe plane). It’s derived purely from position, so the lathe’s seam vertices move identically and the surface stays watertight.

The raycast targets the actual ring mesh through all its rig/sway transforms (with an extra 25ms cast throttle, since the lathe is ~24k triangles and has no BVH).

And because the technique lives in the material’s positionNode/normalNode, three things ripple for free that the sphere never had: the refraction (the wobbling normals bend the dispersed backdrop — poking the glass smears the confetti), the caustics (the shadow pass uses the same displaced surface), and the floor mirror (it renders the same material).

And at the end…

…why not compose some procedural beeps and tones to make the scene complete?

I know there are many, many folks out there who turn out sound immediately, but for me, sound is like a little extra rounding the whole scene up.

As for the glass’s wobble: Two high-Q resonances (640 Hz + 963 Hz) filter noise into a pure-ish tone with a slow vibrato — whose level is driven every frame by the ripple field’s live energy. Stroke the glass and the hum swells under your finger; stop and it fades exactly as the visible waves decay, because it’s reading the same numbers. It physically cannot spam — there’s nothing to trigger.

The pad’s filter opening was also softened so the combined wobble response stays warm rather than shrill.

Cubes through the ring — a shimmer bed (three beating triangles plus bright noise) whose level follows the fraction of the stream currently inside the hole, computed from the head phase against the path’s hole window. You’ll hear the sparkle swell as the comet threads through and fade as the tail exits — roughly a ten-second breath cycle at your speed of 0.1.

Et voilà!

Frank Reitberger

25 years of 3D & Shaders, Gfx Coding and Creative Technology, aged skateboard and snowboard enthusiast, proud dad, currently living in Bochum, Germany. Fascinated by all kinda computer and game graphics, procedural driven and generative art, interactive design and digital beauty - which all together are the results of simple mathematical or algorithmic processes. For me, my creative process is writing my own software, programs and scripts to play, explore, experiment and generate beauty with code and numbers.

Creative Spotlights

Inside the journeys and portfolios of today's most inspiring designers and developers.

Studio Stories

Discover how studios & agencies started, how they work, and what they've built.

Case Studies

Discover the ideas, design, and craft behind today’s most inspiring web experiences.