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
This commit is contained in:
parent
09be4a0917
commit
6538f1e600
Notes:
blender-bot
2023-02-14 08:38:11 +01:00
Referenced by issue #83253, Compositor: Exposure Node
|
@ -330,6 +330,7 @@ compositor_node_categories = [
|
|||
NodeItem("CompositorNodeHueCorrect"),
|
||||
NodeItem("CompositorNodeBrightContrast"),
|
||||
NodeItem("CompositorNodeGamma"),
|
||||
NodeItem("CompositorNodeExposure"),
|
||||
NodeItem("CompositorNodeColorCorrection"),
|
||||
NodeItem("CompositorNodeTonemap"),
|
||||
NodeItem("CompositorNodeZcombine"),
|
||||
|
|
|
@ -1204,6 +1204,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *localtree,
|
|||
#define CMP_NODE_SWITCH_VIEW 322
|
||||
#define CMP_NODE_CRYPTOMATTE 323
|
||||
#define CMP_NODE_DENOISE 324
|
||||
#define CMP_NODE_EXPOSURE 325
|
||||
|
||||
/* channel toggles */
|
||||
#define CMP_CHAN_RGB 1
|
||||
|
|
|
@ -4496,6 +4496,7 @@ static void registerCompositNodes(void)
|
|||
register_node_type_cmp_hue_sat();
|
||||
register_node_type_cmp_brightcontrast();
|
||||
register_node_type_cmp_gamma();
|
||||
register_node_type_cmp_exposure();
|
||||
register_node_type_cmp_invert();
|
||||
register_node_type_cmp_alphaover();
|
||||
register_node_type_cmp_zcombine();
|
||||
|
|
|
@ -213,6 +213,8 @@ set(SRC
|
|||
nodes/COM_ColorCorrectionNode.h
|
||||
nodes/COM_ColorCurveNode.cpp
|
||||
nodes/COM_ColorCurveNode.h
|
||||
nodes/COM_ColorExposureNode.cpp
|
||||
nodes/COM_ColorExposureNode.h
|
||||
nodes/COM_ColorRampNode.cpp
|
||||
nodes/COM_ColorRampNode.h
|
||||
nodes/COM_ColorToBWNode.cpp
|
||||
|
@ -399,6 +401,8 @@ set(SRC
|
|||
operations/COM_ChromaMatteOperation.h
|
||||
operations/COM_ColorCurveOperation.cpp
|
||||
operations/COM_ColorCurveOperation.h
|
||||
operations/COM_ColorExposureOperation.cpp
|
||||
operations/COM_ColorExposureOperation.h
|
||||
operations/COM_ColorMatteOperation.cpp
|
||||
operations/COM_ColorMatteOperation.h
|
||||
operations/COM_ColorRampOperation.cpp
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "COM_ColorBalanceNode.h"
|
||||
#include "COM_ColorCorrectionNode.h"
|
||||
#include "COM_ColorCurveNode.h"
|
||||
#include "COM_ColorExposureNode.h"
|
||||
#include "COM_ColorMatteNode.h"
|
||||
#include "COM_ColorNode.h"
|
||||
#include "COM_ColorRampNode.h"
|
||||
|
@ -411,6 +412,9 @@ Node *Converter::convert(bNode *b_node)
|
|||
case CMP_NODE_DENOISE:
|
||||
node = new DenoiseNode(b_node);
|
||||
break;
|
||||
case CMP_NODE_EXPOSURE:
|
||||
node = new ExposureNode(b_node);
|
||||
break;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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_ColorExposureNode.h"
|
||||
#include "COM_ColorExposureOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ExposureNode::ExposureNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void ExposureNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext & /*context*/) const
|
||||
{
|
||||
ExposureOperation *operation = new ExposureOperation();
|
||||
converter.addOperation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
|
||||
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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_EXPOSURENODE_H__
|
||||
#define __COM_EXPOSURENODE_H__
|
||||
|
||||
#include "COM_Node.h"
|
||||
|
||||
/**
|
||||
* \brief ExposureNode
|
||||
* \ingroup Node
|
||||
*/
|
||||
class ExposureNode : public Node {
|
||||
public:
|
||||
ExposureNode(bNode *editorNode);
|
||||
void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -149,6 +149,7 @@ extern StructRNA RNA_CompositorNodeDilateErode;
|
|||
extern StructRNA RNA_CompositorNodeDisplace;
|
||||
extern StructRNA RNA_CompositorNodeDistanceMatte;
|
||||
extern StructRNA RNA_CompositorNodeDoubleEdgeMask;
|
||||
extern StructRNA RNA_CompositorNodeExposure;
|
||||
extern StructRNA RNA_CompositorNodeFilter;
|
||||
extern StructRNA RNA_CompositorNodeFlip;
|
||||
extern StructRNA RNA_CompositorNodeGamma;
|
||||
|
|
|
@ -73,6 +73,7 @@ set(SRC
|
|||
composite/nodes/node_composite_distanceMatte.c
|
||||
composite/nodes/node_composite_doubleEdgeMask.c
|
||||
composite/nodes/node_composite_ellipsemask.c
|
||||
composite/nodes/node_composite_exposure.c
|
||||
composite/nodes/node_composite_filter.c
|
||||
composite/nodes/node_composite_flip.c
|
||||
composite/nodes/node_composite_gamma.c
|
||||
|
|
|
@ -56,6 +56,7 @@ void register_node_type_cmp_mix_rgb(void);
|
|||
void register_node_type_cmp_hue_sat(void);
|
||||
void register_node_type_cmp_brightcontrast(void);
|
||||
void register_node_type_cmp_gamma(void);
|
||||
void register_node_type_cmp_exposure(void);
|
||||
void register_node_type_cmp_invert(void);
|
||||
void register_node_type_cmp_alphaover(void);
|
||||
void register_node_type_cmp_zcombine(void);
|
||||
|
|
|
@ -222,6 +222,7 @@ DefNode(CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNER
|
|||
DefNode(CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" )
|
||||
DefNode(CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" )
|
||||
DefNode(CompositorNode, CMP_NODE_DENOISE, def_cmp_denoise, "DENOISE", Denoise, "Denoise", "" )
|
||||
DefNode(CompositorNode, CMP_NODE_EXPOSURE, 0, "EXPOSURE", Exposure, "Exposure", "" )
|
||||
|
||||
DefNode(TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
|
||||
DefNode(TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2020 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "node_composite_util.h"
|
||||
|
||||
/* **************** Exposure ******************** */
|
||||
|
||||
static bNodeSocketTemplate cmp_node_exposure_in[] = {
|
||||
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
|
||||
{SOCK_FLOAT, N_("Exposure"), 0.0f, 0.0f, 0.0f, 0.0f, -10.0f, 10.0f, PROP_NONE},
|
||||
{-1, ""},
|
||||
};
|
||||
static bNodeSocketTemplate cmp_node_exposure_out[] = {
|
||||
{SOCK_RGBA, N_("Image")},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
void register_node_type_cmp_exposure(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, "Exposure", NODE_CLASS_OP_COLOR, 0);
|
||||
node_type_socket_templates(&ntype, cmp_node_exposure_in, cmp_node_exposure_out);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
Loading…
Reference in New Issue