2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2007 Blender Foundation. All rights reserved. */
|
2012-01-05 17:50:09 +00:00
|
|
|
|
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
|
|
|
|
|
|
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;
|
|
|
|
|
struct RenderLayer;
|
|
|
|
|
struct RenderResult;
|
|
|
|
|
struct rcti;
|
|
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-01-05 17:50:09 +00:00
|
|
|
/* New */
|
|
|
|
|
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Called by main render as well for parts will read info from Render *re to define layers.
|
|
|
|
|
* \note Called in threads.
|
|
|
|
|
*
|
|
|
|
|
* `re->winx`, `re->winy` is coordinate space of entire image, `partrct` the part within.
|
|
|
|
|
*/
|
2012-01-05 17:50:09 +00:00
|
|
|
struct RenderResult *render_result_new(struct Render *re,
|
2015-04-06 10:40:12 -03:00
|
|
|
struct rcti *partrct,
|
|
|
|
|
const char *layername,
|
|
|
|
|
const char *viewname);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2021-08-04 15:37:18 +02:00
|
|
|
void render_result_passes_allocated_ensure(struct RenderResult *rr);
|
|
|
|
|
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
2022-06-03 13:39:37 +10:00
|
|
|
* From `imbuf`, if a handle was returned and
|
2021-12-08 17:12:43 +11:00
|
|
|
* it's not a single-layer multi-view we convert this to render result.
|
|
|
|
|
*/
|
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 */
|
|
|
|
|
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Used when rendering to a full buffer, or when reading the EXR part-layer-pass file.
|
|
|
|
|
* no test happens here if it fits... we also assume layers are in sync.
|
|
|
|
|
* \note Is used within threads.
|
|
|
|
|
*/
|
2012-01-05 17:50:09 +00:00
|
|
|
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);
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Version that's compatible with full-sample buffers.
|
|
|
|
|
*/
|
2012-01-05 17:50:09 +00:00
|
|
|
void render_result_free_list(struct ListBase *lb, struct RenderResult *rr);
|
|
|
|
|
|
|
|
|
|
/* Single Layer Render */
|
|
|
|
|
|
|
|
|
|
void render_result_single_layer_begin(struct Render *re);
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* If #RenderData.scemode is #R_SINGLE_LAYER, at end of rendering, merge the both render results.
|
|
|
|
|
*/
|
2012-01-05 17:50:09 +00:00
|
|
|
void render_result_single_layer_end(struct Render *re);
|
|
|
|
|
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Render pass wrapper for grease-pencil.
|
|
|
|
|
*/
|
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,
|
2021-09-29 21:13:03 +02:00
|
|
|
const char *chan_id,
|
2022-01-07 11:38:08 +11:00
|
|
|
bool allocate);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Called for reading temp files, and for external engines.
|
|
|
|
|
*/
|
2012-09-04 13:29:07 +00:00
|
|
|
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);
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* For cache, makes exact copy of render result.
|
|
|
|
|
*/
|
2014-06-28 19:13:54 +02:00
|
|
|
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,
|
2022-01-07 11:38:08 +11:00
|
|
|
int view_id);
|
2012-01-05 17:50:09 +00:00
|
|
|
|
2022-01-07 11:38:08 +11:00
|
|
|
void render_result_rect_fill_zero(struct RenderResult *rr, 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,
|
2022-01-07 11:38:08 +11:00
|
|
|
int view_id);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Create a new views #ListBase in rr without duplicating the memory pointers.
|
|
|
|
|
*/
|
2015-04-06 10:40:12 -03:00
|
|
|
void render_result_views_shallowcopy(struct RenderResult *dst, struct RenderResult *src);
|
2021-12-08 17:12:43 +11:00
|
|
|
/**
|
|
|
|
|
* Free the views created temporarily.
|
|
|
|
|
*/
|
2015-04-06 10:40:12 -03:00
|
|
|
void render_result_views_shallowdelete(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_; \
|
2022-11-01 21:00:56 +01:00
|
|
|
for (nr_ = 0, iter_ = static_cast<ViewLayer *>((re_)->scene->view_layers.first); \
|
|
|
|
|
iter_ != NULL; \
|
2022-08-20 13:42:10 +02:00
|
|
|
iter_ = iter_->next, nr_++) { \
|
2018-07-23 11:47:06 +02:00
|
|
|
if (!G.background && (re_)->r.scemode & R_SINGLE_LAYER) { \
|
2022-11-01 21:00:56 +01:00
|
|
|
if (!STREQ(iter_->name, re->single_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
|