Eevee: Add Rotation and ratio parameters to DoF.
This commit is contained in:
parent
0eb32ab228
commit
5aca575d85
|
@ -234,15 +234,25 @@ class DATA_PT_camera_dof(CameraButtonsPanel, Panel):
|
|||
sub.active = (cam.dof_object is None)
|
||||
sub.prop(cam, "dof_distance", text="Distance")
|
||||
|
||||
hq_support = dof_options.is_hq_supported
|
||||
col = split.column(align=True)
|
||||
col.label("Viewport:")
|
||||
sub = col.column()
|
||||
sub.active = hq_support
|
||||
sub.prop(dof_options, "use_high_quality")
|
||||
col.prop(dof_options, "fstop")
|
||||
if dof_options.use_high_quality and hq_support:
|
||||
col.prop(dof_options, "blades")
|
||||
if context.scene.render.engine == 'BLENDER_EEVEE':
|
||||
col = split.column(align=True)
|
||||
col.label("Aperture:")
|
||||
engine = context.scene.render.engine
|
||||
sub = col.column(align=True)
|
||||
sub.prop(dof_options, "fstop")
|
||||
sub.prop(dof_options, "blades")
|
||||
sub.prop(dof_options, "rotation")
|
||||
sub.prop(dof_options, "ratio")
|
||||
else:
|
||||
hq_support = dof_options.is_hq_supported
|
||||
col = split.column(align=True)
|
||||
col.label("Viewport:")
|
||||
sub = col.column()
|
||||
sub.active = hq_support
|
||||
sub.prop(dof_options, "use_high_quality")
|
||||
col.prop(dof_options, "fstop")
|
||||
if dof_options.use_high_quality and hq_support:
|
||||
col.prop(dof_options, "blades")
|
||||
|
||||
|
||||
class DATA_PT_camera_display(CameraButtonsPanel, Panel):
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#define DNA_DEPRECATED_ALLOW
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_gpu_types.h"
|
||||
#include "DNA_layer_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
@ -253,6 +255,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
|
||||
for (Camera *ca = main->camera.first; ca; ca = ca->id.next) {
|
||||
ca->gpu_dof.ratio = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneLayer", "IDProperty", "*properties")) {
|
||||
|
|
|
@ -314,8 +314,8 @@ void EEVEE_effects_init(EEVEE_Data *vedata)
|
|||
/* TODO UI Options */
|
||||
float fstop = cam->gpu_dof.fstop;
|
||||
float blades = cam->gpu_dof.num_blades;
|
||||
float rotation = 0.0f;
|
||||
float ratio = 1.0f;
|
||||
float rotation = cam->gpu_dof.rotation;
|
||||
float ratio = 1.0f / cam->gpu_dof.ratio;
|
||||
float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
|
||||
float focus_dist = BKE_camera_object_dof_distance(v3d->camera);
|
||||
float focal_len = cam->lens;
|
||||
|
|
|
@ -74,7 +74,7 @@ void step_scatter()
|
|||
/* Generate Triangle */
|
||||
particlecoord = gl_Position.xy;
|
||||
|
||||
gl_Position.xy *= coc * texel_size;
|
||||
gl_Position.xy *= coc * texel_size * vec2(bokeh_ratio, 1.0);
|
||||
gl_Position.xy -= 1.0 - 0.5 * texel_size; /* NDC Bottom left */
|
||||
gl_Position.xy += (0.5 + vec2(texelco) * 2.0) * texel_size;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ typedef struct GPUDOFSettings {
|
|||
float fstop;
|
||||
float focal_length;
|
||||
float sensor;
|
||||
float rotation;
|
||||
float ratio;
|
||||
int num_blades;
|
||||
int high_quality;
|
||||
} GPUDOFSettings;
|
||||
|
|
|
@ -5911,6 +5911,17 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna)
|
|||
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, "rotation", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_ui_text(prop, "Rotation", "Rotation of blades in apperture");
|
||||
RNA_def_property_range(prop, -M_PI, M_PI);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Ratio", "Distortion to simulate anamorphic lens bokeh");
|
||||
RNA_def_property_range(prop, 0.0000001f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.25f, 4.0f, 0.1, 3);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "use_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");
|
||||
|
|
Loading…
Reference in New Issue