diff options
author | Patrick Mours <pmours@nvidia.com> | 2022-01-04 23:39:54 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2022-01-05 17:58:36 +0300 |
commit | 8393ccd07634b3152b18d4d527b1460dab9dbe06 (patch) | |
tree | 816b4dcaa9b8e5163c3934743fe1604f02983e71 /intern/cycles/blender/python.cpp | |
parent | 86141a75ebc5d0517edf71f2bc2fe7d0d13d8b5e (diff) |
Cycles: Add OptiX temporal denoising support
Enables the `bpy.ops.cycles.denoise_animation()` operator again and modifies it to support
temporal denoising with OptiX. This requires renders that were done with both the "Vector"
and "Denoising Data" passes.
Differential Revision: https://developer.blender.org/D11442
Diffstat (limited to 'intern/cycles/blender/python.cpp')
-rw-r--r-- | intern/cycles/blender/python.cpp | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/intern/cycles/blender/python.cpp b/intern/cycles/blender/python.cpp index 024dae306b0..f509d5c2eeb 100644 --- a/intern/cycles/blender/python.cpp +++ b/intern/cycles/blender/python.cpp @@ -735,27 +735,20 @@ static bool image_parse_filepaths(PyObject *pyfilepaths, vector<string> &filepat static PyObject *denoise_func(PyObject * /*self*/, PyObject *args, PyObject *keywords) { -#if 1 - (void)args; - (void)keywords; -#else static const char *keyword_list[] = { - "preferences", "scene", "view_layer", "input", "output", "tile_size", "samples", NULL}; + "preferences", "scene", "view_layer", "input", "output", NULL}; PyObject *pypreferences, *pyscene, *pyviewlayer; PyObject *pyinput, *pyoutput = NULL; - int tile_size = 0, samples = 0; if (!PyArg_ParseTupleAndKeywords(args, keywords, - "OOOO|Oii", + "OOOO|O", (char **)keyword_list, &pypreferences, &pyscene, &pyviewlayer, &pyinput, - &pyoutput, - &tile_size, - &samples)) { + &pyoutput)) { return NULL; } @@ -777,14 +770,10 @@ static PyObject *denoise_func(PyObject * /*self*/, PyObject *args, PyObject *key &RNA_ViewLayer, PyLong_AsVoidPtr(pyviewlayer), &viewlayerptr); - PointerRNA cviewlayer = RNA_pointer_get(&viewlayerptr, "cycles"); + BL::ViewLayer b_view_layer(viewlayerptr); - DenoiseParams params; - params.radius = get_int(cviewlayer, "denoising_radius"); - params.strength = get_float(cviewlayer, "denoising_strength"); - params.feature_strength = get_float(cviewlayer, "denoising_feature_strength"); - params.relative_pca = get_boolean(cviewlayer, "denoising_relative_pca"); - params.neighbor_frames = get_int(cviewlayer, "denoising_neighbor_frames"); + DenoiseParams params = BlenderSync::get_denoise_params(b_scene, b_view_layer, true); + params.use = true; /* Parse file paths list. */ vector<string> input, output; @@ -812,24 +801,15 @@ static PyObject *denoise_func(PyObject * /*self*/, PyObject *args, PyObject *key } /* Create denoiser. */ - DenoiserPipeline denoiser(device); - denoiser.params = params; + DenoiserPipeline denoiser(device, params); denoiser.input = input; denoiser.output = output; - if (tile_size > 0) { - denoiser.tile_size = make_int2(tile_size, tile_size); - } - if (samples > 0) { - denoiser.samples_override = samples; - } - /* Run denoiser. */ if (!denoiser.run()) { PyErr_SetString(PyExc_ValueError, denoiser.error.c_str()); return NULL; } -#endif Py_RETURN_NONE; } |