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.
This commit is contained in:
parent
e50ed90e4d
commit
dd04f54e84
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue