0
\$\begingroup\$

Is there any performance difference between using multiple textures and using texture atlas in splatmapping? I would want to use multiple ones beacouse tiling and changing them would be easier but performance is more important.

\$\endgroup\$
  • \$\begingroup\$ The best way to check which of two options performs better in your particular scenario on your target hardware is to set up samples of each & profile them. In cases like this I wouldn't expect any benefits from atlassing, because splatmapped terrain is usually drawn all in one pass anyway, not one per splat texture. So atlassing wouldn't save draw calls, just push the texture wrapping math into the shader instead of the dedicated sampling hardware. Your mileage may vary, but I'd be wary of making the shader more complex unless you've identified this as a real performance bottleneck first. \$\endgroup\$ – DMGregory Feb 11 '17 at 15:54
0
\$\begingroup\$

I would say that a few years ago, creating a texture atlas would have been better, however now, I believe that GPUs would be more optimal at sampling from multiple different textures. There are a few reasons for this:

  • Normally, when doing texture splatting, you are sampling the same texture coordinate across multiple different textures. Having multiple samplers is more suited to the GPU as it makes use of contiguous memory access. The GPU will cache regions of textures around the sampled locations whenever you do your first texel fetch. If neighbouring pixels are using neighbouring colour data, the textures will already be available in the shader units local texture cache. If you had used an atlas, you may end up jumping around the same large texture, having to re-fetch each time, causing a texture cache crash.

  • When you use a texture atlas, you can also run into pretty severe problems when it comes to texture filtering, with bleeding edges between the texture boundaries and such. Independent samplers generally function better in this regard.

  • as DMGregory said, atlasing would also increase the complexity of your shader, ultimately reducing the overall performance.

Though all this being said, it is still important to evaluate both options. As splatting is quite a fast operation, it may be difficult to notice a difference. If there is no measurable difference, stick with independent textures.

The one downside to this however is that you do have a hard limit of the number of samplers that can be used, though you can make use of texture arrays or multi-pass rendering if you need to use lots of textures. It is worth noting that older GPUs will have less texture samplers available. The modern standard is 32 textures however. Some older cards will only support 16.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.