I'm developing on D3D11 and D3D12 in parallel. D3D12 is really difficult, but I learn it gradually. I faced a problem such as passing an array of textures to a vertex Shader. The method Textures2DArray was interesting in D3D11 , but it had disadvantages (size of texture, width and height must be the same, the same levels of MipMaps etc). As a result: I'm looking for a way to transfer a dimensionless ( if it is possible ) texture array, or at least an array of fixed size, but with different textures (*.dds (mipmaps, *.jpg etc). Why is it so necessary? Let's imagine that a model has been loaded. It has 50 textures. I loaded all 50 textures on the CPU, built an array from it, created the necessary descriptors and sent it to the Shader. I get the right texture in the Shader using the index. Thus, there will be one call to the GPU, instead of multiple calls = = number of textures in the model. Thank you for any information.

P.S.: I know about texture atlases, but in ordinary geometry I do not see any benefit from it

  • \$\begingroup\$ "I know about texture atlases, but in ordinary geometry I do not see any benefit from it" - The benefit of a texture atlas is getting exactly what you say you want: rendering a model with multiple textures of different dimensions in a single draw call. There's no version of an Array Texture that does what you describe in DirectX 11. (And as a bonus with atlases, you need only two texture coordinates instead of three, so your vertex buffer gets to be a little leaner) Can you elaborate on what's preventing you from solving this with an atlas? \$\endgroup\$ – DMGregory Sep 1 '19 at 12:52
  • \$\begingroup\$ @DMGregory Yes, of course.For example I need to perform texturing walls with different textures. One texture has a resolution of approximately 1024 x 1024. And if we will have 15 such walls? If I put it all together in a textural Atlas, how big will it be? \$\endgroup\$ – Range Sep 1 '19 at 13:17
  • 1
    \$\begingroup\$ 4096x4096 will let you handle 16 such wall types in a single atlas, dropping your draw call count by 4 orders of magnitude. That's a substantial win from atlases. :) Of course, if you have a type of asset like that where all the variants use the same texture dimensions, you can use an array to get even more reductions even on DirectX 11. Say one array for all the 1024 wall textures, and an atlas for the mixed/smaller texture sizes, bringing you down to 2 calls for a multitude of different textures. (Or you could even place your atlases inside the array to do it in one call) \$\endgroup\$ – DMGregory Sep 1 '19 at 13:22
  • \$\begingroup\$ @DMGregory Array .. do you mean Texture2DArray? \$\endgroup\$ – Range Sep 1 '19 at 13:42
  • 1
    \$\begingroup\$ Here I'm talking about the same Texture2DArray you can use in DirectX 11, since you mentioned you're supporting both in parallel. If you're unsure how to do something with them, I'd recommend editing your question (or posting a new one) to ask about the specific step in the implementation you need help with - then folks can post answers to help you out. \$\endgroup\$ – DMGregory Sep 1 '19 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.