WIP: eevee-next-world-irradiance #108304
|
@ -520,7 +520,11 @@ void Instance::light_bake_irradiance(LightCache *&r_light_cache,
|
|||
};
|
||||
|
||||
/* Count probes. */
|
||||
custom_pipeline_wrapper([&]() { render_sync(); });
|
||||
custom_pipeline_wrapper([&]() {
|
||||
manager->begin_sync();
|
||||
render_sync();
|
||||
manager->end_sync();
|
||||
});
|
||||
/* Allocate CPU storage. */
|
||||
r_light_cache = this->light_cache_create(light_probes.grids, light_probes.cubes);
|
||||
|
||||
|
@ -537,7 +541,9 @@ void Instance::light_bake_irradiance(LightCache *&r_light_cache,
|
|||
for (auto i : light_probes.grids.index_range()) {
|
||||
custom_pipeline_wrapper([&]() {
|
||||
/* TODO: lightprobe visibility group option. */
|
||||
manager->begin_sync();
|
||||
render_sync();
|
||||
manager->end_sync();
|
||||
irradiance_cache.bake.surfels_create(light_probes.grids[i]);
|
||||
irradiance_cache.bake.surfels_lights_eval();
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ void IrradianceCache::debug_pass_sync()
|
|||
|
||||
LightCache *light_cache = inst_.scene->eevee.light_cache_data;
|
||||
if (light_cache == nullptr || light_cache->version != LIGHTCACHE_NEXT_STATIC_VERSION ||
|
||||
light_cache->grids == nullptr) {
|
||||
light_cache->grids == nullptr || light_cache->grid_len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void IrradianceBake::surfels_create(const IrradianceGrid & /* grid */)
|
|||
using namespace blender::math;
|
||||
|
||||
/* Attachment-less frame-buffer. */
|
||||
empty_raster_fb_.ensure(int2(10 * 4));
|
||||
empty_raster_fb_.ensure(int2(20 * 4));
|
||||
|
||||
/** We could use multi-view rendering here to avoid multiple submissions but it is unlikely to
|
||||
* make any difference. The bottleneck is still the light propagation loop. */
|
||||
|
@ -111,7 +111,6 @@ void IrradianceBake::surfels_create(const IrradianceGrid & /* grid */)
|
|||
|
||||
CartesianBasis basis = from_orthonormal_axes(AxisSigned(axis).next_after(), axis);
|
||||
view_.sync(from_rotation<float4x4>(basis), winmat);
|
||||
view_.visibility_test(false);
|
||||
|
||||
inst_.pipelines.capture.render(view_);
|
||||
};
|
||||
|
@ -133,12 +132,11 @@ void IrradianceBake::surfels_create(const IrradianceGrid & /* grid */)
|
|||
GPU_memory_barrier(GPU_BARRIER_BUFFER_UPDATE);
|
||||
capture_info_buf_.read();
|
||||
if (capture_info_buf_.surfel_len == 0) {
|
||||
/* Not surfel to allocated. */
|
||||
/* No surfel to allocated. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO(fclem): Check for GL limit and abort if the surfel cache doesn't fit the GPU memory. */
|
||||
std::cout << "Resize " << capture_info_buf_.surfel_len << std::endl;
|
||||
surfels_buf_.resize(capture_info_buf_.surfel_len);
|
||||
|
||||
DRW_stats_group_start("IrradianceBake.SurfelsCreate");
|
||||
|
@ -173,7 +171,7 @@ void IrradianceBake::read_result(LightCacheIrradianceGrid &light_cache_grid)
|
|||
case eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_NORMAL:
|
||||
case eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE:
|
||||
GPU_memory_barrier(GPU_BARRIER_BUFFER_UPDATE);
|
||||
std::cout << "Read " << capture_info_buf_.surfel_len << std::endl;
|
||||
capture_info_buf_.read();
|
||||
surfels_buf_.read();
|
||||
light_cache_grid.surfels_len = capture_info_buf_.surfel_len;
|
||||
light_cache_grid.surfels = MEM_dupallocN(surfels_buf_.data());
|
||||
|
|
|
@ -110,6 +110,8 @@ class LightBake {
|
|||
}
|
||||
|
||||
EEVEE_NEXT_lightcache_info_update(&original_scene->eevee);
|
||||
|
||||
DEG_id_tag_update(&original_scene->id, ID_RECALC_COPY_ON_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -164,9 +164,11 @@ MaterialPass MaterialModule::material_pass_get(Object *ob,
|
|||
blender_mat->nodetree :
|
||||
default_surface_ntree_.nodetree_get(blender_mat);
|
||||
|
||||
bool use_deferred_compilation = inst_.is_viewport();
|
||||
|
||||
MaterialPass matpass = MaterialPass();
|
||||
matpass.gpumat = inst_.shaders.material_shader_get(
|
||||
blender_mat, ntree, pipeline_type, geometry_type, true);
|
||||
blender_mat, ntree, pipeline_type, geometry_type, use_deferred_compilation);
|
||||
|
||||
switch (GPU_material_status(matpass.gpumat)) {
|
||||
case GPU_MAT_SUCCESS:
|
||||
|
|
|
@ -6,7 +6,7 @@ void main()
|
|||
switch (eDebugMode(debug_mode)) {
|
||||
default:
|
||||
case DEBUG_IRRADIANCE_CACHE_SURFELS_NORMAL:
|
||||
out_color = vec4(surfel.normal, 1.0);
|
||||
out_color = vec4(pow(surfel.normal * 0.5 + 0.5, vec3(2.2)), 1.0);
|
||||
break;
|
||||
case DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE:
|
||||
out_color = vec4(surfel.radiance, 1.0);
|
||||
|
|
Loading…
Reference in New Issue