How to prevent grass from going through a model?

Is it possible to make it where grass doesn’t go through a model?

Lets say space ship lands on the ground and onto grass.
Grass pokes up through the model.

Any ideas how to stop this from happening ?
Or other clever ideas to hide the issue.

Do you have any colliders, on the space ship or grass?

I only have a collider on the ship.
Didn’t thing colliders on the grass would be a good idea lol

Look into how to stop water from showing inside boats. There are several techniques with different pros and cons.

The simplest method is to use a depth only pass before the grass is rendered to occlude it. Works well, apart from interactions with other transparent effects. It might also stop grass from showing up if you can look through the ship and see grass beyond it out when inside looking out.

Next method would be doing something similar with stencils to mask only the grass, but it still has similar potential problems with looking through or out of the ship.

The method I might suggest is using a 2d height map or 3d distance field to set a max height / min distance you can use to clip() in the grass or other foliage. It’s a bit more work, but not that bad really.

The short version of that last effect is have an orthographic camera that’s underground looking up at the bottom of your ship and use it to render out a depth texture. Feed the texture and the world position / size of that camera view to your foliage (perhaps using Shader.SetGlobal___() functions) and use that to figure know if the grass is too high to render. A 3d distance field is a bit more involved to generate, and you may want to do this offline instead of in real time, but ultimately can work the same basic way. This can work better for trees and larger bushes that might be along side the ship.

There’s also similar techniques in which you render out a normal map like texture to use to displace and/or shrink grass and other foliage to make it look like it’s being pushed it out of the way.

You could do that bending/compressing in a vertex shader…