-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save extra AOVs #1865
Save extra AOVs #1865
Changes from 1 commit
e5463a4
bc18489
24a40c0
426ea5e
99fc7d9
46a1df7
c951f8a
539e5ee
e6657ff
862d9ef
41eabb2
973aee1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,11 +278,13 @@ const AOVContainer& Frame::internal_aovs() const | |
return impl->m_internal_aovs; | ||
} | ||
|
||
size_t Frame::create_extra_aov_image(const char* name) const | ||
size_t Frame::create_extra_aov_image( | ||
const char* name, | ||
const PixelFormat pixel_format) const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally, I prefer to undo this change and remove the option of saving extra aov images to pngs. |
||
{ | ||
const size_t index = aov_images().get_index(name); | ||
if (index == size_t(~0) && aov_images().size() < MaxAOVCount) | ||
return aov_images().append(name, 4, PixelFormatFloat); | ||
return aov_images().append(name, 4, pixel_format); | ||
|
||
return index; | ||
} | ||
|
@@ -646,6 +648,16 @@ namespace | |
} | ||
else if (extension == ".png") | ||
{ | ||
// Test if the image contains appropriate data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this code anymore. You can remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I forgot that |
||
if (image.properties().m_pixel_format != PixelFormatHalf && | ||
image.properties().m_channel_count != 4) | ||
{ | ||
RENDERER_LOG_ERROR( | ||
"failed to write image file %s: data images can only be saved as exr.", | ||
file_path); | ||
return false; | ||
} | ||
|
||
write_png_image( | ||
bf_file_path, | ||
image, | ||
|
@@ -720,7 +732,7 @@ bool Frame::write_aov_images(const char* file_path) const | |
|
||
bool success = true; | ||
|
||
if (!aovs().empty()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not check for the size anymore because if I do, I would have to check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I'm wrong, there is always an AOV, beauty, right ? @est77 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. beauty is not an AOV in appleseed. There's an image in the frame to store it. |
||
if (!aovs().empty() || !aov_images().empty()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the !aov_images().empty() check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain me why ? |
||
{ | ||
const bf::path boost_file_path(file_path); | ||
const bf::path directory = boost_file_path.parent_path(); | ||
|
@@ -741,6 +753,22 @@ bool Frame::write_aov_images(const char* file_path) const | |
if (!write_image(aov_file_path.c_str(), aov->get_image(), aov)) | ||
success = false; | ||
} | ||
|
||
// Extra AOVs | ||
for (size_t i = 0, e = aov_images().size(); i < e; ++i) | ||
{ | ||
const Image & image = aov_images().get_image(i); | ||
|
||
// Compute AOV image file path. | ||
const string aov_name = aov_images().get_name(i); | ||
const string safe_aov_name = make_safe_filename(aov_name); | ||
const string aov_file_name = base_file_name + "." + safe_aov_name + extension; | ||
const string aov_file_path = (directory / aov_file_name).string(); | ||
|
||
// Write AOV image. | ||
if (!write_image(aov_file_path.c_str(), image)) | ||
success = false; | ||
} | ||
} | ||
|
||
return success; | ||
|
@@ -776,6 +804,30 @@ bool Frame::write_main_and_aov_images() const | |
} | ||
} | ||
|
||
if (!aov_images().empty()) | ||
{ | ||
const bf::path boost_file_path(filepath); | ||
const bf::path directory = boost_file_path.parent_path(); | ||
const string base_file_name = boost_file_path.stem().string(); | ||
const string extension = boost_file_path.extension().string(); | ||
|
||
// Extra AOVs | ||
for (size_t i = 0, e = aov_images().size(); i < e; ++i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fragment of code is repeated. Refactor into a function in an unnamed namespace if possible, |
||
{ | ||
const Image & image = aov_images().get_image(i); | ||
|
||
// Compute AOV image file path. | ||
const string aov_name = aov_images().get_name(i); | ||
const string safe_aov_name = make_safe_filename(aov_name); | ||
const string aov_file_name = base_file_name + "." + safe_aov_name + extension; | ||
const string aov_file_path = (directory / aov_file_name).string(); | ||
|
||
// Write AOV image. | ||
if (!write_image(aov_file_path.c_str(), image)) | ||
success = false; | ||
} | ||
} | ||
|
||
return success; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these changes, the range and precision of the images used by the adaptive pixel renderer is much lower than before. This is going to affect the results of the adaptive sampling. I think we want to keep them as floats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chanded the format because the tile_end maps values to colors.