diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-19 14:00:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-19 14:34:11 +0300 |
commit | 9d796df4f6376809f14ca0dd0484f63df9c72494 (patch) | |
tree | 2a01240bcdd82af1bc6c1507f41abf5df20c95a7 /source/blender/render | |
parent | 0d3555fe2ea39e896a4679598723add20609f0c8 (diff) |
Support half float file format storage for Multilayer EXR
Quite straightforward implementation -- all the conversion magic is
happening in IMB_exr_write_channels() and remained changes are only
needed to pass information whether channels is to be converted to
half float or not.
Regular file output will use full-float for Z pass, which matches
behavior of the single layer EXR files. But when saving happens
with File Output node then all the passes are respecting half float
settings because it's not possible to distinguish whether we're
saving Z pass or not.
Reviewers: juicyfruit, campbellbarton
Reviewed By: campbellbarton
Subscribers: maxon, effstops, fsiddi
Differential Revision: https://developer.blender.org/D1353
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/render_result.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index ddd9859ce54..2af6a383145 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -502,7 +502,7 @@ static RenderPass *render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int if (rl->exrhandle) { int a; for (a = 0; a < channels; a++) - IMB_exr_add_channel(rl->exrhandle, rl->name, name_from_passtype(passtype, a), viewname, 0, 0, NULL); + IMB_exr_add_channel(rl->exrhandle, rl->name, name_from_passtype(passtype, a), viewname, 0, 0, NULL, false); } else { float *rect; @@ -1038,6 +1038,7 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil size_t width, height; const bool is_mono = view && !multiview; + const bool use_half_float = (imf->depth == R_IMF_CHAN_DEPTH_16); width = rr->rectx; height = rr->recty; @@ -1049,12 +1050,17 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil IMB_exr_add_view(exrhandle, rview->name); if (rview->rectf) { - for (a = 0; a < 4; a++) + for (a = 0; a < 4; a++) { IMB_exr_add_channel(exrhandle, "", RGBAZ[a], - rview->name, 4, 4 * width, rview->rectf + a); - if (rview->rectz) + rview->name, 4, 4 * width, rview->rectf + a, + use_half_float); + } + if (rview->rectz) { + /* Z pass is always stored as float. */ IMB_exr_add_channel(exrhandle, "", RGBAZ[4], - rview->name, 1, width, rview->rectz); + rview->name, 1, width, rview->rectz, + false); + } } } } @@ -1074,9 +1080,11 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil IMB_exr_add_view(exrhandle, rview->name); if (rview->rectf) { - for (a = 0; a < 4; a++) + for (a = 0; a < 4; a++) { IMB_exr_add_channel(exrhandle, "Composite", name_from_passtype(SCE_PASS_COMBINED, a), - chan_view, 4, 4 * width, rview->rectf + a); + chan_view, 4, 4 * width, rview->rectf + a, + use_half_float); + } } } @@ -1099,14 +1107,15 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil } for (a = 0; a < xstride; a++) { - if (rpass->passtype) { IMB_exr_add_channel(exrhandle, rl->name, name_from_passtype(rpass->passtype, a), chan_view, - xstride, xstride * width, rpass->rect + a); + xstride, xstride * width, rpass->rect + a, + rpass->passtype == SCE_PASS_Z ? false : use_half_float); } else { IMB_exr_add_channel(exrhandle, rl->name, make_pass_name(rpass, a), chan_view, - xstride, xstride * width, rpass->rect + a); + xstride, xstride * width, rpass->rect + a, + use_half_float); } } } |