From 25196f8a369c354bf870b6144e3f43aa0a1d38e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Fri, 15 Apr 2022 13:43:19 +0200 Subject: EEVEE: Support disabling all lightprobe object contribution in viewport This is supported throught the visibility toggle. The light cache will then only be used for world lighting. This is the behavior as light objects. --- source/blender/draw/engines/eevee/eevee_engine.c | 6 ++++++ source/blender/draw/engines/eevee/eevee_lightprobes.c | 5 +++++ source/blender/draw/engines/eevee/eevee_private.h | 1 + 3 files changed, 12 insertions(+) (limited to 'source') diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 0729b2078a8..81edee17c76 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -52,6 +52,8 @@ static void eevee_engine_init(void *ved) stl->g_data->valid_taa_history = (txl->taa_history != NULL); stl->g_data->queued_shaders_count = 0; stl->g_data->render_timesteps = 1; + stl->g_data->disable_ligthprobes = v3d && + (v3d->object_type_exclude_viewport & (1 << OB_LIGHTPROBE)); /* Main Buffer */ DRW_texture_ensure_fullscreen_2d(&txl->color, GPU_RGBA16F, DRW_TEX_FILTER); @@ -253,6 +255,10 @@ static void eevee_draw_scene(void *vedata) /* Set ray type. */ sldata->common_data.ray_type = EEVEE_RAY_CAMERA; sldata->common_data.ray_depth = 0.0f; + if (stl->g_data->disable_ligthprobes) { + sldata->common_data.prb_num_render_cube = 1; + sldata->common_data.prb_num_render_grid = 1; + } GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data); GPU_framebuffer_bind(fbl->main_fb); diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 219c44de9dc..94915180483 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -1193,6 +1193,11 @@ void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *v common_data->ssrefract_toggle = false; common_data->sss_toggle = false; + if (vedata->stl->g_data->disable_ligthprobes) { + sldata->common_data.prb_num_render_cube = 1; + sldata->common_data.prb_num_render_grid = 1; + } + common_data->ray_type = EEVEE_RAY_GLOSSY; common_data->ray_depth = 1.0f; /* Planar reflections are rendered at the `hiz` resolution, so no need to scaling. */ diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index effae313acf..9f97dacf9fe 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -1012,6 +1012,7 @@ typedef struct EEVEE_PrivateData { struct DRWCallBuffer *planar_display_shgrp; struct GHash *material_hash; float background_alpha; /* TODO: find a better place for this. */ + bool disable_ligthprobes; /* Chosen lightcache: can come from Lookdev or the viewlayer. */ struct LightCache *light_cache; /* For planar probes */ -- cgit v1.2.3