Archived

This topic is now archived and is closed to further replies.

Keba

Texture Batching

Recommended Posts

Hello. I''m trying to batch some texture but got some question. The idea is that instead of many small textures create one big texture with the small texture in and manipulate the uv coordinates, but what would be best? if i use a big texture,which size? i mean,is a couple of 128*128 texture better than a big 1204*1024? I know that some old cards maybe dosen''t support that kind of size but anyway. what is most expensive? a big texture or many small depeing on the set texture function in D3D. And if i let say use one big texture for many smaller textures, how shouldi do the mippmapping later? can i do the same thing with them? batched in the same way, but smaller? my english sucks, i hope you will understand me anyway, thanks

Share this post


Link to post
Share on other sites
Changing textures isn''t a cheap operation. Try to do it as little as possible. Therefore, you should group your textures into larger ones. 512x512 would do. It''s fairly simple, actually. If you normally store textures at 256x256, combine four of them into one 512x512. Then, adjust your tex coords. This can be done by dividing them by two (half the size) and translating them by 0.5 depending on their relative location to the larger texture. This could be done during load time or during level creation.

As for mipmapping, they''re relative in size so everything should be okay.

---
Brent Gunning | My Site

Share this post


Link to post
Share on other sites
Creating one large texture is ideal, but often the artists complain when you ask them to do it.

Most cards have a "sweet spot" of 256x256 where the hardware is optimized to render this quickly. But, in an nVidia whitepaper, they say that if you have enough data to use a 512x512 image, it''s better than 4 smaller images.

It really depends on how much you want different art assets to rely of a bitmap shared amongst other art assets. Also, when you stitch bitmaps together like this, you''ll lose your ability to wrap the coordinates past 0 or 1.

You need to decide which, if any, of your bitmaps you CAN place as a part of a larger bitmap, and then you have to figure out some balance with your artists (or yourself) on which ones, if any, should be merged.

Share this post


Link to post
Share on other sites
i think it depends on the size of your target to be textured.
if it ground/terrain, and if its going to be very big, then having one big texture (i''d say no bigger than 256) and then possibly another texture layer (again no bigger than 256) for terrain transitions. then have one more texture layer for your detail map (like a bumpy, rocky, or grassy texture)...but you will want to tile this (the number of tiles is probably trial and error to see when it looks the best).

One more thing, getting a good texture from an artistic point of view really helps. Get photoshop 7.0 or something and start playing with the filters. this will make your texture look much better when running in your game.

Share this post


Link to post
Share on other sites
Another thing to watch out for with this method is problems with min and mag filters. When mip-maps are created, the filter won''t know that the textures are really seperate and will cause artifacts at the edges of textures where texels from the two different textures touch. In some cases this won''t be a problem , but think about if you had a mainly dark, black texture next to a bright yellow or pink texture, you''d definitely notice some problems there!

Share this post


Link to post
Share on other sites
thanks for all answer,another question what commands/functions do you recommend when manipulate with textures, like making a program that stores some textures in a larger texture.
Create/copy textures to each other....and so on

Share this post


Link to post
Share on other sites