Eevee-Next: World Reflective Light #108149

Merged
Jeroen Bakker merged 33 commits from Jeroen-Bakker/blender:eevee-next-world-shader into main 2023-06-29 15:25:04 +02:00
2 changed files with 30 additions and 5 deletions
Showing only changes of commit 95771741ae - Show all commits

View File

@ -79,6 +79,14 @@ void WorldProbePipeline::sync()
side.cubemap_face_ps.init();
side.cubemap_face_ps.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_ALWAYS);
}
dummy_cryptomatte_tx_.ensure_2d(
GPU_RGBA16F, int2(1), GPU_TEXTURE_USAGE_MEMORYLESS | GPU_TEXTURE_USAGE_SHADER_WRITE);
dummy_renderpass_tx_.ensure_2d(
GPU_RGBA32F, int2(1), GPU_TEXTURE_USAGE_MEMORYLESS | GPU_TEXTURE_USAGE_SHADER_WRITE);
dummy_aov_color_tx_.ensure_2d_array(
GPU_RGBA16F, int2(1), 1, GPU_TEXTURE_USAGE_MEMORYLESS | GPU_TEXTURE_USAGE_SHADER_WRITE);
dummy_aov_value_tx_.ensure_2d_array(
GPU_R16F, int2(1), 1, GPU_TEXTURE_USAGE_MEMORYLESS | GPU_TEXTURE_USAGE_SHADER_WRITE);
}
void WorldProbePipeline::sync(GPUMaterial *gpumat)
@ -99,14 +107,26 @@ void WorldProbePipeline::sync(GPUMaterial *gpumat, int face)
side.cubemap_face_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_CUBEFACE(cubemap, face));
ResourceHandle handle = manager.resource_handle(float4x4::identity());
PassSimple &pass = side.cubemap_face_ps;
side.cubemap_face_ps.framebuffer_set(&side.cubemap_face_fb);
side.cubemap_face_ps.material_set(manager, gpumat);
side.cubemap_face_ps.push_constant("world_opacity_fade", 1.0f);
pass.framebuffer_set(&side.cubemap_face_fb);
pass.material_set(manager, gpumat);
pass.push_constant("world_opacity_fade", 1.0f);
side.cubemap_face_ps.draw(DRW_cache_fullscreen_quad_get(), handle);
pass.bind_image("rp_normal_img", dummy_renderpass_tx_);
pass.bind_image("rp_light_img", dummy_renderpass_tx_);
pass.bind_image("rp_diffuse_color_img", dummy_renderpass_tx_);
pass.bind_image("rp_specular_color_img", dummy_renderpass_tx_);
pass.bind_image("rp_emission_img", dummy_renderpass_tx_);
pass.bind_image("rp_cryptomatte_img", dummy_cryptomatte_tx_);
pass.bind_image("aov_color_img", dummy_aov_color_tx_);
pass.bind_image("aov_value_img", dummy_aov_value_tx_);
pass.bind_ssbo("aov_buf", &inst_.film.aovs_info);
pass.draw(DRW_cache_fullscreen_quad_get(), handle);
/* To allow opaque pass rendering over it. */
side.cubemap_face_ps.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
pass.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
}
void WorldProbePipeline::render()

View File

@ -53,6 +53,11 @@ class WorldProbePipeline {
private:
Instance &inst_;
Texture dummy_renderpass_tx_;
Jeroen-Bakker marked this conversation as resolved Outdated

Add comment saying these are required in order to reuse the background shader and avoid another shader variation.

Add comment saying these are required in order to reuse the background shader and avoid another shader variation.
Texture dummy_cryptomatte_tx_;
Texture dummy_aov_color_tx_;
Jeroen-Bakker marked this conversation as resolved Outdated

Use a single View instance and fill with different view ids.

Use a single View instance and fill with different view ids.

As far as I have seen this requires other changes.

As far as I have seen this requires other changes.
Texture dummy_aov_value_tx_;
struct CubemapSide {
Jeroen-Bakker marked this conversation as resolved Outdated

This struct shouldn't be contained by the pipeline. The pipeline should only contain the pass and be view agnostic.

So you should only have one pass that is being drawn for the 6 views.

This struct shouldn't be contained by the pipeline. The pipeline should only contain the pass and be view agnostic. So you should only have one pass that is being drawn for the 6 views.
PassSimple cubemap_face_ps;
View view;