EEVEE Next: Volumes: Lighting integration improvements #110809
|
@ -948,7 +948,7 @@ void ShadowModule::end_sync()
|
|||
/* Non volume usage tagging happens between these two steps.
|
||||
* (Setup at begin_sync) */
|
||||
|
||||
if (inst_.volume.is_enabled()) {
|
||||
if (inst_.volume.needs_shadow_tagging() && !inst_.is_baking()) {
|
||||
PassMain::Sub &sub = tilemap_usage_ps_.sub("World Volume");
|
||||
sub.shader_set(inst_.shaders.static_shader_get(SHADOW_TILEMAP_TAG_USAGE_VOLUME));
|
||||
sub.bind_ssbo("tilemaps_buf", &tilemap_pool.tilemaps_data);
|
||||
|
@ -958,6 +958,8 @@ void ShadowModule::end_sync()
|
|||
inst_.sampling.bind_resources(&sub);
|
||||
inst_.lights.bind_resources(&sub);
|
||||
inst_.volume.bind_resources(sub);
|
||||
inst_.volume.bind_properties_buffers(sub);
|
||||
sub.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
|
||||
sub.dispatch(math::divide_ceil(inst_.volume.grid_size(), int3(VOLUME_GROUP_SIZE)));
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,8 @@ void ShadingView::render()
|
|||
/* TODO(fclem): Move it after the first prepass (and hiz update) once pipeline is stabilized. */
|
||||
inst_.lights.set_view(render_view_new_, extent_);
|
||||
|
||||
inst_.volume.draw_prepass(render_view_new_);
|
||||
|
||||
/* TODO: cleanup. */
|
||||
View main_view_new("MainView", main_view_);
|
||||
/* TODO(Miguel Pozo): Deferred and forward prepass should happen before the GBuffer pass. */
|
||||
|
|
|
@ -293,22 +293,20 @@ void VolumeModule::end_sync()
|
|||
resolve_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
void VolumeModule::draw_compute(View &view)
|
||||
void VolumeModule::draw_prepass(View &view)
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
DRW_stats_group_start("Volumes");
|
||||
|
||||
inst_.pipelines.world_volume.render(view);
|
||||
inst_.pipelines.volume.render(view);
|
||||
}
|
||||
|
||||
void VolumeModule::draw_compute(View &view)
|
||||
{
|
||||
inst_.manager->submit(scatter_ps_, view);
|
||||
|
||||
inst_.manager->submit(integration_ps_, view);
|
||||
|
||||
DRW_stats_group_end();
|
||||
}
|
||||
|
||||
void VolumeModule::draw_resolve(View &view)
|
||||
|
|
|
@ -116,9 +116,9 @@ class VolumeModule {
|
|||
ps.bind_image(VOLUME_PROP_PHASE_IMG_SLOT, &prop_phase_tx_);
|
||||
}
|
||||
|
||||
bool is_enabled()
|
||||
bool needs_shadow_tagging()
|
||||
{
|
||||
return enabled_;
|
||||
return enabled_ && data_.use_lights;
|
||||
}
|
||||
|
||||
int3 grid_size()
|
||||
|
@ -138,8 +138,11 @@ class VolumeModule {
|
|||
|
||||
void end_sync();
|
||||
|
||||
/* Render material properties. */
|
||||
void draw_prepass(View &view);
|
||||
/* Compute scattering and integration. */
|
||||
void draw_compute(View &view);
|
||||
|
||||
/* Final image compositing. */
|
||||
void draw_resolve(View &view);
|
||||
};
|
||||
} // namespace blender::eevee
|
||||
|
|
|
@ -18,6 +18,13 @@ void main()
|
|||
return;
|
||||
}
|
||||
|
||||
vec3 extinction = imageLoad(in_extinction_img, froxel).rgb;
|
||||
vec3 scattering = imageLoad(in_scattering_img, froxel).rgb;
|
||||
|
||||
if (extinction == vec3(0.0) || scattering == vec3(0.0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 jitter = sampling_rng_3D_get(SAMPLING_VOLUME_U);
|
||||
vec3 volume_ndc = volume_to_ndc((vec3(froxel) + jitter) * volumes_info_buf.inv_tex_size);
|
||||
vec3 vP = get_view_space_from_depth(volume_ndc.xy, volume_ndc.z);
|
||||
|
|
|
@ -116,7 +116,8 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume)
|
|||
.storage_buf(5, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
|
||||
.uniform_buf(VOLUMES_INFO_BUF_SLOT, "VolumesInfoData", "volumes_info_buf")
|
||||
.push_constant(Type::FLOAT, "tilemap_projection_ratio")
|
||||
.additional_info("eevee_shared",
|
||||
.additional_info("eevee_volume_properties_data",
|
||||
"eevee_shared",
|
||||
"draw_view",
|
||||
"draw_view_culling",
|
||||
"eevee_hiz_data",
|
||||
|
|
Loading…
Reference in New Issue