2017-03-17 00:00:46 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2016, Blender Foundation.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Institute
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-04-26 17:42:39 +10:00
|
|
|
/** \file eevee_engine.c
|
|
|
|
* \ingroup draw_engine
|
2017-03-17 00:00:46 +01:00
|
|
|
*/
|
|
|
|
|
2017-06-04 12:12:58 +02:00
|
|
|
#include "DRW_render.h"
|
2017-04-25 23:48:26 +02:00
|
|
|
|
2017-03-28 00:09:45 +02:00
|
|
|
#include "BLI_dynstr.h"
|
2017-04-18 12:50:09 +02:00
|
|
|
#include "BLI_rand.h"
|
2017-04-27 22:27:09 +02:00
|
|
|
|
2017-09-21 12:55:14 +02:00
|
|
|
#include "BKE_object.h"
|
|
|
|
|
2017-11-20 14:11:45 +11:00
|
|
|
#include "DNA_world_types.h"
|
|
|
|
|
2017-04-27 22:27:09 +02:00
|
|
|
#include "GPU_material.h"
|
2017-04-18 12:50:09 +02:00
|
|
|
#include "GPU_glew.h"
|
2017-03-28 00:09:45 +02:00
|
|
|
|
2017-04-26 17:42:39 +10:00
|
|
|
#include "eevee_engine.h"
|
2017-03-17 00:00:46 +01:00
|
|
|
#include "eevee_private.h"
|
|
|
|
|
|
|
|
#define EEVEE_ENGINE "BLENDER_EEVEE"
|
|
|
|
|
2017-04-25 23:48:26 +02:00
|
|
|
extern GlobalsUboStorage ts;
|
2017-04-25 18:46:59 +02:00
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
/* *********** FUNCTIONS *********** */
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_engine_init(void *ved)
|
2017-03-17 00:00:46 +01:00
|
|
|
{
|
2017-04-18 12:50:09 +02:00
|
|
|
EEVEE_Data *vedata = (EEVEE_Data *)ved;
|
|
|
|
EEVEE_TextureList *txl = vedata->txl;
|
|
|
|
EEVEE_FramebufferList *fbl = vedata->fbl;
|
2017-06-22 02:28:49 +02:00
|
|
|
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-07-19 14:22:03 +02:00
|
|
|
if (!stl->g_data) {
|
|
|
|
/* Alloc transient pointers */
|
2017-08-30 11:09:07 +02:00
|
|
|
stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
|
2017-07-19 14:22:03 +02:00
|
|
|
}
|
2017-12-20 15:28:12 -02:00
|
|
|
stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f;
|
2017-07-19 14:22:03 +02:00
|
|
|
stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL);
|
|
|
|
|
2017-10-10 18:32:05 +02:00
|
|
|
DRWFboTexture tex = {&txl->color, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP};
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-04-12 12:10:01 +10:00
|
|
|
const float *viewport_size = DRW_viewport_size_get();
|
2017-05-16 03:03:58 +02:00
|
|
|
DRW_framebuffer_init(&fbl->main, &draw_engine_eevee_type,
|
2017-03-17 00:00:46 +01:00
|
|
|
(int)viewport_size[0], (int)viewport_size[1],
|
|
|
|
&tex, 1);
|
|
|
|
|
2017-09-25 20:14:07 +02:00
|
|
|
/* EEVEE_effects_init needs to go first for TAA */
|
|
|
|
EEVEE_effects_init(sldata, vedata);
|
|
|
|
|
2017-07-03 16:38:14 +02:00
|
|
|
EEVEE_materials_init(stl);
|
2017-06-03 00:53:47 +02:00
|
|
|
EEVEE_lights_init(sldata);
|
2017-06-17 00:08:03 +02:00
|
|
|
EEVEE_lightprobes_init(sldata, vedata);
|
2017-09-25 20:14:07 +02:00
|
|
|
|
2018-01-05 10:25:00 +01:00
|
|
|
if ((stl->effects->taa_current_sample > 1) && !DRW_state_is_image_render()) {
|
2017-09-25 20:14:07 +02:00
|
|
|
/* XXX otherwise it would break the other engines. */
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_PERS);
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_PERSINV);
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_WIN);
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_WININV);
|
|
|
|
}
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_cache_init(void *vedata)
|
2017-03-17 00:00:46 +01:00
|
|
|
{
|
2017-03-26 19:10:53 +02:00
|
|
|
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_bloom_cache_init(sldata, vedata);
|
|
|
|
EEVEE_depth_of_field_cache_init(sldata, vedata);
|
2017-07-03 16:38:14 +02:00
|
|
|
EEVEE_effects_cache_init(sldata, vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_lightprobes_cache_init(sldata, vedata);
|
|
|
|
EEVEE_lights_cache_init(sldata, psl);
|
|
|
|
EEVEE_materials_cache_init(vedata);
|
|
|
|
EEVEE_motion_blur_cache_init(sldata, vedata);
|
|
|
|
EEVEE_occlusion_cache_init(sldata, vedata);
|
|
|
|
EEVEE_screen_raytrace_cache_init(sldata, vedata);
|
2017-11-14 00:49:54 +01:00
|
|
|
EEVEE_subsurface_cache_init(sldata, vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_temporal_sampling_cache_init(sldata, vedata);
|
|
|
|
EEVEE_volumes_cache_init(sldata, vedata);
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_cache_populate(void *vedata, Object *ob)
|
2017-03-17 00:00:46 +01:00
|
|
|
{
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-05-17 17:06:55 +10:00
|
|
|
const DRWContextState *draw_ctx = DRW_context_state_get();
|
|
|
|
const bool is_active = (ob == draw_ctx->obact);
|
|
|
|
if (is_active) {
|
2017-07-13 00:27:06 +10:00
|
|
|
if (DRW_object_is_mode_shade(ob) == true) {
|
2017-05-17 17:06:55 +10:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2017-05-12 17:54:14 +02:00
|
|
|
|
2017-12-21 13:29:14 -02:00
|
|
|
if (DRW_check_object_visible_within_active_context(ob) == false) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-12-14 12:22:55 -02:00
|
|
|
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
|
2017-07-09 12:01:29 +02:00
|
|
|
EEVEE_materials_cache_populate(vedata, sldata, ob);
|
2017-04-25 18:46:59 +02:00
|
|
|
|
2017-05-20 13:16:14 +02:00
|
|
|
const bool cast_shadow = true;
|
|
|
|
|
|
|
|
if (cast_shadow) {
|
2018-01-11 14:08:21 +01:00
|
|
|
EEVEE_lights_cache_shcaster_object_add(sldata, ob);
|
2017-05-20 13:16:14 +02:00
|
|
|
}
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
2017-06-12 20:59:54 +10:00
|
|
|
else if (ob->type == OB_LIGHTPROBE) {
|
2017-07-19 18:15:27 +02:00
|
|
|
if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
|
|
|
|
/* TODO: Special case for dupli objects because we cannot save the object pointer. */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
EEVEE_lightprobes_cache_add(sldata, ob);
|
|
|
|
}
|
2017-06-08 21:48:50 +02:00
|
|
|
}
|
2017-03-17 00:00:46 +01:00
|
|
|
else if (ob->type == OB_LAMP) {
|
2018-01-09 18:01:56 +01:00
|
|
|
EEVEE_lights_cache_add(sldata, ob);
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_cache_finish(void *vedata)
|
2017-05-02 19:25:25 +02:00
|
|
|
{
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-06-05 22:05:21 +02:00
|
|
|
EEVEE_materials_cache_finish(vedata);
|
2017-05-30 22:29:20 +02:00
|
|
|
EEVEE_lights_cache_finish(sldata);
|
2017-06-15 00:10:34 +02:00
|
|
|
EEVEE_lightprobes_cache_finish(sldata, vedata);
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
|
2018-01-02 14:15:33 +01:00
|
|
|
/* As renders in an HDR offscreen buffer, we need draw everything once
|
|
|
|
* during the background pass. This way the other drawing callback between
|
|
|
|
* the background and the scene pass are visible.
|
|
|
|
* Note: we could break it up in two passes using some depth test
|
|
|
|
* to reduce the fillrate */
|
|
|
|
static void eevee_draw_background(void *vedata)
|
2017-03-17 00:00:46 +01:00
|
|
|
{
|
2017-03-26 19:10:53 +02:00
|
|
|
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
|
2017-09-25 20:14:07 +02:00
|
|
|
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
2017-03-26 19:10:53 +02:00
|
|
|
EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl;
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
|
2017-03-17 00:00:46 +01:00
|
|
|
|
|
|
|
/* Default framebuffer and texture */
|
|
|
|
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Number of iteration: needed for all temporal effect (SSR, TAA)
|
|
|
|
* when using opengl render. */
|
|
|
|
int loop_ct = DRW_state_is_image_render() ? 4 : 1;
|
2017-04-10 12:06:17 +02:00
|
|
|
|
2018-01-05 10:25:00 +01:00
|
|
|
while (loop_ct--) {
|
2018-01-15 17:14:49 +01:00
|
|
|
unsigned int primes[3] = {2, 3, 7};
|
|
|
|
double offset[3] = {0.0, 0.0, 0.0};
|
|
|
|
double r[3];
|
2017-08-21 01:38:14 +02:00
|
|
|
|
2018-01-05 10:25:00 +01:00
|
|
|
if (DRW_state_is_image_render()) {
|
2018-01-15 17:14:49 +01:00
|
|
|
BLI_halton_3D(primes, offset, stl->effects->taa_current_sample, r);
|
2018-01-05 10:25:00 +01:00
|
|
|
/* Set jitter offset */
|
|
|
|
/* PERF This is killing perf ! */
|
2018-01-15 17:14:49 +01:00
|
|
|
EEVEE_update_util_texture(r);
|
2018-01-05 10:25:00 +01:00
|
|
|
}
|
2018-01-15 17:14:49 +01:00
|
|
|
else if ((stl->effects->enabled_effects & EFFECT_TAA) != 0) {
|
|
|
|
BLI_halton_3D(primes, offset, stl->effects->taa_current_sample, r);
|
2018-01-05 10:25:00 +01:00
|
|
|
/* Set jitter offset */
|
|
|
|
/* PERF This is killing perf ! */
|
2018-01-15 17:14:49 +01:00
|
|
|
EEVEE_update_util_texture(r);
|
2018-01-05 10:25:00 +01:00
|
|
|
}
|
2017-08-18 15:06:51 +02:00
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Refresh Probes */
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_start("Probes Refresh");
|
2017-07-22 20:36:34 +02:00
|
|
|
EEVEE_lightprobes_refresh(sldata, vedata);
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_end();
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-09-10 03:07:55 +02:00
|
|
|
/* Refresh shadows */
|
|
|
|
DRW_stats_group_start("Shadows");
|
|
|
|
EEVEE_draw_shadows(sldata, psl);
|
|
|
|
DRW_stats_group_end();
|
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Attach depth to the hdr buffer and bind it */
|
|
|
|
DRW_framebuffer_texture_detach(dtxl->depth);
|
|
|
|
DRW_framebuffer_texture_attach(fbl->main, dtxl->depth, 0, 0);
|
|
|
|
DRW_framebuffer_bind(fbl->main);
|
2018-01-02 14:15:33 +01:00
|
|
|
if (DRW_state_draw_background()) {
|
|
|
|
DRW_framebuffer_clear(false, true, true, NULL, 1.0f);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* We need to clear the alpha chanel in this case. */
|
|
|
|
float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
|
|
|
DRW_framebuffer_clear(true, true, true, clear_col, 1.0f);
|
|
|
|
}
|
2017-06-04 12:12:58 +02:00
|
|
|
|
2018-01-05 10:25:00 +01:00
|
|
|
if (((stl->effects->enabled_effects & EFFECT_TAA) != 0) &&
|
|
|
|
(stl->effects->taa_current_sample > 1) &&
|
|
|
|
!DRW_state_is_image_render())
|
|
|
|
{
|
2017-09-25 20:14:07 +02:00
|
|
|
DRW_viewport_matrix_override_set(stl->effects->overide_persmat, DRW_MAT_PERS);
|
|
|
|
DRW_viewport_matrix_override_set(stl->effects->overide_persinv, DRW_MAT_PERSINV);
|
|
|
|
DRW_viewport_matrix_override_set(stl->effects->overide_winmat, DRW_MAT_WIN);
|
|
|
|
DRW_viewport_matrix_override_set(stl->effects->overide_wininv, DRW_MAT_WININV);
|
|
|
|
}
|
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Depth prepass */
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_start("Prepass");
|
2017-07-22 20:36:34 +02:00
|
|
|
DRW_draw_pass(psl->depth_pass);
|
|
|
|
DRW_draw_pass(psl->depth_pass_cull);
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_end();
|
2017-06-22 02:28:49 +02:00
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Create minmax texture */
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_start("Main MinMax buffer");
|
2017-07-23 20:33:29 +02:00
|
|
|
EEVEE_create_minmax_buffer(vedata, dtxl->depth, -1);
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_end();
|
2017-06-22 02:28:49 +02:00
|
|
|
|
2018-01-09 19:01:24 +01:00
|
|
|
EEVEE_occlusion_compute(sldata, vedata, dtxl->depth, -1);
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_volumes_compute(sldata, vedata);
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Shading pass */
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_start("Shading");
|
2018-01-03 13:24:04 +01:00
|
|
|
if (DRW_state_draw_background()) {
|
|
|
|
DRW_draw_pass(psl->background_pass);
|
|
|
|
}
|
2017-07-22 20:36:34 +02:00
|
|
|
EEVEE_draw_default_passes(psl);
|
|
|
|
DRW_draw_pass(psl->material_pass);
|
2017-11-14 00:49:54 +01:00
|
|
|
EEVEE_subsurface_data_render(sldata, vedata);
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_end();
|
2017-07-16 23:49:25 +02:00
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
/* Effects pre-transparency */
|
2017-11-14 00:49:54 +01:00
|
|
|
EEVEE_subsurface_compute(sldata, vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_reflection_compute(sldata, vedata);
|
|
|
|
EEVEE_occlusion_draw_debug(sldata, vedata);
|
2017-07-27 11:22:47 +02:00
|
|
|
DRW_draw_pass(psl->probe_display);
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_refraction_compute(sldata, vedata);
|
2017-08-09 16:54:18 +02:00
|
|
|
|
2017-08-09 23:48:42 +02:00
|
|
|
/* Opaque refraction */
|
|
|
|
DRW_stats_group_start("Opaque Refraction");
|
|
|
|
DRW_draw_pass(psl->refract_depth_pass);
|
|
|
|
DRW_draw_pass(psl->refract_depth_pass_cull);
|
|
|
|
DRW_draw_pass(psl->refract_pass);
|
|
|
|
DRW_stats_group_end();
|
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
/* Volumetrics Resolve Opaque */
|
|
|
|
EEVEE_volumes_resolve(sldata, vedata);
|
2017-10-24 14:49:00 +02:00
|
|
|
|
2017-07-22 20:36:34 +02:00
|
|
|
/* Transparent */
|
|
|
|
DRW_pass_sort_shgroup_z(psl->transparent_pass);
|
|
|
|
DRW_draw_pass(psl->transparent_pass);
|
|
|
|
|
|
|
|
/* Post Process */
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_start("Post FX");
|
2017-07-22 20:36:34 +02:00
|
|
|
EEVEE_draw_effects(vedata);
|
2017-07-26 19:58:15 +02:00
|
|
|
DRW_stats_group_end();
|
2017-09-25 20:14:07 +02:00
|
|
|
|
2018-01-05 10:25:00 +01:00
|
|
|
if ((stl->effects->taa_current_sample > 1) && !DRW_state_is_image_render()) {
|
2017-09-25 20:14:07 +02:00
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_PERS);
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_PERSINV);
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_WIN);
|
|
|
|
DRW_viewport_matrix_override_unset(DRW_MAT_WININV);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_volumes_free_smoke_textures();
|
2017-10-27 22:35:48 +02:00
|
|
|
|
2017-09-25 20:14:07 +02:00
|
|
|
stl->g_data->view_updated = false;
|
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_view_update(void *vedata)
|
2017-09-25 20:14:07 +02:00
|
|
|
{
|
|
|
|
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
|
|
|
if (stl->g_data) {
|
|
|
|
stl->g_data->view_updated = true;
|
2017-07-22 20:36:34 +02:00
|
|
|
}
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_id_update(void *UNUSED(vedata), ID *id)
|
2017-11-28 17:05:52 +01:00
|
|
|
{
|
2017-12-19 11:46:53 +01:00
|
|
|
/* This is a bit mask of components which update is to be ignored. */
|
|
|
|
const int ignore_updates = ID_RECALC_COLLECTIONS;
|
|
|
|
/* Check whether we have to do anything here. */
|
|
|
|
if ((id->recalc & ~ignore_updates) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Handle updates based on ID type. */
|
2017-11-28 17:05:52 +01:00
|
|
|
const ID_Type id_type = GS(id->name);
|
|
|
|
if (id_type == ID_OB) {
|
|
|
|
Object *object = (Object *)id;
|
2017-11-29 11:00:50 +01:00
|
|
|
EEVEE_LightProbeEngineData *ped = EEVEE_lightprobe_data_get(object);
|
2017-11-28 17:05:52 +01:00
|
|
|
if (ped != NULL) {
|
|
|
|
ped->need_full_update = true;
|
|
|
|
}
|
2017-11-29 11:00:50 +01:00
|
|
|
EEVEE_LampEngineData *led = EEVEE_lamp_data_get(object);
|
2017-11-28 17:05:52 +01:00
|
|
|
if (led != NULL) {
|
|
|
|
led->need_update = true;
|
|
|
|
}
|
2017-11-29 11:00:50 +01:00
|
|
|
EEVEE_ObjectEngineData *oedata = EEVEE_object_data_get(object);
|
2017-11-28 17:05:52 +01:00
|
|
|
if (oedata != NULL) {
|
|
|
|
oedata->need_update = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_engine_free(void)
|
2017-03-17 00:00:46 +01:00
|
|
|
{
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_bloom_free();
|
|
|
|
EEVEE_depth_of_field_free();
|
2017-05-04 17:36:40 +02:00
|
|
|
EEVEE_effects_free();
|
2017-06-12 20:59:54 +10:00
|
|
|
EEVEE_lightprobes_free();
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_lights_free();
|
|
|
|
EEVEE_materials_free();
|
|
|
|
EEVEE_motion_blur_free();
|
|
|
|
EEVEE_occlusion_free();
|
|
|
|
EEVEE_screen_raytrace_free();
|
2017-11-14 00:49:54 +01:00
|
|
|
EEVEE_subsurface_free();
|
2017-11-01 01:03:36 +01:00
|
|
|
EEVEE_temporal_sampling_free();
|
|
|
|
EEVEE_volumes_free();
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_layer_collection_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
|
2017-03-17 00:00:46 +01:00
|
|
|
{
|
2017-03-30 17:01:23 +02:00
|
|
|
BLI_assert(props &&
|
|
|
|
props->type == IDP_GROUP &&
|
|
|
|
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
|
|
|
|
// BKE_collection_engine_property_add_int(props, "high_quality_sphere_lamps", false);
|
2017-05-05 16:27:31 +02:00
|
|
|
UNUSED_VARS_NDEBUG(props);
|
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static void eevee_view_layer_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
|
2017-05-05 16:27:31 +02:00
|
|
|
{
|
|
|
|
BLI_assert(props &&
|
|
|
|
props->type == IDP_GROUP &&
|
|
|
|
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
|
2017-05-10 15:58:18 +02:00
|
|
|
|
2017-10-01 02:19:10 +02:00
|
|
|
BKE_collection_engine_property_add_int(props, "gi_diffuse_bounces", 3);
|
2017-10-10 21:56:11 +02:00
|
|
|
BKE_collection_engine_property_add_int(props, "gi_cubemap_resolution", 512);
|
2017-12-02 13:01:40 +01:00
|
|
|
BKE_collection_engine_property_add_int(props, "gi_visibility_resolution", 32);
|
2017-10-01 02:19:10 +02:00
|
|
|
|
2017-09-25 20:14:07 +02:00
|
|
|
BKE_collection_engine_property_add_int(props, "taa_samples", 8);
|
2017-08-09 16:54:18 +02:00
|
|
|
|
2017-11-14 00:49:54 +01:00
|
|
|
BKE_collection_engine_property_add_bool(props, "sss_enable", false);
|
2017-11-14 02:17:34 +01:00
|
|
|
BKE_collection_engine_property_add_int(props, "sss_samples", 7);
|
|
|
|
BKE_collection_engine_property_add_float(props, "sss_jitter_threshold", 0.3f);
|
2017-11-24 22:29:18 +01:00
|
|
|
BKE_collection_engine_property_add_bool(props, "sss_separate_albedo", false);
|
2017-11-14 00:49:54 +01:00
|
|
|
|
2017-07-16 23:49:25 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "ssr_enable", false);
|
2017-08-09 16:54:18 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "ssr_refraction", false);
|
2017-07-22 01:13:33 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "ssr_halfres", true);
|
2017-07-31 15:18:22 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "ssr_quality", 0.25f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "ssr_max_roughness", 0.5f);
|
2017-07-22 14:41:34 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "ssr_thickness", 0.2f);
|
2017-07-22 01:13:33 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "ssr_border_fade", 0.075f);
|
2017-08-11 12:59:32 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "ssr_firefly_fac", 10.0f);
|
2017-07-16 23:49:25 +02:00
|
|
|
|
2017-07-03 16:38:14 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "volumetric_enable", false);
|
2017-07-05 19:15:32 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "volumetric_start", 0.1f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "volumetric_end", 100.0f);
|
2017-10-24 14:49:00 +02:00
|
|
|
BKE_collection_engine_property_add_int(props, "volumetric_tile_size", 8);
|
2017-07-05 18:28:48 +02:00
|
|
|
BKE_collection_engine_property_add_int(props, "volumetric_samples", 64);
|
2017-07-05 19:15:32 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "volumetric_sample_distribution", 0.8f);
|
2017-07-05 18:28:48 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "volumetric_lights", true);
|
2017-07-05 19:14:50 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "volumetric_light_clamp", 0.0f);
|
2017-07-05 18:28:48 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "volumetric_shadows", false);
|
|
|
|
BKE_collection_engine_property_add_int(props, "volumetric_shadow_samples", 16);
|
|
|
|
BKE_collection_engine_property_add_bool(props, "volumetric_colored_transmittance", true);
|
2017-07-03 16:38:14 +02:00
|
|
|
|
2017-06-22 02:30:20 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "gtao_enable", false);
|
|
|
|
BKE_collection_engine_property_add_bool(props, "gtao_use_bent_normals", true);
|
2017-08-18 15:06:51 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "gtao_bounce", true);
|
2017-06-22 02:30:20 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "gtao_distance", 0.2f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "gtao_factor", 1.0f);
|
2017-08-18 15:06:51 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "gtao_quality", 0.25f);
|
2017-06-22 02:30:20 +02:00
|
|
|
|
2017-05-10 15:58:18 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "dof_enable", false);
|
|
|
|
BKE_collection_engine_property_add_float(props, "bokeh_max_size", 100.0f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "bokeh_threshold", 1.0f);
|
|
|
|
|
2017-08-19 02:40:02 +02:00
|
|
|
float default_bloom_color[3] = {1.0f, 1.0f, 1.0f};
|
2017-05-10 15:58:18 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "bloom_enable", false);
|
2017-08-19 02:40:02 +02:00
|
|
|
BKE_collection_engine_property_add_float_array(props, "bloom_color", default_bloom_color, 3);
|
2017-05-10 15:58:18 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "bloom_threshold", 0.8f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "bloom_knee", 0.5f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "bloom_intensity", 0.8f);
|
|
|
|
BKE_collection_engine_property_add_float(props, "bloom_radius", 6.5f);
|
2017-08-19 02:39:16 +02:00
|
|
|
BKE_collection_engine_property_add_float(props, "bloom_clamp", 1.0f);
|
2017-05-10 15:58:18 +02:00
|
|
|
|
|
|
|
BKE_collection_engine_property_add_bool(props, "motion_blur_enable", false);
|
|
|
|
BKE_collection_engine_property_add_int(props, "motion_blur_samples", 8);
|
|
|
|
BKE_collection_engine_property_add_float(props, "motion_blur_shutter", 1.0f);
|
2017-09-01 15:59:01 +02:00
|
|
|
|
|
|
|
BKE_collection_engine_property_add_int(props, "shadow_method", SHADOW_ESM);
|
|
|
|
BKE_collection_engine_property_add_int(props, "shadow_size", 512);
|
2017-09-02 02:27:28 +02:00
|
|
|
BKE_collection_engine_property_add_bool(props, "shadow_high_bitdepth", false);
|
2017-03-17 00:00:46 +01:00
|
|
|
}
|
|
|
|
|
2017-11-29 12:28:40 +01:00
|
|
|
static const DrawEngineDataSize eevee_data_size = DRW_VIEWPORT_DATA_SIZE(EEVEE_Data);
|
2017-04-12 19:49:19 +10:00
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
DrawEngineType draw_engine_eevee_type = {
|
|
|
|
NULL, NULL,
|
2017-03-26 19:10:53 +02:00
|
|
|
N_("Eevee"),
|
2017-11-29 12:28:40 +01:00
|
|
|
&eevee_data_size,
|
|
|
|
&eevee_engine_init,
|
|
|
|
&eevee_engine_free,
|
|
|
|
&eevee_cache_init,
|
|
|
|
&eevee_cache_populate,
|
|
|
|
&eevee_cache_finish,
|
2018-01-02 14:15:33 +01:00
|
|
|
&eevee_draw_background,
|
|
|
|
NULL, /* Everything is drawn in the background pass (see comment on function) */
|
2017-11-29 12:28:40 +01:00
|
|
|
&eevee_view_update,
|
|
|
|
&eevee_id_update,
|
2017-03-17 00:00:46 +01:00
|
|
|
};
|
|
|
|
|
2017-04-26 17:42:39 +10:00
|
|
|
RenderEngineType DRW_engine_viewport_eevee_type = {
|
2017-03-17 00:00:46 +01:00
|
|
|
NULL, NULL,
|
2017-05-01 14:55:59 +02:00
|
|
|
EEVEE_ENGINE, N_("Eevee"), RE_INTERNAL | RE_USE_SHADING_NODES,
|
2017-05-05 16:27:31 +02:00
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
2017-11-29 12:28:40 +01:00
|
|
|
&eevee_layer_collection_settings_create,
|
|
|
|
&eevee_view_layer_settings_create,
|
2017-03-17 00:00:46 +01:00
|
|
|
&draw_engine_eevee_type,
|
|
|
|
{NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#undef EEVEE_ENGINE
|