Implement SSAO bent normals

We now have an option for evaluating the bent normals from SSAO.
This is used to improve specular AO.
Currently these bent normals are not used for diffuse lighting because
they're "flat" (face normals), which is too distracting.

The bent normal buffer is stored in the SSAO texture, in a separate
layer. This is the first post processing effect that uses 2D array
in order to limit our sampler usage.

This CL also changes how we handle SPECULAR_AO_BENT_NORMALS when
material bent normals are not available: we're now using the "Cones"
algorithm with the regular normal, instead of Lagarde's approximation.
This commit is contained in:
Mathias Agopian
2021-07-22 18:19:09 -07:00
committed by Mathias Agopian
parent 282b6f72c1
commit 4e9dcb45ea
25 changed files with 564 additions and 55 deletions

View File

@@ -428,6 +428,8 @@ static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk,
i = parse(tokens, i + 1, jsonChunk, &out->upsampling);
} else if (compare(tok, jsonChunk, "enabled") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->enabled);
} else if (compare(tok, jsonChunk, "bentNormals") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->bentNormals);
} else if (compare(tok, jsonChunk, "minHorizonAngleRad") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->minHorizonAngleRad);
} else if (compare(tok, jsonChunk, "ssct") == 0) {
@@ -1204,6 +1206,7 @@ static std::ostream& operator<<(std::ostream& out, const AmbientOcclusionOptions
<< "\"lowPassFilter\": " << (in.lowPassFilter) << ",\n"
<< "\"upsampling\": " << (in.upsampling) << ",\n"
<< "\"enabled\": " << to_string(in.enabled) << ",\n"
<< "\"bentNormals\": " << to_string(in.bentNormals) << ",\n"
<< "\"minHorizonAngleRad\": " << (in.minHorizonAngleRad) << ",\n"
<< "\"ssct\": " << (in.ssct) << "\n"
<< "}";