diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-05-10 16:58:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-05-10 17:03:25 +0300 |
commit | 45207bf3ce96f008496caf1be8166fd09065c4a0 (patch) | |
tree | 2cac0276dd3aa7cd97e6619ba66f9889d1c88a85 /source | |
parent | fdf2d8bb9592bd3a650b35d8bbd8a633169ac026 (diff) |
Eevee: Post process parameters.
-Display almost all parameters.
-Made some small adjustment to motion blur to support FOV motion blur.
-Made DOF max radius a parameter.
Diffstat (limited to 'source')
8 files changed, 232 insertions, 31 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 0bbcfa3a49e..0135a859865 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -30,11 +30,13 @@ #include "DNA_anim_types.h" #include "DNA_camera_types.h" +#include "DNA_screen_types.h" #include "DNA_view3d_types.h" #include "BKE_camera.h" #include "BKE_object.h" #include "BKE_animsys.h" +#include "BKE_screen.h" #include "eevee_private.h" #include "GPU_texture.h" @@ -81,9 +83,12 @@ void EEVEE_effects_init(EEVEE_Data *vedata) EEVEE_EffectsInfo *effects; const DRWContextState *draw_ctx = DRW_context_state_get(); + SceneLayer *scene_layer = draw_ctx->sl; Scene *scene = draw_ctx->scene; View3D *v3d = draw_ctx->v3d; RegionView3D *rv3d = draw_ctx->rv3d; + ARegion *ar = draw_ctx->ar; + IDProperty *props = BKE_scene_layer_engine_evaluated_get(scene_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); const float *viewport_size = DRW_viewport_size_get(); @@ -131,27 +136,58 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects->enabled_effects = 0; #if ENABLE_EFFECT_MOTION_BLUR - { + if (BKE_collection_engine_property_value_get_bool(props, "motion_blur_enable")) { /* Update Motion Blur Matrices */ if (rv3d->persp == RV3D_CAMOB && v3d->camera) { float ctime = BKE_scene_frame_get(scene); - float past_obmat[4][4], future_obmat[4][4], winmat[4][4]; - - DRW_viewport_matrix_get(winmat, DRW_MAT_WIN); + float delta = BKE_collection_engine_property_value_get_float(props, "motion_blur_shutter"); + float past_obmat[4][4], future_obmat[4][4]; /* HACK */ - Object cam_cpy; + Object cam_cpy; Camera camdata_cpy; memcpy(&cam_cpy, v3d->camera, sizeof(cam_cpy)); + memcpy(&camdata_cpy, v3d->camera->data, sizeof(camdata_cpy)); + cam_cpy.data = &camdata_cpy; /* Past matrix */ /* FIXME : This is a temporal solution that does not take care of parent animations */ /* Recalc Anim manualy */ - BKE_animsys_evaluate_animdata(scene, &cam_cpy.id, cam_cpy.adt, ctime - 1.0, ADT_RECALC_ANIM); - BKE_object_where_is_calc_time(scene, &cam_cpy, ctime - 1.0); + BKE_animsys_evaluate_animdata(scene, &cam_cpy.id, cam_cpy.adt, ctime - delta, ADT_RECALC_ALL); + BKE_animsys_evaluate_animdata(scene, &camdata_cpy.id, camdata_cpy.adt, ctime - delta, ADT_RECALC_ALL); + BKE_object_where_is_calc_time(scene, &cam_cpy, ctime - delta); + + /* Compute winmat */ + CameraParams params; + BKE_camera_params_init(¶ms); + + /* copy of BKE_camera_params_from_view3d */ + { + params.lens = v3d->lens; + params.clipsta = v3d->near; + params.clipend = v3d->far; + + /* camera view */ + BKE_camera_params_from_object(¶ms, &cam_cpy); + + params.zoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); + + params.offsetx = 2.0f * rv3d->camdx * params.zoom; + params.offsety = 2.0f * rv3d->camdy * params.zoom; + params.shiftx *= params.zoom; + params.shifty *= params.zoom; + + params.zoom = CAMERA_PARAM_ZOOM_INIT_CAMOB / params.zoom; + } + + BKE_camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, 1.0f, 1.0f); + BKE_camera_params_compute_matrix(¶ms); + + /* FIXME Should be done per view (MULTIVIEW) */ normalize_m4_m4(past_obmat, cam_cpy.obmat); invert_m4(past_obmat); - mul_m4_m4m4(effects->past_world_to_ndc, winmat, past_obmat); + mul_m4_m4m4(effects->past_world_to_ndc, params.winmat, past_obmat); + #if 0 /* for future high quality blur */ /* Future matrix */ @@ -169,14 +205,14 @@ void EEVEE_effects_init(EEVEE_Data *vedata) /* Current matrix */ DRW_viewport_matrix_get(effects->current_ndc_to_world, DRW_MAT_PERSINV); - effects->blur_amount = 0.5f; + effects->motion_blur_samples = BKE_collection_engine_property_value_get_int(props, "motion_blur_samples"); effects->enabled_effects |= EFFECT_MOTION_BLUR; } } #endif /* ENABLE_EFFECT_MOTION_BLUR */ #if ENABLE_EFFECT_BLOOM - { + if (BKE_collection_engine_property_value_get_bool(props, "bloom_enable")) { /* Bloom */ int blitsize[2], texsize[2]; @@ -196,11 +232,10 @@ void EEVEE_effects_init(EEVEE_Data *vedata) &tex_blit, 1); /* Parameters */ - /* TODO UI Options */ - float threshold = 0.8f; - float knee = 0.5f; - float intensity = 0.8f; - float radius = 8.5f; + float threshold = BKE_collection_engine_property_value_get_float(props, "bloom_threshold"); + float knee = BKE_collection_engine_property_value_get_float(props, "bloom_knee"); + float intensity = BKE_collection_engine_property_value_get_float(props, "bloom_intensity"); + float radius = BKE_collection_engine_property_value_get_float(props, "bloom_radius"); /* determine the iteration count */ const float minDim = (float)MIN2(blitsize[0], blitsize[1]); @@ -212,7 +247,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects->bloom_sample_scale = 0.5f + maxIter - (float)maxIterInt; effects->bloom_curve_threshold[0] = threshold - knee; effects->bloom_curve_threshold[1] = knee * 2.0f; - effects->bloom_curve_threshold[2] = 0.25f / knee; + effects->bloom_curve_threshold[2] = 0.25f / max_ff(1e-5f, knee); effects->bloom_curve_threshold[3] = threshold; effects->bloom_intensity = intensity; @@ -250,7 +285,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) #endif /* ENABLE_EFFECT_BLOOM */ #if ENABLE_EFFECT_DOF - { + if (BKE_collection_engine_property_value_get_bool(props, "dof_enable")) { /* Depth Of Field */ if (rv3d->persp == RV3D_CAMOB && v3d->camera) { Camera *cam = (Camera *)v3d->camera->data; @@ -302,6 +337,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects->dof_bokeh[0] = blades; effects->dof_bokeh[1] = rotation; effects->dof_bokeh[2] = ratio; + effects->dof_bokeh[3] = BKE_collection_engine_property_value_get_float(props, "bokeh_max_size"); effects->enabled_effects |= EFFECT_DOF; } @@ -351,7 +387,7 @@ void EEVEE_effects_cache_init(EEVEE_Data *vedata) psl->motion_blur = DRW_pass_create("Motion Blur", DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(e_data.motion_blur_sh, psl->motion_blur); - DRW_shgroup_uniform_float(grp, "blurAmount", &effects->blur_amount, 1); + DRW_shgroup_uniform_int(grp, "samples", &effects->motion_blur_samples, 1); DRW_shgroup_uniform_mat4(grp, "currInvViewProjMatrix", (float *)effects->current_ndc_to_world); DRW_shgroup_uniform_mat4(grp, "pastViewProjMatrix", (float *)effects->past_world_to_ndc); DRW_shgroup_uniform_buffer(grp, "colorBuffer", &effects->source_buffer); @@ -432,7 +468,7 @@ void EEVEE_effects_cache_init(EEVEE_Data *vedata) DRW_shgroup_uniform_buffer(grp, "colorBuffer", &effects->unf_source_buffer); DRW_shgroup_uniform_buffer(grp, "cocBuffer", &txl->dof_coc); DRW_shgroup_uniform_vec2(grp, "layerSelection", effects->dof_layer_select, 1); - DRW_shgroup_uniform_vec3(grp, "bokehParams", effects->dof_bokeh, 1); + DRW_shgroup_uniform_vec4(grp, "bokehParams", effects->dof_bokeh, 1); psl->dof_resolve = DRW_pass_create("DoF Resolve", DRW_STATE_WRITE_COLOR); diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 0ab5691b5a1..8c6085f1a04 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -731,7 +731,20 @@ static void EEVEE_scene_layer_settings_create(RenderEngine *UNUSED(engine), IDPr BLI_assert(props && props->type == IDP_GROUP && props->subtype == IDP_GROUP_SUB_ENGINE_RENDER); - UNUSED_VARS_NDEBUG(props); + + 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); + + BKE_collection_engine_property_add_bool(props, "bloom_enable", false); + 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); + + 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); } static const DrawEngineDataSize EEVEE_data_size = DRW_VIEWPORT_DATA_SIZE(EEVEE_Data); diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index ef3cc7aa4c0..ab70f415d4c 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -202,12 +202,12 @@ typedef struct EEVEE_EffectsInfo { float current_ndc_to_world[4][4]; float past_world_to_ndc[4][4]; float tmp_mat[4][4]; - float blur_amount; + int motion_blur_samples; /* Depth Of Field */ float dof_near_far[2]; float dof_params[3]; - float dof_bokeh[3]; + float dof_bokeh[4]; float dof_layer_select[2]; int dof_target_size[2]; diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl index 0eaee94165d..e77379744d1 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl @@ -10,10 +10,12 @@ uniform vec3 dofParams; #define dof_distance dofParams.y #define dof_invsensorsize dofParams.z -uniform vec3 bokehParams; +uniform vec4 bokehParams; #define bokeh_sides bokehParams.x /* Polygon Bokeh shape number of sides */ #define bokeh_rotation bokehParams.y +#define bokeh_ratio bokehParams.z +#define bokeh_maxsize bokehParams.w uniform vec2 nearFar; /* Near & far view depths values */ diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl index 3899365a771..e75ffe236f1 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl @@ -4,6 +4,13 @@ in vec2 uvs; uniform vec2 layerSelection; +uniform vec4 bokehParams; + +#define bokeh_sides bokehParams.x /* Polygon Bokeh shape number of sides */ +#define bokeh_rotation bokehParams.y +#define bokeh_ratio bokehParams.z +#define bokeh_maxsize bokehParams.w + uniform sampler2D colorBuffer; uniform sampler2D cocBuffer; @@ -28,7 +35,7 @@ void step_scatter() float coc = dot(layerSelection, texelFetch(cocBuffer, texelco, 0).rg); /* Clamp to max size for performance */ - coc = min(coc, 100.0); + coc = min(coc, bokeh_maxsize); if (coc >= 1.0) { color = texelFetch(colorBuffer, texelco, 0); diff --git a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl index e603769c9c8..8960b339a61 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl @@ -2,7 +2,6 @@ uniform sampler2D colorBuffer; uniform sampler2D depthBuffer; -uniform float blurAmount; /* current frame */ uniform mat4 currInvViewProjMatrix; @@ -14,7 +13,9 @@ in vec4 uvcoordsvar; out vec4 FragColor; -#define MAX_SAMPLE 16 +#define MAX_SAMPLE 64 + +uniform int samples; float wang_hash_noise(uint s) { @@ -37,7 +38,8 @@ void main() ndc_pos.xy = uvcoordsvar.xy; ndc_pos.z = texture(depthBuffer, uvcoordsvar.xy).x; - float noise = 2.0 * wang_hash_noise(0u) / MAX_SAMPLE; + float inv_samples = 1.0 / float(samples); + float noise = 2.0 * wang_hash_noise(0u) * inv_samples; /* Normalize Device Coordinates are [-1, +1]. */ ndc_pos = ndc_pos * 2.0 - 1.0; @@ -50,10 +52,12 @@ void main() vec4 old_ndc = pastViewProjMatrix * vec4(world_pos, 1.0); old_ndc.xyz /= old_ndc.w; /* Perspective divide */ - vec2 motion = (ndc_pos.xy - old_ndc.xy) * blurAmount; + vec2 motion = (ndc_pos.xy - old_ndc.xy) * 0.25; /* 0.25 fit cycles ref */ - const float inc = 2.0 / MAX_SAMPLE; - for (float i = -1.0 + noise; i < 1.0; i += inc) { - FragColor += texture(colorBuffer, uvcoordsvar.xy + motion * i) / MAX_SAMPLE; + float inc = 2.0 * inv_samples; + float i = -1.0 + noise; + for (int j = 0; j < samples && j < MAX_SAMPLE; j++) { + FragColor += texture(colorBuffer, uvcoordsvar.xy + motion * i) * inv_samples; + i += inc; } } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 23ea08da26c..b7d607b6940 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1946,6 +1946,7 @@ enum { extern const char *RE_engine_id_BLENDER_RENDER; extern const char *RE_engine_id_BLENDER_GAME; extern const char *RE_engine_id_BLENDER_CLAY; +extern const char *RE_engine_id_BLENDER_EEVEE; extern const char *RE_engine_id_CYCLES; /* **************** SCENE ********************* */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a9e657327d0..0f904ab214b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1944,6 +1944,9 @@ static StructRNA *rna_SceneLayerSettings_refine(PointerRNA *ptr) return &RNA_SceneLayerEngineSettingsClay; } #endif + if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) { + return &RNA_SceneLayerEngineSettingsEevee; + } break; case IDP_GROUP_SUB_MODE_OBJECT: case IDP_GROUP_SUB_MODE_EDIT: @@ -1969,6 +1972,10 @@ static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr) return &RNA_LayerCollectionEngineSettingsClay; } #endif + if (STREQ(props->name, RE_engine_id_BLENDER_EEVEE)) { + printf("Mode not fully implemented\n"); + return &RNA_LayerCollectionSettings; + } break; case IDP_GROUP_SUB_MODE_OBJECT: return &RNA_LayerCollectionModeSettingsObject; @@ -2502,6 +2509,15 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, #define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \ RNA_LAYER_ENGINE_GET_SET(bool, Clay, COLLECTION_MODE_NONE, _NAME_) +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(float, Eevee, COLLECTION_MODE_NONE, _NAME_) + +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(int, Eevee, COLLECTION_MODE_NONE, _NAME_) + +#define RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(_NAME_) \ + RNA_LAYER_ENGINE_GET_SET(bool, Eevee, COLLECTION_MODE_NONE, _NAME_) + /* mode engines */ #define RNA_LAYER_MODE_OBJECT_GET_SET_FLOAT(_NAME_) \ @@ -2545,6 +2561,20 @@ RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_distance) RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_attenuation) #endif /* WITH_CLAY_ENGINE */ +/* eevee engine */ +/* SceneLayer settings. */ +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(dof_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bokeh_max_size) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bokeh_threshold) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(bloom_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_threshold) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_knee) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_radius) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(bloom_intensity) +RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(motion_blur_enable) +RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(motion_blur_samples) +RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(motion_blur_shutter) + /* object engine */ RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_wire) RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_backface_culling) @@ -6105,6 +6135,113 @@ static void rna_def_scene_layer_engine_settings_clay(BlenderRNA *brna) } #endif /* WITH_CLAY_ENGINE */ +static void rna_def_scene_layer_engine_settings_eevee(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SceneLayerEngineSettingsEevee", "SceneLayerSettings"); + RNA_def_struct_ui_text(srna, "Eevee Scene Layer Settings", "Eevee Engine settings"); + + RNA_define_verify_sdna(0); /* not in sdna */ + + /* see RNA_LAYER_ENGINE_GET_SET macro */ + /* Depth of Field */ + prop = RNA_def_property(srna, "dof_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_dof_enable_get", + "rna_LayerEngineSettings_Eevee_dof_enable_set"); + RNA_def_property_ui_text(prop, "Enable Depth of Field", "Enable depth of field using the values from the active camera"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bokeh_max_size_get", + "rna_LayerEngineSettings_Eevee_bokeh_max_size_set", NULL); + RNA_def_property_ui_text(prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower values increase performance)"); + RNA_def_property_range(prop, 0.0f, 2000.0f); + RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bokeh_threshold_get", + "rna_LayerEngineSettings_Eevee_bokeh_threshold_set", NULL); + RNA_def_property_ui_text(prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field"); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Bloom */ + prop = RNA_def_property(srna, "bloom_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_enable_get", + "rna_LayerEngineSettings_Eevee_bloom_enable_set"); + RNA_def_property_ui_text(prop, "Enable Bloom", "High brighness pixels generate a glowing effect"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_threshold_get", + "rna_LayerEngineSettings_Eevee_bloom_threshold_set", NULL); + RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness"); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_knee_get", + "rna_LayerEngineSettings_Eevee_bloom_knee_set", NULL); + RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_radius_get", + "rna_LayerEngineSettings_Eevee_bloom_radius_set", NULL); + RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance"); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_bloom_intensity_get", + "rna_LayerEngineSettings_Eevee_bloom_intensity_set", NULL); + RNA_def_property_ui_text(prop, "Intensity", "Blend factor"); + RNA_def_property_range(prop, 0.0f, 10000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + /* Motion blur */ + prop = RNA_def_property(srna, "motion_blur_enable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_enable_get", + "rna_LayerEngineSettings_Eevee_motion_blur_enable_set"); + RNA_def_property_ui_text(prop, "Enable Motion Blur", "Enable motion blur effect (only in camera view)"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_samples_get", + "rna_LayerEngineSettings_Eevee_motion_blur_samples_set", NULL); + RNA_def_property_ui_text(prop, "Samples", "Number of samples to take with motion blur"); + RNA_def_property_range(prop, 1, 64); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Eevee_motion_blur_shutter_get", + "rna_LayerEngineSettings_Eevee_motion_blur_shutter_set", NULL); + RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close"); + RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 2); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update"); + + RNA_define_verify_sdna(1); /* not in sdna */ +} + #ifdef WITH_CLAY_ENGINE static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna) { @@ -6387,6 +6524,7 @@ static void rna_def_scene_layer_settings(BlenderRNA *brna) #ifdef WITH_CLAY_ENGINE rna_def_scene_layer_engine_settings_clay(brna); #endif + rna_def_scene_layer_engine_settings_eevee(brna); #if 0 rna_def_scene_layer_mode_settings_object(brna); |