PDA

View Full Version : Large Texture files



WILL
29-06-2007, 07:46 PM
Hey I was wondering if someone could shed some more light on this issue of large textures.

I have a rather large 2500x1250 size world map image that I want to convert into a texture for my next game project. It's 2:1 sized, which works in a way, because then I can then simply split the image in two and not have to worry about any extra unused texture memory.

However because of the odd size, I'm left with the choice of either reducing or enlarging the size of it. Which becomes a problem if I choose to go up to 4096 and your card (or mine for that matter) cannot support a texture size greater than 2048x2048.

On the other hand if I reduce it down to two 2048x2048 textures then when I wish to zoom in to a particular region, I'll end up with an overly pixelated chart on my hands.


Any recommendations about this? Reduction quality or texture sizes on cards?

JernejL
29-06-2007, 10:52 PM
set the near and far filtering mode to bilinear.

cairnswm
30-06-2007, 05:54 AM
Soem of my games (Run-A-War) had textures of 2048x2048. I found that a number of older cards could not use that sized texture.

As long as you only aim for cards younger than 5 years its OK.

My suggestin would be to try get the map into a 2048 size as maximum.

User137
30-06-2007, 09:14 AM
Or use 2 textures of 1024x1024.

czar
30-06-2007, 10:29 AM
That would be 4 textures of 1024x1024 - not 2

I would suggest using a different approach - e.g. tiles and render to texture for effects on the landscape

2048x2048 is a lot of memory to push around

technomage
30-06-2007, 12:55 PM
Hey WILL

You are using Opengl Right? In which case texture size has no bearing on the size of your world.

You could render a 2500x 1250 quad on the screen if you wanted and just put a 512x64 texture on it. It wouldn't look nice but you get the idea.

Scale your texture to a power of 2 (rememder the width and height don't have to be the same, just power of 2 so 512x64 is OK as is 1024x512 or 1024x8 etc). An just render your world the normal size.

I may have got the wrong idea, but I would make my world size not dependant on the size of my textures.

Dean

Legolas
30-06-2007, 01:34 PM
What about mipmapping? :think:

WILL
30-06-2007, 10:08 PM
Thanks guys!

I've been tinkering with the base of the code to display and scroll about my map with the mouse. It works ok so far, no zooming in/out yet, but I'll get there.

Right now I have the image split in 2 textures with each a perfect square at 2048x2048. I scaled the image up in Photoshop and sliced it into my textures.

So now it just draws them onto an Ortho perspective one besides the other to represent the whole map.

I am using OpenGL for those that are curious.


My end goal is to have a 1024x768 game screen size where my 1.0 scale 4096x2048 sized map can be scrolled across (wrapping around the left|right edges) and zoomed in and out of different spots. Kind of like how the game 'Defcon' does it.


Scale your texture to a power of 2 (rememder the width and height don't have to be the same, just power of 2 so 512x64 is OK as is 1024x512 or 1024x8 etc). An just render your world the normal size.

See I don't know about that. I keep hearing that some cards have a really hard time with non 2:2 textures. So I just play it safe and make sure they are all 2:2. Maybe it's just the older 'obsolete' cards that do that?

Legolas: I don't know a lot about mipmapping, can I do that in Ortho? I think I have a height map to go with the real color image.


set the near and far filtering mode to bilinear.

Will this work in ortho too? Or is it more for 3D perspectives? I'd love any way possible to map the image look a bit nicer when zoomed into the closest view.


2048x2048 is a lot of memory to push around

Wouldn't flipping through a series of textures be more of a burden on the card though? Having 2 2048x2048 would allow me to have the larger res image for zoomed in viewing and I'd only have to change textures twice to draw the map.

Legolas
30-06-2007, 10:54 PM
Legolas: I don't know a lot about mipmapping, can I do that in Ortho? I think I have a height map to go with the real color image.

Sorry, really I don't know. I read somewhere how mipmapping works and I thought it would be useful in your case :)

WILL
01-07-2007, 12:25 AM
Well here is the texture I'm using at 4x zoom. I may need a more detailed texture to get a nicer image. It's a 100% Quality Jpeg. The distortion of the image is from OpenGL showing the image not from the encoding of the image file it's self.

http://upload9.postimage.org/69482/Japan4xZoom.jpg (http://upload9.postimage.org/69482/photo_hosting.html)

Any suggestions?

dmantione
01-07-2007, 07:16 AM
Tiles look like the best option to me; storing textures larger than the display in video memory is a terrible waste of video memory to me (2048*2048)=16MB, as you don't need to show the full texture at all.

Now if 16MB is the price to solve the problem, let's pay for it, but it isn't as you won't be able to scale up to larger maps. Tiling allows you to scale easily to maps, and is therefore well worth the effort.

User137
01-07-2007, 09:13 AM
Hey WILL

You are using Opengl Right? In which case texture size has no bearing on the size of your world.

You could render a 2500x 1250 quad on the screen if you wanted and just put a 512x64 texture on it. It wouldn't look nice but you get the idea.

Scale your texture to a power of 2 (rememder the width and height don't have to be the same, just power of 2 so 512x64 is OK as is 1024x512 or 1024x8 etc). An just render your world the normal size.

I may have got the wrong idea, but I would make my world size not dependant on the size of my textures.

Dean

Oh my god, you were right! Changed my texture loader to calculate power of 2 separately width and height and works well. So 1024x512 does work. However textures like 1000x1000 will just return error and white texture. My card is Radeon 9200.

1250 is closer to 1024 in my opinion, detail loss isn't that great. At least if you plan to show more and more detailed graphics when zoomed.