EEVEE: Ambient Occlusion: Add sample parameter support for the AO node
The actual sample count is rounded up to a multiple of 4 because we sample 4 horizons directions. Changing this setting forces the shader to recompile (because using a GPU_constant).
This commit is contained in:
parent
1540f1df07
commit
30cb4326fe
|
@ -3,12 +3,13 @@ void node_ambient_occlusion(vec4 color,
|
|||
float dist,
|
||||
vec3 normal,
|
||||
const float inverted,
|
||||
const float sample_count,
|
||||
out vec4 result_color,
|
||||
out float result_ao)
|
||||
{
|
||||
vec3 bent_normal;
|
||||
vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
|
||||
OcclusionData data = occlusion_search(viewPosition, maxzBuffer, dist, inverted, 8.0);
|
||||
OcclusionData data = occlusion_search(viewPosition, maxzBuffer, dist, inverted, sample_count);
|
||||
|
||||
vec3 V = cameraVec(worldPosition);
|
||||
vec3 N = normalize(normal);
|
||||
|
|
|
@ -47,8 +47,15 @@ static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat,
|
|||
GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE);
|
||||
|
||||
float inverted = node->custom2 ? 1.0f : 0.0f;
|
||||
float f_samples = divide_ceil_u(node->custom1, 4);
|
||||
|
||||
return GPU_stack_link(mat, node, "node_ambient_occlusion", in, out, GPU_constant(&inverted));
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"node_ambient_occlusion",
|
||||
in,
|
||||
out,
|
||||
GPU_constant(&inverted),
|
||||
GPU_constant(&f_samples));
|
||||
}
|
||||
|
||||
static void node_shader_init_ambient_occlusion(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
|
|
Loading…
Reference in New Issue