Grid material stretched on object surface that is perfectly aligned on the grid

The issue I have is that the grid line gets draged up the face of the mesh that is exactly positionend on the Grid (what is gonna be the case for most objects).
Is there anything I can do to prevent this from happening?
I was thinking maybe I can mask out the vertical surfaces of the placed objects in the world from the grid material but I could not figure out how to do this.

Also when I’m making this post anyway, Any ideas on how I could mask out the grass so that the material is only applied to the landscape below?

The way to mask out the side is to look at the surfaces normal direction. The dot product of the up vector (0,0,1) and the mesh’s normal will create a mask that can be used to control where to apply the grid. I assume the grid is a decal? Objects like the grass can be set not to accept decals.