diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-06 18:18:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-06 18:24:15 +0400 |
commit | a41648c1dc58fcfdb149bf6839ae237d1dadc704 (patch) | |
tree | 25fed9ed0a9d5e3f2dcfe60074e7ae3be19914ba /source | |
parent | 5cbddd4ca47b4b2b45ae7284129db5b83d1a948c (diff) |
Cycles: add pass alpha threshold value to render layers.
Z, Index, normal, UV and vector passes are only affected by surfaces with alpha
transparency equal to or higher than this threshold. With value 0.0 the first
surface hit will always write to these passes, regardless of transparency. With
higher values surfaces that are mostly transparent can be skipped until an opaque
surface is encountered.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 6 |
4 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 1088b3a2523..580f7ab2e54 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1707,6 +1707,7 @@ SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name) srl->lay = (1 << 20) - 1; srl->layflag = 0x7FFF; /* solid ztra halo edge strand */ srl->passflag = SCE_PASS_COMBINED | SCE_PASS_Z; + slr->pass_alpha_threshold = 0.5f; BKE_freestyle_config_init(&srl->freestyleConfig); return srl; diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 82fa58b57e1..d6117224bb4 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -48,8 +48,10 @@ void BLO_update_defaults_startup_blend(Main *main) scene->r.im_format.planes = R_IMF_PLANES_RGBA; scene->r.im_format.compress = 15; - for (srl = scene->r.layers.first; srl; srl = srl->next) + for (srl = scene->r.layers.first; srl; srl = srl->next) { srl->freestyleConfig.sphere_radius = 0.1f; + srl->pass_alpha_threshold = 0.5f; + } } for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 177b687802d..8c4026e8b67 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -187,7 +187,7 @@ typedef struct SceneRenderLayer { int pass_xor; int samples; - int pad; + float pass_alpha_threshold; struct FreestyleConfig freestyleConfig; } SceneRenderLayer; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e901737c670..a3b8c9ff859 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2271,6 +2271,12 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, " "0 will use the scene setting"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_ui_text(prop, "Alpha Treshold", "Z, Index, normal, UV and vector passes are" + "only affected by surfaces with alpha transparency equal to" + "or higher than this threshold"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); } /* layer options */ |