Texture Filtering Problem

Started by
5 comments, last by Tubos 12 years, 7 months ago
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? :)
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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.
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? ;)




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.
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).
@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!

This topic is closed to new replies.

Advertisement