26#include "util/colorspace.h"
49#define TEXTURE_MAPPING_DEFINE(TextureNode) \
50 SOCKET_POINT(tex_mapping.translation, "Translation", zero_float3()); \
51 SOCKET_VECTOR(tex_mapping.rotation, "Rotation", zero_float3()); \
52 SOCKET_VECTOR(tex_mapping.scale, "Scale", one_float3()); \
54 SOCKET_VECTOR(tex_mapping.min, "Min", make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX)); \
55 SOCKET_VECTOR(tex_mapping.max, "Max", make_float3(FLT_MAX, FLT_MAX, FLT_MAX)); \
56 SOCKET_BOOLEAN(tex_mapping.use_minmax, "Use Min Max", false); \
58 static NodeEnum mapping_axis_enum; \
59 mapping_axis_enum.insert("none", TextureMapping::NONE); \
60 mapping_axis_enum.insert("x", TextureMapping::X); \
61 mapping_axis_enum.insert("y", TextureMapping::Y); \
62 mapping_axis_enum.insert("z", TextureMapping::Z); \
63 SOCKET_ENUM(tex_mapping.x_mapping, "x_mapping", mapping_axis_enum, TextureMapping::X); \
64 SOCKET_ENUM(tex_mapping.y_mapping, "y_mapping", mapping_axis_enum, TextureMapping::Y); \
65 SOCKET_ENUM(tex_mapping.z_mapping, "z_mapping", mapping_axis_enum, TextureMapping::Z); \
67 static NodeEnum mapping_type_enum; \
68 mapping_type_enum.insert("point", TextureMapping::POINT); \
69 mapping_type_enum.insert("texture", TextureMapping::TEXTURE); \
70 mapping_type_enum.insert("vector", TextureMapping::VECTOR); \
71 mapping_type_enum.insert("normal", TextureMapping::NORMAL); \
72 SOCKET_ENUM(tex_mapping.type, "Type", mapping_type_enum, TextureMapping::TEXTURE); \
74 static NodeEnum mapping_projection_enum; \
75 mapping_projection_enum.insert("flat", TextureMapping::FLAT); \
76 mapping_projection_enum.insert("cube", TextureMapping::CUBE); \
77 mapping_projection_enum.insert("tube", TextureMapping::TUBE); \
78 mapping_projection_enum.insert("sphere", TextureMapping::SPHERE); \
79 SOCKET_ENUM(tex_mapping.projection, "Projection", mapping_projection_enum, TextureMapping::FLAT);
122 mat = tmat * rmat * smat;
127 mat = tmat * rmat * smat;
175 NODE_TEXTURE_MAPPING,
177 .vec_offset = offset_in,
178 .out_offset = offset_out,
186 .vec_offset = offset_out,
187 .out_offset = offset_out,
203 .vector_offset = offset_out,
284 SOCKET_FLOAT(projection_blend,
"Projection Blend", 0.0f);
330 tiles.push_back_slow(1001);
343 if (
tiles.size() == 0) {
349 if (vector_in->
link) {
351 if (
node->type == UVMapNode::get_node_type()) {
355 else if (
node->type == TextureCoordinateNode::get_node_type()) {
356 if (vector_in->
link !=
node->output(
"UV")) {
365 unordered_set<int> used_tiles;
370 for (
Node *
node : geom->get_used_shaders()) {
372 if (shader->
graph.get() == graph) {
380 if (used_tiles.contains(
tile)) {
384 tiles.steal_data(new_tiles);
405 return NODE_TEX_IMAGE;
407 return NODE_TEX_IMAGE_BOX;
450 if (compress_as_srgb) {
453 if (!alpha_out->
links.empty()) {
458 if (unassociate_alpha) {
468 .projection =
uint(projection),
470 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
473 .out_offset = compiler.
output(
"Color"),
474 .alpha_offset = compiler.
output(
"Alpha"),
482 .blend = projection_blend,
484 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
487 .out_offset = compiler.
output(
"Color"),
488 .alpha_offset = compiler.
output(
"Alpha"),
520 const bool is_float = metadata.
is_float();
530 compiler.
parameter(
this,
"projection_blend");
531 compiler.
parameter(
"compress_as_srgb", compress_as_srgb);
533 compiler.
parameter(
"unassociate_alpha", !
output(
"Alpha")->links.empty() && unassociate_alpha);
534 compiler.
parameter(
"is_float", is_float);
535 compiler.
parameter(
this,
"interpolation");
538 compiler.
add(
this,
"node_image_texture");
646 if (compress_as_srgb) {
651 NODE_TEX_ENVIRONMENT,
652 SVMNodeTexEnvironment{
654 .projection = projection,
656 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
659 .out_offset = compiler.
output(
"Color"),
660 .alpha_offset = compiler.
output(
"Alpha"),
676 const bool is_float = metadata.
is_float();
681 compiler.
parameter(
this,
"interpolation");
682 compiler.
parameter(
"compress_as_srgb", compress_as_srgb);
684 compiler.
parameter(
"is_float", is_float);
685 compiler.
add(
this,
"node_environment_texture");
707 return (1.0f + lam[0] *
expf(lam[1] /
cosf(theta))) *
708 (1.0f + lam[2] *
expf(lam[3] * gamma) + lam[4] *
cosf(gamma) *
cosf(gamma));
713 const float turbidity)
722 const float theta = spherical.
x;
723 const float phi = spherical.
y;
725 sunsky->
theta = theta;
728 const float theta2 = theta * theta;
729 const float theta3 = theta2 * theta;
730 const float T = turbidity;
731 const float T2 =
T *
T;
733 const float chi = (4.0f / 9.0f -
T / 120.0f) * (
M_PI_F - 2.0f * theta);
734 sunsky->
radiance_x = (4.0453f *
T - 4.9710f) *
tanf(chi) - 0.2155f *
T + 2.4192f;
737 sunsky->
radiance_y = (0.00166f * theta3 - 0.00375f * theta2 + 0.00209f * theta) *
T2 +
738 (-0.02903f * theta3 + 0.06377f * theta2 - 0.03202f * theta + 0.00394f) *
T +
739 (0.11693f * theta3 - 0.21196f * theta2 + 0.06052f * theta + 0.25886f);
741 sunsky->
radiance_z = (0.00275f * theta3 - 0.00610f * theta2 + 0.00317f * theta) *
T2 +
742 (-0.04214f * theta3 + 0.08970f * theta2 - 0.04153f * theta + 0.00516f) *
T +
743 (0.15346f * theta3 - 0.26756f * theta2 + 0.06670f * theta + 0.26688f);
745 sunsky->
config_x[0] = (0.1787f *
T - 1.4630f);
746 sunsky->
config_x[1] = (-0.3554f *
T + 0.4275f);
747 sunsky->
config_x[2] = (-0.0227f *
T + 5.3251f);
748 sunsky->
config_x[3] = (0.1206f *
T - 2.5771f);
749 sunsky->
config_x[4] = (-0.0670f *
T + 0.3703f);
751 sunsky->
config_y[0] = (-0.0193f *
T - 0.2592f);
752 sunsky->
config_y[1] = (-0.0665f *
T + 0.0008f);
753 sunsky->
config_y[2] = (-0.0004f *
T + 0.2125f);
754 sunsky->
config_y[3] = (-0.0641f *
T - 0.8989f);
755 sunsky->
config_y[4] = (-0.0033f *
T + 0.0452f);
757 sunsky->
config_z[0] = (-0.0167f *
T - 0.2608f);
758 sunsky->
config_z[1] = (-0.0950f *
T + 0.0092f);
759 sunsky->
config_z[2] = (-0.0079f *
T + 0.2102f);
760 sunsky->
config_z[3] = (-0.0441f *
T - 1.6537f);
761 sunsky->
config_z[4] = (-0.0109f *
T + 0.0529f);
764 for (
int i = 5; i < 9; i++) {
779 const float ground_albedo)
783 float theta = spherical.
x;
784 const float phi = spherical.
y;
787 turbidity =
clamp(turbidity, 0.0f, 10.0f);
792 sunsky->
theta = theta;
795 const float solarElevation =
M_PI_2_F - theta;
800 (
double)turbidity, (
double)ground_albedo, (
double)solarElevation);
803 for (
int i = 0; i < 9; ++i) {
818 bool multiple_scattering,
820 const float sun_size,
821 const float sun_intensity,
822 const float sun_elevation,
823 const float sun_rotation,
824 const float altitude,
825 const float air_density,
826 const float aerosol_density,
827 const float ozone_density)
830 float pixel_bottom[3];
833 if (multiple_scattering) {
845 sun_elevation, sun_size, altitude, air_density, aerosol_density, pixel_bottom, pixel_top);
891 const float3 pixel_bottom =
make_float3(pix_bottom[0], pix_bottom[1], pix_bottom[2]);
893 float3 xyz =
interp(pixel_bottom, pixel_top, 0.5f) * sun_intensity;
898 float sun_contribution =
average(xyz) *
sqr(angular_diameter);
900 const float first_point = 0.8f / 180.0f *
M_PI_F;
901 const float second_point = 1.0f / 180.0f *
M_PI_F;
903 if (angular_diameter < first_point) {
904 sun_contribution *= 1.0f;
906 else if (angular_diameter < second_point) {
907 const float diff = angular_diameter - first_point;
908 const float slope = (0.8f - 1.0f) / (second_point - first_point);
909 sun_contribution *= 1.0f + slope *
diff;
912 const float diff = angular_diameter - 1.0f / 180.0f *
M_PI_F;
913 const float slope = (0.45f - 0.8f) / (third_point - second_point);
914 sun_contribution *= 0.8f + slope *
diff;
917 return sun_contribution;
952SkyTextureNode::SkyTextureNode() :
TextureNode(get_node_type()) {}
958 float new_sun_elevation = sun_elevation;
959 float new_sun_rotation = sun_rotation;
969 new_sun_elevation =
copysignf(
M_PI_F, new_sun_elevation) - new_sun_elevation;
970 new_sun_rotation +=
M_PI_F;
976 if (new_sun_rotation < 0.0f) {
979 new_sun_rotation =
M_2PI_F - new_sun_rotation;
981 sun_elevation = new_sun_elevation;
982 sun_rotation = new_sun_rotation;
1020 unique_ptr<SkyLoader> loader = make_unique<SkyLoader>(sky_type ==
1036 .sky_type = sky_type,
1037 .dir_offset = vector_offset,
1038 .out_offset = compiler.
output(
"Color"),
1041 SVMNodeTexSkyPreethamData preetham_data = {};
1042 preetham_data.
phi = sunsky.
phi;
1103 unique_ptr<SkyLoader> loader = make_unique<SkyLoader>(sky_type ==
1125 compiler.
add(
this,
"node_sky_texture");
1154GradientTextureNode::GradientTextureNode() :
TextureNode(get_node_type()) {}
1158 ShaderInput *vector_in =
input(
"Vector");
1164 .gradient_type = gradient_type,
1165 .co = vector_offset,
1166 .fac_offset = compiler.
output(
"Fac"),
1167 .color_offset = compiler.
output(
"Color"),
1177 compiler.
parameter(
this,
"gradient_type");
1178 compiler.
add(
this,
"node_gradient_texture");
1190 dimensions_enum.
insert(
"1D", 1);
1191 dimensions_enum.
insert(
"2D", 2);
1192 dimensions_enum.
insert(
"3D", 3);
1193 dimensions_enum.
insert(
"4D", 4);
1194 SOCKET_ENUM(dimensions,
"Dimensions", dimensions_enum, 3);
1222NoiseTextureNode::NoiseTextureNode() :
TextureNode(get_node_type()) {}
1226 ShaderInput *vector_in =
input(
"Vector");
1229 compiler, vector_in,
nullptr);
1233 .dimensions =
uint(dimensions),
1235 .normalize =
uint(use_normalize),
1244 .vector = vector_stack_offset,
1245 .value_offset = compiler.
output(
"Fac"),
1246 .color_offset = compiler.
output(
"Color"),
1257 compiler.
parameter(
this,
"use_normalize");
1258 compiler.
add(
this,
"node_noise_texture");
1288GaborTextureNode::GaborTextureNode() :
TextureNode(get_node_type()) {}
1292 ShaderInput *vector_in =
input(
"Vector");
1295 compiler, vector_in,
nullptr);
1300 .orientation_3d = compiler.
input_float3(
"Orientation 3D"),
1304 .orientation_2d = compiler.
input_float(
"Orientation 2D"),
1305 .coordinates = vector_stack_offset,
1306 .value_offset = compiler.
output(
"Value"),
1307 .phase_offset = compiler.
output(
"Phase"),
1308 .intensity_offset = compiler.
output(
"Intensity"),
1318 compiler.
add(
this,
"node_gabor_texture");
1330 dimensions_enum.
insert(
"1D", 1);
1331 dimensions_enum.
insert(
"2D", 2);
1332 dimensions_enum.
insert(
"3D", 3);
1333 dimensions_enum.
insert(
"4D", 4);
1334 SOCKET_ENUM(dimensions,
"Dimensions", dimensions_enum, 3);
1372VoronoiTextureNode::VoronoiTextureNode() :
TextureNode(get_node_type()) {}
1376 ShaderInput *vector_in =
input(
"Vector");
1379 compiler, vector_in,
nullptr);
1383 .dimensions =
uint(dimensions),
1394 .normalize = use_normalize,
1395 .coord = vector_stack_offset,
1396 .distance_offset = compiler.
output(
"Distance"),
1397 .color_offset = compiler.
output(
"Color"),
1398 .position_offset = compiler.
output(
"Position"),
1399 .w_out_offset = compiler.
output(
"W"),
1400 .radius_offset = compiler.
output(
"Radius"),
1412 compiler.
parameter(
this,
"use_normalize");
1413 compiler.
add(
this,
"node_voronoi_texture");
1435IESLightNode::IESLightNode() :
TextureNode(get_node_type())
1437 light_manager =
nullptr;
1445 node->light_manager =
nullptr;
1453 if (light_manager) {
1454 light_manager->remove_ies(slot);
1458void IESLightNode::get_slot()
1467 slot = light_manager->add_ies(ies.string(),
true);
1476 ShaderInput *vector_in =
input(
"Vector");
1484 .vector_offset = vector_offset,
1485 .fac_offset = compiler.
output(
"Fac"),
1499 compiler.
add(
this,
"node_ies_light");
1509 dimensions_enum.
insert(
"1D", 1);
1510 dimensions_enum.
insert(
"2D", 2);
1511 dimensions_enum.
insert(
"3D", 3);
1512 dimensions_enum.
insert(
"4D", 4);
1513 SOCKET_ENUM(dimensions,
"Dimensions", dimensions_enum, 3);
1524WhiteNoiseTextureNode::WhiteNoiseTextureNode() :
ShaderNode(get_node_type()) {}
1529 NODE_TEX_WHITE_NOISE,
1530 SVMNodeTexWhiteNoise{
1531 .dimensions =
uint(dimensions),
1534 .value_offset = compiler.
output(
"Value"),
1535 .color_offset = compiler.
output(
"Color"),
1542 compiler.
add(
this,
"node_white_noise_texture");
1558 static NodeEnum bands_direction_enum;
1566 static NodeEnum rings_direction_enum;
1593WaveTextureNode::WaveTextureNode() :
TextureNode(get_node_type()) {}
1597 ShaderInput *vector_in =
input(
"Vector");
1603 .wave_type = wave_type,
1604 .bands_direction = bands_direction,
1605 .rings_direction = rings_direction,
1611 .droughness = compiler.
input_float(
"Detail Roughness"),
1613 .co = vector_offset,
1614 .color_offset = compiler.
output(
"Color"),
1615 .fac_offset = compiler.
output(
"Fac"),
1626 compiler.
parameter(
this,
"bands_direction");
1627 compiler.
parameter(
this,
"rings_direction");
1630 compiler.
add(
this,
"node_wave_texture");
1653MagicTextureNode::MagicTextureNode() :
TextureNode(get_node_type()) {}
1657 ShaderInput *vector_in =
input(
"Vector");
1666 .co = vector_offset,
1667 .color_offset = compiler.
output(
"Color"),
1668 .fac_offset = compiler.
output(
"Fac"),
1679 compiler.
add(
this,
"node_magic_texture");
1701CheckerTextureNode::CheckerTextureNode() :
TextureNode(get_node_type()) {}
1705 ShaderInput *vector_in =
input(
"Vector");
1714 .co = vector_offset,
1715 .color_offset = compiler.
output(
"Color"),
1716 .fac_offset = compiler.
output(
"Fac"),
1726 compiler.
add(
this,
"node_checker_texture");
1738 SOCKET_INT(offset_frequency,
"Offset Frequency", 2);
1740 SOCKET_INT(squash_frequency,
"Squash Frequency", 2);
1760BrickTextureNode::BrickTextureNode() :
TextureNode(get_node_type()) {}
1764 ShaderInput *vector_in =
input(
"Vector");
1774 .mortar_size = compiler.
input_float(
"Mortar Size"),
1776 .brick_width = compiler.
input_float(
"Brick Width"),
1778 .mortar_smooth = compiler.
input_float(
"Mortar Smooth"),
1779 .offset_amount = offset,
1780 .squash_amount = squash,
1781 .offset_frequency =
uint8_t(offset_frequency),
1782 .squash_frequency =
uint8_t(squash_frequency),
1783 .co = vector_offset,
1784 .color_offset = compiler.
output(
"Color"),
1785 .fac_offset = compiler.
output(
"Fac"),
1796 compiler.
parameter(
this,
"offset_frequency");
1798 compiler.
parameter(
this,
"squash_frequency");
1799 compiler.
add(
this,
"node_brick_texture");
1818NormalNode::NormalNode() :
ShaderNode(get_node_type()) {}
1826 .out_normal_offset = compiler.
output(
"Normal"),
1827 .out_dot_offset = compiler.
output(
"Dot"),
1828 .direction_x = direction.x,
1829 .direction_y = direction.y,
1830 .direction_z = direction.z,
1837 compiler.
add(
this,
"node_normal");
1863MappingNode::MappingNode() :
ShaderNode(get_node_type()) {}
1881 .mapping_type = mapping_type,
1886 .result_offset = compiler.
output(
"Vector"),
1892 compiler.
parameter(
this,
"mapping_type");
1893 compiler.
add(
this,
"node_mapping");
1908RGBToBWNode::RGBToBWNode() :
ShaderNode(get_node_type()) {}
1925 .to_offset = compiler.
output(
"Val"),
1931 compiler.
add(
this,
"node_rgb_to_bw");
1936const NodeType *(&ConvertNode::get_node_types()) [ConvertNode::MAX_TYPE][ConvertNode::MAX_TYPE] {
1937 static const NodeType *node_types[MAX_TYPE][MAX_TYPE];
1938 static std::once_flag node_types_flag;
1940 std::call_once(node_types_flag, [&] {
1941 const int num_types = 8;
1951 for (
size_t i = 0; i < num_types; i++) {
1954 const ustring from_value_name(
"value_" + from_name.string());
1956 for (
size_t j = 0; j < num_types; j++) {
1959 const ustring to_value_name(
"value_" + to_name.string());
1961 const string node_name =
"convert_" + from_name.string() +
"_to_" + to_name.string();
1977 node_types[from][to] = type;
1986 ConvertNode::get_node_types();
1987 return static_cast<const NodeType *
>(
nullptr);
2004 else if (autoconvert) {
2014 value_color(other.value_color),
2015 value_string(other.value_string)
2026 float val = value_float;
2068 if (prev->type == get_node_types()[to][from]) {
2130 .convert_type = cvt_type,
2131 .from_offset = compiler.
input_link(
in->name().c_str()),
2132 .to_offset = compiler.
output(
out->name().c_str()),
2154 compiler.
add(
this,
"node_convert_from_float");
2157 compiler.
add(
this,
"node_convert_from_int");
2160 compiler.
add(
this,
"node_convert_from_color");
2163 compiler.
add(
this,
"node_convert_from_vector");
2166 compiler.
add(
this,
"node_convert_from_point");
2169 compiler.
add(
this,
"node_convert_from_normal");
2187 return (normal_in && normal_in->
link &&
2204 if (color_in->
link) {
2206 NODE_CLOSURE_WEIGHT,
2208 .weight_offset = compiler.
input_link(
"Color"),
2213 NODE_CLOSURE_SET_WEIGHT,
2214 SVMNodeClosureSetWeight{
2273MetallicBsdfNode::MetallicBsdfNode() :
BsdfNode(get_node_type())
2282 return (!
input(
"Anisotropy")->link &&
fabsf(anisotropy) <= 1e-4f);
2308 .closure_type = fresnel_type,
2311 SVMNodeMetallicBsdfData{
2312 .distribution = distribution,
2322 .thin_film_thickness = compiler.
input_float(
"Thin Film Thickness"),
2323 .thin_film_ior = compiler.
input_float(
"Thin Film IOR"),
2324 .normal_offset = compiler.
input_link(
"Normal"),
2325 .tangent_offset = compiler.
input_link(
"Tangent"),
2331 compiler.
parameter(
this,
"distribution");
2332 compiler.
parameter(
this,
"fresnel_type");
2333 compiler.
add(
this,
"node_metallic_bsdf");
2364GlossyBsdfNode::GlossyBsdfNode() :
BsdfNode(get_node_type())
2373 return (!
input(
"Anisotropy")->link &&
fabsf(anisotropy) <= 1e-4f);
2408 .normal_offset = compiler.
input_link(
"Normal"),
2409 .tangent_offset = compiler.
input_link(
"Tangent"),
2415 compiler.
parameter(
this,
"distribution");
2416 compiler.
add(
this,
"node_glossy_bsdf");
2451GlassBsdfNode::GlassBsdfNode() :
BsdfNode(get_node_type())
2459 return (!
input(
"Anisotropy")->link &&
fabsf(anisotropy) <= 1e-4f);
2491 .thin_film_thickness = compiler.
input_float(
"Thin Film Thickness"),
2492 .thin_film_ior = compiler.
input_float(
"Thin Film IOR"),
2493 .normal_offset = compiler.
input_link(
"Normal"),
2494 .tangent_offset = compiler.
input_link(
"Tangent"),
2500 compiler.
parameter(
this,
"distribution");
2501 compiler.
add(
this,
"node_glass_bsdf");
2528RefractionBsdfNode::RefractionBsdfNode() :
BsdfNode(get_node_type())
2537 SVMNodeRefractionBsdfData{
2540 .normal_offset = compiler.
input_link(
"Normal"),
2546 compiler.
parameter(
this,
"distribution");
2547 compiler.
add(
this,
"node_refraction_bsdf");
2572ToonBsdfNode::ToonBsdfNode() :
BsdfNode(get_node_type())
2581 SVMNodeToonBsdfData{
2584 .normal_offset = compiler.
input_link(
"Normal"),
2591 compiler.
add(
this,
"node_toon_bsdf");
2615SheenBsdfNode::SheenBsdfNode() :
BsdfNode(get_node_type())
2624 SVMNodeSimpleBsdfData{
2626 .normal_offset = compiler.
input_link(
"Normal"),
2632 compiler.
parameter(
this,
"distribution");
2633 compiler.
add(
this,
"node_sheen_bsdf");
2652DiffuseBsdfNode::DiffuseBsdfNode() :
BsdfNode(get_node_type())
2660 SVMNodeDiffuseBsdfData{.color = compiler.
input_float3(
"Color"),
2662 .normal_offset = compiler.
input_link(
"Normal")});
2667 compiler.
add(
this,
"node_diffuse_bsdf");
2681 static NodeEnum subsurface_method_enum;
2687 "Subsurface Method",
2688 subsurface_method_enum,
2706 SOCKET_IN_FLOAT(subsurface_anisotropy,
"Subsurface Anisotropy", 0.0f);
2715 SOCKET_IN_FLOAT(transmission_dispersion_scale,
"Transmission Dispersion Scale", 0.0f);
2717 transmission_dispersion_abbe_number,
"Transmission Dispersion Abbe Number", 20.0f);
2742PrincipledBsdfNode::PrincipledBsdfNode() :
BsdfBaseNode(get_node_type())
2807 if (
input(
"Roughness")->link ||
input(
"IOR")->link) {
2820 return (
input(
"Thin Wall")->link ==
nullptr) && thin_wall;
2825 return (
input(
"Emission Color")->link !=
nullptr ||
2827 (
input(
"Emission Strength")->
link !=
nullptr ||
2833 return (
input(
"Subsurface Weight")->link !=
nullptr ||
2835 (
input(
"Subsurface Scale")->
link !=
nullptr || subsurface_scale != 0.0f);
2858 if (weight_in ==
nullptr) {
2861 if (weight_in->
link !=
nullptr) {
2871 if (!
input(
"Tangent")->link) {
2883 tangent_offset = compiler.
input_link(
"Tangent");
2891 SVMNodePrincipledBsdfData{
2892 .distribution = distribution,
2896 .sheen_weight = compiler.
input_float(
"Sheen Weight"),
2897 .coat_weight = compiler.
input_float(
"Coat Weight"),
2899 .transmission_weight = compiler.
input_float(
"Transmission Weight"),
2900 .subsurface_weight = compiler.
input_float(
"Subsurface Weight"),
2904 .diffuse_roughness = compiler.
input_float(
"Diffuse Roughness"),
2906 .normal_offset = compiler.
input_link(
"Normal"),
2907 .tangent_offset = tangent_offset,
2908 .coat_normal_offset = compiler.
input_link(
"Coat Normal"),
2910 .specular_tint = compiler.
input_float3(
"Specular Tint"),
2911 .specular_ior_level = compiler.
input_float(
"Specular IOR Level"),
2912 .anisotropic = compiler.
input_float(
"Anisotropic"),
2913 .anisotropic_rotation = compiler.
input_float(
"Anisotropic Rotation"),
2915 .transmission_dispersion_scale = compiler.
input_float(
"Transmission Dispersion Scale"),
2916 .transmission_dispersion_abbe_number = compiler.
input_float(
2917 "Transmission Dispersion Abbe Number"),
2919 .emission_color = compiler.
input_float3(
"Emission Color"),
2920 .emission_strength = compiler.
input_float(
"Emission Strength"),
2923 .sheen_roughness = compiler.
input_float(
"Sheen Roughness"),
2926 .coat_roughness = compiler.
input_float(
"Coat Roughness"),
2929 .subsurface_method = subsurface_method,
2930 .subsurface_radius = compiler.
input_float3(
"Subsurface Radius"),
2931 .subsurface_scale = compiler.
input_float(
"Subsurface Scale"),
2932 .subsurface_ior = compiler.
input_float(
"Subsurface IOR"),
2933 .subsurface_anisotropy = compiler.
input_float(
"Subsurface Anisotropy"),
2935 .thin_film_thickness = compiler.
input_float(
"Thin Film Thickness"),
2936 .thin_film_ior = compiler.
input_float(
"Thin Film IOR"),
2938 .thin_wall = compiler.
input_int(
"Thin Wall"),
2944 compiler.
parameter(
this,
"distribution");
2945 compiler.
parameter(
this,
"subsurface_method");
2946 compiler.
add(
this,
"node_principled_bsdf");
2969TranslucentBsdfNode::TranslucentBsdfNode() :
BsdfNode(get_node_type())
2977 SVMNodeSimpleBsdfData{
2978 .normal_offset = compiler.
input_link(
"Normal"),
2984 compiler.
add(
this,
"node_translucent_bsdf");
3001TransparentBsdfNode::TransparentBsdfNode() :
BsdfNode(get_node_type())
3013 compiler.
add(
this,
"node_transparent_bsdf");
3033RayPortalBsdfNode::RayPortalBsdfNode() :
BsdfNode(get_node_type())
3041 SVMNodeRayPortalBsdfData{
3043 .position_offset = compiler.
input_link(
"Position"),
3049 compiler.
add(
this,
"node_ray_portal_bsdf");
3081SubsurfaceScatteringNode::SubsurfaceScatteringNode() :
BsdfNode(get_node_type())
3096 .normal_offset = compiler.
input_link(
"Normal"),
3104 compiler.
add(
this,
"node_subsurface_scattering");
3111 return (normal_in->
link &&
3131EmissionNode::EmissionNode() :
ShaderNode(get_node_type()) {}
3135 ShaderInput *color_in =
input(
"Color");
3136 ShaderInput *strength_in =
input(
"Strength");
3138 if (color_in->
link || strength_in->
link) {
3140 NODE_EMISSION_WEIGHT,
3141 SVMNodeEmissionWeight{
3147 const float3 w = color * strength;
3149 NODE_CLOSURE_SET_WEIGHT,
3150 SVMNodeClosureSetWeight{
3156 NODE_CLOSURE_EMISSION,
3157 SVMNodeClosureEmission{
3164 compiler.
add(
this,
"node_emission");
3171 (!
input(
"Strength")->link && strength == 0.0f))
3192BackgroundNode::BackgroundNode() :
ShaderNode(get_node_type()) {}
3196 ShaderInput *color_in =
input(
"Color");
3197 ShaderInput *strength_in =
input(
"Strength");
3199 if (color_in->
link || strength_in->
link) {
3201 NODE_EMISSION_WEIGHT,
3202 SVMNodeEmissionWeight{
3208 const float3 w = color * strength;
3210 NODE_CLOSURE_SET_WEIGHT,
3211 SVMNodeClosureSetWeight{
3217 NODE_CLOSURE_BACKGROUND,
3218 SVMNodeClosureBackground{
3225 compiler.
add(
this,
"node_background");
3232 (!
input(
"Strength")->link && strength == 0.0f))
3252HoldoutNode::HoldoutNode() :
ShaderNode(get_node_type()) {}
3258 NODE_CLOSURE_SET_WEIGHT,
3259 SVMNodeClosureSetWeight{
3263 NODE_CLOSURE_HOLDOUT,
3264 SVMNodeClosureHoldout{
3271 compiler.
add(
this,
"node_holdout");
3295AmbientOcclusionNode::AmbientOcclusionNode() :
ShaderNode(get_node_type()) {}
3299 ShaderInput *distance_in =
input(
"Distance");
3308 NODE_AMBIENT_OCCLUSION,
3309 SVMNodeAmbientOcclusion{
3314 .normal_offset = compiler.
input_link(
"Normal"),
3315 .out_ao_offset = compiler.
output(
"AO"),
3316 .out_color_offset = compiler.
output(
"Color"),
3325 compiler.
add(
this,
"node_ambient_occlusion");
3342 if (color_in->
link) {
3344 NODE_CLOSURE_WEIGHT,
3346 .weight_offset = compiler.
input_link(
"Color"),
3351 NODE_CLOSURE_SET_WEIGHT,
3363 NODE_CLOSURE_VOLUME,
3368 .param_extra = (param2) ? compiler.
input_float(param2->
name().c_str()) :
3370 .mix_weight_offset = mix_weight_ofs,
3376 compile(compiler,
nullptr,
nullptr,
nullptr);
3399AbsorptionVolumeNode::AbsorptionVolumeNode() :
VolumeNode(get_node_type())
3411 compiler.
add(
this,
"node_absorption_volume");
3482 compiler.
add(
this,
"node_scatter_volume");
3515VolumeCoefficientsNode::VolumeCoefficientsNode() :
ScatterVolumeNode(get_node_type())
3523 const char *param1 =
nullptr;
3524 const char *param2 =
nullptr;
3528 param1 =
"Anisotropy";
3532 param2 =
"Backscatter";
3537 param1 =
"Anisotropy";
3541 param1 =
"Diameter";
3548 if (
input(
"Scatter Coefficients")->link) {
3550 NODE_CLOSURE_WEIGHT,
3551 SVMNodeClosureWeight{
3552 .weight_offset = compiler.
input_link(
"Scatter Coefficients"),
3557 NODE_CLOSURE_SET_WEIGHT,
3558 SVMNodeClosureSetWeight{
3559 .rgb = scatter_coeffs,
3566 NODE_VOLUME_COEFFICIENTS,
3567 SVMNodeVolumeCoefficients{
3569 .absorption_coeffs = compiler.
input_float3(
"Absorption Coefficients"),
3570 .emission_coeffs = compiler.
input_float3(
"Emission Coefficients"),
3571 .param1 = (param1) ? compiler.
input_float(param1) : SVMInputFloat{0},
3572 .param_extra = (param2) ? compiler.
input_float(param2) : SVMInputFloat{0},
3573 .mix_weight_offset = mix_weight_ofs,
3580 compiler.
add(
this,
"node_volume_coefficients");
3591 SOCKET_IN_STRING(temperature_attribute,
"Temperature Attribute", ustring());
3609PrincipledVolumeNode::PrincipledVolumeNode() :
VolumeNode(get_node_type())
3612 density_attribute = ustring(
"density");
3613 temperature_attribute = ustring(
"temperature");
3620 if (
input(
"Density")->link || density > 0.0f) {
3625 if (
input(
"Blackbody Intensity")->link || blackbody_intensity > 0.0f) {
3639 if (color_in->
link) {
3641 NODE_CLOSURE_WEIGHT,
3643 .weight_offset = compiler.
input_link(
"Color"),
3648 NODE_CLOSURE_SET_WEIGHT,
3649 SVMNodeClosureSetWeight{
3656 NODE_PRINCIPLED_VOLUME,
3657 SVMNodePrincipledVolume{
3658 .absorption_color = compiler.
input_float3(
"Absorption Color"),
3659 .emission_color = compiler.
input_float3(
"Emission Color"),
3660 .blackbody_tint = compiler.
input_float3(
"Blackbody Tint"),
3663 .emission = compiler.
input_float(
"Emission Strength"),
3664 .blackbody = compiler.
input_float(
"Blackbody Intensity"),
3665 .temperature = compiler.
input_float(
"Temperature"),
3679 compiler.
add(
this,
"node_principled_volume");
3695 static NodeEnum parametrization_enum;
3708 absorption_coefficient,
"Absorption Coefficient",
make_float3(0.245531f, 0.52f, 1.365f));
3733PrincipledHairBsdfNode::PrincipledHairBsdfNode() :
BsdfBaseNode(get_node_type())
3742 if (aspect_ratio != 1.0f ||
input(
"Aspect Ratio")->link) {
3756 if (!
input(
"Random")->link) {
3769 NODE_CLOSURE_SET_WEIGHT,
3774 ShaderInput *random_in =
input(
"Random");
3784 SVMNodePrincipledHairBsdfData{
3785 .parametrization = parametrization,
3788 .absorption_coefficient = compiler.
input_float3(
"Absorption Coefficient"),
3790 .random_roughness = compiler.
input_float(
"Random Roughness"),
3795 .melanin_redness = compiler.
input_float(
"Melanin Redness"),
3797 .aspect_ratio = compiler.
input_float(
"Aspect Ratio"),
3798 .radial_roughness = compiler.
input_float(
"Radial Roughness"),
3799 .random_color = compiler.
input_float(
"Random Color"),
3803 .attr_random = attr_random,
3812 compiler.
parameter(
this,
"parametrization");
3813 compiler.
add(
this,
"node_principled_hair_bsdf");
3839HairBsdfNode::HairBsdfNode() :
BsdfNode(get_node_type())
3849 SVMNodeHairBsdfData{
3853 .tangent_offset = compiler.
input_link(
"Tangent"),
3860 compiler.
add(
this,
"node_hair_bsdf");
3882GeometryNode::GeometryNode() :
ShaderNode(get_node_type())
3890 if (!
output(
"Tangent")->links.empty()) {
3893 if (!
output(
"Pointiness")->links.empty()) {
3896 if (!
output(
"Random Per Island")->links.empty()) {
3906 return NODE_GEOMETRY;
3929 if (!
out->links.empty()) {
3934 .bump_offset = bump_offset,
3935 .store_derivatives = store_derivatives,
3936 .out_offset = compiler.
output(
"Position"),
3944 if (!
out->links.empty()) {
3950 .store_derivatives = store_derivatives,
3951 .out_offset = compiler.
output(
"Normal"),
3957 if (!
out->links.empty()) {
3963 .store_derivatives = store_derivatives,
3964 .out_offset = compiler.
output(
"Tangent"),
3971 if (!
out->links.empty()) {
3977 .store_derivatives = store_derivatives,
3978 .out_offset = compiler.
output(
"True Normal"),
3985 if (!
out->links.empty()) {
3991 .store_derivatives = store_derivatives,
3992 .out_offset = compiler.
output(
"Incoming"),
3999 if (!
out->links.empty()) {
4004 .bump_offset = bump_offset,
4005 .store_derivatives = store_derivatives,
4006 .out_offset = compiler.
output(
"Parametric"),
4013 if (!
out->links.empty()) {
4018 .out_offset = compiler.
output(
"Backfacing"),
4023 if (!
out->links.empty()) {
4029 .missing = SVMInputFloat3{{0}, {0}, {0}},
4031 .out_offset = compiler.
output(
"Pointiness"),
4033 .bump_offset = bump_offset,
4034 .store_derivatives = store_derivatives,
4045 if (!
out->links.empty()) {
4051 .missing = SVMInputFloat3{{0}, {0}, {0}},
4053 .out_offset = compiler.
output(
"Random Per Island"),
4055 .bump_offset = bump_offset,
4056 .store_derivatives = store_derivatives,
4070 compiler.
parameter(
"bump_offset",
"dx");
4073 compiler.
parameter(
"bump_offset",
"dy");
4076 compiler.
parameter(
"bump_offset",
"center");
4080 compiler.
add(
this,
"node_geometry");
4104TextureCoordinateNode::TextureCoordinateNode() :
ShaderNode(get_node_type()) {}
4110 if (!
output(
"Generated")->links.empty()) {
4113 if (!
output(
"UV")->links.empty()) {
4121 if (!
output(
"Generated")->links.empty()) {
4132 return NODE_TEX_COORD;
4143 if (!
out->links.empty()) {
4149 .bump_offset = bump_offset,
4150 .store_derivatives = store_derivatives,
4151 .out_offset = compiler.
output(
"Generated"),
4164 .store_derivatives = store_derivatives,
4165 .out_offset = compiler.
output(
"Generated"),
4175 .bump_offset = bump_offset,
4176 .store_derivatives = store_derivatives,
4177 .out_offset = compiler.
output(
"Generated"),
4187 .missing = SVMInputFloat3{{0}, {0}, {0}},
4189 .out_offset = compiler.
output(
"Generated"),
4191 .bump_offset = bump_offset,
4192 .store_derivatives = store_derivatives,
4201 if (!
out->links.empty()) {
4206 .bump_offset = bump_offset,
4207 .store_derivatives = store_derivatives,
4208 .out_offset = compiler.
output(
"Normal"),
4215 if (!
out->links.empty()) {
4223 .store_derivatives = store_derivatives,
4224 .out_offset = compiler.
output(
"UV"),
4234 .missing = SVMInputFloat3{{0}, {0}, {0}},
4236 .out_offset = compiler.
output(
"UV"),
4238 .bump_offset = bump_offset,
4239 .store_derivatives = store_derivatives,
4247 if (!
out->links.empty()) {
4253 .bump_offset = bump_offset,
4254 .store_derivatives = store_derivatives,
4255 .out_offset = compiler.
output(
"Object"),
4259 if (use_transform) {
4266 if (!
out->links.empty()) {
4271 .bump_offset = bump_offset,
4272 .store_derivatives = store_derivatives,
4273 .out_offset = compiler.
output(
"Camera"),
4280 if (!
out->links.empty()) {
4285 .bump_offset = bump_offset,
4286 .store_derivatives = store_derivatives,
4287 .out_offset = compiler.
output(
"Window"),
4295 if (!
out->links.empty()) {
4302 .store_derivatives = store_derivatives,
4303 .out_offset = compiler.
output(
"Reflection"),
4314 .store_derivatives = store_derivatives,
4315 .out_offset = compiler.
output(
"Reflection"),
4326 compiler.
parameter(
"bump_offset",
"dx");
4329 compiler.
parameter(
"bump_offset",
"dy");
4332 compiler.
parameter(
"bump_offset",
"center");
4337 compiler.
parameter(
"is_background",
true);
4342 compiler.
parameter(
this,
"use_transform");
4344 compiler.
parameter(
"object_itfm", ob_itfm);
4348 compiler.
add(
this,
"node_texture_coordinate");
4365UVMapNode::UVMapNode() :
ShaderNode(get_node_type()) {}
4371 if (!
output(
"UV")->links.empty()) {
4387 return NODE_TEX_COORD;
4397 if (!
out->links.empty()) {
4405 .store_derivatives = store_derivatives,
4406 .out_offset = compiler.
output(
"UV"),
4424 .missing = SVMInputFloat3{{0}, {0}, {0}},
4426 .out_offset = compiler.
output(
"UV"),
4428 .bump_offset = bump_offset,
4429 .store_derivatives = store_derivatives,
4440 compiler.
parameter(
"bump_offset",
"dx");
4443 compiler.
parameter(
"bump_offset",
"dy");
4446 compiler.
parameter(
"bump_offset",
"center");
4452 compiler.
add(
this,
"node_uv_map");
4480LightPathNode::LightPathNode() :
ShaderNode(get_node_type())
4490 if (!
out->links.empty()) {
4495 .out_offset = compiler.
output(
"Is Camera Ray"),
4500 if (!
out->links.empty()) {
4505 .out_offset = compiler.
output(
"Is Shadow Ray"),
4510 if (!
out->links.empty()) {
4515 .out_offset = compiler.
output(
"Is Diffuse Ray"),
4520 if (!
out->links.empty()) {
4525 .out_offset = compiler.
output(
"Is Glossy Ray"),
4530 if (!
out->links.empty()) {
4535 .out_offset = compiler.
output(
"Is Singular Ray"),
4540 if (!
out->links.empty()) {
4545 .out_offset = compiler.
output(
"Is Reflection Ray"),
4550 if (!
out->links.empty()) {
4555 .out_offset = compiler.
output(
"Is Transmission Ray"),
4560 if (!
out->links.empty()) {
4565 .out_offset = compiler.
output(
"Is Volume Scatter Ray"),
4570 if (!
out->links.empty()) {
4575 .out_offset = compiler.
output(
"Ray Length"),
4580 if (!
out->links.empty()) {
4585 .out_offset = compiler.
output(
"Ray Depth"),
4590 if (!
out->links.empty()) {
4595 .out_offset = compiler.
output(
"Diffuse Depth"),
4600 if (!
out->links.empty()) {
4605 .out_offset = compiler.
output(
"Glossy Depth"),
4610 if (!
out->links.empty()) {
4615 .out_offset = compiler.
output(
"Transparent Depth"),
4620 if (!
out->links.empty()) {
4625 .out_offset = compiler.
output(
"Transmission Depth"),
4630 if (!
out->links.empty()) {
4635 .out_offset = compiler.
output(
"Portal Depth"),
4642 compiler.
add(
this,
"node_light_path");
4661LightFalloffNode::LightFalloffNode() :
ShaderNode(get_node_type()) {}
4665 ShaderOutput *
out =
output(
"Quadratic");
4666 if (!
out->links.empty()) {
4669 SVMNodeLightFalloff{
4673 .out_offset = compiler.
output(
"Quadratic"),
4678 if (!
out->links.empty()) {
4681 SVMNodeLightFalloff{
4685 .out_offset = compiler.
output(
"Linear"),
4690 if (!
out->links.empty()) {
4693 SVMNodeLightFalloff{
4697 .out_offset = compiler.
output(
"Constant"),
4704 compiler.
add(
this,
"node_light_falloff");
4723ObjectInfoNode::ObjectInfoNode() :
ShaderNode(get_node_type()) {}
4728 if (!
out->links.empty()) {
4733 .out_offset = compiler.
output(
"Location"),
4738 if (!
out->links.empty()) {
4743 .out_offset = compiler.
output(
"Color"),
4748 if (!
out->links.empty()) {
4753 .out_offset = compiler.
output(
"Alpha"),
4758 if (!
out->links.empty()) {
4763 .out_offset = compiler.
output(
"Object Index"),
4768 if (!
out->links.empty()) {
4773 .out_offset = compiler.
output(
"Material Index"),
4778 if (!
out->links.empty()) {
4783 .out_offset = compiler.
output(
"Random"),
4790 compiler.
add(
this,
"node_object_info");
4805 SOCKET_OUT_QUATERNION(rotation,
"Rotation");
4814ParticleInfoNode::ParticleInfoNode() :
ShaderNode(get_node_type()) {}
4818 if (!
output(
"Index")->links.empty()) {
4821 if (!
output(
"Random")->links.empty()) {
4824 if (!
output(
"Age")->links.empty()) {
4827 if (!
output(
"Lifetime")->links.empty()) {
4830 if (!
output(
"Location")->links.empty()) {
4834 if (!
output(
"Rotation")->links.empty()) {
4838 if (!
output(
"Size")->links.empty()) {
4841 if (!
output(
"Velocity")->links.empty()) {
4844 if (!
output(
"Angular Velocity")->links.empty()) {
4856 if (!
out->links.empty()) {
4861 .out_offset = compiler.
output(
"Index"),
4866 if (!
out->links.empty()) {
4869 SVMNodeParticleInfo{
4871 .out_offset = compiler.
output(
"Random"),
4876 if (!
out->links.empty()) {
4879 SVMNodeParticleInfo{
4881 .out_offset = compiler.
output(
"Age"),
4886 if (!
out->links.empty()) {
4889 SVMNodeParticleInfo{
4891 .out_offset = compiler.
output(
"Lifetime"),
4896 if (!
out->links.empty()) {
4899 SVMNodeParticleInfo{
4901 .out_offset = compiler.
output(
"Location"),
4908 if (!
out->links.empty()) {
4909 compiler.
add_node(
this, NODE_PARTICLE_INFO,
4910 SVMNodeParticleInfo{
4911 .info_type = NODE_INFO_PAR_ROTATION,
4912 .out_offset = compiler.
output(
"Rotation"),
4918 if (!
out->links.empty()) {
4921 SVMNodeParticleInfo{
4923 .out_offset = compiler.
output(
"Size"),
4928 if (!
out->links.empty()) {
4931 SVMNodeParticleInfo{
4933 .out_offset = compiler.
output(
"Velocity"),
4938 if (!
out->links.empty()) {
4941 SVMNodeParticleInfo{
4943 .out_offset = compiler.
output(
"Angular Velocity"),
4950 compiler.
add(
this,
"node_particle_info");
4969HairInfoNode::HairInfoNode() :
ShaderNode(get_node_type()) {}
4975 if (!
output(
"Intercept")->links.empty()) {
4979 if (!
output(
"Length")->links.empty()) {
4983 if (!
output(
"Random")->links.empty()) {
4996 if (!
out->links.empty()) {
5001 .out_offset = compiler.
output(
"Is Strand"),
5006 if (!
out->links.empty()) {
5011 .missing = SVMInputFloat3{{0}, {0}, {0}},
5013 .out_offset = compiler.
output(
"Intercept"),
5019 if (!
out->links.empty()) {
5024 .missing = SVMInputFloat3{{0}, {0}, {0}},
5026 .out_offset = compiler.
output(
"Length"),
5032 if (!
out->links.empty()) {
5037 .out_offset = compiler.
output(
"Thickness"),
5042 if (!
out->links.empty()) {
5047 .out_offset = compiler.
output(
"Tangent Normal"),
5052 if (!
out->links.empty()) {
5057 .missing = SVMInputFloat3{{0}, {0}, {0}},
5059 .out_offset = compiler.
output(
"Random"),
5067 compiler.
add(
this,
"node_hair_info");
5083PointInfoNode::PointInfoNode() :
ShaderNode(get_node_type()) {}
5088 if (!
output(
"Random")->links.empty()) {
5101 if (!
out->links.empty()) {
5106 .out_offset = compiler.
output(
"Position"),
5111 if (!
out->links.empty()) {
5116 .out_offset = compiler.
output(
"Radius"),
5121 if (!
out->links.empty()) {
5126 .missing = SVMInputFloat3{{0}, {0}, {0}},
5128 .out_offset = compiler.
output(
"Random"),
5136 compiler.
add(
this,
"node_point_info");
5153VolumeInfoNode::VolumeInfoNode() :
ShaderNode(get_node_type()) {}
5161 if (!
output(
"Color")->links.empty()) {
5164 if (!
output(
"Density")->links.empty()) {
5167 if (!
output(
"Flame")->links.empty()) {
5170 if (!
output(
"Temperature")->links.empty()) {
5181 if (!color_out->
links.empty()) {
5183 attr->set_attribute(ustring(
"color"));
5188 if (!density_out->
links.empty()) {
5190 attr->set_attribute(ustring(
"density"));
5195 if (!flame_out->
links.empty()) {
5197 attr->set_attribute(ustring(
"flame"));
5202 if (!temperature_out->
links.empty()) {
5204 attr->set_attribute(ustring(
"temperature"));
5224VertexColorNode::VertexColorNode() :
ShaderNode(get_node_type()) {}
5228 if (!(
output(
"Color")->links.empty() &&
output(
"Alpha")->links.empty())) {
5229 if (!layer_name.empty()) {
5244 if (color_out->
links.empty() && alpha_out->
links.empty()) {
5249 attr->set_attribute(
5252 attr->set_missing_alpha(0.0f);
5274ValueNode::ValueNode() :
ShaderNode(get_node_type()) {}
5288 compiler.
parameter(
"value_value", value);
5289 compiler.
add(
this,
"node_value");
5304ColorNode::ColorNode() :
ShaderNode(get_node_type()) {}
5315 if (!color_out->
links.empty()) {
5324 compiler.
add(
this,
"node_value");
5340AddClosureNode::AddClosureNode() :
ShaderNode(get_node_type())
5352 compiler.
add(
this,
"node_add_closure");
5361 if (!closure1_in->
link) {
5364 else if (!closure2_in->
link) {
5384MixClosureNode::MixClosureNode() :
ShaderNode(get_node_type())
5396 compiler.
add(
this,
"node_mix_closure");
5405 if (closure1_in->
link == closure2_in->
link) {
5410 else if (!
input(
"Fac")->link) {
5416 else if (fac >= 1.0f) {
5437MixClosureWeightNode::MixClosureWeightNode() :
ShaderNode(get_node_type()) {}
5445 .in_weight_offset = compiler.
input_link(
"Weight"),
5446 .weight1_offset = compiler.
output(
"Weight1"),
5447 .weight2_offset = compiler.
output(
"Weight2"),
5470InvertNode::InvertNode() :
ShaderNode(get_node_type()) {}
5476 if (!
input(
"Fac")->link) {
5478 if (!color_in->
link) {
5482 else if (fac == 0.0f) {
5495 .out_offset = compiler.
output(
"Color"),
5501 compiler.
add(
this,
"node_invert");
5543MixNode::MixNode() :
ShaderNode(get_node_type()) {}
5552 .mix_type = mix_type,
5556 .result_offset = color_offset,
5565 .c2 = SVMInputFloat3{{0}, {0}, {0}},
5566 .fac = SVMInputFloat{0},
5567 .result_offset = color_offset,
5576 compiler.
add(
this,
"node_mix");
5585 folder.
fold_mix(mix_type, use_clamp);
5600 return use_clamp ==
false &&
input(
"Factor")->
link ==
nullptr;
5642MixColorNode::MixColorNode() :
ShaderNode(get_node_type()) {}
5649 .blend_type = blend_type,
5653 .use_clamp = use_clamp,
5654 .use_clamp_result = use_clamp_result,
5655 .result_offset = compiler.
output(
"Result"),
5663 compiler.
parameter(
this,
"use_clamp_result");
5664 compiler.
add(
this,
"node_mix_color");
5671 fac =
clamp(fac, 0.0f, 1.0f);
5682 switch (blend_type) {
5691 return use_clamp ==
false && use_clamp_result ==
false &&
input(
"Factor")->
link ==
nullptr;
5709MixFloatNode::MixFloatNode() :
ShaderNode(get_node_type()) {}
5719 .use_clamp = use_clamp,
5720 .result_offset = compiler.
output(
"Result"),
5727 compiler.
add(
this,
"node_mix_float");
5734 fac =
clamp(fac, 0.0f, 1.0f);
5745 return use_clamp ==
false &&
input(
"Factor")->
link ==
nullptr;
5764MixVectorNode::MixVectorNode() :
ShaderNode(get_node_type()) {}
5774 .use_clamp = use_clamp,
5775 .result_offset = compiler.
output(
"Result"),
5782 compiler.
add(
this,
"node_mix_vector");
5789 fac =
clamp(fac, 0.0f, 1.0f);
5800 return use_clamp ==
false &&
input(
"Factor")->
link ==
nullptr;
5819MixVectorNonUniformNode::MixVectorNonUniformNode() :
ShaderNode(get_node_type()) {}
5824 NODE_MIX_VECTOR_NON_UNIFORM,
5825 SVMNodeMixVectorNonUniform{
5829 .use_clamp = use_clamp,
5830 .result_offset = compiler.
output(
"Result"),
5837 compiler.
add(
this,
"node_mix_vector_non_uniform");
5852 return use_clamp ==
false &&
input(
"Factor")->
link ==
nullptr;
5876CombineColorNode::CombineColorNode() :
ShaderNode(get_node_type()) {}
5890 .color_type = color_type,
5894 .color_offset = compiler.
output(
"Color"),
5901 compiler.
add(
this,
"node_combine_color");
5919CombineXYZNode::CombineXYZNode() :
ShaderNode(get_node_type()) {}
5932 NODE_COMBINE_VECTOR,
5936 .out_offset = vector_out,
5939 NODE_COMBINE_VECTOR,
5940 SVMNodeCombineVector{
5943 .out_offset = vector_out,
5946 NODE_COMBINE_VECTOR,
5947 SVMNodeCombineVector{
5950 .out_offset = vector_out,
5956 compiler.
add(
this,
"node_combine_xyz");
5972GammaNode::GammaNode() :
ShaderNode(get_node_type()) {}
5988 else if (folder.
is_one(gamma_in)) {
6001 .out_offset = compiler.
output(
"Color"),
6007 compiler.
add(
this,
"node_gamma");
6025BrightContrastNode::BrightContrastNode() :
ShaderNode(get_node_type()) {}
6037 NODE_BRIGHTCONTRAST,
6042 .out_offset = compiler.
output(
"Color"),
6048 compiler.
add(
this,
"node_brightness");
6072SeparateColorNode::SeparateColorNode() :
ShaderNode(get_node_type()) {}
6079 for (
int channel = 0; channel < 3; channel++) {
6091 NODE_SEPARATE_COLOR,
6093 .color_type = color_type,
6095 .red_offset = compiler.
output(
"Red"),
6096 .green_offset = compiler.
output(
"Green"),
6097 .blue_offset = compiler.
output(
"Blue"),
6104 compiler.
add(
this,
"node_separate_color");
6122SeparateXYZNode::SeparateXYZNode() :
ShaderNode(get_node_type()) {}
6127 for (
int channel = 0; channel < 3; channel++) {
6140 NODE_SEPARATE_VECTOR,
6142 .vector = vector_in,
6144 .out_offset = compiler.
output(
"X"),
6147 NODE_SEPARATE_VECTOR,
6148 SVMNodeSeparateVector{
6149 .vector = vector_in,
6151 .out_offset = compiler.
output(
"Y"),
6154 NODE_SEPARATE_VECTOR,
6155 SVMNodeSeparateVector{
6156 .vector = vector_in,
6158 .out_offset = compiler.
output(
"Z"),
6164 compiler.
add(
this,
"node_separate_xyz");
6181GetVectorComponentNode::GetVectorComponentNode() :
ShaderNode(get_node_type()) {}
6193 NODE_GET_VECTOR_COMPONENT,
6197 .out_offset = compiler.
output(
"Value"),
6203 compiler.
add(
this,
"node_get_vector_component");
6223HSVNode::HSVNode() :
ShaderNode(get_node_type()) {}
6235 .out_color_offset = compiler.
output(
"Color"),
6241 compiler.
add(
this,
"node_hsv");
6262AttributeNode::AttributeNode() :
ShaderNode(get_node_type()) {}
6267 if (!
output(
"Color")->links.empty() || !
output(
"Vector")->links.empty() ||
6268 !
output(
"Fac")->links.empty() || !
output(
"Alpha")->links.empty())
6299 if (!color_out->
links.empty() || !vector_out->
links.empty()) {
6300 if (!color_out->
links.empty()) {
6306 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
6307 .out_offset = compiler.
output(
"Color"),
6309 .bump_offset = bump_offset,
6310 .store_derivatives = store_derivatives,
6311 .bump_filter_width = bump_filter_or_stochastic,
6315 if (!vector_out->
links.empty()) {
6321 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
6322 .out_offset = compiler.
output(
"Vector"),
6324 .bump_offset = bump_offset,
6325 .store_derivatives = store_derivatives,
6326 .bump_filter_width = bump_filter_or_stochastic,
6332 if (!fac_out->
links.empty()) {
6338 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
6339 .out_offset = compiler.
output(
"Fac"),
6341 .bump_offset = bump_offset,
6342 .store_derivatives = store_derivatives,
6343 .bump_filter_width = bump_filter_or_stochastic,
6348 if (!alpha_out->
links.empty()) {
6354 .missing_alpha = compiler.
input_float(
"Missing Alpha"),
6355 .out_offset = compiler.
output(
"Alpha"),
6357 .bump_offset = bump_offset,
6358 .store_derivatives = store_derivatives,
6359 .bump_filter_width = bump_filter_or_stochastic,
6368 compiler.
parameter(
"bump_offset",
"dx");
6371 compiler.
parameter(
"bump_offset",
"dy");
6374 compiler.
parameter(
"bump_offset",
"center");
6380 compiler.
add(
this,
"node_attribute");
6396CameraNode::CameraNode() :
ShaderNode(get_node_type()) {}
6403 .vector_offset = compiler.
output(
"View Vector"),
6404 .zdepth_offset = compiler.
output(
"View Z Depth"),
6405 .distance_offset = compiler.
output(
"View Distance"),
6411 compiler.
add(
this,
"node_camera");
6429FresnelNode::FresnelNode() :
ShaderNode(get_node_type()) {}
6437 .normal_offset = compiler.
input_link(
"Normal"),
6438 .out_offset = compiler.
output(
"Fac"),
6444 compiler.
add(
this,
"node_fresnel");
6463LayerWeightNode::LayerWeightNode() :
ShaderNode(get_node_type()) {}
6467 ShaderOutput *fresnel_out =
output(
"Fresnel");
6468 ShaderOutput *facing_out =
output(
"Facing");
6470 if (!fresnel_out->
links.empty()) {
6476 .normal_offset = compiler.
input_link(
"Normal"),
6477 .out_offset = compiler.
output(
"Fresnel"),
6481 if (!facing_out->
links.empty()) {
6487 .normal_offset = compiler.
input_link(
"Normal"),
6488 .out_offset = compiler.
output(
"Facing"),
6495 compiler.
add(
this,
"node_layer_weight");
6511WireframeNode::WireframeNode() :
ShaderNode(get_node_type()) {}
6527 .use_pixel_size = use_pixel_size,
6528 .bump_offset = bump_offset,
6529 .out_fac_offset = compiler.
output(
"Fac"),
6536 compiler.
parameter(
"bump_offset",
"dx");
6539 compiler.
parameter(
"bump_offset",
"dy");
6542 compiler.
parameter(
"bump_offset",
"center");
6546 compiler.
parameter(
this,
"use_pixel_size");
6547 compiler.
add(
this,
"node_wireframe");
6562WavelengthNode::WavelengthNode() :
ShaderNode(get_node_type()) {}
6570 .color_offset = compiler.
output(
"Color"),
6576 compiler.
add(
this,
"node_wavelength");
6591BlackbodyNode::BlackbodyNode() :
ShaderNode(get_node_type()) {}
6607 .temperature = compiler.
input_float(
"Temperature"),
6608 .color_offset = compiler.
output(
"Color"),
6614 compiler.
add(
this,
"node_blackbody");
6631OutputNode::OutputNode() :
ShaderNode(get_node_type())
6639 ShaderInput *displacement_in =
input(
"Displacement");
6641 if (displacement_in->
link) {
6643 NODE_SET_DISPLACEMENT,
6644 SVMNodeSetDisplacement{.fac_offset = compiler.
input_link(
"Displacement")});
6652 compiler.
add(
this,
"node_output_surface");
6655 compiler.
add(
this,
"node_output_volume");
6658 compiler.
add(
this,
"node_output_displacement");
6688MapRangeNode::MapRangeNode() :
ShaderNode(get_node_type()) {}
6694 if (!result_out->
links.empty()) {
6697 graph->
relink(result_out, clamp_node->
output(
"Result"));
6698 graph->
connect(result_out, clamp_node->
input(
"Value"));
6699 if (
input(
"To Min")->link) {
6703 clamp_node->set_min(to_min);
6705 if (
input(
"To Max")->link) {
6709 clamp_node->set_max(to_max);
6729 .range_type = range_type,
6736 .result_offset = compiler.
output(
"Result"),
6743 compiler.
add(
this,
"node_map_range");
6772VectorMapRangeNode::VectorMapRangeNode() :
ShaderNode(get_node_type()) {}
6781 return input(
"From_Min_FLOAT3")->
link ==
nullptr &&
input(
"From_Max_FLOAT3")->
link ==
nullptr &&
6788 NODE_VECTOR_MAP_RANGE,
6790 .range_type = range_type,
6791 .use_clamp = use_clamp,
6798 .result_offset = compiler.
output(
"Vector"),
6806 compiler.
add(
this,
"node_vector_map_range");
6829ClampNode::ClampNode() :
ShaderNode(get_node_type()) {}
6848 .clamp_type = clamp_type,
6852 .result_offset = compiler.
output(
"Result"),
6859 compiler.
add(
this,
"node_clamp");
6876OutputAOVNode::OutputAOVNode() :
ShaderNode(get_node_type())
6982MathNode::MathNode() :
ShaderNode(get_node_type()) {}
6988 if (!result_out->
links.empty()) {
6991 clamp_node->set_min(0.0f);
6992 clamp_node->set_max(1.0f);
6993 graph->
relink(result_out, clamp_node->
output(
"Result"));
6994 graph->
connect(result_out, clamp_node->
input(
"Value"));
7011 switch (math_type) {
7018 return input(
"Value2")->
link ==
nullptr;
7023 int num_variable_inputs = 0;
7025 num_variable_inputs += (
input->
link) ? 1 : 0;
7027 return num_variable_inputs <= 1;
7035 .math_type = math_type,
7039 .result_offset = compiler.
output(
"Value"),
7046 compiler.
add(
this,
"node_math");
7075BooleanMathNode::BooleanMathNode() :
ShaderNode(get_node_type()) {}
7091 .math_type = math_type,
7092 .value1 = compiler.
input_int(
"Boolean1"),
7093 .value2 = compiler.
input_int(
"Boolean2"),
7094 .result_offset = compiler.
output(
"Boolean"),
7101 compiler.
add(
this,
"node_boolean_math");
7140IntegerMathNode::IntegerMathNode() :
ShaderNode(get_node_type()) {}
7154 .math_type = math_type,
7158 .result_offset = compiler.
output(
"Value"),
7165 compiler.
add(
this,
"node_integer_math");
7223VectorMathNode::VectorMathNode() :
ShaderNode(get_node_type()) {}
7246 switch (math_type) {
7253 return input(
"Vector2")->
link ==
nullptr;
7258 int num_variable_inputs = 0;
7260 num_variable_inputs += (
input->
link) ? 1 : 0;
7262 return num_variable_inputs <= 1;
7270 .math_type = math_type,
7275 .value_offset = compiler.
output(
"Value"),
7276 .vector_offset = compiler.
output(
"Vector"),
7283 compiler.
add(
this,
"node_vector_math");
7312VectorRotateNode::VectorRotateNode() :
ShaderNode(get_node_type()) {}
7318 SVMNodeVectorRotate{
7319 .rotate_type = rotate_type,
7326 .result_offset = compiler.
output(
"Vector"),
7332 compiler.
parameter(
this,
"rotate_type");
7334 compiler.
add(
this,
"node_vector_rotate");
7362VectorTransformNode::VectorTransformNode() :
ShaderNode(get_node_type()) {}
7367 NODE_VECTOR_TRANSFORM,
7368 SVMNodeVectorTransform{
7369 .transform_type = transform_type,
7370 .convert_from = convert_from,
7371 .convert_to = convert_to,
7373 .vector_out_offset = compiler.
output(
"Vector"),
7379 compiler.
parameter(
this,
"transform_type");
7380 compiler.
parameter(
this,
"convert_from");
7382 compiler.
add(
this,
"node_vector_transform");
7411BumpNode::BumpNode() :
ShaderNode(get_node_type())
7420 SVMNodeSetBump{.scale = compiler.
input_float(
"Distance"),
7422 .bump_filter_width = filter_width,
7423 .normal_offset = compiler.
input_link(
"Normal"),
7425 .use_object_space = use_object_space,
7426 .center_offset = compiler.
input_link(
"SampleCenter"),
7429 .out_offset = compiler.
output(
"Normal"),
7436 compiler.
parameter(
this,
"use_object_space");
7437 compiler.
add(
this,
"node_bump");
7444 if (
input(
"Height")->link ==
nullptr) {
7445 if (normal_in->
link ==
nullptr) {
7466 if (
curves.size() == 0) {
7480 else if (!
input(
"Fac")->link && fac == 0.0f) {
7488 if (
curves.size() == 0) {
7498 .table_size = uint(
curves.size()),
7499 .extrapolate = extrapolate,
7500 .out_offset = compiler.
output(value_out->
name().c_str())});
7501 for (
int i = 0; i <
curves.size(); i++) {
7508 if (
curves.size() == 0) {
7515 compiler.
parameter(
this,
"extrapolate");
7548RGBCurvesNode::RGBCurvesNode() :
CurvesNode(get_node_type()) {}
7584VectorCurvesNode::VectorCurvesNode() :
CurvesNode(get_node_type()) {}
7620FloatCurveNode::FloatCurveNode() :
ShaderNode(get_node_type()) {}
7627 if (curve.size() == 0) {
7631 const float pos = (value - min_x) / (max_x - min_x);
7632 const float result =
float_ramp_lookup(curve.data(), pos,
true, extrapolate, curve.size());
7637 else if (!
input(
"Factor")->link && fac == 0.0f) {
7645 if (curve.size() == 0) {
7656 .table_size =
uint(curve.size()),
7657 .extrapolate = extrapolate,
7658 .out_offset = compiler.
output(
"Value"),
7660 for (
int i = 0; i < curve.size(); i++) {
7667 if (curve.size() == 0) {
7674 compiler.
parameter(
this,
"extrapolate");
7675 compiler.
add(
this,
"node_float_curve");
7696RGBRampNode::RGBRampNode() :
ShaderNode(get_node_type()) {}
7700 if (ramp.size() == 0 || ramp.size() != ramp_alpha.size()) {
7705 const float f =
clamp(fac, 0.0f, 1.0f) * (ramp.size() - 1);
7708 const int i =
clamp((
int)f, 0, ramp.size() - 1);
7709 const float t = f - (
float)i;
7719 ramp_alpha.data(), fac, use_lerp,
false, ramp_alpha.size());
7727 if (ramp.size() == 0 || ramp.size() != ramp_alpha.size()) {
7733 SVMNodeRGBRamp{.table_size =
uint(ramp.size()),
7736 .color_offset = compiler.
output(
"Color"),
7737 .alpha_offset = compiler.
output(
"Alpha")});
7738 for (
int i = 0; i < ramp.size(); i++) {
7745 if (ramp.size() == 0 || ramp.size() != ramp_alpha.size()) {
7750 compiler.
parameter_array(
"ramp_alpha", ramp_alpha.data(), ramp_alpha.size());
7751 compiler.
parameter(
this,
"interpolate");
7753 compiler.
add(
this,
"node_rgb_ramp");
7768SetNormalNode::SetNormalNode() :
ShaderNode(get_node_type()) {}
7773 NODE_CLOSURE_SET_NORMAL,
7774 SVMNodeClosureSetNormal{
7775 .direction_offset = compiler.
input_link(
"Direction"),
7776 .normal_offset = compiler.
output(
"Normal"),
7782 compiler.
add(
this,
"node_set_normal");
7790 has_emission =
false;
7830 char *node_memory = (
char *)
operator new(node_size + inputs_size);
7831 memset(node_memory, 0, node_size + inputs_size);
7837 memcpy(node_memory + node_size, (
char *)from + node_size, inputs_size);
7847 const size_t num_inputs =
type->
inputs.size();
7855 const size_t offset = memory - (
char *)
this;
7914NormalMapNode::NormalMapNode() :
ShaderNode(get_node_type()) {}
7941 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent_sign").c_str()));
7953 int attr_sign_id = 0;
7968 attr_id = compiler.
attribute(ustring((
string(
attribute.c_str()) +
".tangent").c_str()));
7970 ustring((
string(
attribute.c_str()) +
".tangent_sign").c_str()));
7974 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent").c_str()));
7976 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent_sign").c_str()));
7988 .attr_sign = attr_sign_id,
7989 .color = compiler.input_float3(
"Color"),
7990 .strength = compiler.input_float(
"Strength"),
7991 .normal_offset = compiler.
output(
"Normal"),
7998 std::string attr_name, attr_sign_name;
8002 attr_name =
"geom:tangent";
8003 attr_sign_name =
"geom:tangent_sign";
8006 attr_name =
"geom:undisplaced_tangent";
8007 attr_sign_name =
"geom:undisplaced_tangent_sign";
8012 attr_name = string(
attribute.c_str()) +
".tangent";
8013 attr_sign_name = string(
attribute.c_str()) +
".tangent_sign";
8016 attr_name = string(
attribute.c_str()) +
".undisplaced_tangent";
8017 attr_sign_name = string(
attribute.c_str()) +
".undisplaced_tangent_sign";
8021 compiler.
parameter(
"attr_name", attr_name.c_str());
8022 compiler.
parameter(
"attr_sign_name", attr_sign_name.c_str());
8028 compiler.
add(
this,
"node_normal_map");
8050RadialTilingNode::RadialTilingNode() :
ShaderNode(get_node_type()) {}
8056 SVMNodeRadialTiling{
8059 .r_gon_roundness = compiler.
input_float(
"Roundness"),
8060 .normalize_r_gon_parameter = use_normalize,
8061 .segment_coordinates_offset = compiler.
output(
"Segment Coordinates"),
8062 .segment_id_offset = compiler.
output(
"Segment ID"),
8063 .max_unit_parameter_offset = compiler.
output(
"Segment Width"),
8064 .x_axis_A_angle_bisector_offset = compiler.
output(
"Segment Rotation"),
8070 compiler.
parameter(
this,
"use_normalize");
8071 compiler.
add(
this,
"node_radial_tiling");
8080 static NodeEnum direction_type_enum;
8098TangentNode::TangentNode() :
ShaderNode(get_node_type()) {}
8131 attr = compiler.
attribute(ustring((
string(
attribute.c_str()) +
".tangent").c_str()));
8141 .direction_type = direction_type,
8144 .tangent_offset = compiler.
output(
"Tangent"),
8152 compiler.
parameter(
"attr_name", ustring(
"geom:tangent"));
8155 compiler.
parameter(
"attr_name", ustring((
string(
attribute.c_str()) +
".tangent").c_str()));
8159 compiler.
parameter(
this,
"direction_type");
8161 compiler.
add(
this,
"node_tangent");
8180BevelNode::BevelNode() :
ShaderNode(get_node_type()) {}
8188 .num_samples =
uint8_t(samples),
8189 .normal_offset = compiler.
input_link(
"Normal"),
8190 .out_offset = compiler.
output(
"Normal"),
8197 compiler.
add(
this,
"node_bevel");
8222DisplacementNode::DisplacementNode() :
ShaderNode(get_node_type()) {}
8227 if ((height - midlevel == 0.0f) || (
scale == 0.0f)) {
8241 .normal_offset = compiler.
input_link(
"Normal"),
8242 .out_offset = compiler.
output(
"Displacement")});
8248 compiler.
add(
this,
"node_displacement");
8274VectorDisplacementNode::VectorDisplacementNode() :
ShaderNode(get_node_type()) {}
8315 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent").c_str()));
8317 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent_sign").c_str()));
8323 NODE_VECTOR_DISPLACEMENT,
8324 SVMNodeVectorDisplacement{.space = space,
8329 .attr_sign = attr_sign,
8330 .displacement_offset = compiler.
output(
"Displacement")});
8337 compiler.
parameter(
"attr_name", ustring(
"geom:undisplaced_tangent"));
8338 compiler.
parameter(
"attr_sign_name", ustring(
"geom:undisplaced_tangent_sign"));
8342 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent").c_str()));
8345 ustring((
string(
attribute.c_str()) +
".undisplaced_tangent_sign").c_str()));
8350 compiler.
add(
this,
"node_vector_displacement");
8358 switch (attribute_output_type) {
8366 LOG_DFATAL <<
"Invalid attribute output type " << int(attribute_output_type);
8373 switch (attribute_output_type) {
8381 LOG_DFATAL <<
"Invalid attribute output type " << int(attribute_output_type);
8409 direction(other.direction),
8411 only_local(other.only_local)
8413 for (
const AttributeOutput &other_attribute_output : other.attribute_outputs_) {
8415 assert(output(other_attribute_output.socket_id) == nullptr);
8417 add_output_attribute_socket(other_attribute_output.attribute_name,
8418 other_attribute_output.attribute_output_type,
8419 other_attribute_output.socket_id);
8425 for (
const AttributeOutput &attribute_output : attribute_outputs_) {
8434 const ustring socket_id)
8441 const AttributeOutput attribute_output = {
8442 .attribute_name = attribute_name,
8443 .attribute_output_type = attribute_output_type,
8444 .socket_id = socket_id,
8446 attribute_outputs_.push_back(attribute_output);
8448 auto socket_type = std::make_unique<SocketType>();
8449 socket_type->name = socket_id;
8450 socket_type->type =
type;
8452 socket_type->ui_name = socket_id;
8454 auto shader_output = std::make_unique<ShaderOutput>(*socket_type.get(),
this);
8457 socket_types_.push_back(std::move(socket_type));
8462 uint num_linked_attributes = 0;
8463 for (
const auto &attribute_output : attribute_outputs_) {
8464 assert(num_linked_attributes < std::numeric_limits<uint16_t>::max() - 1);
8465 if (!
output(attribute_output.socket_id)->
links.empty()) {
8466 ++num_linked_attributes;
8478 .only_local = only_local,
8479 .num_attributes =
uint16_t(num_linked_attributes),
8480 .is_hit_offset = compiler.
output(
"Is Hit"),
8481 .is_self_hit_offset = compiler.
output(
"Self Hit"),
8482 .hit_distance_offset = compiler.
output(
"Hit Distance"),
8483 .hit_position_offset = compiler.
output(
"Hit Position"),
8484 .hit_normal_offset = compiler.
output(
"Hit Normal"),
8487 for (
const auto &attribute_output : attribute_outputs_) {
8488 ShaderOutput *shader_output =
output(attribute_output.socket_id);
8489 if (shader_output->
links.empty()) {
8498 .missing = SVMInputFloat3{{0}, {0}, {0}},
8500 .out_offset = compiler.
output(shader_output),
8503 .store_derivatives =
false,
8504 .bump_filter_width = 0.0f,
8512 array<ustring> float_attribute_names;
8513 array<ustring> alpha_attribute_names;
8514 array<ustring> vector_attribute_names;
8515 for (
const auto &attribute_output : attribute_outputs_) {
8516 switch (attribute_output.attribute_output_type) {
8518 float_attribute_names.
push_back_slow(attribute_output.attribute_name);
8521 alpha_attribute_names.
push_back_slow(attribute_output.attribute_name);
8524 vector_attribute_names.
push_back_slow(attribute_output.attribute_name);
8534 compiler.
add(
this,
"node_raycast");
8536 int float_attr_index = 0;
8537 int alpha_attr_index = 0;
8538 int vector_attr_index = 0;
8539 for (
const auto &attribute_output : attribute_outputs_) {
8540 switch (attribute_output.attribute_output_type) {
8542 compiler.
parameter(
"attribute_index", float_attr_index);
8544 "node_raycast_attr_float",
8548 attribute_output.socket_id);
8552 compiler.
parameter(
"attribute_index", alpha_attr_index);
8554 "node_raycast_attr_float",
8558 attribute_output.socket_id);
8562 compiler.
parameter(
"attribute_index", vector_attr_index);
8564 "node_raycast_attr_vector",
8565 "vector_attributes",
8566 "vector_attributes",
8568 attribute_output.socket_id);
8569 ++vector_attr_index;
8587SceneTimeNode::SceneTimeNode() :
ShaderNode(get_node_type())
8596 SVMNodeSceneTime{.seconds_out = compiler.
output(
"Seconds"),
8597 .frame_out = compiler.
output(
"Frame")});
8602 compiler.
add(
this,
"node_scene_time");
CCL_NAMESPACE_BEGIN ccl_device int svm_boolean_math(const NodeBooleanMathType type, const int a_int, const int b_int)
ccl_device_inline float bsdf_thin_glass_transmission_alpha(const float alpha, const float eta)
ccl_device_forceinline bool alpha_is_almost_specular(const float alpha_x, const float alpha_y)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void constant_fold(const ConstantFolder &folder) override
ShaderNodeType shader_node_type() const override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void add_name_or_standard(ustring name)
static ustring osl_name(AttributeStandard std)
static const char * standard_name(AttributeStandard std)
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
BsdfBaseNode(const NodeType *node_type)
BsdfNode(const NodeType *node_type)
void compile(SVMCompiler &compiler, const T &data)
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
static bool colorspace_is_data(ustring colorspace)
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
void bypass(ShaderOutput *output) const
void bypass_or_discard(ShaderInput *input) const
void fold_mapping(NodeMappingType type) const
void fold_mix_float(bool clamp_factor, bool clamp) const
bool all_inputs_constant() const
bool try_bypass_or_make_constant(ShaderInput *input, bool clamp=false) const
bool is_zero(ShaderInput *input) const
bool is_one(ShaderInput *input) const
void fold_math(NodeMathType type) const
void make_constant(const float value) const
ShaderOutput *const output
void fold_mix(NodeMix type, bool clamp) const
void make_constant_clamp(const float value, bool clamp) const
void fold_vector_math(NodeVectorMathType type) const
void fold_mix_color(NodeMix type, bool clamp_factor, bool clamp) const
void constant_fold(const ConstantFolder &folder) override
ConvertNode(SocketType::Type from, SocketType::Type to, bool autoconvert=false)
NodeConvert convert_type()
void compile(SVMCompiler &compiler, ShaderInput *value_in, ShaderOutput *value_out)
CurvesNode(const NodeType *node_type)
void constant_fold(const ConstantFolder &folder, ShaderInput *value_in)
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
ShaderNode * clone(ShaderGraph *graph) const override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void update_images(const SVMCompiler &compiler) override
ImageParams image_params() const
int get_aov_offset(Scene *scene, string name, bool &is_color)
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
ShaderNodeType shader_node_type() const override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
virtual void get_uv_tiles(ustring map, unordered_set< int > &tiles)=0
void constant_fold(const ConstantFolder &folder) override
void simplify_settings(Scene *scene) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void simplify_settings(Scene *scene) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
ShaderNode * clone(ShaderGraph *graph) const override
ImageMetaData metadata(Progress &progress)
bool all_udim_tiled(Progress &progress)
ImageHandle add_image(const string &filename, const ImageParams ¶ms)
bool get_use_texture_cache() const
bool get_auto_texture_cache() const
ImageAlphaType alpha_type
InterpolationType interpolation
void update_images(const SVMCompiler &compiler) override
ImageParams image_params() const
void cull_tiles(Scene *scene, ShaderGraph *graph)
ShaderNode * clone(ShaderGraph *graph) const override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
ShaderNodeType shader_node_type() const override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
int add_ies_from_file(const string &filename)
bool is_linear_operation() override
void expand(ShaderGraph *graph) override
void constant_fold(const ConstantFolder &folder) override
void expand(ShaderGraph *graph) override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void parameter_array(const char *name, const float f[], int arraylen)
void add_output_converter(const ShaderNode *node, string_view converter_name, string_view node_output_parameter, string_view converter_input_parameter, string_view converter_output_parameter, string_view shader_output_parameter)
void add(ShaderNode *node, const char *name, bool isfilepath=false)
void parameter_color_array(const char *name, const array< packed_float3 > &f)
void parameter(ShaderNode *node, const char *name)
void parameter_texture(const char *name, const ImageHandle &handle)
void parameter_texture_ies(const char *name, const int svm_slot)
void parameter_string_array(const char *name, const array< ustring > &a)
ShaderGraph * current_graph
void parameter_attribute(const char *name, ustring s)
void parameter_color(const char *name, const float3 f)
void add_input(ustring name, SocketType::Type type, const int flags=0)
static OSLNode * create(ShaderGraph *graph, const size_t num_inputs, const OSLNode *from=nullptr)
void add_output(ustring name, SocketType::Type type)
ShaderNode * clone(ShaderGraph *graph) const override
char * input_default_value()
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void simplify_settings(Scene *scene) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
bool subsurface_has_positive_weight()
void attributes(Shader *shader, AttributeRequestSet *attributes) override
bool has_dispersion() override
bool has_surface_bssrdf() override
void simplify_settings(Scene *scene) override
bool has_nonzero_weight(const char *name)
bool has_surface_transparent() override
bool has_bssrdf_bump() override
bool has_surface_emission() override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
bool has_surface_transparent() override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
RaycastNode(const RaycastNode &other)
void global_attributes(Shader *shader, AttributeRequestSet *attributes) override
void add_output_attribute_socket(ustring attribute_name, AttributeOutputType attribute_output_type, ustring socket_id)
@ ATTR_OUTPUT_FLOAT_ALPHA
ShaderGraph * current_graph
SVMStackOffset input_link(const char *name)
SVMStackOffset output(const char *name)
SVMInputFloat input_float(const char *name)
void add_value_node(ShaderNode *shader_node, const float value, const int stack_offset)
void add_node_data(const T &data)
void add_bsdf_node(const SVMNodeClosureBsdf &node, const T &data)
SVMStackOffset stack_find_offset(const ShaderIO *io)
void add_node(ShaderNodeType type)
SVMStackOffset closure_mix_weight_offset()
uint attribute_standard(ustring name)
void stack_link(ShaderInput *input, ShaderOutput *output)
void add_node_data_float(const float f)
void add_node_data_float4(const float4 &f)
SVMInputInt input_int(const char *name)
uint attribute(ustring name)
SVMStackOffset get_bump_state_offset()
SVMStackOffset stack_assign(ShaderInput *input)
SVMInputFloat3 input_float3(const char *name)
void stack_clear_offset(const ShaderIO *io, const SVMStackOffset offset)
SVMInputFloat3 input_float3_from_offset(SVMStackOffset offset)
ScatterVolumeNode(const NodeType *node_type)
unique_ptr< LightManager > light_manager
unique_ptr_vector< Geometry > geometry
unique_ptr< ShaderManager > shader_manager
unique_ptr< ImageManager > image_manager
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
T * create_node(Args &&...args)
void connect(ShaderOutput *from, ShaderInput *to)
void relink(ShaderInput *from, ShaderInput *to)
T * create_osl_node(void *node_memory, Args &&...args)
const SocketType & socket_type
SocketType::Type type() const
ShaderInput * input(const char *name)
bool need_derivatives() const
ShaderNodeSpecialType special_type
void set_need_derivatives(const bool need_derivatives=true)
virtual void global_attributes(Shader *shader, AttributeRequestSet *attributes)
void disconnect_unused_input(const char *name)
ShaderNode(const NodeType *type)
unique_ptr_vector< ShaderInput > inputs
ShaderOutput * output(const char *name)
virtual void compile(SVMCompiler &compiler)=0
virtual void attributes(Shader *shader, AttributeRequestSet *attributes)
unique_ptr_vector< ShaderOutput > outputs
vector< ShaderInput * > links
bool has_surface_link() const
NODE_DECLARE unique_ptr< ShaderGraph > graph
void simplify_settings(Scene *scene) override
float get_sun_average_radiance()
bool has_bssrdf_bump() override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
ShaderNodeType shader_node_type() const override
SVMStackOffset compile_begin(SVMCompiler &compiler, ShaderInput *vector_in, ShaderNode *node)
Transform compute_transform()
void compile(SVMCompiler &compiler, const SVMStackOffset offset_in, const SVMStackOffset offset_out, ShaderNode *node)
void compile_end(SVMCompiler &compiler, ShaderInput *vector_in, const SVMStackOffset vector_offset)
TextureMapping tex_mapping
void attributes(Shader *shader, AttributeRequestSet *attributes) override
ShaderNodeType shader_node_type() const override
void constant_fold(const ConstantFolder &folder) override
void constant_fold(const ConstantFolder &folder) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void expand(ShaderGraph *graph) override
void constant_fold(const ConstantFolder &folder) override
bool is_linear_operation() override
void expand(ShaderGraph *graph) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void attributes(Shader *shader, AttributeRequestSet *attributes) override
void expand(ShaderGraph *graph) override
void compile(SVMCompiler &compiler, ShaderInput *density, ShaderInput *param1=nullptr, ShaderInput *param2=nullptr)
VolumeNode(const NodeType *node_type)
void push_back_slow(const T &t)
void push_back(unique_ptr< T > &&value)
ccl_device float3 svm_separate_color(NodeCombSepColorType type, const float3 color)
ccl_device_noinline_cpu float3 svm_mix(NodeMix type, const float t, const float3 c1, const float3 c2)
ccl_device float3 svm_combine_color(NodeCombSepColorType type, const float3 color)
ccl_device_noinline_cpu float3 svm_mix_clamped_factor(NodeMix type, const float t, const float3 c1, const float3 c2)
ccl_device_inline float3 svm_brightness_contrast(float3 color, const float brightness, const float contrast)
CCL_NAMESPACE_BEGIN ustring u_colorspace_auto
#define SVM_STACK_INVALID
#define CCL_NAMESPACE_END
#define CLOSURE_WEIGHT_CUTOFF
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
#define assert(assertion)
float dot(VecOp< float, D >, VecOp< float, D >) RET
float distance(float, float) RET
constexpr T clamp(T, U, U) RET
float length(VecOp< float, D >) RET
VecBase< float, 3 > float3
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
float sky_perez_function(float4 lam03, float lam4, float theta, float gamma)
float3 sky_spherical_coordinates(float3 dir)
float2x2 invert(float2x2 mat)
float3x3 scale(float3x3 mat, float2 scale)
Quaternion interpolate(Quaternion a, Quaternion b, float t)
float reduce_max(float2 a)
ccl_device int svm_integer_math(const NodeIntegerMathType type, const int a, const int b, const int c)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
const ccl_global KernelWorkTile * tile
@ NODE_INFO_POINT_POSITION
@ NODE_NORMAL_MAP_BASE_DISPLACED
@ NODE_NORMAL_MAP_BASE_ORIGINAL
@ NODE_VECTOR_TRANSFORM_TYPE_NORMAL
@ NODE_VECTOR_TRANSFORM_TYPE_VECTOR
@ NODE_VECTOR_TRANSFORM_TYPE_POINT
@ NODE_ATTR_OUTPUT_FLOAT_ALPHA
@ NODE_ATTR_OUTPUT_FLOAT3
@ NODE_VECTOR_ROTATE_TYPE_AXIS
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Z
@ NODE_VECTOR_ROTATE_TYPE_AXIS_X
@ NODE_VECTOR_ROTATE_TYPE_EULER_XYZ
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Y
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
@ NODE_BUMP_OFFSET_CENTER
@ NODE_INFO_PAR_ANGULAR_VELOCITY
@ NODE_INFO_CURVE_IS_STRAND
@ NODE_INFO_CURVE_TANGENT_NORMAL
@ NODE_INFO_CURVE_THICKNESS
@ CLOSURE_VOLUME_RAYLEIGH_ID
@ CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID
@ CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID
@ CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID
@ CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID
@ CLOSURE_BSDF_DIFFUSE_ID
@ CLOSURE_BSSRDF_BURLEY_ID
@ CLOSURE_BSDF_PRINCIPLED_ID
@ CLOSURE_BSDF_TRANSPARENT_ID
@ CLOSURE_BSDF_DIFFUSE_TOON_ID
@ CLOSURE_VOLUME_DRAINE_ID
@ CLOSURE_BSDF_MICROFACET_GGX_ID
@ CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID
@ CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID
@ CLOSURE_BSDF_HAIR_TRANSMISSION_ID
@ CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID
@ CLOSURE_VOLUME_FOURNIER_FORAND_ID
@ CLOSURE_BSSRDF_RANDOM_WALK_ID
@ CLOSURE_BSDF_PHYSICAL_CONDUCTOR
@ CLOSURE_BSDF_HAIR_HUANG_ID
@ CLOSURE_BSDF_MICROFACET_BECKMANN_ID
@ CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID
@ CLOSURE_BSDF_F82_CONDUCTOR
@ CLOSURE_BSSRDF_RANDOM_WALK_LEGACY_ID
@ CLOSURE_BSDF_RAY_PORTAL_ID
@ CLOSURE_BSDF_GLOSSY_TOON_ID
@ CLOSURE_BSDF_HAIR_CHIANG_ID
@ CLOSURE_VOLUME_ABSORPTION_ID
@ CLOSURE_BSDF_HAIR_REFLECTION_ID
@ CLOSURE_BSSRDF_RANDOM_WALK_SKIN_ID
@ CLOSURE_BSDF_TRANSLUCENT_ID
@ CLOSURE_BSDF_ASHIKHMIN_VELVET_ID
@ NODE_BOOLEAN_MATH_IMPLY
@ NODE_BOOLEAN_MATH_NIMPLY
@ SHADER_TYPE_DISPLACEMENT
@ NODE_VORONOI_N_SPHERE_RADIUS
@ NODE_VORONOI_DISTANCE_TO_EDGE
@ NODE_ENVIRONMENT_MIRROR_BALL
@ NODE_ENVIRONMENT_EQUIRECTANGULAR
@ NODE_BLEND_QUADRATIC_SPHERE
@ NODE_MATH_FLOORED_MODULO
@ NODE_INTEGER_MATH_ABSOLUTE
@ NODE_INTEGER_MATH_MODULO
@ NODE_INTEGER_MATH_POWER
@ NODE_INTEGER_MATH_MINIMUM
@ NODE_INTEGER_MATH_MULTIPLY_ADD
@ NODE_INTEGER_MATH_SUBTRACT
@ NODE_INTEGER_MATH_MULTIPLY
@ NODE_INTEGER_MATH_DIVIDE_FLOOR
@ NODE_INTEGER_MATH_DIVIDE_CEIL
@ NODE_INTEGER_MATH_NEGATE
@ NODE_INTEGER_MATH_MAXIMUM
@ NODE_INTEGER_MATH_FLOORED_MODULO
@ NODE_INTEGER_MATH_DIVIDE_ROUND
@ NODE_INTEGER_MATH_DIVIDE
@ NODE_LIGHT_FALLOFF_QUADRATIC
@ NODE_LIGHT_FALLOFF_LINEAR
@ NODE_LIGHT_FALLOFF_CONSTANT
@ NODE_SKY_SINGLE_SCATTERING
@ NODE_SKY_MULTIPLE_SCATTERING
@ NODE_PRINCIPLED_HAIR_CHIANG
@ NODE_PRINCIPLED_HAIR_HUANG
@ NODE_IMAGE_COMPRESS_AS_SRGB
@ NODE_IMAGE_ALPHA_UNASSOCIATE
@ NODE_LAYER_WEIGHT_FACING
@ NODE_LAYER_WEIGHT_FRESNEL
@ NODE_PRINCIPLED_HAIR_REFLECTANCE
@ NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION
@ NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
@ NODE_NOISE_HYBRID_MULTIFRACTAL
@ NODE_NOISE_RIDGED_MULTIFRACTAL
@ NODE_NOISE_HETERO_TERRAIN
@ NODE_NOISE_MULTIFRACTAL
@ NODE_WAVE_BANDS_DIRECTION_Z
@ NODE_WAVE_BANDS_DIRECTION_DIAGONAL
@ NODE_WAVE_BANDS_DIRECTION_Y
@ NODE_WAVE_BANDS_DIRECTION_X
@ NODE_NORMAL_MAP_CONVENTION_DIRECTX
@ NODE_NORMAL_MAP_CONVENTION_OPENGL
@ NODE_VECTOR_MATH_NORMALIZE
@ NODE_VECTOR_MATH_LENGTH
@ NODE_VECTOR_MATH_CROSS_PRODUCT
@ NODE_VECTOR_MATH_MODULO
@ NODE_VECTOR_MATH_COSINE
@ NODE_VECTOR_MATH_REFLECT
@ NODE_VECTOR_MATH_REFRACT
@ NODE_VECTOR_MATH_DOT_PRODUCT
@ NODE_VECTOR_MATH_ABSOLUTE
@ NODE_VECTOR_MATH_DIVIDE
@ NODE_VECTOR_MATH_TANGENT
@ NODE_VECTOR_MATH_DISTANCE
@ NODE_VECTOR_MATH_FRACTION
@ NODE_VECTOR_MATH_PROJECT
@ NODE_VECTOR_MATH_MULTIPLY
@ NODE_VECTOR_MATH_MAXIMUM
@ NODE_VECTOR_MATH_FACEFORWARD
@ NODE_VECTOR_MATH_SUBTRACT
@ NODE_VECTOR_MATH_MULTIPLY_ADD
@ NODE_VECTOR_MATH_MINIMUM
@ NODE_WAVE_RINGS_DIRECTION_Y
@ NODE_WAVE_RINGS_DIRECTION_SPHERICAL
@ NODE_WAVE_RINGS_DIRECTION_X
@ NODE_WAVE_RINGS_DIRECTION_Z
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
@ NODE_TEXCO_VOLUME_GENERATED
@ NODE_TEXCO_OBJECT_WITH_TRANSFORM
@ NODE_TEXCO_DUPLI_GENERATED
@ NODE_NORMAL_MAP_TANGENT
@ NODE_NORMAL_MAP_BLENDER_WORLD
@ NODE_NORMAL_MAP_BLENDER_OBJECT
@ NODE_LP_ray_transmission
@ NODE_LP_ray_transparent
@ NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT
@ NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD
@ NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA
@ ATTR_STD_CURVE_INTERCEPT
@ ATTR_STD_GENERATED_TRANSFORM
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_NORMAL_UNDISPLACED
@ ATTR_STD_UV_TANGENT_SIGN
@ ATTR_STD_UV_TANGENT_SIGN_UNDISPLACED
@ ATTR_STD_UV_TANGENT_UNDISPLACED
@ ATTR_STD_RANDOM_PER_ISLAND
CCL_NAMESPACE_BEGIN ccl_device Float3Type svm_mapping(NodeMappingType type, const Float3Type vector, const float3 location, const float3 rotation, const float3 scale)
ccl_device_inline float signf(const float f)
ccl_device_inline float interp(const float a, const float b, const float t)
ccl_device_inline float3 one_float3()
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
ccl_device float svm_math(NodeMathType type, const float a, float b, const float c)
ccl_device float3 svm_math_blackbody_color_rec709(const float t)
ccl_device_inline float3 svm_math_gamma_color(float3 color, const float gamma)
CCL_NAMESPACE_BEGIN ccl_device void svm_vector_math(ccl_private FloatType *value, ccl_private Float3Type *vector, NodeVectorMathType type, const Float3Type a, const Float3Type b, const Float3Type c, const FloatType param1)
#define IMAGE_MISSING_RGB
std::string filename(const std::string_view &str, size_t pos)
BMesh const char void * data
color rgb_ramp_lookup(color ramp[], float at, int interpolate, int extrapolate)
static unordered_map< ustring, NodeType > & types()
#define SOCKET_IN_NORMAL(name, ui_name, default_value,...)
#define SOCKET_OUT_POINT(name, ui_name)
#define SOCKET_OUT_FLOAT(name, ui_name)
#define SOCKET_OUT_INT(name, ui_name)
#define SOCKET_OUT_COLOR(name, ui_name)
#define SOCKET_FLOAT(name, ui_name, default_value,...)
#define SOCKET_INT(name, ui_name, default_value,...)
#define SOCKET_IN_COLOR(name, ui_name, default_value,...)
#define SOCKET_FLOAT_ARRAY(name, ui_name, default_value,...)
#define SOCKET_TRANSFORM(name, ui_name, default_value,...)
#define SOCKET_OUT_NORMAL(name, ui_name)
#define SOCKET_IN_FLOAT(name, ui_name, default_value,...)
#define SOCKET_IN_CLOSURE(name, ui_name,...)
#define SOCKET_OFFSETOF(T, name)
#define SOCKET_INT_ARRAY(name, ui_name, default_value,...)
#define SOCKET_VECTOR_ARRAY(name, ui_name, default_value,...)
#define SOCKET_IN_VECTOR(name, ui_name, default_value,...)
#define NODE_DEFINE(structname)
#define SOCKET_VECTOR(name, ui_name, default_value,...)
#define SOCKET_IN_POINT(name, ui_name, default_value,...)
#define SOCKET_COLOR_ARRAY(name, ui_name, default_value,...)
#define SOCKET_COLOR(name, ui_name, default_value,...)
#define SOCKET_OUT_VECTOR(name, ui_name)
#define SOCKET_IN_STRING(name, ui_name, default_value,...)
#define SOCKET_BOOLEAN(name, ui_name, default_value,...)
#define SOCKET_IN_BOOLEAN(name, ui_name, default_value,...)
#define SOCKET_IN_INT(name, ui_name, default_value,...)
#define SOCKET_STRING(name, ui_name, default_value,...)
#define SOCKET_ENUM(name, ui_name, values, default_value,...)
#define SOCKET_OUT_CLOSURE(name, ui_name)
ccl_device_inline float float_ramp_lookup(KernelGlobals kg, const int offset, float f, bool interpolate, bool extrapolate, const int table_size)
@ SHADER_SPECIAL_TYPE_LIGHT_PATH
@ SHADER_SPECIAL_TYPE_PROXY
@ SHADER_SPECIAL_TYPE_GEOMETRY
@ SHADER_SPECIAL_TYPE_OUTPUT_AOV
@ SHADER_SPECIAL_TYPE_COMBINE_CLOSURE
@ SHADER_SPECIAL_TYPE_BUMP
@ SHADER_SPECIAL_TYPE_AUTOCONVERT
@ SHADER_SPECIAL_TYPE_SCENE_TIME
@ SHADER_SPECIAL_TYPE_OUTPUT
@ SHADER_SPECIAL_TYPE_CLOSURE
@ SHADER_SPECIAL_TYPE_OSL
static NodeBumpOffset shader_bump_to_node_bump_offset(ShaderBump bump)
static void sky_texture_precompute_hosek(SunSky *sunsky, const float3 dir, float turbidity, const float ground_albedo)
static NodeAttributeOutputType get_node_attribute_output_type(const RaycastNode::AttributeOutputType attribute_output_type)
static void sky_texture_precompute_preetham(SunSky *sunsky, const float3 dir, const float turbidity)
static void sky_texture_precompute_nishita(SunSky *sunsky, bool multiple_scattering, bool sun_disc, const float sun_size, const float sun_intensity, const float sun_elevation, const float sun_rotation, const float altitude, const float air_density, const float aerosol_density, const float ozone_density)
#define TEXTURE_MAPPING_DEFINE(TextureNode)
static SocketType::Type get_socket_type(const RaycastNode::AttributeOutputType attribute_output_type)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void SKY_arhosekskymodelstate_free(SKY_ArHosekSkyModelState *state)
SKY_ArHosekSkyModelState * SKY_arhosek_xyz_skymodelstate_alloc_init(const double turbidity, const double albedo, const double elevation)
float3 sun_direction(float sun_cos_theta)
void SKY_single_scattering_precompute_sun(float sun_elevation, float angular_diameter, float altitude, float air_density, float aerosol_density, float r_pixel_bottom[3], float r_pixel_top[3])
void SKY_multiple_scattering_precompute_sun(float sun_elevation, float angular_diameter, float altitude, float air_density, float aerosol_density, float ozone_density, float r_pixel_bottom[3], float r_pixel_top[3])
float SKY_earth_intersection_angle(float altitude)
bool string_endswith(const string_view s, const string_view end)
void insert(const char *x, const int y)
vector< SocketType, std::allocator< SocketType > > inputs
NodeType(Type type=NONE, const NodeType *base=nullptr)
static NodeType * add(const char *name, CreateFunc create, Type type=NONE, const NodeType *base=nullptr)
void register_input(ustring name, ustring ui_name, SocketType::Type type, const int struct_offset, const void *default_value, const NodeEnum *enum_values=nullptr, const NodeType *node_type=nullptr, int flags=0, int extra_flags=0)
static bool register_on_init(const NodeType *(*init_func)())
void register_output(ustring name, ustring ui_name, SocketType::Type type)
vector< SocketType, std::allocator< SocketType > > outputs
float get_float(const SocketType &input) const
SKY_ArHosekSkyModelConfiguration configs[11]
static bool is_float3(Type type)
static ustring type_name(Type type)
static void * zero_default_value()
ccl_device_inline size_t align_up(const size_t offset, const size_t alignment)
@ IMAGE_ALPHA_CHANNEL_PACKED
@ IMAGE_ALPHA_UNASSOCIATED
ustring u_colorspace_scene_linear