forked from blender/blender
MaterialX: add color nodes #17
@ -165,6 +165,7 @@ if(WITH_MATERIALX)
|
|||||||
materialx/nodes/huesatval.cc
|
materialx/nodes/huesatval.cc
|
||||||
materialx/nodes/invert.cc
|
materialx/nodes/invert.cc
|
||||||
materialx/nodes/light_falloff.cc
|
materialx/nodes/light_falloff.cc
|
||||||
|
materialx/nodes/light_path.cc
|
||||||
materialx/nodes/map_range.cc
|
materialx/nodes/map_range.cc
|
||||||
materialx/nodes/math.cc
|
materialx/nodes/math.cc
|
||||||
materialx/nodes/mix_rgb.cc
|
materialx/nodes/mix_rgb.cc
|
||||||
|
@ -11,7 +11,8 @@ NodeItem LightFalloffNodeParser::compute()
|
|||||||
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
||||||
NodeItem smooth = get_input_value("Smooth", NodeItem::Type::Float);
|
NodeItem smooth = get_input_value("Smooth", NodeItem::Type::Float);
|
||||||
|
|
||||||
/* This node isn't supported by MaterialX. This formula was given from OSL shader code in Cycles node_light_falloff.osl. Considered ray_length=1.0f. */
|
/* This node isn't supported by MaterialX. This formula was given from OSL shader code in Cycles
|
||||||
|
* node_light_falloff.osl. Considered ray_length=1.0f. */
|
||||||
strength = strength * val(1.0f) / (smooth + val(1.0f));
|
strength = strength * val(1.0f) / (smooth + val(1.0f));
|
||||||
|
|
||||||
return strength;
|
return strength;
|
||||||
|
21
source/blender/nodes/shader/materialx/nodes/light_path.cc
Normal file
21
source/blender/nodes/shader/materialx/nodes/light_path.cc
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
|
#include "node_parser.h"
|
||||||
|
|
||||||
|
namespace blender::nodes::materialx {
|
||||||
|
|
||||||
|
NodeItem LightPathNodeParser::compute()
|
||||||
|
{
|
||||||
|
/* This node isn't supported by MaterialX. Only default values returned. */
|
||||||
|
if (STREQ(socket_out_->name, "Is Camera Ray")) {
|
||||||
|
return val(1.0f);
|
||||||
|
}
|
||||||
|
if (STREQ(socket_out_->name, "Ray Length")) {
|
||||||
|
return val(1.0f);
|
||||||
|
}
|
||||||
|
return val(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace blender::nodes::materialx
|
@ -158,6 +158,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to
|
|||||||
CASE_NODE_TYPE(SH_NODE_HUE_SAT, HueSatValNodeParser)
|
CASE_NODE_TYPE(SH_NODE_HUE_SAT, HueSatValNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_INVERT, InvertNodeParser)
|
CASE_NODE_TYPE(SH_NODE_INVERT, InvertNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_LIGHT_FALLOFF, LightFalloffNodeParser)
|
CASE_NODE_TYPE(SH_NODE_LIGHT_FALLOFF, LightFalloffNodeParser)
|
||||||
|
CASE_NODE_TYPE(SH_NODE_LIGHT_PATH, LightPathNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MAP_RANGE, MapRangeNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MAP_RANGE, MapRangeNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MATH, MathNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MATH, MathNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MIX_RGB_LEGACY, MixRGBNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MIX_RGB_LEGACY, MixRGBNodeParser)
|
||||||
|
@ -100,6 +100,7 @@ DECLARE_NODE_PARSER(GammaNodeParser)
|
|||||||
DECLARE_NODE_PARSER(HueSatValNodeParser)
|
DECLARE_NODE_PARSER(HueSatValNodeParser)
|
||||||
DECLARE_NODE_PARSER(InvertNodeParser)
|
DECLARE_NODE_PARSER(InvertNodeParser)
|
||||||
DECLARE_NODE_PARSER(LightFalloffNodeParser)
|
DECLARE_NODE_PARSER(LightFalloffNodeParser)
|
||||||
|
DECLARE_NODE_PARSER(LightPathNodeParser)
|
||||||
DECLARE_NODE_PARSER(MapRangeNodeParser)
|
DECLARE_NODE_PARSER(MapRangeNodeParser)
|
||||||
DECLARE_NODE_PARSER(MathNodeParser)
|
DECLARE_NODE_PARSER(MathNodeParser)
|
||||||
DECLARE_NODE_PARSER(MixRGBNodeParser)
|
DECLARE_NODE_PARSER(MixRGBNodeParser)
|
||||||
|
Loading…
Reference in New Issue
Block a user