Light Style© by Fisana

Jump to content


Photo

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


  • Please log in to reply
1273 replies to this topic

#1 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 06 May 2012 - 04:35 AM

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
  • 3
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#2 quantumstate

quantumstate

    Primus Pilus

  • WFG Retired
  • 1,150 posts

Posted 06 May 2012 - 08:47 AM

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.
  • 0

Jonathan Waller [ aka quantumstate ]

Wildfire Games Programmer
Contact me: jonathanmarkwaller at gmail dot com


Support Wildfire Games!


#3 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 06 May 2012 - 09:50 AM

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).
  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#4 Ykkrosh

Ykkrosh

    Primus Pilus

  • WFG Programming Team
  • 4,921 posts

Posted 06 May 2012 - 01:18 PM

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.
  • 0
Philip Taylor [aka Ykkrosh]

Wildfire Games Programmer
Contact me: philip@wildfiregames.com

#5 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 06 May 2012 - 06:29 PM

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
  • 0
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#6 Wijitmaker

Wijitmaker

    0 A.D. Old Timer

  • WFG Retired
  • 9,552 posts

Posted 07 May 2012 - 04:13 PM

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.
  • 0

Jason Bishop [ aka Wijitmaker ]

0 A.D. Founder

Contact me: jason@wildfiregames.com


#7 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 07 May 2012 - 09:46 PM

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.
  • 0
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#8 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 08 May 2012 - 06:19 AM

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, 08 May 2012 - 06:28 AM.

  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#9 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 10 May 2012 - 11:32 AM

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.
  • 0
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#10 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,967 posts

Posted 10 May 2012 - 04:41 PM

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. :)
  • 0

#11 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 10 May 2012 - 06:16 PM

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!
  • 0
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#12 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,967 posts

Posted 10 May 2012 - 06:30 PM

I'm most excited about the SSAO. :) Works wonders for the buildings, especially those with colonnades.
  • 0

#13 quantumstate

quantumstate

    Primus Pilus

  • WFG Retired
  • 1,150 posts

Posted 10 May 2012 - 10:50 PM

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.
  • 0

Jonathan Waller [ aka quantumstate ]

Wildfire Games Programmer
Contact me: jonathanmarkwaller at gmail dot com


Support Wildfire Games!


#14 MishFTW

MishFTW

    Primus Pilus

  • Web Development Team
  • 1,921 posts

Posted 11 May 2012 - 01:09 AM

Wow, they look great (y)
  • 0
Mish [Adarash Mishra]
Wildfire Games Webmaster
Email Me | About Me

#15 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,967 posts

Posted 11 May 2012 - 02:33 AM

Throw some distance fog in there and we got us a stew goin'! Posted Image
  • 0

#16 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 11 May 2012 - 05:56 AM

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:
  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#17 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 11 May 2012 - 12:00 PM

Bumpity! http://i.imgur.com/dfoz3.jpg Posted Image
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, 11 May 2012 - 01:22 PM.

  • 0
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#18 Pureon

Pureon

    Primus Pilus

  • 0 A.D. Art Team
  • 3,652 posts

Posted 11 May 2012 - 02:48 PM

This is awesome (y)
  • 0

Pureon
0 A.D. Part time Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com


#19 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 11 May 2012 - 02:53 PM

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, 11 May 2012 - 02:54 PM.

  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#20 myconid

myconid

    Centurio

  • WFG Retired
  • 789 posts

Posted 11 May 2012 - 03:28 PM

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. :)
  • 0
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com