myconid Posted May 6, 2012 Report Share Posted May 6, 2012 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/zZe2LThese 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.PeaceMyc 4 Quote Link to comment Share on other sites More sharing options...
quantumstate Posted May 6, 2012 Report Share Posted May 6, 2012 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. Quote Link to comment Share on other sites More sharing options...
wraitii Posted May 6, 2012 Report Share Posted May 6, 2012 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). Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted May 6, 2012 Report Share Posted May 6, 2012 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. Quote Link to comment Share on other sites More sharing options...
myconid Posted May 6, 2012 Author Report Share Posted May 6, 2012 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 Quote Link to comment Share on other sites More sharing options...
Wijitmaker Posted May 7, 2012 Report Share Posted May 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
myconid Posted May 7, 2012 Author Report Share Posted May 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
wraitii Posted May 8, 2012 Report Share Posted May 8, 2012 (edited) 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 May 8, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
myconid Posted May 10, 2012 Author Report Share Posted May 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted May 10, 2012 Report Share Posted May 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
myconid Posted May 10, 2012 Author Report Share Posted May 10, 2012 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! Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted May 10, 2012 Report Share Posted May 10, 2012 I'm most excited about the SSAO. Works wonders for the buildings, especially those with colonnades. Quote Link to comment Share on other sites More sharing options...
quantumstate Posted May 10, 2012 Report Share Posted May 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
MishFTW Posted May 11, 2012 Report Share Posted May 11, 2012 Wow, they look great Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted May 11, 2012 Report Share Posted May 11, 2012 Throw some distance fog in there and we got us a stew goin'! Quote Link to comment Share on other sites More sharing options...
wraitii Posted May 11, 2012 Report Share Posted May 11, 2012 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 Quote Link to comment Share on other sites More sharing options...
myconid Posted May 11, 2012 Author Report Share Posted May 11, 2012 (edited) Bumpity! http://i.imgur.com/dfoz3.jpg Edit: A Sobel-based map works much better http://i.imgur.com/R3U7r.jpgSo 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 May 11, 2012 by myconid Quote Link to comment Share on other sites More sharing options...
Pureon Posted May 11, 2012 Report Share Posted May 11, 2012 This is awesome Quote Link to comment Share on other sites More sharing options...
wraitii Posted May 11, 2012 Report Share Posted May 11, 2012 (edited) 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 May 11, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
myconid Posted May 11, 2012 Author Report Share Posted May 11, 2012 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. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted May 11, 2012 Report Share Posted May 11, 2012 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. Quote Link to comment Share on other sites More sharing options...
Wijitmaker Posted May 11, 2012 Report Share Posted May 11, 2012 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. Quote Link to comment Share on other sites More sharing options...
feneur Posted May 11, 2012 Report Share Posted May 11, 2012 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 Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted May 11, 2012 Report Share Posted May 11, 2012 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. Quote Link to comment Share on other sites More sharing options...
Enrique Posted May 11, 2012 Report Share Posted May 11, 2012 This sounds awesome myconid! 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 Or even for WFG to expand upon the game for 0 A.D. Part 2 or anything that comes after.Sounds like a plan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.