Improve performance whilst using a TON of objects

So I’m currently working on a project where I’m importing GIS soil sample data into unity. I’m going to be visualizing it using a voxel/minecraft like system, where each voxel is a soil sample.

I’ve got a good system working so far, at a same scale that is. When I tried to use one of our raw files converted to image layers (about 300x300 for each image), it crashed unity and the computer when it tried to render it.

In my tasting I used 3 16x16 images for 3 dummy layers, this ran OK, but the performance wasn’t too good with all the colliders (colliders are necessary for click detection), and all the primitive cube instances.

I don’t think object pooling is really an option here. My one thought was to turn it into one big mesh, but I have no idea how I would even start going about doing that.

Is there a way I can improve performance while still using a ton of cubes and colliders?

You mentioned voxels, but then described a system of cubes and colliders…? the first approach might work, but the second definitely will not.

I would create a texture in which each pixel encoded the soil sample as a RGB value, then apply a single collider to the mesh that looked up the colour corresponding to a textureCoord of a raycast where clicked