Sign in to follow this  
Followers 0
myconid

Post-processing effects test (SSAO/HDR/Bloom)

1,274 posts in this topic

Hey everyone,

I've been coding some very rough GLSL post-processing tests just to see what they'd look like in 0ad, and thought I might share some results. The following images are in pairs, with the "plain" images first and the filtered images after: http://imgur.com/a/zZe2L

These images use SSAO, HDR and Bloom filters. The dark halos around the character models are due to the SSAO, which otherwise looks pretty decent.

Credit where it's due: the shaders are modified versions of the fantastic work of user martinsh on the Blender Artists forums.

Peace

Myc

4 people like this

Share this post


Link to post
Share on other sites

This looks nice. Building are especially improved.

To eliminate the halos perhaps it would be possible to not apply SSAO to the terrain. This might require an extra buffer, I am not experienced with this stuff.

Share this post


Link to post
Share on other sites

Yeah, the effects might be a tad too strong (it looks like someone upped the contrast a bit too much), but it does give this sort of "I don't know what they're doing, but it looks niiiiice" feel that is really cool.

Not applying SSAO to the terrain would indeed fix the halos. My guess is that most units wouldn't require it either (or as a setting for really advanced graphics, since that would computationally be slower.). Afaik, specular is dealt with on a case-by-base basis already, can't SSAO be done that way too? Buildings could use finer SSAO, while most units hardly benefit from it.

For the terrain, you could have, on the contrary, a very rough filter that would have the effect or pretty much not detecting units, but would make the inside of forests darker or something (perhaps a huge downscaling, or something, I have no idea of the technical details behind all this).

Share this post


Link to post
Share on other sites
Not applying SSAO to the terrain would indeed fix the halos. My guess is that most units wouldn't require it either (or as a setting for really advanced graphics, since that would computationally be slower.).

As I understand it (which is not very well), removing the effect from units would be unlikely to make it much faster - SSAO is a screen-space algorithm, i.e. you render the whole scene to colour+depth+normal+other buffers (or some subset of that) and then run SSAO over the relevant buffers. It doesn't care about the number of objects or triangles being drawn - only the number of pixels matters. Units typically cover very few pixels so their cost would be negligible. I guess removing the effect from terrain could improve performance (the shaders can do an early exit and skip some processing for large areas of terrain), but then it'd presumably need an extra buffer to distinguish terrain from non-terrain which could make it slower again.

Share this post


Link to post
Share on other sites

Wraitii, the high-contrast effect is due to the fake HDR, which is half-necessary for the bloom effect. I could reduce it, but I kind of like it this way ;)

Anyway, the halos were easy to fix once I stopped being lazy. People suggesting not to render on the terrain were onto the right track, and there's actually no need for an extra buffer: the models can be rendered first, then have the effect applied, then render everything else with depth testing on.

New example: http://imgur.com/Tfa1b

Share this post


Link to post
Share on other sites

Looks nice, did the units loose their shadows? Would it be possible to apply a post processing hue/saturation/color cast & temperature tweak? If the config could be saved to maps it would allow map makers to make winter scenes appear cold and dreary, dessert scenes to be hot and arid. Similar idea to post processing for movies that you see in films like gladiator.

Share this post


Link to post
Share on other sites

Looks nice, did the units loose their shadows? Would it be possible to apply a post processing hue/saturation/color cast & temperature tweak? If the config could be saved to maps it would allow map makers to make winter scenes appear cold and dreary, dessert scenes to be hot and arid. Similar idea to post processing for movies that you see in films like gladiator.

The units do have shadows, they're just hard to see when zoomed out this far.

Yes, it would certainly be possible to have such effects (at least in GLSL mode)! Ideally, there would be a postprocessing filter manager that gets its instructions straight from map files/scripts to load specific effects and their parameters. I'm not too familiar with the codebase and how easy it would be to add a new manager type, but most of the heavy-lifting parts are definitely already there.

Share this post


Link to post
Share on other sites

Wraitii, the high-contrast effect is due to the fake HDR, which is half-necessary for the bloom effect. I could reduce it, but I kind of like it this way ;)

Oh yeah, should have remembered that from when I tampered with HDR on Ogre.

I still think the effect is too strong, because for example in your screenshot the whole ground is bloomed... at such a scale bloom should only happen on extremely white stuffs, I think (which should solve the 'units lose their shadows' problem). But hey, that's for the art department to decide, and anyway, it's very cool :) .

Edited by wraitii

Share this post


Link to post
Share on other sites

Oh yeah, should have remembered that from when I tampered with HDR on Ogre.

