Texture Detailing

Started by
6 comments, last by TheAdmiral 17 years, 7 months ago
I need to have various levels of detail for my textures because blocks of land faraway dont need the high texture detail, but when I go close to them, I need the high detail to appear. So my question is should I draw multiple textures in photoshop with various levels of detail, or is there a way in the game to "tone down" the detail on the fly? I need this for efficiency mainly.
Advertisement
I've totally never heard of that. Most games worry about polygon level of detail. Is texture detail a real issue in terms of game speed? This may also be related to mipmaps. "MIP mapping features multiple images of a single texture map at different resolutions", but I don't know that it is really related to speed. I also remember reading that the image format DDS is the most effective because it has some system that is pre calculated.
___ _ _ _Journal with textures, moddeling:http://btoxin.livejournal.comGame Website:http://fadedearth.infinityanalog.com
If I understand your question correctly, I think you are talking about mipmaps. Which API are you using, Directx or Opengl? I know Opengl has the function gluBuild2DMipmaps and I assume Directx has something similar.
Im using directx 9. Im using blocks of land 64verts by 64 verts, maybe thats the problem? The way Im doing it right now is what I saw in a tutorial. I have a .raw for the heightmappings of the terrain,and then I have a .jpg for the texture. The .jpg's are 512 x 512. In a normal view during the game, about 6-8 blocks of land are rendered (meaning in view) and im culling everything outside the frustrum before they even get a chance to try rendering themselves. When 4 blocks of land are in view, the fps is about 30, but once i get more, the fps drops dramatically to about 10-20. I will go look into mipmaps and DDS(im not sure what they are, but Ill go look at the tutorials and such for that).
Do you know of any good mipmap tutorials? I tried searching, but i didnt find anything satisfying. But yes, mipmaps are exactly what i mean now that i see what mipmaps are.
Save your textures in the .DDS format, it autmoatically creates mipmaps. I'm not sure how to implement them in the code though.
After a while of browsing around, i found "D3DXCreateTextureFromFileEx". It has a param for how many mipmap lvls, and a bunch of other params. so, once i load the texture with a certain amount of mipmap lvls, how do i specify which lvl to render as? iow, what texturestates or texturestages or other settings do i have to set during rendertime to tell the card which level of mipmaps i want to use?
You can't really specify which mip-level to use without writing your own shader or seriously bullying the API into using specific texture surfaces. However, unless you have a very specialist application, there is no need to specify the mip-level:

The default pixel shader in the fixed pipeline will automatically determine, from the homogeneous w coordinate, which mip level to use to give the closest pixel-texel mapping. All you need to do is to create the texture with one or more mipmap levels and use the texture it creates as you normally would.

Unless you have very strict memory requirements, pass 0 as MipLevels to D3DXCreateTextureFromFileEx to create a full mipmap chain. It costs only 33% extra video memory to create a full chain, but the benefits are dramatic.

Also, be sure to set texture filtering to trilinear so that the boundaries between mipmap levels don't appear as radial artifacts in your render.

Regards
Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.

This topic is closed to new replies.

Advertisement