I decided on using 16x16x16 (4096 total) chunks of blocks.
Problem is with textures.
First idea was about texture atlas but it would require a lot of calculation and possible problems in dividing UV (1) by atlas size (power of 2).
Then I was thinking about using array of textures or
I do not have fixed amount of textures and I reserved
65,535) for block-only textures (those textures are not used anywhere else, even items have their own item-only textures).
All those textures are loaded before the world (based on loaded "mods").
I got so far that array of textures should be best solution because they support different resolutions (8x8, 16x16, 32x32, 64x64...) without duplicated pixels (which
sampler2darray would require when even 1 texture has higher resolution because all textures would be re-scaled to fit it).
Problems I found with array of textures are:
- the length must also be defined in shader (which I would need to recompile at runtime)
- limited length (
2048based on vulkan.gpuinfo.org but even Minecraft has
229block types, some with multiple textures)
- possible "greedy" mesh optimization reducing number of vertices utilizing
Which type of storage for textures is best in this case?
Or should I separate faces by textures, create VkPipeline for each texture and render them one by one?
EDIT: Each block has at least 1 texture (most time unique) but can be higher then 6 (different texture for each face) when 1 block is made of multiple cubes = non-solid.
.plyor a similar format, you can save UV's there, and achieve the same result with not having to do any calculations at all, \$\endgroup\$