Archived

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

doogle

One huge background image: compression

Recommended Posts

For my 2D side scroller, I want one huge background picture (probably high quality too, maybe 3072x1024x16), instead of smaller tiled images. Is this fesible? What (open source) file format do you recommend? Would one big OpenGL textured quad be ok, or would it affect performance? Thanks

Share this post


Link to post
Share on other sites
Sounds like a bad idea, what if you want to make a new background? Or what if levels have different backgrounds? A text file with #''s specifying tiles is a lot smaller than a HUGE bitmap..

-=Peon=- : A Poorly Implement Forum Bot ------
© Kordova, 2003

Share this post


Link to post
Share on other sites
It is feasible, but some cards don''t support textures of that size (the geforce2 and most Radeon cards only support textures up to 2048x2048). You could compress the texture internally when you load it into OpenGL to minimize the amount of memory it would take up on the card, but your fillrate would definitely take a hit having a big huge textured quad filling the whole screen.

Share this post


Link to post
Share on other sites
1) 3072x1024x16 is 6Mb so as long as you have that amount of video memory available (32Mb cards are common), then yes, it''s entirely feasible.

2) However some graphics cards have a limit on the size of textures they support. For example the Radeon 9000 Pro I have in this machine has maximum size of 2048x2048, older cards have even lower maximums (1024x1024 on a TNT2, 256x256 on a Voodoo2 for example).
Some cards also have a restriction on the shape and dimensions of texture - commonly some require square only textures, others require power-of-2 dimensions (128,256,512,1024,2048,4096 etc). If your textures don''t comply then either the creation call will fail or things will go "wrong".

3) A single texture will also negatively affect hardware texture cache performance since much of what is contained within the map won''t be being displayed.

4) I''d actually still advise chopping your larger map up into tiles - even if you''re not doing traditional repeating tiles. The tiles don''t need to be too small either - you could use say 256x256. Writing a program to chop the huge background into say 256x256 tiles is pretty trivial (could even be done at load time).

5) Open source flexible file formats for storing images?: PNG (Portable Network Graphics) gets my vote every time given that criteria. Alternatively you may want to store your image or tiles in the format they''ll be loaded in (e.g. compressed textures or raw) and then compress the raw file with something such as ZLIB (what PNG uses, and also open source).

--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Share this post


Link to post
Share on other sites