RenderTarget and AA

Oidamoh

09-05-2011 19:21:35

Hi There,

I'm really stuck on this topic so i would appreciate answers or claps on the back of my Head... :)

Im trying the following. I successfully tried the way Mogre in combination with WPF described in

http://www.ogre3d.org/forums/viewtopic.php?t=44263

Everything is fine, except an extremly ugly Aliasing-Problem. I tried to set the Window-Parameters the right way:


var misc = new NameValuePairList();
misc["externalWindowHandle"] = hWnd.ToString();
misc["FSAA"] = "16";
misc["FSAAHint"] = "Quality";
renderWindow = ogreRoot.CreateRenderWindow("OgreImageSource Windows", 0, 0, false, misc.ReadOnlyInstance);

result was the same ugly Staircase.

Then discovered that the Texture can also be setup for AA:


_texture = TextureManager.Singleton.CreateManual(
"OgreImageSource RenderTarget",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
TextureType.TEX_TYPE_2D,
1024,768,
0, Mogre.PixelFormat.PF_A8R8G8B8,
(int)TextureUsage.TU_RENDERTARGET,
null,false,16,"Quality");


After that i thought i made it, but instead my App crashed in the last line (getBuffer().GetRenderTarget())


IntPtr surface;
_renTarget.GetCustomAttribute("DDBACKBUFFER", out surface);
_renTarget = _texture.GetBuffer().GetRenderTarget();


The Error Message was: An antialiased back buffer requires a IDirect3DDevice9Ex device.

My Question is now what to do to get it to work. :)

Thx in Advance.

Meharin

19-04-2012 09:14:18

Did you ever get this working? I am now starting to pay attention to how ugly the jaggies are :)

Beauty

19-04-2012 13:31:12

There is more than one example and more than one forum topic about WPF and Mogre.
I wanted to collect all information on a wiki page, but until now I didn't do.
You need to look for it yourself. (sorry)

A few weeks ago by random I found a WPF/Mogre example. Perhaps it wasn't mentioned before in the Mogre forum.
Look here:
viewtopic.php?p=98900#p98900

A combination of WPF and Mogre I never tried.
So I can't tell you anything from experience.


Perhaps FSAA 16 is not supported on your system?
In normal case this should cause an exception.

Here I published a code snippet for reading-out all FSAA modes, which are available on the used system:
viewtopic.php?f=8&t=14584

Also there is a slightly differentiation for the FSAA config option.
Upto Ogre/Mogre 1.6 is was called "Anti aliasing" and in 1.7+ it's called "FSAA".

So look to your used Mogre version and apply the related option name.
Otherwise (I suppose) it will be ignored.


P.S.
Please use the CODE tags (or "Code" button) when you add source code to your posts. It improves the overview.
I will add it to your previous post. For the future please keep it in mind. :wink:

Meharin

19-04-2012 16:30:33

Thanks Beauty. It's great to have you around here proactively sharing things.

I did just give this a shot (I was the one to release a D3D 9Ex Ogre plugin afterall) and it worked! My jaggies are now not so jagged and my awkward programmer art is now slightly less horrendous. Thanks for the FSAA mode enumeration link, beauty -- I will probably use that to add it to the options menu of my game.

(I was trying another approach of creating a 2nd render texture as suggested somewhere else (but no example source) but with no luck. The idea being to render Ogre to an intermediate texture that has AA turned on, and then copy its contents to the one WPF uses.)

It might be nice to have a definitive WPF + Mogre wiki page -- I could contribute to it.

I may only support 9Ex + AA for my game (or else 9 + no AA + other performance problems for all those stubborn Windows XP holdouts!)

Beauty

19-04-2012 17:43:07

I was the one to release a D3D 9Ex Ogre plugin afterall
I remember - there was a post about an extended DX9 plugin.

... Now I found the post:
Note: For Ogre (and Mogre), I implemented a Direct3D 9Ex plugin. 9Ex seems to be Microsoft's effort to bring some features of 10/11 (namely WDDM driver support, which is only available on Vista/Win7) back to the 9 world.

Currently I'm working on the MogreBuilder tool.
If possible it would be useful to extend the builder to create your extended plugin version.

To be save, perhaps the MogreBuilder could build the common DX plugin and your one as additional one.
So the end user can choose by the plugins.cfg file, which versions he want to use.

To add it to the Mogre builder we need more information.
For writing this (and the following discussion) you could create a new topic called "Extended Directx 9 plugin".

If you are interested, you also can try to extend the MogreBuilder with your extended plugin.
If you have questions for it, just ask in the MogreBuilder forum topic.


Everything is fine, except an extremly ugly Aliasing-Problem.
Didn't you write, that you found a solution for AA and WPF?
Look to your own words here.

Thanks for the FSAA mode enumeration link, beauty -- I will probably use that to add it to the options menu of my game
Note - There are not only FSAA 2, 4, 8 settings. There are also "special ones" like "NonMaskable 4".
The code for printing all DirectX FSAA types I published in the same topic.

It might be nice to have a definitive WPF + Mogre wiki page -- I could contribute to it.
Ok, I try to keep it in my mind. If I created a page, I will tell you. Otherwise don't be afraid to remember me in about 4 weeks.

Meharin

19-04-2012 18:26:53

Everything is fine, except an extremly ugly Aliasing-Problem.
Didn't you write, that you found a solution for AA and WPF?
Look to your own words here.


Oh yeah so it was he who tried that. Too bad he didn't post his source!

I started a new thread about an Ogre D3D9 Ex plugin: http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=29430

Beauty

19-04-2012 22:38:38

There is a very high chance that Oidamoh read this topic. (he was the topic creator)
So Oidamoh, we both ask you to publish your code, please. :mrgreen: