I have bunch of quads organized in a grid 8x8. Each quad has one material assigned out of few available. I rotate each quad by random angle and combine their meshes in specific order. This results in rectangular mosaic with jagged edges, exactly what I want to have.
But this object with mesh combined in such way is just one of multiple similar objects I want to have in my scene. And by multiple I mean up to few thousands of them. Most of them cannot be manipulated by player until some specific conditions are met and they are just stacked around. So I guess it doesn’t make much sense to generate let’s say 5k of those objects just to have 4995 of them sit there and eat resources.
If I could somehow save each generated mesh as a texture I could just create 5k of simple quads, merge all those not accessible for player into one big mesh (or a few if I happen to hit 65k vertices limit) and rest would be kept as my jagged mosaic objects.
Next I would generate 5k - [number of interactive objects] of “mosaics”, merge them all into an atlas and use that to texture my big mesh. With pooling I have already implemented that would be rather fast and not memory intensive operation. All objects that player can interact with would stay in scene and have their meshes, rest would be just look like them. And if some object should be interactive I would just regenerate my big mesh without that one piece.
I don’t know if I’m explaining this properly so the bottom line is: is there any way to save mesh (or maybe I should say it’s colors?) to texture? And I mean with code not with some editor tool.