MeshPhysicalMaterial - can i measure how much more expensive it is?

The documentation states MeshPhysicalMaterial is more expensive than MeshStandardMaterial.

Is there a way to measure just how much more expensive it is?
I don’t see a difference on my 32-GB M1 but I know that isn’t the standard computer out there…

Any ideas on benchmarks I should aim for?

it depends on what you do with it, if you use transmission it renders the whole scene again additionally/each frame. do you use clearcoat, etc. the material alone won’t do anything bad, it’s how you use it, how many times, how many vertices, etc.

for general things to watch out for try this document The Big List of three.js Tips and Tricks! | Discover three.js

2 Likes

Use examples/jsm/GPUStatsPanel.js etc.

gpuPanel.startQuery();
renderer.render(oneMesh,camera);
gpuPanel.endQuery();

image

2 Likes

The shader enables only the features you use a as @drcmda said above - so if you don’t use any of the MeshPhysicalMaterial props, it will cost the same as MeshStandardMaterial.

Clearcoat and all other highlighting props are relatively cheap, transmission and thickness are relatively expensive. This matters most for low-end devices, for modern MBPs you can easily use PhysicalMaterial instead of StandardMaterial and never notice a difference.

2 Likes

awesome, thanks for the help all. Definitely clears things up for me.

Also note that the added cost in shader complexity is proportional to the percentage of the screen you’re covering with that material. So drawing a small object with MeshPhysicalMaterial will be cheaper than drawing a screen-filling environment with it, especially if there’s any overdraw. Transmission is an exception, since there’s an additional pass required regardless of the size of the object.

On some mobile devices you may find that even MeshStandardMaterial is too expensive to fill the screen, and need to use cheaper materials (e.g. MeshBasicMaterial) for things like terrain.

4 Likes