Jump to content

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


Recommended Posts

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

  • Like 4
Link to comment
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).

Link to comment
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.

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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!

Link to comment
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
Link to comment
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
Link to comment
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. :)

Link to comment
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 :)

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...