From f80617ab37c3ed09e6ef5513e53ecf37fd692f36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 2 Feb 2010 15:51:44 +0000 Subject: [PATCH] render simplify option to disable triangulation. - triangulating non planer quads is needed to resolve some artifacts however this also ends up triangulating most faces in - Suzzane subsurf level 4 for eg. this check could be tuned for better performance but for now skipping it is useful for test renders. --- release/scripts/ui/properties_scene.py | 4 ++++ source/blender/makesdna/DNA_scene_types.h | 8 ++++++-- source/blender/makesrna/intern/rna_scene.c | 4 ++++ source/blender/render/intern/source/convertblender.c | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py index 3a29381fe77..61938ca93b4 100644 --- a/release/scripts/ui/properties_scene.py +++ b/release/scripts/ui/properties_scene.py @@ -208,11 +208,15 @@ class SCENE_PT_simplify(SceneButtonsPanel): col = split.column() col.prop(rd, "simplify_subdivision", text="Subdivision") col.prop(rd, "simplify_child_particles", text="Child Particles") + + col.prop(rd, "simplify_triangulate") if wide_ui: col = split.column() col.prop(rd, "simplify_shadow_samples", text="Shadow Samples") col.prop(rd, "simplify_ao_sss", text="AO and SSS") + + bpy.types.register(SCENE_PT_scene) bpy.types.register(SCENE_PT_unit) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 636596f7af7..d646d9b7c67 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -359,8 +359,9 @@ typedef struct RenderData { float bg_stamp[4]; /* render simplify */ - int simplify_subsurf; - int simplify_shadowsamples; + int simplify_flag; + short simplify_subsurf; + short simplify_shadowsamples; float simplify_particles; float simplify_aosss; @@ -966,6 +967,9 @@ typedef struct Scene { #define R_BAKE_SPACE_OBJECT 2 #define R_BAKE_SPACE_TANGENT 3 +/* simplify_flag */ +#define R_SIMPLE_NO_TRIANGULATE 1 + /* **************** SCENE ********************* */ /* for general use */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 41605894613..12415d1c635 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2471,6 +2471,10 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AA and SSS quality factor."); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + prop= RNA_def_property(srna, "simplify_triangulate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", R_SIMPLE_NO_TRIANGULATE); + RNA_def_property_ui_text(prop, "Skip Quad to Triangles", "Disables non-planer quads being triangulated."); + /* Scene API */ RNA_api_scene_render(srna); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index a8afc40f04d..0b818ca761e 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4098,7 +4098,8 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset) /* Baking lets us define a quad split order */ split_quads(obr, re->r.bake_quad_split); } else { - check_non_flat_quads(obr); + if((re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0) + check_non_flat_quads(obr); } set_fullsample_flag(re, obr);