2012-01-05 17:50:09 +00:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2012-01-05 17:50:09 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup render
|
2012-01-05 17:50:09 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2012-01-05 17:50:09 +00:00
|
|
|
|
|
|
|
|
#define PASS_VECTOR_MAX 10000.0f
|
|
|
|
|
|
|
|
|
|
#define RR_USE_MEM 0
|
|
|
|
|
#define RR_USE_EXR 1
|
|
|
|
|
|
2012-09-04 13:29:07 +00:00
|
|
|
#define RR_ALL_LAYERS NULL
|
2015-04-06 10:40:12 -03:00
|
|
|
#define RR_ALL_VIEWS NULL
|
2012-09-04 13:29:07 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ColorManagedDisplaySettings;
|
|
|
|
|
struct ColorManagedViewSettings;
|
2012-01-05 17:50:09 +00:00
|
|
|
struct ImBuf;
|
|
|
|
|
struct ListBase;
|
|
|
|
|
struct Render;
|
|
|
|
|
struct RenderData;
|
Fix T56799: Custom render passes missing when using Save Buffers
The problem here was that when a render result is allocated, the standard render passes are added according to the
pass bitfield. Then, when the render engine sets the result, it adds the additional passes which are then merged
into the main render result.
However, when using Save Buffers, the EXR is created before the actual render starts, so it's missing all those
additional passes.
To fix that, we need to query the render engine for a list of additional passes so they can be added before the EXR
is created. Luckily, there already is a function to do that for the node editor.
The same needs to be done when the EXR is loaded back.
Due to how that is implemented though (Render API calls into engine, engine calls back for each pass), if we have
multiple places that call this function there needs to be a way to tell which one the call came from in the pass
registration callback. Therefore, the original caller now provides a callback that is called for each pass.
2019-01-18 00:45:21 +01:00
|
|
|
struct RenderEngine;
|
2012-01-05 17:50:09 +00:00
|
|
|
struct RenderLayer;
|
|
|
|
|
struct RenderResult;
|
|
|
|
|
struct Scene;
|
|
|
|
|
struct rcti;
|
|
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-01-05 17:50:09 +00:00
|
|
|
/* New */
|
|
|
|
|
|
|
|
|
|
struct RenderResult *render_result_new(struct Render *re,
|
2015-04-06 10:40:12 -03:00
|
|
|
struct rcti *partrct,
|
|
|
|
|
int savebuffers,
|
|
|
|
|
const char *layername,
|
|
|
|
|
const char *viewname);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
struct RenderResult *render_result_new_from_exr(
|
|
|
|
|
void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2015-04-28 17:36:44 -03:00
|
|
|
void render_result_view_new(struct RenderResult *rr, const char *viewname);
|
2020-03-13 17:27:11 +11:00
|
|
|
void render_result_views_new(struct RenderResult *rr, const struct RenderData *rd);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2012-01-05 17:50:09 +00:00
|
|
|
/* Merge */
|
|
|
|
|
|
|
|
|
|
void render_result_merge(struct RenderResult *rr, struct RenderResult *rrpart);
|
|
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
/* Add Passes */
|
|
|
|
|
|
|
|
|
|
void render_result_clone_passes(struct Render *re, struct RenderResult *rr, const char *viewname);
|
|
|
|
|
|
2012-01-05 17:50:09 +00:00
|
|
|
/* Free */
|
|
|
|
|
|
|
|
|
|
void render_result_free(struct RenderResult *rr);
|
|
|
|
|
void render_result_free_list(struct ListBase *lb, struct RenderResult *rr);
|
|
|
|
|
|
|
|
|
|
/* Single Layer Render */
|
|
|
|
|
|
|
|
|
|
void render_result_single_layer_begin(struct Render *re);
|
|
|
|
|
void render_result_single_layer_end(struct Render *re);
|
|
|
|
|
|
|
|
|
|
/* EXR Tile File Render */
|
|
|
|
|
|
2015-06-17 17:48:15 +02:00
|
|
|
void render_result_save_empty_result_tiles(struct Render *re);
|
Fix T56799: Custom render passes missing when using Save Buffers
The problem here was that when a render result is allocated, the standard render passes are added according to the
pass bitfield. Then, when the render engine sets the result, it adds the additional passes which are then merged
into the main render result.
However, when using Save Buffers, the EXR is created before the actual render starts, so it's missing all those
additional passes.
To fix that, we need to query the render engine for a list of additional passes so they can be added before the EXR
is created. Luckily, there already is a function to do that for the node editor.
The same needs to be done when the EXR is loaded back.
Due to how that is implemented though (Render API calls into engine, engine calls back for each pass), if we have
multiple places that call this function there needs to be a way to tell which one the call came from in the pass
registration callback. Therefore, the original caller now provides a callback that is called for each pass.
2019-01-18 00:45:21 +01:00
|
|
|
void render_result_exr_file_begin(struct Render *re, struct RenderEngine *engine);
|
|
|
|
|
void render_result_exr_file_end(struct Render *re, struct RenderEngine *engine);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2016-08-03 23:31:48 +02:00
|
|
|
/* render pass wrapper for gpencil */
|
Cycles: code refactor to bake using regular render session and tiles
There should be no user visible change from this, except that tile size
now affects performance. The goal here is to simplify bake denoising in
D3099, letting it reuse more denoising tiles and pass code.
A lot of code is now shared with regular rendering, with the two main
differences being that we read some render result passes from the bake API
when starting to render a tile, and call the bake kernel instead of the
path trace kernel.
With this kind of design where Cycles asks for tiles from the bake API,
it should eventually be easier to reduce memory usage, show tiles as
they are baked, or bake multiple passes at once, though there's still
quite some work needed for that.
Reviewers: #cycles
Subscribers: monio, wmatyjewicz, lukasstockner97, michaelknubben
Differential Revision: https://developer.blender.org/D3108
2019-05-10 21:39:58 +02:00
|
|
|
struct RenderPass *render_layer_add_pass(struct RenderResult *rr,
|
|
|
|
|
struct RenderLayer *rl,
|
|
|
|
|
int channels,
|
|
|
|
|
const char *name,
|
|
|
|
|
const char *viewname,
|
2020-09-04 20:59:13 +02:00
|
|
|
const char *chan_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
void render_result_exr_file_merge(struct RenderResult *rr,
|
|
|
|
|
struct RenderResult *rrpart,
|
|
|
|
|
const char *viewname);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-04 13:29:07 +00:00
|
|
|
void render_result_exr_file_path(struct Scene *scene,
|
|
|
|
|
const char *layname,
|
|
|
|
|
int sample,
|
|
|
|
|
char *filepath);
|
|
|
|
|
int render_result_exr_file_read_path(struct RenderResult *rr,
|
|
|
|
|
struct RenderLayer *rl_single,
|
|
|
|
|
const char *filepath);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2014-06-28 19:13:54 +02:00
|
|
|
/* EXR cache */
|
|
|
|
|
|
|
|
|
|
void render_result_exr_file_cache_write(struct Render *re);
|
|
|
|
|
bool render_result_exr_file_cache_read(struct Render *re);
|
|
|
|
|
|
2012-01-05 17:50:09 +00:00
|
|
|
/* Combined Pixel Rect */
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
struct ImBuf *render_result_rect_to_ibuf(struct RenderResult *rr,
|
2020-03-13 17:27:11 +11:00
|
|
|
const struct RenderData *rd,
|
2015-04-06 10:40:12 -03:00
|
|
|
const int view_id);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
void render_result_rect_fill_zero(struct RenderResult *rr, const int view_id);
|
2012-12-31 13:52:13 +00:00
|
|
|
void render_result_rect_get_pixels(struct RenderResult *rr,
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
unsigned int *rect,
|
|
|
|
|
int rectx,
|
|
|
|
|
int recty,
|
|
|
|
|
const struct ColorManagedViewSettings *view_settings,
|
2015-04-06 10:40:12 -03:00
|
|
|
const struct ColorManagedDisplaySettings *display_settings,
|
|
|
|
|
const int view_id);
|
|
|
|
|
|
|
|
|
|
void render_result_views_shallowcopy(struct RenderResult *dst, struct RenderResult *src);
|
|
|
|
|
void render_result_views_shallowdelete(struct RenderResult *rr);
|
2017-10-20 15:18:26 +02:00
|
|
|
bool render_result_has_views(struct RenderResult *rr);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2018-02-28 10:05:38 +11:00
|
|
|
#define FOREACH_VIEW_LAYER_TO_RENDER_BEGIN(re_, iter_) \
|
2018-02-20 12:55:02 -03:00
|
|
|
{ \
|
2018-02-28 10:05:38 +11:00
|
|
|
int nr_; \
|
2018-02-20 12:55:02 -03:00
|
|
|
ViewLayer *iter_; \
|
2018-02-28 10:05:38 +11:00
|
|
|
for (nr_ = 0, iter_ = (re_)->view_layers.first; iter_ != NULL; iter_ = iter_->next, nr_++) { \
|
2018-07-23 11:47:06 +02:00
|
|
|
if (!G.background && (re_)->r.scemode & R_SINGLE_LAYER) { \
|
2018-02-28 10:05:38 +11:00
|
|
|
if (nr_ != re->active_view_layer) { \
|
2018-02-20 12:55:02 -03:00
|
|
|
continue; \
|
2019-04-17 06:17:24 +02:00
|
|
|
} \
|
2018-02-20 12:55:02 -03:00
|
|
|
} \
|
|
|
|
|
else { \
|
|
|
|
|
if ((iter_->flag & VIEW_LAYER_RENDER) == 0) { \
|
|
|
|
|
continue; \
|
|
|
|
|
} \
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-02-20 12:55:02 -03:00
|
|
|
#define FOREACH_VIEW_LAYER_TO_RENDER_END \
|
2019-04-17 06:17:24 +02:00
|
|
|
} \
|
2018-02-20 12:55:02 -03:00
|
|
|
} \
|
2018-03-09 11:44:42 +11:00
|
|
|
((void)0)
|
2018-02-20 12:55:02 -03:00
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|