   Bloom effect
  Hi, all!So, I have been trying to implement my own Bloom effect in D3D9. I have been using the .fx files straight from the PostProcess sample. After a while fiddling I got this thing working, sort of. Yet one problem remains: it doesn't look good. The problem is this:- I down filter the scene (4x)- I bright pass it- I apply a scaled Gaussian blur (both H&V) to it- then I up-filter (4x) & combine with the original scene.Here's the problem: after up-filtering the Bloom image is aliased. When combining it with the anti-aliased original scene, the stairs can be seen and the result does not look pleasant.I don't understand why the same sequence of filters gives the desired look when used in the PostProcess sample and it does not in my app. There's something I am missing here (which may very well be as I am new to this), I think. Either I need to smooth out the up-filtered Bloom image or I need to change the way the final image gets composed. I am not sure where I go wrong and I'd be grateful for any advice/help I can get.Thanks,Alex   
  Screenshot please.   ;  How are you upscaling?  If you don't linearly filter as you're upscaling, then you'll get the aliasing artifacts.   ;Quote:Original post by MJPHow are you upscaling?  If you don't linearly filter as you're upscaling, then you'll get the aliasing artifacts.I might be wrong but I think the pixelshader uses linear for the mag filter.Anyway, pix:original:http://i52.photobucket.com/albums/g30/ak-73/1.pngdown-filtered&brightpass:http://i52.photobucket.com/albums/g30/ak-73/2.pngblurred:http://i52.photobucket.com/albums/g30/ak-73/3.pngup-filtered:http://i52.photobucket.com/albums/g30/ak-73/4.pngcombined:http://i52.photobucket.com/albums/g30/ak-73/5.pngThis final image doesn't show it properly but "live" you can make out the steps "underneath" the aliased original moon image.Alex;  The pixel shader does not determine the texture filtering mode. On D3D9, you need to set the relevant texture stage states to enable or disable filtering as needed, regardless of whether you use fixed or programmable rasterizer.Graphics driver settings (commonly "Image Quality" or something like that) may override the states that you set in the application. For development, be sure to set the driver settings to "default", "balanced" and/or "application controlled".EDIT: That said, your bloom looks like it hasn't been properly received the Gaussian blur treatment. The texture filtering itself looks like standard bilinear filter.   ;Quote:Original post by Nik02The pixel shader does not determine the texture filtering mode. On D3D9, you need to set the relevant texture stage states to enable or disable filtering as needed, regardless of whether you use fixed or programmable rasterizer.I'm pretty sure that at this stage of development I have set the texture filering mode to linear once at program start and didn't change it afterwards. The problem, as you noticed, probably doesn't lie in that but in my use of the Bloom effect.Quote:Graphics driver settings (commonly "Image Quality" or something like that) may override the states that you set in the application. For development, be sure to set the driver settings to "default", "balanced" and/or "application controlled".EDIT: That said, your bloom looks like it hasn't been properly received the Gaussian blur treatment. The texture filtering itself looks like standard bilinear filter.Yeah that's what I also noticed in the meantime. The problem might have to do with surface format? I had been using the backbuffer format mistakenly which does not have an alpha component. So I set the format to A8R8G8B8 this morning but upon doing that the result was completely black. I am using the .fx file straight from the PostProcessSample, so the problem cannot be in the shader itself but in my configuration that uses it. I was fiddling with formats and stuff in the beginning because the PostProcess sample does not make use of multisampling and my app did. So as a consequence my app does not render directly to textures but to rendertargets which get StretchRected to (rendertarget) textures.Right now I am a bit at a loss as to why the Gaussian Blur/Bloom effect doesn't work properly. I suspect that it might have to do with alpha because the wrongly blurred moon has the same size as the original moon - a bit smaller even because of the aliasing. Anybody having any guess what I am missing? Alex