With the impending collapse of the Citadel, two members of the Resistance are tasked with evacuating any citizens remaining. Little do they know that their mission sees them gaining critical information that puts the early fate of White Forest in their hands.

RSS City 17: Episode One MOTY Update | Day Four

Why FXAA is the best AA method out there, and why you need to implement it into your own game right now!

Posted by on

City 17: Episode One

FXAA, it's Awesome

Mod of the Year AwardsToday we wanted to talk about FXAA, what kinds of magic it brings to the table, and what kinds of magic it doesn't.

    First and foremost, what is FXAA? FXAA is an anti-aliasing method developed by Timothy Lottes over at Nvidia. During it’s development, Timothy set three major goals to what FXAA should accomplish:
    1. SCALES – Full performance and quality scaling from the low to the high end. Use the same code on console and PC and it just works. Can adaptively adjust FXAA cost at run-time for adaptive frame-rate control.
    2. QUALITY – High-end quality of FXAA II is a tiny better than FXAA I, low-end quality is remarkably better.
    3. BETTER FXAA+MSAA – Attempting to provide better quality when mixing with MSAA or another AA method. For example 2xMSAA for better sub pixel features + FXAA for better edge gradients.

FXAA source can be found out in the wild now, as well as on Timothy’s blog spot.

Technical bits and bobs

So, getting on to the good stuff. FXAA is a pretty great anti-aliasing method. One of it’s biggest upsides is that it applies aliasing to not only polygonal edges, but also to textures (with alpha channels as well) and even post processing effects. More or less, it applies to everything on screen almost. FXAA costs nearly a twentieth of the cost of MSAA, it’s even lower then the lowest of MSAA methods such as 2x -4x MSAA while being able to provide a better quality than the two. City17 currently supports FXAA as the only selectable AA method, however you can still combine the two, or turn on standard MLAA via the console. We don't advise doing so though unless you have a Dual GPU setup. Before getting too ahead of ourselves though, let’s get a little more technical about our implementation of FXAA.

We didn’t really know how well FXAA was going to work when we ran into it, but we decided to give it a go, and implement it anyways. Magically it worked on the first compile. FXAA offers some flexibility and customization right out of the box. Currently we are using FXAA implementation3.11.

When we implemented FXAA we were quite amazed with the performance, however there were a few good and bad things we noticed:

  • Offers better quality than the lowest of MSAA methods out there, while being cheaper. Typical FXAA is about 2.0ms at 720p.
  • FXAA 3.11 has some bigger optimization: 2.2ms cost at 1080p, about 2.0ms on 720p still.
  • FXAA applies to not only polygonal edges, but also to translucent and alpha-tested textures. Big plus here for alpha-tested textures because of how horribly alpha testing rapes image quality.
  • FXAA can still be combined with MSAA methods. We ourselves currently use 4x MSAA and still are able to enjoy the benefits of both methods at once, while still retaining a better cost then jacking AA all the way up. (We still do not advise combining more than 4x MSAA!)
  • FXAA applies to post process shaders as well, such as our god rays.
  • Lastly, FXAA offers a nice amount of headroom for other bigger things we’d like to spend budget on.
  • Blurred the entire screen
  • Lost some detail in textures because of the way FXAA worked.

While two drawbacks pale in comparison to what FXAA brought to the table, those two issues were rather large and annoying.If we wanted to fully support FXAA we new we’d have to do something about the loss of quality in some high res details.
Frame counter on the top right of the image!

No AA:

AA x4:

FXAA (Very High):

Using full screen Sharpen Filters to get details back!

This is where our Unsharp shader came to the rescue. Our Unsharp shader is a feature we talked a while back in one of our updates.

Unsharp Mask is a high quality sharpening algorithm. In City 17, Unsharp Mask brings out texture detail that is normally hidden or lost.

For FXAA we modified our Unsharp shader so it uses specific settings when FXAA is turned on, and reverts back when FXAA is turned off, or normal MSAA/other AA methods are in use. Lets look at the previous images again:


Unsharp FXAA:

We got interviewed

A while back we got interviewed (around the time we released our Portal 2 stuff) Winning the contest raped our bandwidth, and the interview was forever lost! Fear not though, it was just sitting on my desktop...