I still think the effect is too strong, because for example in your screenshot the whole ground is bloomed... at such a scale bloom should only happen on extremely white stuffs, I think (which should solve the 'units lose their shadows' problem). But hey, that's for the art department to decide, and anyway, it's very cool :) .

That could be fixed by reducing the overbrightness/sun colour values in Atlas. Anyway, since we're on the topic of fancy shaders, perhaps a different solution to add more texture to the terrain could be to add bump maps so things don't get shaded so evenly. I see code for materials that use shaders, but I still haven't found if there's a system for loading extra normal maps, specular maps, etc.

Maybe one of the programmers could point me to the right functions/documentation if they exist.

Share this post


Link to post
Share on other sites

They do not exist. We don't have support for normal maps/specular maps. We do have support for specular materials, but I don't think that would work on terrains. :)

Share this post


Link to post
Share on other sites

They do not exist. We don't have support for normal maps/specular maps. We do have support for specular materials, but I don't think that would work on terrains. :)

I might give it a shot if I find the time. Parallax mapping would open a world of new possibilities for the art team!

Share this post


Link to post
Share on other sites

I might give it a shot if I find the time. Parallax mapping would open a world of new possibilities for the art team!

Normal and parallax mapping would be great to have.

Share this post


Link to post
Share on other sites

Parallax mapping only really needs to be implemented for buildings and terrain, however, which considerably simplifies its adoption.

This all looks particuarlry promising anyway, keep up the good work :victory:

Share this post


Link to post
Share on other sites

Bumpity! http://i.imgur.com/dfoz3.jpg cool.gif

Edit: A Sobel-based map works much better http://i.imgur.com/R3U7r.jpg

So far, I can add normal maps for models with a new <normal> tag in the "actor" description files. What you see in this example is object-space bump mapping, which has some very serious limitations compared to tangent-space mapping, but it's much easier to compute.

Next step is tangent-space mapping.

Edited by myconid

Share this post


Link to post
Share on other sites

This looks very good already on buildings, I'm extremely unsure the game needs anything more for buildings, given the maximal zooming of the camera. However, Parallax mapping on the terrain could give a very cool effect for things such as grass, where it would be MUCH better looking, and I think you should focus your efforts on that.

Edited by wraitii

Share this post


Link to post
Share on other sites

This looks very good already on buildings, I'm extremely unsure the game needs anything more for buildings, given the maximal zooming of the camera. However, Parallax mapping on the terrain could give a very cool effect for things such as grass, where it would be MUCH better looking, and I think you should focus your efforts on that.

Agreed, I started with this just because it feels simpler. The plan is to:

  • first do proper tangent-space bump mapping for models,
  • then the same for terrains,
  • then parallax mapping for terrains,
  • finally parallax for models.

My thinking is that even if the game does not require some of these features, there's no harm in having the tools available in the engine. For example, parallax mapping could look nice on rooftiles or stone walls -- there's no reason to deprive the artists of that option.

Anyway, I'll keep the thread updated as I go along. :)

Share this post


Link to post
Share on other sites

Parallax mapping would make rooftiles look fantastic. And using it only in specific cases (like rooftiles and other areas) could help keep the performance hit low.

Share this post


Link to post
Share on other sites

Awesome work man - I'm loving the results of what you are doing!

Parallax mapping would open a world of new possibilities for the art team!

Sure does, makes me wish I was able to be an artist again - I'm jealous.

Share this post


Link to post
Share on other sites

Agreed, I started with this just because it feels simpler. The plan is to:

  • first do proper tangent-space bump mapping for models,
  • then the same for terrains,
  • then parallax mapping for terrains,
  • finally parallax for models.

My thinking is that even if the game does not require some of these features, there's no harm in having the tools available in the engine. For example, parallax mapping could look nice on rooftiles or stone walls -- there's no reason to deprive the artists of that option.

Anyway, I'll keep the thread updated as I go along. :)

Should be useful if someone else wants to reuse the engine for something slightly different as well :)

Share this post


Link to post
Share on other sites

Should be useful if someone else wants to reuse the engine for something slightly different as well :)

Or even for WFG to expand upon the game for 0 A.D. Part 2 or anything that comes after.

Share this post


Link to post
Share on other sites

This sounds awesome myconid! drool.gif

I think terrain could look really nice with bump/parallax/specular, but some buildings and specially units aren't big enough to notice it unless you zoom a lot. I'm curious how much impact may have on performance.

I have to do some research on parallax mapping... I never worked with it due to my humble graphic card blush.gif

Or even for WFG to expand upon the game for 0 A.D. Part 2 or anything that comes after.

Sounds like a plan happy.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0