From 50485f5d738288ed99d61db3c082b7cb495a0b56 Mon Sep 17 00:00:00 2001 From: Person Date: Tue, 22 Aug 2017 18:07:43 -0700 Subject: [PATCH] Bug fixes: --EXR images needed the values to be squared to look correct. --- Source/EmberCommon/EmberCommon.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/EmberCommon/EmberCommon.h b/Source/EmberCommon/EmberCommon.h index 71c56ad..0093d54 100644 --- a/Source/EmberCommon/EmberCommon.h +++ b/Source/EmberCommon/EmberCommon.h @@ -229,6 +229,7 @@ static void Rgba32ToRgba16(v4F* rgba, glm::uint16* rgb, size_t width, size_t hei /// /// Convert an RGBA 32-bit float buffer to an EXR RGBA 32-bit float buffer. /// The two buffers can point to the same memory location if needed. +/// Note that this squares the values coming in, for some reason EXR expects that. /// /// The RGBA 32-bit float buffer /// The EXR RGBA 32-bit float buffer @@ -239,9 +240,9 @@ static void Rgba32ToRgbaExr(v4F* rgba, Rgba* ilmfRgba, size_t width, size_t heig { for (size_t i = 0; i < (width * height); i++) { - ilmfRgba[i].r = Clamp(rgba[i].r, 0.0f, 1.0f); - ilmfRgba[i].g = Clamp(rgba[i].g, 0.0f, 1.0f); - ilmfRgba[i].b = Clamp(rgba[i].b, 0.0f, 1.0f); + ilmfRgba[i].r = Clamp(Sqr(rgba[i].r), 0.0f, 1.0f); + ilmfRgba[i].g = Clamp(Sqr(rgba[i].g), 0.0f, 1.0f); + ilmfRgba[i].b = Clamp(Sqr(rgba[i].b), 0.0f, 1.0f); ilmfRgba[i].a = doAlpha ? Clamp(rgba[i].a * 1.0f, 0.0f, 1.0f) : 1.0f; } }