Jagged Edges

Blitz3D Forums/Blitz3D Programming/Jagged Edges

John Blackledge(Posted 2009) [#1]
So now I've got my planets and atmospheres sorted I still have the problem of the planet curved edges looking very jagged against the black space background.

Can I ask for everyone's ideas on the best method to get rid of the jaggies?

If only anti-aliasing worked.

I've tried the fast libraries - they seem to have concentrated on filters of various types - but even their own demos still have spheres/balls with jagged edges.

I'm out for the day, but I'd still appreciate comments/observations from anyone, and I'll pick them up later.


Yasha(Posted 2009) [#2]
One way that works is to take advantage of render-to-texture, to render a viewport twice as large as your desired result, paste it on a fullscreen quad, and then render that to the backbuffer at the desired output resolution. I believe they call this supersampling.

There are two big disadvantages here: 1) rendering scenes at ridiculously high resolutions may damage performance significantly on some setups, and 2) DirectX7 has an upper resolution limit, which I believe is 2048x1536, so if your end resolution is greater than 1024x768 then you'll either need to put up with imperfect supersampling or come up with some kind of multiple-render arrangement for different quadrants of the screen. There are other slightly more complex methods of supersampling that don't suffer from these problems but they'd be harder to implement without shaders.

Will post an example if I can find it.


Kryzon(Posted 2009) [#3]
I don't like jagged edges either (specially when color contrast heightens it up), but if you think about it, the majority of professional games don't really do anything about it.

Try playing games like Microsoft's Freelancer to see how you don't really care about the edges when the atmosphere in the game makes it look like the phenomenon is "part of that world":



PS: Anti-Alias does work in Blitz3D, just not directly from it. I went to nVidia Control panel and set the anti-alias to "mandatory" or something like that (meaning, doesn't matter if the application has the anti-alias setting off, the card will always use it), and voilа, the B3D window was being rendered with anti-alias.

It's up to someone like MikhailV (or others who understand Blitz3D's mysterious structure) to figure out what flag inside Blitz3D turns off anti-alias for good, and overwrite that.


Yasha(Posted 2009) [#4]
Found it.

Dump this in your FastExtend folder with the normal examples, for the media's sake.



With a little imagination, you could set a variable to control how much bigger the original render is, to possibly allow some varying tradeoff between performance and quality. If the ScaleTexture command still works with renderable textures, this would be very easy. (EDIT2: It does, but I for one can't work out the scaling algorithm, and you don't get much speed gain anyway)

EDIT: I should add, before anyone accuses me of misrepresenting Mikhail's work, that this is not one of his examples, I just stole the "framework" from one of the postprocess examples, which is why it has his name on it and Russian text all over the place. Sorry to confuse anyone.


Gabriel(Posted 2009) [#5]
PS: Anti-Alias does work in Blitz3D, just not directly from it. I went to nVidia Control panel and set the anti-alias to "mandatory" or something like that (meaning, doesn't matter if the application has the anti-alias setting off, the card will always use it), and voilа, the B3D window was being rendered with anti-alias.

That doesn't always work either though. Some drivers/cards it does, and some it doesn't. Antialiasing in plain vanilla Blitz3D is a lost cause. I assume it's reliable with the addon libraries but I never used any of them.


John Blackledge(Posted 2009) [#6]
Yasha, a beautiful effect thanks, but plummets from 260 FPS to 39 FPS when used - drat.
Also you're right about the oversampling limit: anything bigger than 1024x786 caused a black screen.


GIB3D(Posted 2009) [#7]
For me it went from 300 to 100.


Kryzon(Posted 2009) [#8]
Well Gab, seeing what the FastLibs can do, I don't doubt someone will find out how to do that one day.


For me it went from 300 to 100.

But it's still a considerable FPS reduction, even if it's at playable levels. When your game is starting to bulk up a lot of effects and stuff, you'll just need to start worrying if the resultant FPS is equal to or greater than 60, IMO.


Ross C(Posted 2009) [#9]
why not try and increase your screen resolution? That will reduce the appearance of the jagged edges, and may be faster than the anti-alias solution.


Ferret(Posted 2010) [#10]
This works fine for me, except on a widescreen resolution.

How do i do this on a resolution of 1360x768 and how do i increase the supersampling?

Last edited 2010


Yasha(Posted 2010) [#11]
In a word, you don't. DirectX7 has an absolute upper limit on the resolution of 2048x1536, so the extremely simplistic example above, which simply doubles the graphics size, can't be done on a display of 1360x768.

You have two options:

1) Cap the supersample at the maximum resolution your choice of aspect will allow, and use some clever scaling tricks to fit to the screen in some variable ratio. Just have to live with the fact that as the resolution increases, the antialiasing will have less and less effect (eventually zero) while still crippling performance.

2) render different rects of the scene in different passes, e.g. each quarter of the screen in a separate render then paste them together. This removes the restriction on the upper limit (not for the final display, obviously) but would require some clever camera jiggerypokery and damage performance four times as badly as thee original. I'll say right here that I have no idea if this is even possible with Blitz3D's cameras (it's probably possible in pure DirectX though).

In short... the above example is a very pretty demonstration of FSAA not actually being feasible, sorry.

Huh... looking back, that's pretty much what I posted a year ago at the top of the thread...


SoggyP(Posted 2010) [#12]
Hello.

Why not just paste a blurred ring around the planet? Not ideal but would reduce woes.

Goodbye.


Ferret(Posted 2010) [#13]
I knew this was to easy :(

Last edited 2010


Who was John Galt?(Posted 2010) [#14]
Use a texture with an alpha channel. Blend the alpha so the pixels become more transparent towards the direction you want a soft edge.