The following is a complex graphics issue in unity. I thought that since Empyrion has similar systems to what I am trying to achieve, people in this community might know the answers to my questions. Alright I have an issue with materials. I have a pretty nice setup for a voxel game, can create any shape and it occludes the inward facing faces. The problem arises when I try to apply materials to each face of the voxel shape. I was doing this by making an array of materials, and adding a single material for every face. The problem with this is that it lags . To test this, I generated a cube of 32x32x32 cubes. without materials: With materials: I want to be able to have different materials for each face, so I can colorize and texture them differently. This is basically just like Empyrion's ship building... I'm a bit confused about what approach I should strike this problem with. These are some ideas I have: Some sort of splat-map shader, which I have little experience with. Make a massive texture by sending an array of floats to the GPU, then change the UVs of the different faces of the mesh to match it. Sounds a bit silly and might be a waste of time. Somehow use shared materials or instanced materials in a way I don't understand yet. This is just for fun, and so I can teach myself skills that I will hopefully use in the future for a job.
Well, I figured it out. I'm doing it Minecraft style, so I'm grabbing the textures from the same sheet. Behold, my algorithm with a metal panel texture spammed across a lattice of cubes.
I added a second vertex color so I can colorize the textures with two textures at once for different parts. Also improved the shader so its really nice looking. I did this in a hacky way. In order to make new vertex colors, I used the secondary uv map and pluged it in as a color in the shader.