EEVEE Next: Ambient Occlusion #108398
|
@ -87,9 +87,7 @@ void AmbientOcclusion::sync()
|
|||
bind_resources(&render_pass_ps_);
|
||||
|
||||
render_pass_ps_.bind_image("in_normal_img", &rp_normal_tx_);
|
||||
render_pass_ps_.push_constant("rp_normal_index", &rp_normal_index);
|
||||
render_pass_ps_.bind_image("out_ao_img", &rp_ao_tx_);
|
||||
render_pass_ps_.push_constant("rp_ao_index", &rp_ao_index);
|
||||
|
||||
render_pass_ps_.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS & GPU_BARRIER_TEXTURE_FETCH);
|
||||
render_pass_ps_.dispatch(
|
||||
|
@ -125,17 +123,12 @@ void AmbientOcclusion::render_pass(View &view)
|
|||
|
||||
RenderBuffers &rb = inst_.render_buffers;
|
||||
|
||||
rp_normal_tx_ = rb.rp_color_tx;
|
||||
rp_normal_index = rb.data.normal_id;
|
||||
rp_ao_tx_ = rb.rp_value_tx;
|
||||
rp_ao_index = rb.data.ambient_occlusion_id;
|
||||
|
||||
/*
|
||||
rb.rp_color_tx.ensure_layer_views();
|
||||
rp_normal_tx_ = rb.rp_color_tx.layer_view(rb.data.normal_id);
|
||||
rb.rp_value_tx.ensure_layer_views();
|
||||
rp_ao_tx_ = rb.rp_value_tx.layer_view(rb.data.ambient_occlusion_id);
|
||||
*/
|
||||
|
||||
BLI_assert(rp_normal_tx_ && rp_ao_tx_);
|
||||
|
||||
inst_.manager->submit(render_pass_ps_, view);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
void main()
|
||||
{
|
||||
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
|
||||
// ivec2 extent = imageSize(in_normal_img);
|
||||
ivec2 extent = imageSize(in_normal_img).xy;
|
||||
ivec2 extent = imageSize(in_normal_img);
|
||||
if (any(greaterThanEqual(texel, extent))) {
|
||||
return;
|
||||
}
|
||||
|
@ -17,15 +16,14 @@ void main()
|
|||
vec3 vP, vNg;
|
||||
if (!reconstruct_view_position_and_normal_from_depth(hiz_tx, extent, uv, vP, vNg)) {
|
||||
/* Do not trace for background */
|
||||
imageStore(out_ao_img, ivec3(texel, ao_index), vec4(0.0));
|
||||
imageStore(out_ao_img, texel, vec4(0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 P = transform_point(ViewMatrixInverse, vP);
|
||||
vec3 V = cameraVec(P);
|
||||
vec3 Ng = transform_direction(ViewMatrixInverse, vNg);
|
||||
// vec3 N = imageLoad(in_normal_img, texel).xyz;
|
||||
vec3 N = imageLoad(in_normal_img, ivec3(texel, normal_index)).xyz;
|
||||
vec3 N = imageLoad(in_normal_img, texel).xyz;
|
||||
|
||||
// OcclusionData data = unpack_occlusion_data(texelFetch(horizons_tx, texel, 0));
|
||||
OcclusionData data = occlusion_search(vP, hiz_tx, texel, ao_buf.distance, 0.0, 8.0);
|
||||
|
@ -37,6 +35,5 @@ void main()
|
|||
/* Scale by user factor */
|
||||
visibility = occlusion_pow(saturate(visibility), ao_buf.factor);
|
||||
|
||||
// imageStore(out_ao_img, texel, vec4(visibility));
|
||||
imageStore(out_ao_img, ivec3(texel, ao_index), vec4(visibility));
|
||||
imageStore(out_ao_img, texel, vec4(visibility));
|
||||
}
|
||||
|
|
|
@ -22,12 +22,6 @@ GPU_SHADER_CREATE_INFO(eevee_ao_pass)
|
|||
.additional_info("eevee_ao_data")
|
||||
.compute_source("eevee_ao_pass_comp.glsl")
|
||||
.local_group_size(AO_PASS_TILE_SIZE, AO_PASS_TILE_SIZE)
|
||||
/*
|
||||
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_normal_img")
|
||||
.image(1, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ao_img")
|
||||
*/
|
||||
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_normal_img")
|
||||
.push_constant(Type::INT, "normal_index")
|
||||
.image(1, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_ao_img")
|
||||
.push_constant(Type::INT, "ao_index")
|
||||
.do_static_compilation(true);
|
||||
|
|
Loading…
Reference in New Issue