Blender V4.3
node_shader_hueSatVal.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "node_shader_util.hh"
10
12
14{
15 b.add_input<decl::Float>("Hue").default_value(0.5f).min(0.0f).max(1.0f).description(
16 "Hue rotation offset, from 0 (-180°) to 1 (+180°). Note that 0 and 1 have the same result");
17 b.add_input<decl::Float>("Saturation")
18 .default_value(1.0f)
19 .min(0.0f)
20 .max(2.0f)
22 "Value of 0 removes color from the image, making it black-and-white. "
23 "A value greater than 1.0 increases saturation");
24 b.add_input<decl::Float>("Value")
25 .default_value(1.0f)
26 .min(0.0f)
27 .max(2.0f)
29 .description(
30 "Value shift. 0 makes the color black, 1 keeps it the same, and higher values make it "
31 "brighter");
32 b.add_input<decl::Float>("Fac")
33 .default_value(1.0f)
34 .min(0.0f)
35 .max(1.0f)
37 .description("Amount of influence the node exerts on the image");
38 b.add_input<decl::Color>("Color")
39 .default_value({0.8f, 0.8f, 0.8f, 1.0f})
40 .description("Color input on which HSV color transformation will be applied");
41 b.add_output<decl::Color>("Color");
42}
43
45 bNode *node,
46 bNodeExecData * /*execdata*/,
47 GPUNodeStack *in,
48 GPUNodeStack *out)
49{
50 return GPU_stack_link(mat, node, "hue_sat", in, out);
51}
52
54#ifdef WITH_MATERIALX
55{
56 NodeItem hue = get_input_value("Hue", NodeItem::Type::Float);
57 NodeItem saturation = get_input_value("Saturation", NodeItem::Type::Float);
58 NodeItem value = get_input_value("Value", NodeItem::Type::Float);
59 NodeItem fac = get_input_value("Fac", NodeItem::Type::Float);
60 NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
61
62 /* Modifier to follow Cycles result */
63 hue = hue - val(0.5f);
64
65 NodeItem combine = create_node(
66 "combine3", NodeItem::Type::Vector3, {{"in1", hue}, {"in2", saturation}, {"in3", value}});
67
68 NodeItem hsv = create_node(
69 "hsvadjust", NodeItem::Type::Color3, {{"in", color}, {"amount", combine}});
70
71 return fac.mix(color, hsv);
72}
73#endif
75
76} // namespace blender::nodes::node_shader_hueSatVal_cc
77
79{
81
82 static blender::bke::bNodeType ntype;
83
84 sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue/Saturation/Value", NODE_CLASS_OP_COLOR);
85 ntype.declare = file_ns::node_declare;
87 ntype.gpu_fn = file_ns::gpu_shader_hue_sat;
88 ntype.materialx_fn = file_ns::node_shader_materialx;
89
91}
#define SH_NODE_HUE_SAT
Definition BKE_node.hh:911
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:406
#define BLT_I18NCONTEXT_COLOR
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its saturation
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its hue
@ PROP_FACTOR
Definition RNA_types.hh:154
local_group_size(16, 16) .push_constant(Type b
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size)
Definition node.cc:4614
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_hue_sat()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:320
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:318
NodeDeclareFunction declare
Definition BKE_node.hh:347