diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-11-23 18:27:22 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-11-23 19:14:04 +0300 |
commit | dd04f54e845e976e525e17a4bfa91714a2bca341 (patch) | |
tree | b979735462eeee198d0c56d6b04fcb4d1f5ae05d | |
parent | e50ed90e4dff3a01fd5e3211f3571a34e1d6855d (diff) |
Fix inaccuracy when storing material ID pass in half float multilayer EXR.
These and other non-RGB passes should always be stored as full float, the
precision loss is too unpredictable.
Related to T53381, but that one is about file output nodes where we don't
know the type of data being saved currently.
-rw-r--r-- | source/blender/render/intern/source/render_result.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 9ad5d73fc55..88ccb9452ba 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -925,6 +925,17 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil } } + /* We only store RGBA passes as half float, for + * others precision loss can be problematic. */ + bool pass_half_float = half_float && + (STREQ(rp->chan_id, "RGB") || + STREQ(rp->chan_id, "RGBA") || + STREQ(rp->chan_id, "R") || + STREQ(rp->chan_id, "G") || + STREQ(rp->chan_id, "B") || + STREQ(rp->chan_id, "A")); + + for (int a = 0; a < rp->channels; a++) { /* Save Combined as RGBA if single layer save. */ char passname[EXR_PASS_MAXNAME]; @@ -940,10 +951,9 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil layname[0] = '\0'; } - /* Add channel. */ IMB_exr_add_channel(exrhandle, layname, passname, viewname, rp->channels, rp->channels * rr->rectx, rp->rect + a, - STREQ(rp->name, RE_PASSNAME_Z) ? false : half_float); + pass_half_float); } } } |