4.7 foliage has higher shader complexity now?

Here is a shader complexity screenshot of same grass mesh with good-old masked material - left one is put as InstancedFoliageActor and right one as StaticMesh. Scene lit by Static dirlight.


Right one (StaticMesh) looks legit - opaque pixels are green with no overdraw, but same mesh as foliage (left) looks as if it was entirely translucent with lots of overdraw. Also, even single sheet of material seems a bit heavier (darker) than on StaticMesh.

What’s happening here? In 4.6 both foliage and mesh would show identical shader complexity.


Update: I just looked at profileGPU data and it seems that now foliage is shown in BasePass as Dynamic, even though scene is fully static, with static lightmapping. Weird?

Hey Virt -

I have been trying to reproduce this complexity but currently have not been able to get the same results. Is it possible for you to share the Mesh, Texture and Material UAssets for your mesh pictures above so I can test it internally?

Let me know -

Eric Ketchum

Hey Eric,

So I just had a look at this and tracked it down to r.EarlyZPass being equal to 2 and not 3.

Virt has set this to 2 because all the docs about deferred decals advise to do so (Martin Mittring’s comment from April 2014, for instance), while in the meantime there was a commit in December 2014 that gave r.EarlyZPass=3 a new meaning, and it seems to me that this is what we actually need to have both D-buffers and foliage early Z working.

Bottom line, we’ve fixed this simply by setting it to 3, but you may want to update both the documentation and CVarEarlyZPass’s description in DeferredShadingRenderer.cpp to reflect this. :wink:



Just for the sake of this having an answer – r.EarlyZPass needs to be 3, not 2. See my comment.

where do I find this r.EarlyZPass?, thanks

Hi FilipeTessaro -

You can now do this in the Project Settings under Rendering >> Optimizations >> Early Z-Pass and you will want to set it to Opaque and masked Meshes

Thank You

Eric Ketchum