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:
authorDalai Felinto <dfelinto@gmail.com>2012-01-24 20:32:31 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-01-24 20:32:31 +0400
commit335ffb0ff3df6ee52f525448d09ae6448b75e158 (patch)
tree460fc93c618d05f0585405c61dcc5152ee906798 /source/blender/nodes
parent1f9e25ac1a7851ab2503b88564c0d480b9e125cf (diff)
Brightness/Contrast Node for Cycles
Contrast helps to adjust IBL (HDR images used for background lighting). Note: In the UI we are caling it Bright instead of Brightness. This copy what Blender composite is doing. Note2: the algorithm we are using produces pure black when contrast is 100. I'm not a fan of that, but it's a division by zero. I would like to look at other algorithms (what gimp does for example). But that would be only after 2.62.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/CMakeLists.txt1
-rw-r--r--source/blender/nodes/NOD_shader.h1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_brightness.c60
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_gamma.c5
4 files changed, 62 insertions, 5 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 6d5c282d308..b458ae3a77d 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -115,6 +115,7 @@ set(SRC
shader/nodes/node_shader_curves.c
shader/nodes/node_shader_dynamic.c
shader/nodes/node_shader_gamma.c
+ shader/nodes/node_shader_brightness.c
shader/nodes/node_shader_geom.c
shader/nodes/node_shader_hueSatVal.c
shader/nodes/node_shader_invert.c
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 907efd76786..63fc0f4232c 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -55,6 +55,7 @@ void register_node_type_sh_rgbtobw(struct bNodeTreeType *ttype);
void register_node_type_sh_texture(struct bNodeTreeType *ttype);
void register_node_type_sh_normal(struct bNodeTreeType *ttype);
void register_node_type_sh_gamma(struct bNodeTreeType *ttype);
+void register_node_type_sh_brightcontrast(struct bNodeTreeType *ttype);
void register_node_type_sh_geom(struct bNodeTreeType *ttype);
void register_node_type_sh_mapping(struct bNodeTreeType *ttype);
void register_node_type_sh_curve_vec(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c
new file mode 100644
index 00000000000..7448a0b3bab
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c
@@ -0,0 +1,60 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+
+*/
+
+#include "node_shader_util.h"
+
+
+/* **************** Brigh and contrsast ******************** */
+
+static bNodeSocketTemplate sh_node_brightcontrast_in[]= {
+ { SOCK_RGBA, 1, "Color", 1.0f, 1.0f, 1.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Bright", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Contrast", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate sh_node_brightcontrast_out[]= {
+ { SOCK_RGBA, 0, "Color"},
+ { -1, 0, "" }
+};
+
+void register_node_type_sh_brightcontrast(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, sh_node_brightcontrast_in, sh_node_brightcontrast_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, NULL);
+ node_type_storage(&ntype, "", NULL, NULL);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, NULL);
+
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c
index 1d525d71698..e2907f5ba91 100644
--- a/source/blender/nodes/shader/nodes/node_shader_gamma.c
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c
@@ -26,11 +26,6 @@
*/
-/** \file blender/nodes/composite/nodes/node_composite_gamma.c
- * \ingroup cmpnodes
- */
-
-
#include "node_shader_util.h"
/* **************** Gamma Tools ******************** */