Anti-aliasing in the BGE via Multisampling (testers needed)

Hello everyone,

A while back I submitted a patch to the tracker to add anti-aliasing support to the BGE by using multisampling. The patch is located here:

https://projects.blender.org/tracker/?func=detail&aid=20623&group_id=9&atid=127

In an attempt to get a review for this patch, I’ve decided to do more testing, which is best done by having the community test the feature. To this end I’ve created a win32 build with multisampling support, which can be found here:

Here is the description of the build

This is a build to test out the BGE multisampling patch found here: https://projects.blender.org/tracker/?func=detail&aid=20623&group_id=9&atid=127

This build also has a few other things that I was playing around with since I didn’t feel like cleaning up my working copy:

Bullet 2.76

Capsule Physics Bounds

A filter option for GameLogic.LibLoad

A note about the multisampling:

Blender itself currently isn’t using a multisample pixelformat. It does have the ability too, but it was causing some problems with something (selection maybe?). However, to request a multisample format for the Blenderplayer (included) simply use the -m switch with the number of samples you would like. For example, to request 4 I’d use the following:

blenderplayer.exe -m 4 myblend.blend

And one last thing, keep it to one of the following: 0, 2, 4, 8, 16.

Sorry to Linux and Mac users about not providing a build. If some creates a build with the patch, I’ll be happy to add the link to this post.

Feedback is welcome. :slight_smile:

Cheers,
Moguri

This would be great. But I cant figure out how to get it to work.

maybe a simple tutorial or an example blend?

Thanks
Ex.

One thing you can do is create a shortcut from the file, then go and edit the shortcut’s target and add the following to the end:


 -m 4 myblend.blend

Make sure to include the leading space and to replace myblend.blend with your .blend file.

I’m hesitant to provide an example blend because I want people to test their own blends to see if they cause problems with the anti-aliasing. If everyone just used the same .blend, about all I would figure out is if there are unsupported platforms, and not if this patch is breaking existing .blends.

Awesome job, you should try making a soft shadows patch with multisampling.
I was able to achieve really nice AA in blender because my NVidia card has built in antialiasing but it significantly lowered the frame rate.

Well, I tried it, but couldn’t get it to work. I probably missed something.

Could you explain a bit more please? What command line options did you use? Could you post a screenshot without AA (0 samples, which is default) and with AA (something like 4, 8, or 16 samples)?

Sasori:
Did you get the AA to work?

I’m still looking for people to test this and give feedback. The more people that test this, the quicker it will get reviewed/committed. :wink:

If you have problems please post the following:

  • The exact problem (console errors, crashes, not seeing any AA, etc)
  • A screenshot of AA disabled (0 samples) and one with something like 8 or 16 (AA can sometimes be hard to notice)
  • Graphics card information

Thank you,
Moguri

Moguri: I don’t know how to get it to work… I don’t understand what you mean when you say “One thing you can do is create a shortcut from the file, then go and edit the shortcut’s target and add the following to the end:”

this is great, however indeed make a bit more user friendly description how we can test and post screenshot of what it should like. Thanks anyway!

why does not work :frowning:

Attachments


I tested it with 16 samples, I had no visible difference with a completely different build. On the left is your build with multisampling enabled, on the right is just an old build I had lying around.

http://www.pasteall.org/pic/show.php?id=2521

I assume this will eventually get its own GUI option?

I enabled multisampling by adding -m 16 Castle.blend to the blender.exe shortcut, was it meant to be added to the shortcut?

Hi Moguri,

I also get a crash before anything starts.

My Specs:
WinXP SP3, Nvidia 6600GT, Forceware Version 169.21, Python 2.5 and 2.6 installed

Windows tells me that it’s got a problem with blenderplayer.exe with the following problem sig:


AppName: blenderplayer.exe     AppVer: 0.0.0.0     ModName: python31.dll
ModVer: 3.1.150.1013     Offset: 000f43bb

the cmd window has the following output:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\blender2_5_2_27372>blenderplayer.exe graviballs_1.1_AI.blend
Detected GL_ARB_texture_env_combine
Detected GL_ARB_texture_cube_map
Detected GL_ARB_multitexture
Detected GL_ARB_shader_objects
Detected GL_ARB_vertex_shader
Detected GL_ARB_fragment_shader
Detected GL_ARB_vertex_program
Detected GL_ARB_depth_texture
Detected GL_EXT_separate_specular_color
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8

C:\blender2_5_2_27372>blenderplayer.exe -m 4 graviballs_1.1_AI.blend
Detected GL_ARB_texture_env_combine
Detected GL_ARB_texture_cube_map
Detected GL_ARB_multitexture
Detected GL_ARB_shader_objects
Detected GL_ARB_vertex_shader
Detected GL_ARB_fragment_shader
Detected GL_ARB_vertex_program
Detected GL_ARB_depth_texture
Detected GL_EXT_separate_specular_color
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8

The Blenderplayer window stays black.

I tested both with and without multisampling as you can see. Probably got some Umlaute (üöä) in my python code, but it runs without flaw insinde blender [Edit: runs perfecty in 2.49a, inside your 2.5 Blender.exe build mouse input seems broken but the game starts at least, unlike the blenderplayer.exe]. You can check for yourself if you want to, take the link to my game “Graviballs” in my signature.

Hope I could help and thx for your effort in implementing AA in BGE !! :yes:

Andrew, you should add that to the blenderplayer.exe, not the blender.exe :wink:
I think it’s best if you just use the command line, this way you know what really happens

Ahh, blender player.
I changed my shortcut location to blenderplayer.exe and I now get the same error as Letun and zapman, the ImportError and Runtime Error.

Those two cryptic error messages are related, and they mean that the Blenderplayer can’t find Python.

Open the command line and type the following (hitting enter after each line)


cd path/to/blenderplayer.exe
set PYTHONHOME=absolute/path/to/.blender/python
blenderplayer.exe myblend.blend

Put in your information for the paths. For example, if you’ve extracted the files to a blender folder on your deskop, use the following for PYTHONHOME on Vista/7


set PYTHONHOME=C:/Users/Username/Desktop/blender/.blender/python

Please make a Linux build if you have the time!

This thread is almost a year old. I’m not currently actively working on AA. The method I made use of would work, but I would like to try and use anti-aliased frame-buffer objects. This would allow for both CSAA and MSAA without having to fight with the OS to get an appropriate pixel format. Also, I think it would allow for AA when running the BGE inside Blender. Currently this isn’t supported since multisample pixel formats are disabled since they can lead to potential problems with Blender’s selection code.

Thanks for your interest though. :wink:

there isn’t any projects actually to implement msaa in BGE? If you look around you will see MSAA, CSAA, FXAA, and a lot of other techniques to do anti-aliasing, but BGE don’t have any even today! If knew programming i swear, i would help blender with the multisampling. About the selection code, if you mean select vertices, edges, etc. (because i put my video driver to force anti-aliasing and i had a problem selecting in blender), it’s really a problem, BUT in 3D view, and not in the BGE. So why not implement msaa just in the BGE and not in 3dview? This would really help the BGE go one step ahead.

#UPDATE:
I tested your patch and it worked well with 4, 16 and even 32x antialising. It would be great if you could keeping up your work and make this a native function…