Archived

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

Texture Filtering (Pixelated?)

This topic is 5048 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a new "engine" and I spent a great deal of time on the texture system. The only thing that's annoying me is the way my textures look. They're not smooth at all, they look pixelated... Here's an screen shot of what I am talking about: (NOTE: These screen shots are using 2x Anti-Aliasing and 8x Anisotropic Filtering on the video card and it's using NEAREST as the MIN and MAG filters. I also tried 6x Anti-Aliasing and 16x Anisotropic Filtering and that seemed to give me about the same result.) The bump mapping in the system looks "choppy" too. Could someone please give me an idea of what I can try to smooth them out a little? I would appreciate it. Thanks, -UltimaX- Ariel Productions "You wished for a white christmas... Now go shovel your wishes!" [edited by - UltimaX on February 20, 2004 12:18:57 AM]

Share this post


Link to post
Share on other sites
Nearest point filtering is the cheapest and ugliest filtering method there is. It basically samples the texture using the pixel specified by the texture coordinates. Of course, when you zoom in the result is that more than one pixel on screen will use the same pixel from the texture. Using GL_LINEAR filtering, OpenGL interpolates the value between the texture''s pixels. The result is that colours blend much more smoothly when you zoom in.

The only reason to use GL_NEAREST is when you don''t want any filtering at all. It is best when you are displaying the texture to screen at a 1:1 ratio, usually for multipass rendering techniques. In such a case, a texture''s pixel will never cover more or less than one pixel on screen. For basic texturing of surfaces, you''ll definitely want to use GL_LINEAR. When you start learning about mip-mapping there''s other filtering settings, but until then: use GL_LINEAR.

Share this post


Link to post
Share on other sites
quote:
Original post by Ostsol
Nearest point filtering is the cheapest and ugliest filtering method there is. It basically samples the texture using the pixel specified by the texture coordinates. Of course, when you zoom in the result is that more than one pixel on screen will use the same pixel from the texture. Using GL_LINEAR filtering, OpenGL interpolates the value between the texture''s pixels. The result is that colours blend much more smoothly when you zoom in.

The only reason to use GL_NEAREST is when you don''t want any filtering at all. It is best when you are displaying the texture to screen at a 1:1 ratio, usually for multipass rendering techniques. In such a case, a texture''s pixel will never cover more or less than one pixel on screen. For basic texturing of surfaces, you''ll definitely want to use GL_LINEAR. When you start learning about mip-mapping there''s other filtering settings, but until then: use GL_LINEAR.


1) Thanks for reply

2) I looked at my default setting for the texture parameters and they were set to linear. I thought it was nearest, but I guess not. So that''s not it... And yes I know the difference. Linear uses a weighted linear average of a 2x2 array from the center of the pixel. Nearest uses the center of the pixel for both minification and magnification. So it really doesn''t use interpolation for the filtering.

Linear Interpolation:
Result = Texture[0] + (Weight * (Texture[1] - Texture[0]));

Average:
RF11 = Data[Index(X - 1, Y - 1)];
RF12 = Data[Index(X - 1, Y - 0)];
RF13 = Data[Index(X - 1, Y + 1)];
RF21 = Data[Index(X - 0, Y - 1)];
RF22 = Data[Index(X - 0, Y - 0)];
RF23 = Data[Index(X - 0, Y + 1)];
RF31 = Data[Index(X + 1, Y - 1)];
RF32 = Data[Index(X + 1, Y - 0)];
RF33 = Data[Index(X + 1, Y + 1)];
Result = (RF22 + RF12 + RF21 + RF23 + RF32 + RF11 + RF13 + RF31 + RF33) / 9.0f;

They would produce 2 different results.

3) The bump mapping uses 3 texture units. 1 for the base map, 1 for the height, and another for the normal map. It doesn''t look as bad because of the fact you pointed out, but it''s still a little choppy.

4) I don''t see how you can assume I know nothing about mip mapping. It''s one of basic things I learnt when doing textures. My system defaults to use GL_LINEAR_MIPMAP_LINEAR as the MAG filter and GL_LINEAR as the MIN filter.

5) "When you start learning about mip-mapping there''s other filtering settings" I hope I would have learnt that before bump mapping

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

Share this post


Link to post
Share on other sites
*shrugs* My assumption was the result of you using nearest point filtering, which (as I mentioned) is only used in very specific situations and not at all for general texturing. Sorry if I offended. . .

Share this post


Link to post
Share on other sites