diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index e7e5302bd91..a985bb25e81 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -2271,6 +2271,7 @@ class CYCLES_RENDER_PT_simplify_viewport(CyclesButtonsPanel, Panel): col.prop(rd, "simplify_child_particles", text="Child Particles") col.prop(cscene, "texture_limit", text="Texture Limit") col.prop(rd, "simplify_volumes", text="Volume Resolution") + col.prop(rd, "use_simplify_normals", text="Normals") class CYCLES_RENDER_PT_simplify_render(CyclesButtonsPanel, Panel): diff --git a/scripts/startup/bl_ui/properties_render.py b/scripts/startup/bl_ui/properties_render.py index 74ef1792188..d79a0a957d2 100644 --- a/scripts/startup/bl_ui/properties_render.py +++ b/scripts/startup/bl_ui/properties_render.py @@ -1197,6 +1197,9 @@ class RENDER_PT_simplify_viewport(RenderButtonsPanel, Panel): col = flow.column() col.prop(rd, "simplify_shadows", text="Shadow Resolution") + col = flow.column() + col.prop(rd, "use_simplify_normals", text="Normals") + class RENDER_PT_simplify_render(RenderButtonsPanel, Panel): bl_label = "Render" diff --git a/source/blender/blenloader/intern/versioning_280.cc b/source/blender/blenloader/intern/versioning_280.cc index ac9c22b3108..8124a563870 100644 --- a/source/blender/blenloader/intern/versioning_280.cc +++ b/source/blender/blenloader/intern/versioning_280.cc @@ -4652,7 +4652,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain) R_MODE_UNUSED_5 | R_MODE_UNUSED_6 | R_MODE_UNUSED_7 | R_MODE_UNUSED_8 | R_MODE_UNUSED_10 | R_MODE_UNUSED_13 | R_MODE_UNUSED_16 | R_MODE_UNUSED_17 | R_MODE_UNUSED_18 | R_MODE_UNUSED_19 | - R_MODE_UNUSED_20 | R_MODE_UNUSED_21 | R_MODE_UNUSED_27); + R_MODE_UNUSED_20 | R_MODE_UNUSED_21 | R_SIMPLIFY_NORMALS); scene->r.scemode &= ~(R_SCEMODE_UNUSED_8 | R_SCEMODE_UNUSED_11 | R_SCEMODE_UNUSED_13 | R_SCEMODE_UNUSED_16 | R_SCEMODE_UNUSED_17 | R_SCEMODE_UNUSED_19); diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 942d3fd20dd..6097c79bb55 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -686,6 +686,7 @@ void mesh_buffer_cache_create_requested(TaskGraph *task_graph, mr->use_hide = use_hide; mr->use_subsurf_fdots = mr->me && !mr->me->runtime->subsurf_face_dot_tags.is_empty(); mr->use_final_mesh = do_final; + mr->use_simplify_normals = (scene->r.mode & R_SIMPLIFY) && (scene->r.mode & R_SIMPLIFY_NORMALS); #ifdef DEBUG_TIME double rdata_end = PIL_check_seconds_timer(); diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc index c3b5ee31834..48b48342841 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc @@ -413,9 +413,10 @@ void mesh_render_data_update_normals(MeshRenderData &mr, const eMRDataType data_ if (data_flag & (MR_DATA_POLY_NOR | MR_DATA_LOOP_NOR | MR_DATA_TAN_LOOP_NOR)) { mr.face_normals = mr.me->face_normals(); } - if (((data_flag & MR_DATA_LOOP_NOR) && ELEM(mr.me->normals_domain(), - blender::bke::MeshNormalDomain::Corner, - blender::bke::MeshNormalDomain::Face)) || + if (((data_flag & MR_DATA_LOOP_NOR) && !mr.use_simplify_normals && + ELEM(mr.me->normals_domain(), + blender::bke::MeshNormalDomain::Corner, + blender::bke::MeshNormalDomain::Face)) || (data_flag & MR_DATA_TAN_LOOP_NOR)) { mr.loop_normals = mr.me->corner_normals(); diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh index 4aebdde050f..47f4a1888b8 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh @@ -51,6 +51,7 @@ struct MeshRenderData { bool use_subsurf_fdots; bool use_final_mesh; bool hide_unmapped_edges; + bool use_simplify_normals; /** Use for #MeshStatVis calculation which use world-space coords. */ float obmat[4][4]; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 94a4ada6c75..1f0ea0e9691 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -2114,9 +2114,9 @@ enum { R_NO_OVERWRITE = 1 << 22, /* Skip existing files. */ R_TOUCH = 1 << 23, /* Touch files before rendering. */ R_SIMPLIFY = 1 << 24, - R_EDGE_FRS = 1 << 25, /* R_EDGE reserved for Freestyle */ - R_PERSISTENT_DATA = 1 << 26, /* Keep data around for re-render. */ - R_MODE_UNUSED_27 = 1 << 27, /* cleared */ + R_EDGE_FRS = 1 << 25, /* R_EDGE reserved for Freestyle */ + R_PERSISTENT_DATA = 1 << 26, /* Keep data around for re-render. */ + R_SIMPLIFY_NORMALS = 1 << 27, /* cleared */ }; /** #RenderData::seq_flag */ diff --git a/source/blender/makesrna/intern/rna_scene.cc b/source/blender/makesrna/intern/rna_scene.cc index 3e8462190c7..28e98002416 100644 --- a/source/blender/makesrna/intern/rna_scene.cc +++ b/source/blender/makesrna/intern/rna_scene.cc @@ -7049,6 +7049,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop, "Simplify Volumes", "Resolution percentage of volume objects in viewport"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + prop = RNA_def_property(srna, "use_simplify_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, nullptr, "mode", R_SIMPLIFY_NORMALS); + RNA_def_property_ui_text( + prop, + "Mesh Normals", + "Skip computing custom normals and face corner normals for the viewport"); + /* Note: Unlike other simplify properties, this doesn't recalculate objects, since it just + * affects viewport drawing. */ + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr); + /* EEVEE - Simplify Options */ prop = RNA_def_property(srna, "simplify_shadows_render", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 1.0);