halfer.net interviewed us, though for the life of us we can't remember their exact website url, they could even be down right now, but here is the full translated interview.

    Q: Hi guys! We recently got interested about your project on moddb, but apparently the development process began a long time ago? When have you started an intensive development of City17 Episode One? How many members in your team?

    A: We started around 2005. Back then it was pretty much just me fooling around with source at the time, and making what I considered to be a small mod. The project back then came to a finish, and was originally 3 maps long, however we never ended up releasing it. City17 ended up going through this pretty long process where it got shelved, and I did other things related to source. Eventually the project picked up a few dudes back in 2007 and had undergone a huge redesign.

    It's been pretty busy every since then.

    Right now we have about 6 team members. 2 mappers, 1 modeler, 1 programmer, 1 animator, and 1 sound/music guy.

    Q: We've seen excellent visual effects on your videos and screenshots, in particular it's a system of particles and light elaboration. Whether these effects look even more realistic, or is it a limit for the Source Engine? How the numbers of these effects will affect on FPS and overall PC system performance?

    A: So, we'd like to think that we try our best to follow the model Valve put in place in terms of performance across the board presented by the Source engine. We have a rule of thumb that we won't ship features (no matter how cool) if the low end systems won't be able to at least enjoy them on at above 30fps. For city17 we work pretty hard on optimization, generally a map goes through a pretty hardcore process where we sit down and really start stripping things away. Sometimes that can get a little rough.

    So some of our custom shaders like sun rays and whatnot have gotten pretty cheap over the few months we've worked on them. The hardcore process described above has sort of carried into everything we author, so for shaders it's about the same. We just work on them until we know theres honestly nothing left we can do.

    The cool thing about being in development forever it seems is that technology moves forward. Being a mod we don't have to worry about these huge impacts if we miss a release date. Theres still some major side effects for us with that, but the plus side is we can kind of move forward a bit, and do things we couldn't do if say we released city17 2 years ago. The biggest drive going forward is generally going to be just more triangles per-scene. Most of that is going right into the world, or into particle effects. A little bit of that surplus in perf now is also going right to our shaders, with what little is left goes into anything else.

    Regardless of hardware advancements in the past 3 years though we've created an option menu just for city17 where you can lower the resource needs for our shaders, or completely turn them off. So if you want to enjoy city17 like you're back in "ye olde" days you can totally do that. The shaders are on by default, but we don't force you to keep any of it on.

    Q: Do you have a complete storyline or you making it on the way? How long the gameplay of City17 Episode One is going to be?

    A: Story has been a pretty tricky thing for us. We have this existing, solid universe we're already fooling around in. So, with City17 we aren't doing things like: "what if Gordon did that, or if Alyx was never there, etc.". We want to leave the Half Life 2 story, and it's events right where they are, and just build something that focuses around those events.

    So we're really strict with ourselves about how we approach doing certain events. We want to build a world that seems pretty legitimate within the time frame and location. That goal has mostly dictated what city17 is. We're focusing on creating a different perspective of the Half Life 2 Episode 1 timeline events through this pretty normal rebel guy. That's obviously not something fresh, but what we're doing there is trying to be a little deeper with that. Really kind of get into the whole other side of that. So with City17 we're building a story that concentrates on how the rebels operate. Things like ranks, assignments, the way they've navigated throughout the city while Gordon and Alyx were off doing their thing.

    So with that the story is this ongoing thing that still is constantly being worked on. We have a general arc of it already, but we purposefully leave some blanks to see if theres little interesting things we can find out later, or try out. The story heavily dictates the gameplay here, so we aren't traveling around with the gravity gun in City17ep1, nor the HEV suit. So we have this really big fun part missing. We've been exploring different ways to fill that gap with interesting events and gameplay that can hopefully hold up well against that.

    That's a big contributing factor in also creating the story.

    On the note about city17's length though. We're estimating roughly about ~4-5 hours of gameplay. The project has been growing, and we're sort of letting it. Theres a clear goal in sight though, an end line to stop, but a lot of the extra content has come from balancing/flow/story.

    Q: Will we meet Gordon Freeman or any main HL2 characters on the streets of City17?

    A: Like we mentioned with the strict policy on not touching those solid events; we aren't having the player meet any of the hl2 characters. We like to think of it as the player being on an entirely different side of city17. We're introducing a few new characters that we're going to be building up in city17ep2. We're doing this experiment right now where were going to try building sets of characters like Griggs and Sheckley from Half Life Episode 2, or rather like them. So more or less some characters that stay by your side and aren't just these random rebels who occasionally let you into their base via a "whats the password", join you, then die some seconds later. Part of our larger goal in focusing on rebels is broadening their importance, and making them feel like a good amount played serious roles in the downfall of the citadel, and the movement to White Forest.

    The events however are still going to be part of game. White forest plays a bit of a role in our mod, as well as how the story we've built unfolds in and around that. While we never have the player directly meet any characters from hl2 face to face, we have some events where we sort of build on the idea that the players actions are part of this really big machine. So they aren't these rebels that just get in the way, or die a lot. Their actions are pretty heavy in impact, so the player can go through thinking about how some of those events we have are tiny back stories, or a domino effect onto the events that take place in ep1. A lot of it is going to lead up to how we continue the outcomes of those events in city17ep2.

    Q: In fact I myself tried to make a mod few years ago. I had a few ideas such as killing the combine and getting their suits to sneak into some combine only sections... What about you guys? Have you thought of making anything like that?

    A: Thats an interesting idea. Oddly we had this scenario story wise way back in early development where intel' was gathered by a Rebel spy who infiltrated CP. We didn't keep that idea through the redesigning process though. Right now we have a buddy thats joining you through city17ep1, who could almost be compared to Alyx of sorts. He's a Male though. So we've been working on creating a different kind of relationship between him and player versus the general "this guy's a total badass character".

    We have some moments where infiltrating some areas around the city happen, but I don't want to talk about that too much.

    Q: Will there be any improvements to the game (new weapons, unique character models)?

    A: There's going to be some new things here and there, but nothing major such as new weapons. Like I mentioned earlier the orange box really brought a lot of cool new things online. Aside the fact hardware has advanced over the years.

    We're doing things like modeling out more detail and scenery, creating longer, larger maps, and replacing a lot of older stock effects.

    For instance effects like the smg alt-fire explosion are completely particle driven now. Not only do they look better, but also are unique to that type. Each explosive within city17 now has it's own unique explosion effect.

    In terms of updating character models we aren't doing too much of that, though we are introducing some new faces. We've also gone and updated a few of the rebel textures for things like phong, better bumpmaps and a little more detail on them.

    The list has gotten pretty large now with the stuff we've eaither gone in and redid, or altogether improved.

    Q: Any ETA on the release date? what percentage of work progress is done?

    A: Progress has been chugging along for the past three years at an evenly decent rate. Theres been a few major ups and downs, but we're reaching the final stretch in terms of getting this thing done. We've spent so much time on it already that all we really just want to do is be rid of it, and move onto other things.

    I mean we love the heck out of this project, but 5 years is a cringe like reaction when you look back at it.

    We're aiming for sometime 2012 and if not then, hopefully really soon in the Summer of 2012.

