diff options
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); } } } |