Learning how to create shaders, what am I missing here?

So I downloaded a free enviroment on the marketplace to apply my own shaders to and I noticed something. Just let me get this out of the way if it means anything, but it was initially dx11, and I upgraded it to 12 to use unreal 5s new features.

Anyway, I’m creating a water shader from a tutorial and I noticed it was wayyy less performant in terms of instructions compared to the one in the enviroment. But it didn’t make sense just how much less performant. So I decided to create an empty material to compare and the empty one has even more instructions then the water material found in the environment! Also, the water material even though it’s set to translucent, has inputs as if it were opaque. I’m just confused, what am I missing?


I think it’s the blend mode you’ve chosen :slight_smile:

1 Like

They’re both translucent though?

Are you using deferred in both examples?

Ya they’re in the same project / level

There are different kinds of translucencies that vary in cost significantly. There’s another setting, believe its called lighting mode, lower down on the left panel to choose which type. Make sure you’re comparing apples to apples on the details panel from top to bottom.

Ok, so we’re getting somewhere now. It had one difference. “compute fog per pixel”. Which actually costs more to run, but it brought down my base pass vertex shader instructions and shot up my bass pass shader instructions. But you’ll notice in the pictures, the water shader isn’t showing base pass shader instructions, so it could very well be a lot too. I’m not sure why I can’t get that to show on the water shader though…

Also make sure to apply and save changes before comparisons. I can see from your first screenshot that the material had unapplied changes at that point. I’ve noticed if a material isn’t saved, it won’t show complete shader instructions.

Also be careful about drawing too many conclusions about performance based solely on shader instruction counts. Generally the fewer the better, but not all instructions are created equally.

Vertex shader instructions are computed per vertex and generally scale with mesh complexity.
Pixel shader instructions are computed per pixel and mainly cost scales with how much screen space and object occupies.

Because an object often occupies more pixels on screen than it contains verts, the same operation is often more expensive when performed on the pixel shader.

But all that said, total instructions are still one of the better metrics available to us.

1 Like

Still wont show after A save, but thanks for the info!