forked from bartvdbraak/blender
GPencil: Add new parameter for SMAA threshold
This parameter allows to define the threshold for SMAA algorithm. Differential Revision: https://developer.blender.org/D7708
This commit is contained in:
parent
be4b3c64ad
commit
f24e9bb038
@ -543,6 +543,27 @@ class RENDER_PT_eevee_performance(RenderButtonsPanel, Panel):
|
||||
layout.prop(rd, "use_high_quality_normals")
|
||||
|
||||
|
||||
class RENDER_PT_gpencil(RenderButtonsPanel, Panel):
|
||||
bl_label = "Grease Pencil"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
scene = context.scene
|
||||
props = scene.grease_pencil_settings
|
||||
|
||||
col = layout.column()
|
||||
col.prop(props, "antialias_threshold")
|
||||
|
||||
|
||||
|
||||
class RENDER_PT_opengl_sampling(RenderButtonsPanel, Panel):
|
||||
bl_label = "Sampling"
|
||||
COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
|
||||
@ -697,6 +718,7 @@ classes = (
|
||||
RENDER_PT_eevee_indirect_lighting_display,
|
||||
RENDER_PT_eevee_film,
|
||||
RENDER_PT_eevee_film_overscan,
|
||||
RENDER_PT_gpencil,
|
||||
RENDER_PT_opengl_sampling,
|
||||
RENDER_PT_opengl_lighting,
|
||||
RENDER_PT_opengl_color,
|
||||
|
@ -27,7 +27,7 @@
|
||||
* \note Use #STRINGIFY() rather than defining with quotes.
|
||||
*/
|
||||
#define BLENDER_VERSION 283
|
||||
#define BLENDER_SUBVERSION 15
|
||||
#define BLENDER_SUBVERSION 16
|
||||
/** Several breakages with 280, e.g. collections vs layers. */
|
||||
#define BLENDER_MINVERSION 280
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -155,6 +155,9 @@ static void scene_init_data(ID *id)
|
||||
scene->unit.mass_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_MASS);
|
||||
scene->unit.time_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_TIME);
|
||||
|
||||
/* Anti-aliasing threshold. */
|
||||
scene->grease_pencil_settings.smaa_threshold = 1.0f;
|
||||
|
||||
{
|
||||
ParticleEditSettings *pset;
|
||||
pset = &scene->toolsettings->particle;
|
||||
|
@ -5052,6 +5052,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 283, 16)) {
|
||||
/* Init SMAA threshold for grease pencil render. */
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->grease_pencil_settings.smaa_threshold = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
@ -115,6 +115,8 @@ void GPENCIL_antialiasing_init(struct GPENCIL_Data *vedata)
|
||||
DRW_shgroup_uniform_texture(grp, "colorTex", pd->color_tx);
|
||||
DRW_shgroup_uniform_texture(grp, "revealTex", pd->reveal_tx);
|
||||
DRW_shgroup_uniform_vec4_copy(grp, "viewportMetrics", metrics);
|
||||
DRW_shgroup_uniform_float_copy(
|
||||
grp, "lumaWeight", pd->scene->grease_pencil_settings.smaa_threshold);
|
||||
|
||||
DRW_shgroup_clear_framebuffer(grp, GPU_COLOR_BIT, 0, 0, 0, 0, 0.0f, 0x0);
|
||||
DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
|
||||
|
@ -135,10 +135,11 @@ GPUShader *GPENCIL_shader_antialiasing(int stage)
|
||||
},
|
||||
.defs =
|
||||
(const char *[]){
|
||||
"uniform float lumaWeight;\n",
|
||||
"#define SMAA_GLSL_3\n",
|
||||
"#define SMAA_RT_METRICS viewportMetrics\n",
|
||||
"#define SMAA_PRESET_HIGH\n",
|
||||
"#define SMAA_LUMA_WEIGHT float4(1.0, 1.0, 1.0, 0.0)\n",
|
||||
"#define SMAA_LUMA_WEIGHT float4(lumaWeight, lumaWeight, lumaWeight, 0.0)\n",
|
||||
"#define SMAA_NO_DISCARD\n",
|
||||
stage_define,
|
||||
NULL,
|
||||
|
@ -1644,6 +1644,11 @@ typedef struct SceneEEVEE {
|
||||
float light_threshold;
|
||||
} SceneEEVEE;
|
||||
|
||||
typedef struct SceneGpencil {
|
||||
float smaa_threshold;
|
||||
char _pad[4];
|
||||
} SceneGpencil;
|
||||
|
||||
/* *************************************************************** */
|
||||
/* Scene ID-Block */
|
||||
|
||||
@ -1775,6 +1780,7 @@ typedef struct Scene {
|
||||
|
||||
struct SceneDisplay display;
|
||||
struct SceneEEVEE eevee;
|
||||
struct SceneGpencil grease_pencil_settings;
|
||||
} Scene;
|
||||
|
||||
/* **************** RENDERDATA ********************* */
|
||||
|
@ -1137,6 +1137,11 @@ static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr))
|
||||
return BLI_strdup("eevee");
|
||||
}
|
||||
|
||||
static char *rna_SceneGpencil_path(PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
return BLI_strdup("grease_pencil_settings");
|
||||
}
|
||||
|
||||
static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter,
|
||||
void *UNUSED(data))
|
||||
{
|
||||
@ -7194,6 +7199,28 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
}
|
||||
|
||||
static void rna_def_scene_gpencil(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "SceneGpencil", NULL);
|
||||
RNA_def_struct_path_func(srna, "rna_SceneGpencil_path");
|
||||
RNA_def_struct_ui_text(srna, "Grease Pencil Render", "Render settings");
|
||||
|
||||
prop = RNA_def_property(srna, "antialias_threshold", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "smaa_threshold");
|
||||
RNA_def_property_float_default(prop, 1.0f);
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Anti-Aliasing Threshold",
|
||||
"Threshold for edge detection algorithm (higher values might overblur "
|
||||
"some part of the image)");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
|
||||
}
|
||||
|
||||
void RNA_def_scene(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@ -7667,6 +7694,11 @@ void RNA_def_scene(BlenderRNA *brna)
|
||||
RNA_def_property_struct_type(prop, "SceneEEVEE");
|
||||
RNA_def_property_ui_text(prop, "EEVEE", "EEVEE settings for the scene");
|
||||
|
||||
/* Grease Pencil */
|
||||
prop = RNA_def_property(srna, "grease_pencil_settings", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "SceneGpencil");
|
||||
RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil settings for the scene");
|
||||
|
||||
/* Nestled Data */
|
||||
/* *** Non-Animated *** */
|
||||
RNA_define_animate_sdna(false);
|
||||
@ -7685,6 +7717,7 @@ void RNA_def_scene(BlenderRNA *brna)
|
||||
rna_def_scene_display(brna);
|
||||
rna_def_scene_eevee(brna);
|
||||
rna_def_view_layer_eevee(brna);
|
||||
rna_def_scene_gpencil(brna);
|
||||
RNA_define_animate_sdna(true);
|
||||
/* *** Animated *** */
|
||||
rna_def_scene_render_data(brna);
|
||||
|
Loading…
Reference in New Issue
Block a user