January 22, 2020, 12:35:42 PM

Author Topic: Antialias  (Read 254 times)

Offline JBR

  • Jr. Member
  • **
  • Posts: 58
Antialias
« on: January 16, 2020, 02:13:59 AM »
Using BMax and openb3d.

When I set AntiAlias on I find that my frame rate goes from 2ms to 150ms.

I'm using a laptop a few years old but with a discrete graphics card.

Any way to speed things up to a usable level?

Thanks, Jim.

Offline angros47

  • Jr. Member
  • **
  • Posts: 36
Re: Antialias
« Reply #1 on: January 17, 2020, 01:02:17 AM »
I fear not. Most antialias algorithms work by doing multiple renderings, and then making an average final picture, and this is time consuming. That's actually the main reason why the antialias can be disabled in most graphic engines (you aren't the first one who found out that antialias can kill performance). The most obvious solution is: check the frame rate, and make sure your program could automatically disable antialias if it's too slow.

If you can't live without antialias you can also try to perform a "poor man" antialias, by using a postfx shader that could apply a convolution filter on the rendered image.

Online Derron

  • Hero Member
  • *****
  • Posts: 2673
Re: Antialias
« Reply #2 on: January 17, 2020, 06:02:13 AM »
Can't you render with doubled resolution and then scale that down?


Bye
Ron

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 413
Re: Antialias
« Reply #3 on: January 17, 2020, 09:19:11 AM »
In Openb3dmax there are two alternatives to AntiAlias. First, you need to know that the AntiAlias function is software-based using the Accumulation buffer so it's slow but cross-platform, the alternative is to use the MSAntiAlias function (from code by JoshK) which is hardware-based Multisample Antialiasing and is very fast but is for Windows only and requires you to replace the files in brl.glgraphics with the ones in openb3dmax.docs/mod for it to work. If you're using original/vanilla BMX then the files in brl.mod-NG-093 should work (note: if you're using latest NG source you don't need to do this). So currently the only cross-platform fast solution is with a shader called FXAA which is Fast approXimate AntiAliasing.

Offline JBR

  • Jr. Member
  • **
  • Posts: 58
Re: Antialias
« Reply #4 on: January 19, 2020, 12:00:39 AM »
Hi thanks for the advice.

I've tried twice to install the MSantialias and failed miserably.

I really just don't know what I'm doing. :-[

All I'm capable of is installing BMax and installing mods into the mod folder.

Why can't we have it like the old days at blitz.com where you just download the newest 'complete' version.

Anyway, I'm forgetting about AA for now unless someone zips up BMax with latest version of openb3d. 8)

Thanks for your help anyway. Jim.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 413
Re: Antialias
« Reply #5 on: January 19, 2020, 03:33:14 PM »
Hi JBR,

sorry that's my fault it failed! The files in brl.mod-NG-093 do not work with original BRL Blitzmax.

Offline JBR

  • Jr. Member
  • **
  • Posts: 58
Re: Antialias
« Reply #6 on: January 19, 2020, 08:50:49 PM »
Hi Mark,

It is BlitzMax Win32 v0.105.3.35 : It is NG.

There are 2 MinGW versions in the blixmax directory. I've set up environment variable and path to the x64 version as I always code to the 64 bit.

I've rebuilt all the modules and things are working fine.

So, in baby steps, how do I get MSantialias working.

Thanks, Jim.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 413
Re: Antialias
« Reply #7 on: January 20, 2020, 10:41:18 AM »
Hi JBR,

okay, well there's 3 versions in openb3dmax.docs/mod one for 0.93, 0.99 and 1.05, you want the 1.05 version so go and copy the folder in there named glgraphics.mod, the 3 other folders are for the dds tweak so just ignore them, then go to your Blitzmax-105/mod/brl.mod folder and renamed the glgraphics.mod to glgraphics.mod-o (o for original, or whatever you prefer to name it) that disables it, then paste the new glgraphics.mod beside it and go to cmd then type cd ..\..\ and cd Blitzmax-105\bin to get to bmk now type bmk makemods -a -w -g x64 brl.glgraphics and then another bmk makemods -a -w -g x64 brl.graphics (which depends on glgraphics) then you should be able to compile the MSantialias example. Note: these tweaks were made after the NG releases and AFAIK there's no way to add them into the official code.

I'm wondering, what do you think of the FXAA shader example as a solution?

Offline JBR

  • Jr. Member
  • **
  • Posts: 58
Re: Antialias
« Reply #8 on: January 20, 2020, 07:08:11 PM »
Hi Mark, I would welcome a shader version. But as usual I know nothing, so it would have to be an 'easy' example.

I appreciate your help!

Jim.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 413
Re: Antialias
« Reply #9 on: January 21, 2020, 10:09:42 AM »
Hi JBR,

Oh I see, well to find the FXAA shader example go to openb3dmax.docs/shaders/fxaa.bmx the actual shader code for the examples is in openb3dmax.docs/glsl/fxaa.frag.glsl and the same named vert.glsl GLSL is GL shader language and is split into frag and vert files (one is vertex to process 3d coords the other is fragment or pixel to process 2d texture coords, shaders allow hardware based manipulation). The example is by RonTek so I haven't actually examined it myself but it could do with the ability to set the AntiAlias level, I'll have a look at that (done).

Offline JBR

  • Jr. Member
  • **
  • Posts: 58
Re: Antialias
« Reply #10 on: Today at 01:11:02 AM »
Hi Mark,

Downloaded all the stuff and initially I was getting an error about version number in the frag file. Then it worked but it has no effect on the screen. Just see the 'jaggies' as before.

Is there a way to use the online stuff on GitHub so you don't have to download anything?

Thanks, Jim.