- Home /
Loading textures from file
Hi,
I have to load several textures from disk via Resource folder and was wondering I should make a material for each one or make a temp material and swap textures on it.
I suspect in order to reduce draw calls, I have to make one material per texture but was not sure and making one material per texture is good practice.
( I think other option is atlases but I think it's over doing it for what I'm doing as of now).
Thanks.
Answer by robertbu · Jan 02, 2014 at 04:19 PM
Only a texture atlas will allow for draw call batching, and then only if the number of vertex attributes is 900 on each object and if you don't make any changes to the material at runtime. Using a single material and swapping textures will generate multiple material instances, and therefore the drawcalls will not batch.
Thanks.
Also same goes for loading these into cubes. Should I have like 10 cubes with 10 materials that each of those materials load a texture or one cube, one material and 10 textures and swap these?
It doesn't matter if you have ten materials or one material and swap textures. Neither approach will batch. You will need to go to a texture atlas approach to get things to batch.