Hello! I’m Matt Park, a Artistic Developer primarily based in New York.
On this article, we’ll be exploring one of many best but coolest results you’ll be able to create in Three.js—the Transmission Materials.
To be exact, native Three.js doesn’t have a fabric known as TransmissionMaterial
, however Drei does. Drei is a library full of helper parts designed to reinforce the event of React Three Fiber purposes.
Though MeshTransmissionMaterial
comes from Drei, it’s not a completely new materials. Drei layers a bunch of shaders on high of Three.js’ MeshPhysicalMaterial
to create refraction results.

Setup
The unique concept behind the mannequin used on this article comes from a pattern within the Blender group the place round textual content is positioned inside a glass-like materials.
Upon seeing this Blender tutorial, I instantly knew it was the right mannequin to experiment with MeshTransmissionMaterial
, so I rapidly modeled it in Blender.

For these following together with this text, understand that utilizing this particular mannequin isn’t crucial in any respect. The basics of how Transmission Materials works stay the identical for all fashions, even for a easy boxGeometry
🙂
First Steps
When you load your mannequin into your Three.js scene with MeshTransmissionMaterial
, you is likely to be shocked to see a really dull-looking materials.

Then we return to the unique
MeshPhysicalMaterial
docs, solely to seek out the directions beneath.

It’s because the important thing to transmission supplies lies in how gentle is mirrored via the fabric. That’s the essence of any clear materials in actual life as properly. Consider it this fashion: if a fabric have been clear with none reflections or gentle bending throughout its floor, it will look as boring because the torus above. The fantastic thing about any clear materials comes from the best way gentle bends and refracts via its floor. Including surroundings settings to our Three.js scene helps obtain this impact by simulating real-life lighting, offering sufficient gentle for the fabric to replicate correctly.

Diving into Transmission Supplies
Utilizing MeshTransmissionMaterial is simple. Nonetheless, really understanding its detailed properties takes time and requires a deeper grasp of how transmission supplies work. On this part, we’ll break down every subject step-by-step and discover how they contribute to the fabric’s habits.
Samples
The samples property controls the variety of refraction samples used to simulate gentle transmission. Greater values end in smoother, extra real looking refraction, whereas decrease values can create rougher refractions, typically resulting in grainy artifacts. The default worth is 10, however you’ll be able to alter it to seek out the most effective stability on your desired impact.
Observe that larger sampling means higher computational price, resulting in a detrimental efficiency influence. This occurs as a result of growing the variety of shader traces considerably raises the computational workload required to approximate the refraction impact.
Decision
The decision subject controls the render texture decision used for refraction. If utilizing a number of transmission supplies in your scene causes efficiency points, you would possibly need to alter the decision. Personally, I believe this is likely one of the most underrated fields. Reducing the decision to round 128–256 can create a pixelated impact—with out even needing a customized shader.
Transmission
The transmission subject controls how a lot gentle passes via the fabric. It takes a float worth between 0.0 and 1.0, the place 0 represents a totally stable materials, and 1 makes it fully clear. As you would possibly anticipate, setting a price between 0 and 1 creates a semi-transparent impact, permitting some gentle to go via.

Roughness
As a few of you may need already seen, MeshTransmissionMaterial
extends THREE.MeshPhysicalMaterial
, which means we even have entry to all of the fields from MeshPhysicalMaterial
. I wasn’t planning to cowl this subject, since most of you might be in all probability already aware of how roughness works in supplies. Nonetheless, I needed to spotlight one fascinating element—when roughness is about to 1.0, the fabric turns into fully invisible.

This occurs as a result of when roughness is about to 1.0, the floor turns into so tough that it scatters gentle fully. Because of this, gentle can now not go via, eliminating reflections whereas the fabric absorbs and diffuses all incoming gentle.
Shade
The cool factor in regards to the coloration subject is that it acts as an extra filter layer over your materials, affecting every little thing inside or behind the transmission materials. Discover how the unique letters inside my torus have been both orange or gentle purple—setting the colour of MeshTransmissionMaterial
creates the impact of wanting via tinted glass.

Diving Deeper into Transmission Materials
Now, let’s dive into extra superior ideas in TransmissionMaterial. Remember that these fields affect each other, and every distinctive mixture will produce a unique visible impact.
IOR
IOR stands for Index of Refraction. Merely put, it controls how a lot gentle bends (refracts) when passing via a fabric. Consider it like adjusting the thickness of glass—though it’s a very totally different idea. A cloth with a decrease IOR worth ends in much less refraction, whereas the next IOR worth will increase distortion and depth, just like glass or diamonds.
For reference, listed below are some widespread IOR values:
Air: 1.0003
Water: 1.333
Diamond: 2.42
These values give us an concept of how refraction behaves at totally different ranges.
One fascinating attribute of IOR is that objects with excessive values seem warped. As IOR will increase, gentle bends extra, creating sturdy distortions and a magnified, warped impact.
Beneath is an instance of how the fabric seems because the IOR worth will increase:

