diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-02-20 22:33:28 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-02-21 03:33:56 +0300 |
commit | dee94afd039de7b7d3002ff2f8f1f0bf4c515bb3 (patch) | |
tree | 8aee8c086ece945e8b29491911f6d7cfb9ab422d /source/blender/nodes | |
parent | 764082676b4c8761573f5e7b91e004a3a83f2ec7 (diff) |
EEVEE: Ambient Occlusion Node: Support inverted and distance parameters
This adds an approximation of inverted AO by reversing the max horizon
search (becoming a min horizon). The horizons are correctly clamped in
the reverse direction to the shading and geometric normals.
The arc integration is untouched as it seems to be symetrical.
The limitation of this technique is that since it is still screen-space
AO you don't get other hidden surfaces occlusion. This is more
problematic in the case of inverted AO than for normal AO but it's
better than no support AO.
Support of distance parameter was easy thanks to recent AO refactor.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c index 5d3a9dfc025..36971d4e799 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c +++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c @@ -46,7 +46,9 @@ static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE); - return GPU_stack_link(mat, node, "node_ambient_occlusion", in, out); + float inverted = node->custom2 ? 1.0f : 0.0f; + + return GPU_stack_link(mat, node, "node_ambient_occlusion", in, out, GPU_constant(&inverted)); } static void node_shader_init_ambient_occlusion(bNodeTree *UNUSED(ntree), bNode *node) |