diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-03 19:47:31 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-19 17:18:14 +0300 |
commit | 3e9947c4d4714a4752c768bb78fe6d227fc6be97 (patch) | |
tree | 1c21bc46db3bb15f9efeab0c5c0e5d2b8d75d74f /source/blender/makesrna/intern/rna_scene.c | |
parent | 93048873f10bab6ebcee9467a1e462f410f1bf12 (diff) |
Depth of field high quality:
A new checkbox "High quality" is provided in camera settings to enable
this. This creates a depth of field that is much closer to the rendered
result and even supports aperture blades in the effect, but it's more
expensive too. There are optimizations to do here since the technique is
very fill rate heavy.
People, be careful, this -can- lock up your screen if depth of field
blurring is too extreme.
Technical details:
This uses geometry shaders + instancing and is an adaptation of
techniques gathered from
http://bartwronski.com/2014/04/07/bokeh-depth-of-field-going-insane-
http://advances.realtimerendering.com/s2011/SousaSchulzKazyan%20-
%20in%20Real-Time%20Rendering%20Course).ppt
TODOs:
* Support dithering to minimize banding.
* Optimize fill rate in geometry shader.
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 629fbbf66e9..4214c830e4c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1745,6 +1745,19 @@ static void rna_GPUFXSettings_fx_update(Main *UNUSED(bmain), Scene *UNUSED(scene BKE_screen_gpu_fx_validate(fx_settings); } +static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value) +{ + GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data; + + if (value < 3 && dofsettings->num_blades > 2) + dofsettings->num_blades = 0; + else if (value > 0 && dofsettings->num_blades == 0) + dofsettings->num_blades = 3; + else + dofsettings->num_blades = value; +} + + #else static void rna_def_transform_orientation(BlenderRNA *brna) @@ -3908,6 +3921,17 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "num_blades", PROP_INT, PROP_NONE); + RNA_def_property_ui_text(prop, "Viewport Camera Blades", "Blades for dof effect"); + RNA_def_property_range(prop, 0, 16); + RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "high_quality", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "high_quality", 1); + RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_gpu_ssao_fx(BlenderRNA *brna) |