Shader Complexity ViewMode shows weird/different behavior than Material Preview

Hey,
the Material Preview (with Shader Instructions, Texture Samplers, Texture Lookups etc.) is telling me, that my second Version is more performant (fast Version). I managed to reduce Instructions and Texture Lookups.

Slow Shader:
540 Instructions, Texture Lookups PS 29

Fast Shader:
531 Instructions, Texture Lookups PS 21

But when looking with the Shader Complexity viewport, the PS moves slightly to the right, so it is telling me the performance is worse. How is this possible?

Now I am not sure anymore, that my new (fast shader?) is still the faster/more performant version? Why is the PS telling me, that the version with more Instructions and more Texture lookups is more performant?


GIF to better demonstrate the PS in the 3D Shader complexity Viewport:
BothShader

The Shader Complexity viewport and the Material Preview (with Shader Instructions, Texture Samplers, Texture Lookups etc.) are two different ways of measuring performance. The Shader Complexity viewport measures the performance of the shader based on the number of pixels that are shaded per frame, while the Material Preview measures performance based on the number of instructions and texture lookups in the shader.

A higher number of instructions and texture lookups in the Material Preview does not necessarily mean that the shader is slower. It may mean that the shader is doing more complex calculations or using more textures, but these calculations or textures may not be affecting the number of pixels that are shaded per frame.

It’s also possible that your texture lookups are more optimized in the fast shader and therefore don’t affect the performance as much as the slow shader. It’s also possible that the performance difference is small and the difference in instructions and texture lookups may not be significant enough to make a big difference in the final performance.

So in short, the two metrics are measuring different things and one is not necessarily better than the other. You should take the two metrics together and evaluate the performance based on both of them and also test it on different hardware and scenarios to get a better understanding of the performance.

I hope this helps!