PDA

View Full Version : Why Do My Textures Look So Cruddy?



MaxH
12-03-2010, 04:17 PM
Can anyone tell me why my textures look so cruddy? The image below is an example. There are some garbled decals in the middle of my rocket. Those decals are actually fairly detailed images that show up nicely if I zoom in. It seems like the detail in textures is messed up more than in polygons when they get small. Is this a limitation of hardware anti-aliasing? Would mip-mapping help?

Thanks.

http://www.mfwweb.com/Cruddy.jpg

Dark Photon
12-03-2010, 05:44 PM
There are several texture quality issues in your picture.

You're obviously rendering with MSAA (or SSAA) so that explains why your geometry edge quality doesn't have the jaggies. Remember, with MSAA, only one texture sample is taken per pixel (not per sample), so the texture sampling rate is lower than your geometry edges. However, texture accesses are filtered (if you set up the texture right), approximating a higher frequency sampling rate. But this approximation is poor at more glancing angles, unless you crank up anisotropy.

What it looks like on the planet up-close is you're magnifying the texture. And there are ugly ringing-like artifacts around the text. You didn't swipe this texture from a JPEG, did you? That might explain it.

And farther toward the horizon, it looks like you only have a low-res texture paged in. I'd say you just needed to crank up aniso, but there is a nice crisp line where it goes from clear to blurry which nixes that as the only cause here. You can try cranking up aniso on the texture:



glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 4 ); // or 8


but I don't think that's gonna get rid of that crisp/blurry boundary. You do have MIPmaps defined on this texture and have set MIN_FILTER to LINEAR_MIPMAP_LINEAR, right?

Now as to your decals, yes, unless you want a flickery mess, you're going to want MIPmaps defined and a LINEAR_MIPMAP_LINEAR MIN_FILTER enabled. Face-on this will look OK and not flicker, but as you get edge-on, it'll blur out too much (screen X and Y derivatives become widely different, so it pushes your sampling up to higher (courser) MIP levels. To combat, tell the GPU to take multiple samples at lower (finer) MIP levels and average them for higher quality. You do this by cranking up anisotropy on the texture.

For testing purposes though, you can tell the NVidia driver to render with SSAA. That'll sample the texture multiple times in the pixel and avg the results. Here in Linux, looks like there's one lone mode holding out with SSAA support; mode 9:



9 - 8x (4xSS, 2xMS)


What GPU are you running on? If pre-GeForce 8, recall that GeForce 8 "vastly" improved texture sampling quality, which would help with the clarity of your decal and other textures, especially when viewed at a diagonal angle like that or edge-on with aniso cranked up:

* http://techreport.com/articles.x/11211/6
* http://www.rage3d.com/reviews/video/nvidia8800/af2.php

MaxH
12-04-2010, 02:01 PM
What it looks like on the planet up-close is you're magnifying the texture. And there are ugly ringing-like artifacts around the text. You didn't swipe this texture from a JPEG, did you? That might explain it. I'm not too concerned with those background map textures at the moment. They actually show up very seldom in my scenes. It's the decals on my rocket that I'd like to improve on. I'm showing what rockets looks like when viewed from chase planes just after launch. I've compared my graphics images with actual video from the chase planes. Turns out the real video shows these decals much more clearly than my graphics images. So I'd like to improve on that. I did not write the code that sets up the texture mapping on the rocket. But I have access to it. It does not utilize mipmapping. So my next step should probably be to change that code.


What GPU are you running on? Quadro NVS 285

Thanks for your lengthy response.

ZbuffeR
12-04-2010, 02:22 PM
Indeed, mipmaping with trilinear filtering will definitely help a lot in your case.
Anisotropic filtering will not help so much if the decals are facing the camera. Try putting aniso level to 4 or 8 anyway as said Dark Photon, it is not too costly, and does bring nice improvements when texture is seen at an angle.

Dark Photon
12-04-2010, 07:46 PM
What GPU are you running on? Quadro NVS 285
Ok, that looks to be pre-G80 (pre-GeForce 8), comparable to a GeForce 6200. This implies that GPU probably has very directional aniso texture filtering (see the pic in that first link). This means even with aniso cranked up, you'll get the best quality when the projection of your texture axes (s and t) onto the screen align with your screen axes, or are rotated from each other by a multiple of 45 degrees. In between that, it'll get pretty blurry. Put the eyepoint in a spin when you're looking along a surface, and you can see the quality pulse.

In case quality becomes an issue for you and a GPU upgrade is an option, G80+ largely fixed this. Notice the nearly smooth circles in the colorful aniso diagrams.


Thanks for your lengthy response.
Sure thing!