From my research, the shadow pass switch material node doesn’t work with Nanite meshes. But I need the functionality it offers.
I have a tree with leaves on it. I want to place my foliage as instanced mesh but I don’t want leaves. So my previous solution was to disable just the leaves shadow casting in the material section in the static mesh actor. That no longer works with Nanite foliage, neither does the shadow pass switch.
So now comes my delve into source code. I wanted to figure out why this isn’t working. First, I found the hlsl of what the shadow pass switch was doing. It was just calling a function called “GetShadowReplaceState”
I then found that function in the source code. It just checks if “SHADOW_DEPTH_SHADER” Is defined in whatever render pass is currently happening on the material.
I found the spots where this was being defined in the shadow depth Vertex and pixel shading code, but from what I have researched and understand now, a Nanite mesh doesn’t pass through these same render passes?
So now my current problem. If it doesn’t pass through these passes, which passes does it use, where are those located in source, and is there a definition there that defines it’s a shadow pass that could be used in place of checking with the current definition of “SHADOW_DEPTH_SHADER”?