Mesh Cutter - Scene optimization tool

Hi all,

Whilst working on optimizing our scene for our school project I noticed that we had a lot of overdraw in our scenery. Obviously using Occlusion Culling can help a lot with that to hide objects that are hidden behind other objects. What it doesn’t fix however is when a part of the geometry is within other geometry (mainly in our case; Big rocks being build with smaller rocks).

Our problems:

  • A lot of draw calls (because a lot of meshes have different scales, so no batching)
  • A lot of “unseen” geometry being rendered

My solution:

  • Since I have to combine a lot of meshes (grid based) to reduce draw calls I came up with an Idea to remove all the vertices/triangles of meshes that can’t be seen because they’re inside other meshes.
  • Since it’s really hard to actually cut meshes and have them connect correctly I’ve decided to go for a more quick 'n dirty method: I simply remove all triangles that have all 3 vertices within another mesh. This means that the mesh itself isn’t beautiful but that’s something that can’t be seen.

Right now I have a basic prototype ready and if there are enough people interested in this I’m thinking about cleaning it up and putting it on the asset store :slight_smile:

Let me know if this is something you guys are interested in!

Kind regards,

Peter

Before:

After:

1 Like

I think this is a good idea, and it is simple! If this is an editor tool, it would always be good to have some way of reverting back in the case of needing to edit mesh placement

Thanks!

It is an editor tool, since it can take quite a while for large scenes to be processed. Anyway, how I’m currently using this (and my other tools) is as a pre-process option. So the artists just fool around in the scene, and when we have to build I run this tool (and mesh combiner) and save it as another scene :slight_smile:

I did builld-in Undo but I guess that information can get lost between unity sessions etc.

1 Like

Hi guys, I’ve got an update on this!

I ran into the a problem (see picture below) with the mesh cutter. As a fix I’ve implemented a tri-tri check, so my tool shouldn’t cut the 3rd case anymore.


As a result a lot of triangles got marked as intersecting and thus don’t get deleted anymore… In the test scene of my previous post a lot of triangles that are withing the ‘big mesh’ are now not getting delete anymore. As a counter measure I’ve now implemented a method where you can create a cutter mesh (cube?) and force delete those triangles. :slight_smile: This feature is also very nice to remove triangles that are on the backside of the level.

On a sidenote, I’ve made the system about 10-20x faster than it was when I first posted by caching data and implementing an octree for collision detection :slight_smile:

1 Like