Jump to content

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


Recommended Posts

Again, nice work! :-) Do you have a list of what is left before you can start cleaning it up for review and including into the game? Think I said this before, but would be nice to have these in Alpha 11.

The lightmaps/AO (the two patches in the last post) are ready for review, as they are independent from the earlier stuff. In fact, these two patches will be dependencies for the cleaned up version of the model normal/parallax/etc mapping.

I'll first clean up model mapping, then terrain mapping, then smooth LOS, then screen-space effects. I'll make each a separate patch, and hopefully some/all of them will make it into Alpha 11 (end of July?).

plumo and Wijitmaker, will something like this do? :)

http://imgur.com/a/8ezQj

Link to comment
Share on other sites

Yeah, that is great. Would it be difficult to give the engine have the ability to tweak the level of contrast in the AO map? Perhaps giving map designers the ability to save a deviation from the default setting in the map file?

It's possible, but it's the same thing as changing the contrast in the map itself, which is the right way to do it.

Link to comment
Share on other sites

I guess, the reason why I'm asking is because if there was some control - it might be visually advantageous to increase and decrease the intensity of the AO map. For example, in a wintery (lower light) fog atmosphere I would think the levels of the AO would be less intense. The human eye would dilated allowing you to see what is the shadows better than if it was a high noon on a bright sunny day, where the contrasts of the shadows would be much greater (which I especially notice now in age as my eyes are getting older).

Link to comment
Share on other sites

I guess, the reason why I'm asking is because if there was some control - it might be visually advantageous to increase and decrease the intensity of the AO map. For example, in a wintery (lower light) fog atmosphere I would think the levels of the AO would be less intense. The human eye would dilated allowing you to see what is the shadows better than if it was a high noon on a bright sunny day, where the contrasts of the shadows would be much greater (which I especially notice now in age as my eyes are getting older).

Ah, I see. I'm sort of forcing the AO onto all the model's lighting (diffuse + ambient), which isn't quite correct (always makes it too dark). It should really just affect the ambient light! If I do that, you can achieve what you're describing by fiddling with the ambient/sun colour settings in Atlas.

Link to comment
Share on other sites

I guess, the reason why I'm asking is because if there was some control - it might be visually advantageous to increase and decrease the intensity of the AO map. For example, in a wintery (lower light) fog atmosphere I would think the levels of the AO would be less intense. The human eye would dilated allowing you to see what is the shadows better than if it was a high noon on a bright sunny day, where the contrasts of the shadows would be much greater (which I especially notice now in age as my eyes are getting older).

I see this being mitigated by distance fog. Light gray/white in most biomes, light beige in desert biomes.
Link to comment
Share on other sites

Could you help explain what we see in each frame, with minimum technical jargon? And explicitly define all jargon you use?

I'll try to.

The second image is from the unmodified game. The third image is the pure "ambient occlusion" texture, as it was rendered offline with raytracing in Blender. The first image is that texture blended with the model's usual lighting.

Ambient occlusion is basically a measure of how much each part of the model is illuminated by indirect sunlight. That is, parts that are harder for ambient sunlight to reach, such as the areas inside the arches, are made darker, and that makes the model look much more natural. Another way to think about it is, AO determines how much each bit of the model's surface is exposed to the sky (Google for more explanation).

At the beginning of this thread, I showed how AO can be approximated at runtime using SSAO ("Screen Space AO"), a post-processing effect applied after the scene is rendered. Unfortunately, SSAO is a very crude approximation that can introduce unwanted "haloing" around objects and is not very good for RTS games, where you want to show as much detail as possible. Ykkrosh then suggested to precompute the AO, though he wanted to approximate the AO textures at loading time instead of raytracing them in 3d software.

The problem with bringing either kind of precomputed lighting to 0ad was that the texture mapping created by the artists reused parts of the same textures on different models and on different parts of the same models. This is a good thing, as it allows us to have better quality textures, but we can't use the same texture coordinates to implement something that varies from surface to surface and from model to model, such as lighting. That required the introduction of some code to allow additional sets of texture coordinates in the model files, so we can have a texture wrapping where each individual surface has its own unique bit of texture space.

The textures we use to modify the model's lighting, such as the AO texture, are called lightmaps. The two patches above let us to use lightmaps by:

  • allowing the engine to associate any number of textures with an object by putting them in the object's definition or by calling a function at runtime, and exposing them in the GLSL shaders
  • allowing the engine to load any number of texture coordinate sets from the models, and exposing them in the GLSL shaders

By creating a new kind of object material that tells the shaders to expect an extra texture and an extra texcoord set, the shaders know to use a new bit of code that combines those with the model to create any lighting effect we like. The example pic above uses a raytraced AO texture created in Blender, though Ykkrosh's idea is now also possible without other major modifications to the engine (though that's not a priority for me, as there are lots of other improvements I can work on).

So there you go. I hope all that made sense!

Edited by myconid
Link to comment
Share on other sites

A most excellent shot and illustrates AO perfectly. Perhaps I can post this to Moddb as a possible future visual enhancement?

If the question is directed at me, go right ahead. :)

What are the dimensions of the ambient occlusion textures you're using in those screenshots?

512x512. About 100k in png. Simpler models can do with less.

Oh, I should mention that the png loading code doesn't like greyscale images, which would make that about 15k.

Edited by myconid
Link to comment
Share on other sites

Maybe somebody could make this topic public. But, this is seven years in the making (made possible by myconid), and it is a beautiful thing to behold :) The two UV channels is such a huge advantage in comparison to that combined light/shadow and diffuse texture map previously used in that thread.

Glad I could help.

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