Mip mapping

Started by
12 comments, last by webjeff 19 years, 11 months ago
I have a texture thats 800x600. I am going to create a texture 400x300, 200x150, 100x75, 50x34.5, 25x16.75 Is that correct, I know examples use 256x256,128x128, etc. Not every texture is that nice. haha. So can I create those textures and add the surfaces onto the main one and do mip mapping? Thanks Jeff.
Advertisement
Well, first off, thats a mighty big texture!! ;O)

secondly if you''re using OpenGL im fairly sure textures have to be a power of 2 eg: 512x512, 512x256, 128x64 etc

Im not sure about D3D but I''d bet it was the same.

Also you''re almost certainly going to get a boost by using power of 2 texture than not..thats if the latter are acceptable at all.

Hope that helps.

GCoder
GCoder
Appologies for not answering your question directly!

im quite distracted today

There are mipmapping examples on nehe''s site if you''re using Opengl otherwise I think theres probably D3D examples here on gamedev in the articles section?...worth a look.

otherwise....good old Google! :o)

GCoder
GCoder
If you are using OpenGL or Direct3D, then you can simply supply one version of your texture (the largest version) and the API will create all the necessary mipmaps for you. There''s no need to create all the different sized versions of your texture.
Yea, I already searched but all the examples say 256x256, 128x128, etc. Non show a 800x600 so I dont know if I just scale it down by 50% will mip mapping still work?? or do I need to convert my texture to 1024,x1024 for it to work, that would suck.

Thanks
Jeff.
why not just have filler on the edges? take your 1024x1024 texture, put your actual 800x600 of data in the top left corner, and set your mapping coords so that the poly on displays the 800x600 area?

also, on a little side note, you''re going to have a really hard time getting 50x34.5 and 25x16.75
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
crap, I forgot the other thing I was going to say! I''m pretty sure that OpenGL will allow you to use non-power of 2 textures (though, I''m sure it''s slower). Nehe mentions it somewhere on his site. I know that in my application I''ve got a poly that''s mapped with a non-po2 image, but I don''t really remember what specifically I did to put it in there. Just have to make sure your poly is the same ratio as the image, or you''ll have stretching
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
If I add filler to the 800x600 image, black, will that mess up the UV coords, and I will need to adjust that or will it work, because 800x600 is still the same, its just extended??

Let me know please, thanks for your help.
Jeff
it shouldn''t mess up the coords, ''cause they''re expressed in a range from 0.0-1.0 (unless, of course, you''re doing tiling). I''d try the built in mipmapping functionality first, though. if it works, then great, if not then look for other options
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
Non-power of two textures are supported as an extension in OpenGL.

You need to check the device caps if you''re using D3D (in the TextureCaps part of the caps structure, the flags D3DPTEXTURECAPS_NONPOW2CONDITIONAL, D3DPTEXTURECAPS_POW2, D3DPTEXTURECAPS_CUBEMAP_POW2 and D3DPTEXTURECAPS_VOLUMEMAP_POW2 are the ones to check)

Putting the texture into a bigger (next power of two bigger) texture is a reasonable idea, although (IIRC) you can get problems with filtering pulling texels from outside your original image (especially when using the lower mip levels).

HTH

This topic is closed to new replies.

Advertisement