Is shader complexity viewport broken?

In my scene I have a milk bottle, so its a translucent bottle which contains mesh. I searched for a optimized glass shader, which used Fresnel shader for reflection and refraction and used the first 2 slots of fresnel shader with parameter values as 8 and 0 respectively

when I used this on my bottle it showed a color between green and red(in shader complexity), when I used milk material on inner mesh of bottle, the glass became red and it wasn’t even showing milk mesh
So I thought to take a less optimized material but use a better one, I used the windscreen material from automotive pack interior and It was green even when it was interacting with milk mesh and it looked even better than the original optimized glass

So My question is, doesn’t more node mean more complex shader or more unoptimized shader ? is what the complexity viewport showing true or it’s broken ? because the shader from automotive pack has a lot of nodes and so I thought it’s resource usage would be higher as well.

The amount of nodes has no impact on the shader complexity, the complexity is based on the compiled instruction count of the shader. The same material graph will have wildly different instruction counts just depending on which shading model you choose.

Some material nodes cost more than others, some cost basically nothing. Additionally lots of things also affect the number of nodes in the graph that don’t necessarily have much/any impact on performance, such as using static switches to control material options.

I see, so that optimized material was sort of fake, I’m glad I can now use the Automotive Shader

Keep in mind the shader complexity view is more of a “ballpark estimate” of the final cost of a material. Certain things aren’t really taken into account such as the cost of each individual instruction, and some types of materials won’t display their real cost at all (mainly volumetric clouds, can’t think of any other example off the top of my head)

I think it’s more useful than people give it credit for, and will usually give you a decent idea of the cost but it’s not always going to be very accurate. Ben Cloward made a couple of videos on this topic that are helpful in understanding this topic: Part 1, Part 2.