Cel shader not working with foliage

I was trying to make a cel shader from a tutorial which showed how to have only the CustomDepth pass get affected by that shader.
In order to make this work with the foliage I created a blueprint called FoliageBP extending FoliageInstancedStaticMeshComponent. Inside FoliageBP I set the Render CustomDepth Pass as true and changed the component class of the foliage to FoliageBP.
Still the cel shader is not working on the foliage.