Draw call and triangles amount increases when having a physical material with transmission

When auditing the performance of my website, I noticed that the amount of draw call and triangles were much higher than they should be.

After a few test I found the culprit as soon as you have one object with a physical material and it’s transmission set to anything else than zero, it doubles the amount of draw calls and triangles.

I guess it kind of makes sense that a glass material would reflect hence create more draw calls but I just wanted to make sure it was normal and that they are no workaround to prevent that.

(by the way I tested it in an empty scene with two simple cubes and the result is the same)

Thanks in advance for any bit of information !

Transparent ans shadows are makes double drawcalls. In 148v have THREE.TwoPassDoubleSide option for transparent material

Yeah I figured that it would be “normal” that the drawcalls would be doubled when using transparent or transmissive materials. I was just wondering if there was a way to optimize it or an alternative for window / glass material without using transparent and / or transmission.

And thanks for the TwoPassDoubleSide tips, I didn’t know they added this in 148! Doesn’t do anything to the draw calls but there is a slight quality bump :slight_smile:

there’s this now

it looks a thousand times better, but you also control over the buffers. for instance if you use roughness even a resolution of 32x32px will work, this reduces the impact by a lot. you can see it by clicking the “meshPhysical” toggle in that codesandbox linked in the tweet, look at the time per frame these two materials need to render. MTM takes like 0.2ms on my system, MPM is consistently over 2ms, this i think is due to the smaller buffer.

you find the vanilla material here MeshTransmissionMaterial: more realistic glas/epoxy/gelatin - #11 by drcmda although that one has the same issue as MPM, you would have to use the one from drei.


The performance gain is pretty good indeed! Good stuff! Thanks for the sharing.
I’ll mark this as a solution because I don’t think I’ll find a better answer at first I just wanted to make sure I didn’t make a mistake and that the increase in draw calls was normal but now I know the only solution will be to use a more performant material and MTM seems to offer just that!

Thanks a lot!