Jump to content
  • Advertisement
Sign in to follow this  
Tubos

Texture Filtering Problem

This topic is 2530 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

Hi,

I'm rendering billboards with a circle texture. They need to be downscaled for some post-processing.I tried two approaches:

1) Render to a large rendertarget, then downscale by 50%.

Result: bwyuqrdilim0b6bi3.png

2) Render directly to the 50% smaller RT.

Result: bwyuqtlky9fwmf4jf.png



The first method looks much better. Why is that?

I'm using bilinear filtering for the particles. I already tried making the particle texture 50% smaller. It didn't improve the quality.

Any ideas? :)

Share this post


Link to post
Share on other sites
Advertisement
If you render to a texture and then scale down the texture, the resulting image will have gone through the texture’s bilinear filter.
If you render directly to a smaller texture, the result depends on your anti-aliasing settings, but will generally not be as good as the bilinear filter.
Anti-aliasing can be disabled by user control panels, so you can’t rely on it anyway.


L. Spiro

Share this post


Link to post
Share on other sites
I already tried making the particle texture 50% smaller. It didn't improve the quality.



Depends on how did you resize the texture to 50 %. If you used some filtering during the scaling (in Photoshop or whatever), it should look similarly to the first result.

Share this post


Link to post
Share on other sites
Depends on how did you resize the texture to 50 %. If you used some filtering during the scaling (in Photoshop or whatever), it should look similarly to the first result.[/quote]I just tried it again, using Photoshop filtering. I rendered to the small RT using a smaller texture. The result is still very pixelated. "Small RT, small texture" looks only a little bit better than "Small RT, original texture".

If you render directly to a smaller texture, the result depends on your anti-aliasing settings[/quote]I think antialiasing never comes into play here. The circles you see are just textures, mapped onto square billboards. Antialiasing only smoothes the edges of triangles, and not the texture on them. Since the edges of our billboards are invisible, antialiasing has no effect in this case.

If you render to a texture and then scale down the texture, the resulting image will have gone through the texture’s bilinear filter.[/quote]Yes, that's what I'm doing. When I downsize the large RT, I use bilinear filtering. When I render the particles, I use bilinear filtering too.

Who can solve that mystery? ;)




Share this post


Link to post
Share on other sites
When I downsize the large RT, I use bilinear filtering. When I render the particles, I use bilinear filtering too.


Maybe you aren't :) Maybe there's some tiny error somewhere making it that you think you're using it but in fact you aren't.

Try to disable the filtering (use the nearest point "filter") and verify whether there is some difference or not.

Share this post


Link to post
Share on other sites
The second one looks slightly shifted to the bottom right. Is there a half pixel/texel offset (error) somewhere ? Are you using DX 9 ?

Another idea I had is that the lower mip level of your source tex might be bad (which is used for the low-res draw call).

Share this post


Link to post
Share on other sites
@Tom KQT: I verified that I'm indeed using bilinear filtering. When switching to point filtering, the result looks totally different (much more pixelated).




@unbird: Apparently, there's really a half-pixel offset in there. I didn't notice that. However, the above screenshot was taken directly from a RT. The offset does not appear on screen because I take it into account when copying from RT to screen.

Another idea I had is that the lower mip level of your source tex might be bad (which is used for the low-res draw call).[/quote]Ah, good idea. I enabled mipmapping and now it looks very good :)

Of course, this doesn't tell my why it looked bad in the first place. When rendering to the fullscreen RT, I can render billboards of all different sizes, without any billboarding.

So there must be some other reason why it looked bad. Maybe the half-pixel offset?

However, the mipmapping looks good and is an acceptable workaround :)




Thanks everyone for your help!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!