Procedural Generation | Computer Graphics | Math

FXAA is really just magic. No other word for it. Antialiasing as a cheap post-process is pretty much solved thanks to Mr. Lottes. I dropped it into the engine last night and was amazed at the difference! It makes edges look great:

Those asteroids look a lot better without the jaggy edges. Another nice benefit is that FXAA can also handle other types of aliasing, like specular highlights, which is fantastic considering that I just implemented environment mapping. Which leads me to...

Cubemaps / environment mapping in GL turned out a lot less painful than I was expecting. It's the first time I've ever touched cube maps, but everything went well! I've converted the background generator so that it now generates the background nebula directly into a cube map, which makes distortion less apparent. Plugging the background cube map into the deferred lighting pass for environment mapping also turned out to be relatively painless, with the exception of a nasty aliasing problem that I'm still working on. So here I am, flying next to an absurdly shiny behemoth:

It's amazing how much those reflections add to the graphics! I'm super-excited about them 🙂

Another bonus of environment maps is that you can use one of the mipmaps to approximate directional ambient lighting from space. Since the mipmaps are generated using a box blur, they can serve as a (very) rough approximation of the light scattered from a diffuse surface with the given normal. This means that we can use the environment map not only for reflections, but also to add a nice "global" light effect to diffuse surfaces. For example, if one part of the sky is a bright blue nebula, then some of that blue light will be scattered by the sides of asteroids that are facing that direction. Unfortunately, tweaking this to look natural has proved to be much more difficult than getting good reflections.

One final screenshot, this time from some experiments with tweaking the background generator. I came across this system and loved it!

If only there were more to do other than fly around and harass dumb AI...hopefully soon!

3 Responses.

Good call on tweeking the asteroid edges. They look a hundred times better! With that said, I'm a little confused by the lighting seen here in these pictures. Maybe it's because we can't see the game in action, but in the second picture, are you flying between what seems to be a dark planet and a shiny ship? Where is the light coming from to bounce off of the surface to make it that shiny, and why is the planet so dark (and yet you can see other ships close to it)? I'm also confused as to the size proportions of your asteroid to your planet in the third photo, as well as the lighting on the planet. All of your planets look to as if have this blinding white outline, and though I can see where you're trying to go with it, I think a little bit more subtlety of shading can greatly enhance how much more realistic the scene and planet(s) can look. For example:

The same can be said about the lighting on your asteroids. They are all pretty monogamous in color and in contrast with your bright nebula, it just doesn't seem realistic. Whereas, this picture you had earlier (http://algocomp.anewmusic.com/images/blog/fluent20.png) looks so much better, even with jaggy edges. I think that might say something about the lighting. But hey, none of us really knows what anything looks like in space haha.

Yep, that reflection is phony, as you pointed out. Light from the ship is calculated as if the planet were not there. The reason is that it is using a static, pre-computed environment map that just includes the background nebula. Including the planet in the reflection would be very difficult and require a new technique like a dynamically-updating env map, since the relative position of the planet changes when you move. The same would be true of asteroids, you won't see them reflecting off of the ships.

Unfortunately, that's just a fundamental limitation of this technique. Real-time reflections are difficult. I may play around with dynamic environment maps in the future, but for now I'm happy with them, even if they aren't realistic.

Next, the proportions are crazy! Some asteroids are almost as big as planets. It definitely won't be like that in the final game. That being said, I'm NOT going for realistic scale in this game. I'm heavily inspired by the scale of "Freelancer," which I find to be a great balance of vast but manageable at the same time. Realistic scale just doesn't appeal to me, but I do want a sense of grandeur at the same time. What kind of scale appeals most to you? Realistic?

As for the lighting on the asteroids, I'm definitely not happy with it. I've played around a lot but just can't seem to find what I want. Hopefully this will be improved in the future!

Thanks again for the suggestions. Time to go do some more reading about real-time reflections to see if I can't get that planet to show up... 🙂