EEVEE Next: Subsurface Scattering #107407

Merged
Miguel Pozo merged 24 commits from pragma37/blender:pull-eevee-next-sss into main 2023-06-15 15:49:12 +02:00
3 changed files with 9 additions and 2 deletions
Showing only changes of commit 1f47c1b122 - Show all commits

View File

@ -49,6 +49,8 @@ void SubsurfaceModule::end_sync()
subsurface_ps_.bind_texture("radiance_tx", &diffuse_light_tx_);
subsurface_ps_.bind_texture("gbuffer_closure_tx", &inst_.gbuffer.closure_tx);
subsurface_ps_.bind_texture("gbuffer_color_tx", &inst_.gbuffer.color_tx);
subsurface_ps_.bind_ubo(RBUFS_BUF_SLOT, &inst_.render_buffers.data);
subsurface_ps_.bind_image(RBUFS_COLOR_SLOT, &inst_.render_buffers.rp_color_tx);
pragma37 marked this conversation as resolved

Also bind RBUFS_VALUE_SLOT otherwise it will trigger a warning / validation error.

Also bind `RBUFS_VALUE_SLOT` otherwise it will trigger a warning / validation error.
subsurface_ps_.barrier(GPU_BARRIER_TEXTURE_FETCH);
subsurface_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);

View File

@ -74,7 +74,7 @@ void main(void)
float pixel_footprint = sample_scale.x * textureSize(hiz_tx, 0).x;
if (pixel_footprint <= 1.0) {
/* Early out. */
out_combined = vec4(0);
out_combined = vec4(0.0);
return;
}
@ -126,6 +126,10 @@ void main(void)
/* Normalize the sum (slide 34). */
accum /= accum_weight;
if (rp_buf.diffuse_light_id >= 0) {
imageStore(rp_color_img, ivec3(texel, rp_buf.diffuse_light_id), vec4(accum, 1.0));
}
/* This pass uses additive blending.
* Subtract the surface diffuse radiance so it's not added twice. */
accum -= texelFetch(radiance_tx, texel, 0).rgb;

View File

@ -9,11 +9,12 @@ GPU_SHADER_CREATE_INFO(eevee_transmittance_data)
GPU_SHADER_CREATE_INFO(eevee_subsurface_eval)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("eevee_shared", "eevee_render_pass_out")
.uniform_buf(1, "SubsurfaceData", "sss_buf")
.sampler(0, ImageType::FLOAT_2D_ARRAY, "gbuffer_closure_tx")
.sampler(1, ImageType::FLOAT_2D_ARRAY, "gbuffer_color_tx")
.sampler(2, ImageType::FLOAT_2D, "radiance_tx")
.early_fragment_test(true)
.fragment_out(0, Type::VEC4, "out_combined")
.fragment_source("eevee_subsurface_eval_frag.glsl")
/* TODO(fclem) Output to diffuse pass without feedback loop. */