Thickness
Together with IOR, one other subject that contributes to the warping impact is thickness. This subject controls how deep gentle travels via the fabric earlier than exiting. Remember that the fields mentioned on this part affect each other.
If IOR is about to 1.0, you’ll discover that altering the thickness has no impact on the fabric’s look. This occurs as a result of thickness solely issues when gentle bends inside the fabric. If there’s no refraction occurring within the first place, thickness received’t have any visible influence.
Chromatic Aberration
The chromaticAberration subject simulates coloration dispersion, the place totally different wavelengths of sunshine bend at barely totally different angles. Consider how diamonds and prisms break up gentle right into a refined rainbow impact.
This Wikipedia instance provides visible reference for chromatic aberration.

This subject ranges from 0.0 to 1.0. Decrease values end in little to no dispersion, just like real-life glass. As the worth approaches 1.0, coloration splitting turns into extra pronounced, creating stronger chromatic aberration and exaggerated rainbow edges within the refraction.

Anisotropy
The anisotropy subject, also called directional blur, controls how gentle is stretched—usually making a streaked glass or frosted glass impact. By default, anisotropy is about to 0, which means gentle is mirrored evenly in all instructions.
An fascinating facet of this subject is the way it interacts with roughness. Greater roughness values trigger anisotropic reflections to turn into extra subtle and unfold out, altering the ultimate look of the fabric.

Discover how we are able to obtain a frosted glass impact by combining the anisotropy and roughness fields.
Distortion, Distortion Scale, and Temporal Distortion
These three properties—distortion, distortionScale, and temporalDistortion—management how gentle waves bend and shift as they go via the fabric. When used successfully, they will simulate results like wavy glass, warmth distortion, water, or perhaps a jelly-like look. Let’s break them down one after the other.
The distortion subject is the first management for warping gentle, making a wavy impact. Greater values improve the quantity of bending and distortion.
distortionScale adjusts the scale and frequency of the distortion waves—larger values end in bigger, extra stretched distortions.
Lastly, the temporalDistortion subject animates the distortion impact. A well-balanced mixture of those values can create a shocking refraction impact, just like water, with out even needing to make use of useFrame
or requestAnimationFrame
!
Animations?
When you’ve adopted together with this text, you’ll begin to see that creating fancy animations simply by tweaking totally different fields isn’t troublesome in any respect. Whereas experimenting with totally different properties utilizing Leva, I discovered it extremely satisfying to look at how IOR adjustments in actual time—to really see the “woosh” impact with our personal eyes.
To animate this impact, I arrange two totally different phases: the pause part and the oscillation part, the place the “wooshing” occurs. The IOR values I needed to make use of ranged from a minimal of 1.07 to a most of 1.5. Utilizing some fundamental math, I applied this inside my useFrame
perform.

Through the use of GSAP to animate IOR over time, I achieved this outcome:
After I posted this on X, I obtained a number of inquiries about how I managed to place the textual content completely inside my torus. The key sauce? IOR 😉
Efficiency
Efficiency for MeshTransmissionMaterial
is just not low-cost in any respect, so we must be aware of how we use it. When an object has transmission enabled, Three.js performs a separate render go of the scene for every object utilizing this materials. That is essential to accurately compute the refracted background for each transmission object.
In contrast to easy opacity—the place transparency is dealt with in a single go—transmission supplies require an extra go to find out the refraction impact. If a number of objects in a scene use transmission, Three.js should re-render your complete scene a number of occasions—as soon as for every object. This could rapidly turn into a efficiency bottleneck, considerably growing the variety of draw calls.
Going Additional
Mastering MeshTransmissionMaterial
can result in some really fascinating outcomes, like this:
I’ve seen a number of Three.js scenes the place builders use advanced shaders to attain comparable results. Nonetheless, when you perceive the magic behind Transmission Materials, you’ll begin recognizing all of the artistic prospects it gives! 🙂
And that’s it! Enormous because of Codrops for giving me this chance to contribute to the Three.js group. When you have any questions, be at liberty to succeed in out to me on X.
Bear in mind, all nice artwork comes from foolish experiments. Cheers to the Three.js group! 🎮🌟