Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Carlisle <Blendify>2020-12-19 22:40:31 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2020-12-19 22:41:14 +0300
commit6538f1e600ad5e0ca04e8e166b848dd321023c4b (patch)
tree503788d9153bbcd79335213877d19e58e03767f2 /source/blender/compositor/operations
parent09be4a0917fbdb391341a6bfcc1e918fb75d0fd2 (diff)
Compositor: New Exposure Node
This new node increases the radiance of an image by a scalar value. Previously, the only way to adjust the the exposure of an image was with math node or using the scene's color management. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D9677
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_ColorExposureOperation.cpp57
-rw-r--r--source/blender/compositor/operations/COM_ColorExposureOperation.h49
2 files changed, 106 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.cpp b/source/blender/compositor/operations/COM_ColorExposureOperation.cpp
new file mode 100644
index 00000000000..8a475432cc8
--- /dev/null
+++ b/source/blender/compositor/operations/COM_ColorExposureOperation.cpp
@@ -0,0 +1,57 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright 2020, Blender Foundation.
+ */
+
+#include "COM_ColorExposureOperation.h"
+
+ExposureOperation::ExposureOperation() : NodeOperation()
+{
+ this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->m_inputProgram = NULL;
+}
+
+void ExposureOperation::initExecution()
+{
+ this->m_inputProgram = this->getInputSocketReader(0);
+ this->m_inputExposureProgram = this->getInputSocketReader(1);
+}
+
+void ExposureOperation::executePixelSampled(float output[4],
+ float x,
+ float y,
+ PixelSampler sampler)
+{
+ float inputValue[4];
+ float inputExposure[4];
+ this->m_inputProgram->readSampled(inputValue, x, y, sampler);
+ this->m_inputExposureProgram->readSampled(inputExposure, x, y, sampler);
+ const float exposure = pow(2, inputExposure[0]);
+
+ output[0] = inputValue[0] * exposure;
+ output[1] = inputValue[1] * exposure;
+ output[2] = inputValue[2] * exposure;
+
+ output[3] = inputValue[3];
+}
+
+void ExposureOperation::deinitExecution()
+{
+ this->m_inputProgram = NULL;
+ this->m_inputExposureProgram = NULL;
+}
diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.h b/source/blender/compositor/operations/COM_ColorExposureOperation.h
new file mode 100644
index 00000000000..a65d5acbe6c
--- /dev/null
+++ b/source/blender/compositor/operations/COM_ColorExposureOperation.h
@@ -0,0 +1,49 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright 2020, Blender Foundation.
+ */
+
+#ifndef __COM_COLOREXPOSUREOPERATION_H__
+#define __COM_COLOREXPOSUREOPERATION_H__
+#include "COM_NodeOperation.h"
+
+class ExposureOperation : public NodeOperation {
+ private:
+ /**
+ * Cached reference to the inputProgram
+ */
+ SocketReader *m_inputProgram;
+ SocketReader *m_inputExposureProgram;
+
+ public:
+ ExposureOperation();
+
+ /**
+ * the inner loop of this program
+ */
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+
+ /**
+ * Initialize the execution
+ */
+ void initExecution();
+
+ /**
+ * Deinitialize the execution
+ */
+ void deinitExecution();
+};
+#endif