How to put holes in meshes at runtime

I want to be able to put holes in a static mesh at runtime. I am able to do this with a spheremask in the mesh material passed into the opacity mask, but I want to be able to add any number of holes to a mesh during play in a modular fashion, but materials require a finite number of parameters to be defined. I intend to fill the sides of the hole by putting the interior texture on the inside of the sphere and opacity masking the parts of the sphere that are outside the wall mesh.

I’m not convinced anymore that rendering is the best way to accomplish what I am trying to do since materials don’t seem to support modular design. I have found no resources on how I would accomplish this with post processing which seems to be capable of what I want.

  1. Am I on the right track for what I’m trying to do?
  2. If post processing is the preferable option, where can I find resources on how to achieve this?
  3. There is almost certainly a better way of doing this, what options are there?

that’s a bit of your choice.

there are multiple ways to add holes to stuff. but there’s a reason why games usually don’t have infinite realistic holes.

usually most games use decals.

you can use a custom stencil if you want to use post process.

If you want an actual hole that can be looked through (like how The Division allows you to punch holes in signs and stuff) you will generally need to use render targets.

Transparent meshes can have holes cut in then using stencils, but opaque meshes cannot. And decals cannot alter the opacity of an opaque mesh.

So you would need to use a render target to draw the holes, which can then be sampled in the material. This works well for thin objects, out of the box. But to represent thickness, you’d need to do raymarching of some kind, like Parallax Occlusion mapping.

Compute shaders could also be used if you need to get more sophisticated.