How to make an alpha mask by combining a checkerboard with vertex color or gradient?

I am trying to create a floor shader that leaves scattered around in varying amount of leaves determined by a randomly generated checkerboard pattern and the vertex color. I was able to get it working like I wanted until I tried to combine the checkerboard with the vertex color. Each tile has a leaf inside it with a random alpha but when combining it with the vertex color then the tile’s alpha is no longer flat which gives me this result when changing the alpha cutoff.

I need the entire leaf to disappear instead of being split when lowering the alpha color. I’ve gotten to the point when I just started adding random node to see what works and my graph currently looks like a mess and makes no sense. I’m using a gradient texture to help me visualize the vertex color and this is the closest I’ve gotten to the result I want but even if I make the tiles remain flat, some of the tiles unaffected by the vertex alpha don’t have the correct intensity.

What’s the best way to approach this? Am I missing some obvious solution?

How are you combining the alpha with the vertex color? Can you just take the tile alpha and ignore the vertex alpha when combining them?

I tried to clean up as much as I could since my graph is such a mess after trying out so many things. What I’m currently doing is that I have a Density value (0 to 1) that acts as the alpha cutoff and multiply it with the vertex alpha. Leaves with a lower alpha value are cutoff as the Density value goes down. This is a sub graph that I loop by the Layer amount in the main graph to add variety in leaf position, rotation, and scale. When combining all the layers, leaves with a lower alpha value are rendered below leaves with higher values regardless of which layer they are from and are given a darker color when the density is higher.

In this second example, I have 8 layers of leaves and Density is set to 1 and the area with less leaves has a lower vertex alpha. I want the vertex alpha to cut off the entire leaf instead of just part of it.

I would consider using something other than vertex color for the alpha cutoff. Maybe another texture whose pixels sync up perfectly with the checkeboard pattern for your leaf tiles - 1 pixel for each tile. That way just sampling the alpha from the same UV as the checkerboard texture should solve the issue.

I wanted to use the vertex alpha so the density could be set dynamically in separate areas of the mesh, so I’m going to need something that I can change during runtime

I don’t think there’s a way to fix this if you’re limited to vertex color using shader graph (though I could be wrong) since you can’t just get the color of any vertex position you want. So you’ll probably need to think of other solutions.

You could still go with the texture sampling method I suggested. You can edit the pixel data at runtime and then sample it in the shader graph. You could have it have a much lower pixel resolution that the leaf tile texture too if you prefer.