highlight negative values in SH debug files

This commit is contained in:
Mathias Agopian
2019-07-11 22:45:49 -07:00
committed by Mathias Agopian
parent 497c544f33
commit f3e5b46bf9
3 changed files with 17 additions and 0 deletions
+2
View File
@@ -78,6 +78,8 @@ public:
//! clamps image to acceptable range
static void clamp(Image& src);
static void highlight(Image& src);
//! Downsamples a cubemap by helf in x and y using a box filter
static void downsampleCubemapLevelBoxFilter(utils::JobSystem& js, Cubemap& dst, const Cubemap& src);
+13
View File
@@ -57,6 +57,19 @@ void CubemapUtils::clamp(Image& src) {
}
}
void CubemapUtils::highlight(Image& src) {
const size_t width = src.getWidth();
const size_t height = src.getHeight();
for (size_t y=0 ; y<height ; ++y) {
for (size_t x = 0; x < width; ++x) {
float3& c = *static_cast<float3*>(src.getPixelRef(x, y));
if (min(c) < 0.0f) {
c = { 1, 0, 1 };
}
}
}
}
void CubemapUtils::equirectangularToCubemap(JobSystem& js, Cubemap& dst, const Image& src) {
const size_t width = src.getWidth();
const size_t height = src.getHeight();
+2
View File
@@ -745,6 +745,7 @@ void sphericalHarmonics(utils::JobSystem& js, const utils::Path& iname, const Cu
std::string basename = iname.getNameWithoutExtension();
utils::Path filePath =
outputDir + (basename + "_sh" + (g_sh_irradiance ? "_i" : "_r") + ".hdr");
CubemapUtils::highlight(image);
saveImage(filePath, ImageEncoder::Format::HDR, image, "");
}
@@ -755,6 +756,7 @@ void sphericalHarmonics(utils::JobSystem& js, const utils::Path& iname, const Cu
std::string basename = iname.getNameWithoutExtension();
utils::Path filePath =
outputDir + (basename + "_sh" + (!g_sh_irradiance ? "_i" : "_r") + ".hdr");
CubemapUtils::highlight(image);
saveImage(filePath, ImageEncoder::Format::HDR, image, "");
}
}