Render to texture with antialiasing

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
raytaller
Posts: 17
Joined: Wed Feb 07, 2007 11:28 am

Render to texture with antialiasing

Post by raytaller »

Hi,
I would like to perform antialiasing when rendering to a texture before passing it to a pixel shader.

The DX9 createRenderTarget method has more paramters and enables AA :
http://msdn2.microsoft.com/en-us/library/bb174361.aspx

I'm thinking about tweaking the IrrLicht source to enable this but i'm a bit affraid of forking my project from the official source.


I could avoid AA if it was possible to render to a texture bigger than the framebuffer when the device size is not a power of 2. Then the image would not be downsampled :

Image
OK, device size is 512 * 512

Image
OK, device size is 1024 * 1024

Image
NOK, device size is 640 * 480 (so the real render surface is 256 * 256)
Last edited by raytaller on Wed Feb 07, 2007 1:56 pm, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Just go on and implement it. Then provide a patch file which might make it into the Irrlicht core. If not you still have the patch file which you can easily add to the future versions of Irrlicht when available. So you don't have a real branch, but some features you can add for your own.
raytaller
Posts: 17
Joined: Wed Feb 07, 2007 11:28 am

Post by raytaller »

Okay i'll try to modify the code and check if AA solves my problem.
What about rendering to a texture bigger than the device size ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I thought that d3d could do all the time and OpenGL can since fbos were implemented
raytaller
Posts: 17
Joined: Wed Feb 07, 2007 11:28 am

Post by raytaller »

hybrid wrote:I thought that d3d could do all the time and OpenGL can since fbos were implemented
I'll try with openGL and see what's happening.
Anyway, how do you explain the low quality of rendering when the device dimensions are not powers of 2 ?
I think it's because the rendering is done on a smaller surface (512 * 256 actually). So i'm wondering if it's possible to use a bigger texture, like 1024*512 for a 640*480 device.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The problem is due to shared zbuffers (IIRC) which limits the size to the existing one (of the main view). So you had to use a smaller one, thus getting 512x256.
raytaller
Posts: 17
Joined: Wed Feb 07, 2007 11:28 am

Post by raytaller »

Thanks for answering so quickly ;-)

But that means no fullscreen post-processing shader can be applied, without a downsampling degradation ?
Would it be a lot work to create a patch allowing to render to a bigger texture ?
I need fullscreen post-processing shaders for the project i'm porting from MDX to Irrlicht.


PS : I noticed that the Depth of field demo also suffer from downsampling
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, so with FBO support on your gfx card you should get OpenGL RTT to work with larger dimensions. I'm quite unsure about DirectX now, I thought that only one driver had shortcomings with this. Which would mean no problems anymore. But as it seems it's only now one driver with problems left :? Maybe someone else knows?
Post Reply