From e82827bf6ed54a1d1552ac9176df9e309b4d29e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 19 Feb 2020 01:44:52 +0100 Subject: DRW: New High Quality Normal & Tangent extract This patch adds a dedicated path to extract 16bit normals instead of packing them into 10bits/comp. The tangents are also packed to 10bits/comp if not using the new High Quality Normal option. Fix T61024 Degraded texture shading on dense meshes Reviewed By: brecht Differential Revision: https://developer.blender.org/D6614 --- source/blender/makesrna/intern/rna_scene.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/blender/makesrna/intern/rna_scene.c') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 5e5bafdc178..d2a17967de9 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1654,6 +1654,20 @@ static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr) DEG_relations_tag_update(bmain); } +static void rna_Scene_mesh_quality_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->owner_id; + + FOREACH_SCENE_OBJECT_BEGIN (scene, ob) { + if (ob->type == OB_MESH) { + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + } + } + FOREACH_SCENE_OBJECT_END; + + rna_Scene_glsl_update(bmain, scene, ptr); +} + void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; @@ -5762,6 +5776,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Additional Subdiv", "Additional subdivision along the hair"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); + /* Performance */ + prop = RNA_def_property(srna, "use_high_quality_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "perf_flag", SCE_PERF_HQ_NORMALS); + RNA_def_property_ui_text(prop, + "High Quality Normals", + "Use high quality tangent space at the cost of lower performance"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_mesh_quality_update"); + /* border */ prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); -- cgit v1.2.3