That's it for today. Stay tuned for another update tomorrow as we reach day 5 of our ten day MOTY update! Follow us on Twitter for updates on what's going on in development, as well as our blog for City 17 and other development news from us. If you'd like to get in contact with us, be sure to email us at mrtwovideocards@gmail.com.

City 17: Episode One

I like the trees best without the "unsharp mask"...
Otherwise, looks awesome!

Reply Good karma Bad karma+2 votes

I'm very pleased with your story-related responses. It finally satisfied my last lingering doubts about how successful this project would really be. Keep up the good work, gentlemen.

Reply Good karma Bad karma+1 vote

Theres FAR more better antialiasing technique than FXAA. It is called SMAA and heres whitepaper: Iryoku.com and heres the source code: Github.com. + Theres is a SMAA injector, but its the lowest quality version: Mrhaandi.blogspot.com

Reply Good karma Bad karma+2 votes
MrtwovideoCards Author

I think this was made by DICE, pretty cool stuff. We'll take a look at it

Reply Good karma+2 votes

Watch out for haloing when using unsharp mask... I can see a bit in the included screens, most notably where the broken window meets the sky.

Reply Good karma Bad karma+1 vote

"Halflifer.ru interviewed us, though for the life of us we can't remember their exact website url, they could even be down right now, but here is the full translated interview."

Our url is halfer.net :)

Reply Good karma Bad karma+1 vote
MrtwovideoCards Author


Reply Good karma+1 vote

SMAA looks better without loss of performance, which is noticeable in comparison with FXAA. Also guy from UKTS made ​​an overview of these techniques: Forums.uktrainsim.com

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Profile
Half-Life 2
GearDev Studios
Send Message
Release date
Mod watch
Related Games
Half-Life 2
Half-Life 2 First Person Shooter
Related Groups
GearDev Studios
GearDev Studios Developer & Publisher