highlight negative values in SH debug files
This commit is contained in:
committed by
Mathias Agopian
parent
497c544f33
commit
f3e5b46bf9
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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, "");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user