20#include "util/color.h"
36#define TEXTURE_MAPPING_DEFINE(TextureNode) \
37 SOCKET_POINT(tex_mapping.translation, "Translation", zero_float3()); \
38 SOCKET_VECTOR(tex_mapping.rotation, "Rotation", zero_float3()); \
39 SOCKET_VECTOR(tex_mapping.scale, "Scale", one_float3()); \
41 SOCKET_VECTOR(tex_mapping.min, "Min", make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX)); \
42 SOCKET_VECTOR(tex_mapping.max, "Max", make_float3(FLT_MAX, FLT_MAX, FLT_MAX)); \
43 SOCKET_BOOLEAN(tex_mapping.use_minmax, "Use Min Max", false); \
45 static NodeEnum mapping_axis_enum; \
46 mapping_axis_enum.insert("none", TextureMapping::NONE); \
47 mapping_axis_enum.insert("x", TextureMapping::X); \
48 mapping_axis_enum.insert("y", TextureMapping::Y); \
49 mapping_axis_enum.insert("z", TextureMapping::Z); \
50 SOCKET_ENUM(tex_mapping.x_mapping, "x_mapping", mapping_axis_enum, TextureMapping::X); \
51 SOCKET_ENUM(tex_mapping.y_mapping, "y_mapping", mapping_axis_enum, TextureMapping::Y); \
52 SOCKET_ENUM(tex_mapping.z_mapping, "z_mapping", mapping_axis_enum, TextureMapping::Z); \
54 static NodeEnum mapping_type_enum; \
55 mapping_type_enum.insert("point", TextureMapping::POINT); \
56 mapping_type_enum.insert("texture", TextureMapping::TEXTURE); \
57 mapping_type_enum.insert("vector", TextureMapping::VECTOR); \
58 mapping_type_enum.insert("normal", TextureMapping::NORMAL); \
59 SOCKET_ENUM(tex_mapping.type, "Type", mapping_type_enum, TextureMapping::TEXTURE); \
61 static NodeEnum mapping_projection_enum; \
62 mapping_projection_enum.insert("flat", TextureMapping::FLAT); \
63 mapping_projection_enum.insert("cube", TextureMapping::CUBE); \
64 mapping_projection_enum.insert("tube", TextureMapping::TUBE); \
65 mapping_projection_enum.insert("sphere", TextureMapping::SPHERE); \
66 SOCKET_ENUM(tex_mapping.projection, "Projection", mapping_projection_enum, TextureMapping::FLAT);
86 if (type == TEXTURE || type == NORMAL) {
88 if (
fabsf(scale.x) < 1e-5f) {
89 scale_clamped.
x =
signf(scale.x) * 1e-5f;
91 if (
fabsf(scale.y) < 1e-5f) {
92 scale_clamped.
y =
signf(scale.y) * 1e-5f;
94 if (
fabsf(scale.z) < 1e-5f) {
95 scale_clamped.
z =
signf(scale.z) * 1e-5f;
109 mat = tmat * rmat * smat;
114 mat = tmat * rmat * smat;
157 compiler.
add_node(NODE_TEXTURE_MAPPING, offset_in, offset_out);
165 compiler.
add_node(NODE_MIN_MAX, offset_out, offset_out);
170 if (type == NORMAL) {
186 compile(compiler, offset_in, offset_out);
249 SOCKET_FLOAT(projection_blend,
"Projection Blend", 0.0f);
266 tiles.push_back_slow(1001);
279 params.animated = animated;
280 params.interpolation = interpolation;
281 params.extension = extension;
282 params.alpha_type = alpha_type;
283 params.colorspace = colorspace;
293 tiles.push_back_slow(1001);
297 if (!scene->params.background) {
305 if (
tiles.size() < 2) {
311 if (vector_in->
link) {
313 if (node->type == UVMapNode::get_node_type()) {
315 attribute = uvmap->get_attribute();
317 else if (node->type == TextureCoordinateNode::get_node_type()) {
318 if (vector_in->
link != node->output(
"UV")) {
327 unordered_set<int> used_tiles;
331 foreach (
Geometry *geom, scene->geometry) {
332 foreach (
Node *node, geom->get_used_shaders()) {
334 if (shader->graph == graph) {
342 if (used_tiles.count(
tile)) {
346 tiles.steal_data(new_tiles);
370 if (handle.empty()) {
379 const ustring known_colorspace = metadata.
colorspace;
384 if (compress_as_srgb) {
387 if (!alpha_out->
links.empty()) {
392 if (unassociate_alpha) {
400 if (handle.num_tiles() == 1) {
401 num_nodes = -handle.svm_slot();
404 num_nodes =
divide_up(handle.num_tiles(), 2);
416 for (
int i = 0; i < num_nodes; i++) {
419 node.
y = handle.svm_slot(2 * i);
420 if (2 * i + 1 <
tiles.size()) {
421 node.z =
tiles[2 * i + 1];
422 node.
w = handle.svm_slot(2 * i + 1);
428 compiler.
add_node(node.x, node.y, node.z, node.w);
433 assert(handle.num_tiles() == 1);
434 compiler.
add_node(NODE_TEX_IMAGE_BOX,
452 if (handle.empty()) {
458 const bool is_float = metadata.
is_float();
460 const ustring known_colorspace = metadata.
colorspace;
462 if (handle.svm_slot() == -1) {
464 "filename", filename, compress_as_srgb ?
u_colorspace_raw : known_colorspace);
473 const bool is_tiled = (filename.find(
"<UDIM>") != string::npos ||
474 filename.find(
"<UVTILE>") != string::npos) ||
475 handle.num_tiles() > 1;
478 compiler.
parameter(
this,
"projection_blend");
479 compiler.
parameter(
"compress_as_srgb", compress_as_srgb);
481 compiler.
parameter(
"unassociate_alpha", !alpha_out->
links.empty() && unassociate_alpha);
482 compiler.
parameter(
"is_float", is_float);
483 compiler.
parameter(
"is_tiled", is_tiled);
484 compiler.
parameter(
this,
"interpolation");
487 compiler.
add(
this,
"node_image_texture");
547 params.animated = animated;
548 params.interpolation = interpolation;
550 params.alpha_type = alpha_type;
551 params.colorspace = colorspace;
574 if (handle.empty()) {
581 const ustring known_colorspace = metadata.
colorspace;
586 if (compress_as_srgb) {
590 compiler.
add_node(NODE_TEX_ENVIRONMENT,
603 if (handle.empty()) {
611 const bool is_float = metadata.
is_float();
613 const ustring known_colorspace = metadata.
colorspace;
615 if (handle.svm_slot() == -1) {
617 "filename", filename, compress_as_srgb ?
u_colorspace_raw : known_colorspace);
624 compiler.
parameter(
this,
"interpolation");
625 compiler.
parameter(
"compress_as_srgb", compress_as_srgb);
627 compiler.
parameter(
"is_float", is_float);
628 compiler.
add(
this,
"node_environment_texture");
650 return (1.0f + lam[0] *
expf(lam[1] /
cosf(theta))) *
651 (1.0f + lam[2] *
expf(lam[3] * gamma) + lam[4] *
cosf(gamma) *
cosf(gamma));
663 float theta = spherical.x;
664 float phi = spherical.y;
666 sunsky->
theta = theta;
669 float theta2 = theta * theta;
670 float theta3 = theta2 * theta;
674 float chi = (4.0f / 9.0f - T / 120.0f) * (
M_PI_F - 2.0f * theta);
675 sunsky->
radiance_x = (4.0453f * T - 4.9710f) *
tanf(chi) - 0.2155f * T + 2.4192f;
678 sunsky->
radiance_y = (0.00166f * theta3 - 0.00375f * theta2 + 0.00209f * theta) *
T2 +
679 (-0.02903f * theta3 + 0.06377f * theta2 - 0.03202f * theta + 0.00394f) * T +
680 (0.11693f * theta3 - 0.21196f * theta2 + 0.06052f * theta + 0.25886f);
682 sunsky->
radiance_z = (0.00275f * theta3 - 0.00610f * theta2 + 0.00317f * theta) *
T2 +
683 (-0.04214f * theta3 + 0.08970f * theta2 - 0.04153f * theta + 0.00516f) * T +
684 (0.15346f * theta3 - 0.26756f * theta2 + 0.06670f * theta + 0.26688f);
686 sunsky->
config_x[0] = (0.1787f * T - 1.4630f);
687 sunsky->
config_x[1] = (-0.3554f * T + 0.4275f);
688 sunsky->
config_x[2] = (-0.0227f * T + 5.3251f);
689 sunsky->
config_x[3] = (0.1206f * T - 2.5771f);
690 sunsky->
config_x[4] = (-0.0670f * T + 0.3703f);
692 sunsky->
config_y[0] = (-0.0193f * T - 0.2592f);
693 sunsky->
config_y[1] = (-0.0665f * T + 0.0008f);
694 sunsky->
config_y[2] = (-0.0004f * T + 0.2125f);
695 sunsky->
config_y[3] = (-0.0641f * T - 0.8989f);
696 sunsky->
config_y[4] = (-0.0033f * T + 0.0452f);
698 sunsky->
config_z[0] = (-0.0167f * T - 0.2608f);
699 sunsky->
config_z[1] = (-0.0950f * T + 0.0092f);
700 sunsky->
config_z[2] = (-0.0079f * T + 0.2102f);
701 sunsky->
config_z[3] = (-0.0441f * T - 1.6537f);
702 sunsky->
config_z[4] = (-0.0109f * T + 0.0529f);
705 for (
int i = 5; i < 9; i++) {
724 float theta = spherical.x;
725 float phi = spherical.y;
728 turbidity =
clamp(turbidity, 0.0f, 10.0f);
733 sunsky->
theta = theta;
736 float solarElevation =
M_PI_2_F - theta;
741 (
double)turbidity, (
double)ground_albedo, (
double)solarElevation);
744 for (
int i = 0; i < 9; ++i) {
769 float pixel_bottom[3];
772 sun_elevation, sun_size, altitude, air_density, dust_density, pixel_bottom, pixel_top);
789 float clamped_altitude =
clamp(altitude, 1.0f, 59999.0f);
803 float dir_elevation = sun_elevation;
804 float half_angular = angular_diameter / 2.0f;
811 if (sun_elevation - half_angular > 0.0f) {
812 if (sun_elevation + half_angular > 0.0f) {
813 y = ((dir_elevation - sun_elevation) / angular_diameter) + 0.5f;
814 xyz =
interp(pixel_bottom, pixel_top, y) * sun_intensity;
818 if (sun_elevation + half_angular > 0.0f) {
819 y = dir_elevation / (sun_elevation + half_angular);
820 xyz =
interp(pixel_bottom, pixel_top, y) * sun_intensity;
827 float sun_contribution =
average(xyz) *
sqr(angular_diameter);
829 float first_point = 0.8f / 180.0f *
M_PI_F;
830 float second_point = 1.0f / 180.0f *
M_PI_F;
832 if (angular_diameter < first_point) {
833 sun_contribution *= 1.0f;
835 else if (angular_diameter < second_point) {
836 float diff = angular_diameter - first_point;
837 float slope = (0.8f - 1.0f) / (second_point - first_point);
838 sun_contribution *= 1.0f + slope *
diff;
841 float diff = angular_diameter - 1.0f / 180.0f *
M_PI_F;
842 float slope = (0.45f - 0.8f) / (third_point - second_point);
843 sun_contribution *= 0.8f + slope *
diff;
846 return sun_contribution;
881SkyTextureNode::SkyTextureNode() :
TextureNode(get_node_type()) {}
887 float new_sun_elevation = sun_elevation;
888 float new_sun_rotation = sun_rotation;
898 new_sun_elevation =
copysignf(
M_PI_F, new_sun_elevation) - new_sun_elevation;
899 new_sun_rotation +=
M_PI_F;
905 if (new_sun_rotation < 0.0f) {
908 new_sun_rotation =
M_2PI_F - new_sun_rotation;
910 sun_elevation = new_sun_elevation;
911 sun_rotation = new_sun_rotation;
929 float clamped_altitude =
clamp(altitude, 1.0f, 59999.0f);
947 if (handle.empty()) {
949 sun_elevation, clamped_altitude, air_density, dust_density, ozone_density);
950 handle = image_manager->
add_image(loader, impar);
1028 float clamped_altitude =
clamp(altitude, 1.0f, 59999.0f);
1046 if (handle.empty()) {
1048 sun_elevation, clamped_altitude, air_density, dust_density, ozone_density);
1049 handle = image_manager->
add_image(loader, impar);
1069 compiler.
add(
this,
"node_sky_texture");
1098GradientTextureNode::GradientTextureNode() :
TextureNode(get_node_type()) {}
1108 compiler.
add_node(NODE_TEX_GRADIENT,
1121 compiler.
parameter(
this,
"gradient_type");
1122 compiler.
add(
this,
"node_gradient_texture");
1134 dimensions_enum.
insert(
"1D", 1);
1135 dimensions_enum.
insert(
"2D", 2);
1136 dimensions_enum.
insert(
"3D", 3);
1137 dimensions_enum.
insert(
"4D", 4);
1138 SOCKET_ENUM(dimensions,
"Dimensions", dimensions_enum, 3);
1166NoiseTextureNode::NoiseTextureNode() :
TextureNode(get_node_type()) {}
1197 vector_stack_offset, w_stack_offset, scale_stack_offset, detail_stack_offset),
1199 roughness_stack_offset, lacunarity_stack_offset, offset_stack_offset, gain_stack_offset),
1200 compiler.
encode_uchar4(distortion_stack_offset, fac_stack_offset, color_stack_offset));
1219 compiler.
parameter(
this,
"use_normalize");
1220 compiler.
add(
this,
"node_noise_texture");
1250GaborTextureNode::GaborTextureNode() :
TextureNode(get_node_type()) {}
1270 int orientation_3d_stack_offset = compiler.
stack_assign(orientation_3d_in);
1281 frequency_stack_offset,
1282 anisotropy_stack_offset),
1283 compiler.
encode_uchar4(orientation_2d_stack_offset, orientation_3d_stack_offset));
1286 compiler.
encode_uchar4(value_stack_offset, phase_stack_offset, intensity_stack_offset),
1299 compiler.
add(
this,
"node_gabor_texture");
1311 dimensions_enum.
insert(
"1D", 1);
1312 dimensions_enum.
insert(
"2D", 2);
1313 dimensions_enum.
insert(
"3D", 3);
1314 dimensions_enum.
insert(
"4D", 4);
1315 SOCKET_ENUM(dimensions,
"Dimensions", dimensions_enum, 3);
1353VoronoiTextureNode::VoronoiTextureNode() :
TextureNode(get_node_type()) {}
1388 compiler.
add_node(NODE_TEX_VORONOI, dimensions, feature, metric);
1391 vector_stack_offset, w_in_stack_offset, scale_stack_offset, detail_stack_offset),
1393 lacunarity_stack_offset,
1394 smoothness_stack_offset,
1395 exponent_stack_offset),
1397 randomness_stack_offset, use_normalize, distance_stack_offset, color_stack_offset),
1398 compiler.
encode_uchar4(position_stack_offset, w_out_stack_offset, radius_stack_offset));
1416 compiler.
parameter(
this,
"use_normalize");
1417 compiler.
add(
this,
"node_voronoi_texture");
1439IESLightNode::IESLightNode() :
TextureNode(get_node_type())
1441 light_manager =
NULL;
1449 node->light_manager =
NULL;
1457 if (light_manager) {
1462void IESLightNode::get_slot()
1464 assert(light_manager);
1471 slot = light_manager->
add_ies(ies.string());
1506 compiler.
add(
this,
"node_ies_light");
1516 dimensions_enum.
insert(
"1D", 1);
1517 dimensions_enum.
insert(
"2D", 2);
1518 dimensions_enum.
insert(
"3D", 3);
1519 dimensions_enum.
insert(
"4D", 4);
1520 SOCKET_ENUM(dimensions,
"Dimensions", dimensions_enum, 3);
1531WhiteNoiseTextureNode::WhiteNoiseTextureNode() :
ShaderNode(get_node_type()) {}
1540 int vector_stack_offset = compiler.
stack_assign(vector_in);
1542 int value_stack_offset = compiler.
stack_assign(value_out);
1543 int color_stack_offset = compiler.
stack_assign(color_out);
1545 compiler.
add_node(NODE_TEX_WHITE_NOISE,
1547 compiler.
encode_uchar4(vector_stack_offset, w_stack_offset),
1548 compiler.
encode_uchar4(value_stack_offset, color_stack_offset));
1554 compiler.
add(
this,
"node_white_noise_texture");
1570 static NodeEnum bands_direction_enum;
1578 static NodeEnum rings_direction_enum;
1605WaveTextureNode::WaveTextureNode() :
TextureNode(get_node_type()) {}
1631 compiler.
encode_uchar4(wave_type, bands_direction, rings_direction, profile),
1632 compiler.
encode_uchar4(vector_offset, scale_ofs, distortion_ofs),
1633 compiler.
encode_uchar4(detail_ofs, dscale_ofs, droughness_ofs, phase_ofs));
1653 compiler.
parameter(
this,
"bands_direction");
1654 compiler.
parameter(
this,
"rings_direction");
1657 compiler.
add(
this,
"node_wave_texture");
1680MagicTextureNode::MagicTextureNode() :
TextureNode(get_node_type()) {}
1709 compiler.
add(
this,
"node_magic_texture");
1731CheckerTextureNode::CheckerTextureNode() :
TextureNode(get_node_type()) {}
1745 compiler.
add_node(NODE_TEX_CHECKER,
1761 compiler.
add(
this,
"node_checker_texture");
1773 SOCKET_INT(offset_frequency,
"Offset Frequency", 2);
1775 SOCKET_INT(squash_frequency,
"Squash Frequency", 2);
1795BrickTextureNode::BrickTextureNode() :
TextureNode(get_node_type()) {}
1850 compiler.
parameter(
this,
"offset_frequency");
1852 compiler.
parameter(
this,
"squash_frequency");
1853 compiler.
add(
this,
"node_brick_texture");
1869 static NodeEnum interpolation_enum;
1886PointDensityTextureNode::PointDensityTextureNode() :
ShaderNode(get_node_type()) {}
1902 if (shader->has_volume) {
1912 params.interpolation = interpolation;
1922 const bool use_density = !density_out->
links.empty();
1923 const bool use_color = !color_out->
links.empty();
1925 if (!(use_density || use_color)) {
1941 if (handle.empty()) {
1946 const int slot = handle.
svm_slot();
1979 const bool use_density = !density_out->
links.empty();
1980 const bool use_color = !color_out->
links.empty();
1982 if (!(use_density || use_color)) {
1988 compiler.
add(
this,
"node_voxel_texture_zero");
1992 if (handle.empty()) {
2002 compiler.
parameter(
this,
"interpolation");
2003 compiler.
add(
this,
"node_voxel_texture");
2022NormalNode::NormalNode() :
ShaderNode(get_node_type()) {}
2041 compiler.
add(
this,
"node_normal");
2067MappingNode::MappingNode() :
ShaderNode(get_node_type()) {}
2088 int vector_stack_offset = compiler.
stack_assign(vector_in);
2089 int location_stack_offset = compiler.
stack_assign(location_in);
2090 int rotation_stack_offset = compiler.
stack_assign(rotation_in);
2091 int scale_stack_offset = compiler.
stack_assign(scale_in);
2092 int result_stack_offset = compiler.
stack_assign(vector_out);
2098 vector_stack_offset, location_stack_offset, rotation_stack_offset, scale_stack_offset),
2099 result_stack_offset);
2104 compiler.
parameter(
this,
"mapping_type");
2105 compiler.
add(
this,
"node_mapping");
2120RGBToBWNode::RGBToBWNode() :
ShaderNode(get_node_type()) {}
2140 compiler.
add(
this,
"node_rgb_to_bw");
2145const NodeType *ConvertNode::node_types[ConvertNode::MAX_TYPE][ConvertNode::MAX_TYPE];
2146bool ConvertNode::initialized = ConvertNode::register_types();
2150 return new ConvertNode(type->inputs[0].type, type->outputs[0].type);
2153bool ConvertNode::register_types()
2155 const int num_types = 8;
2165 for (
size_t i = 0; i < num_types; i++) {
2168 ustring from_value_name(
"value_" + from_name.string());
2170 for (
size_t j = 0; j < num_types; j++) {
2173 ustring to_value_name(
"value_" + to_name.string());
2175 string node_name =
"convert_" + from_name.string() +
"_to_" + to_name.string();
2178 type->register_input(from_value_name,
2186 type->register_output(to_value_name, to_value_name, to);
2188 assert(from < MAX_TYPE);
2189 assert(to < MAX_TYPE);
2191 node_types[from][to] =
type;
2207 else if (autoconvert) {
2217 value_color(other.value_color),
2218 value_string(other.value_string)
2271 if (prev->type == node_types[to][from]) {
2359 compiler.
add(
this,
"node_convert_from_float");
2362 compiler.
add(
this,
"node_convert_from_int");
2365 compiler.
add(
this,
"node_convert_from_color");
2368 compiler.
add(
this,
"node_convert_from_vector");
2371 compiler.
add(
this,
"node_convert_from_point");
2374 compiler.
add(
this,
"node_convert_from_normal");
2392 return (normal_in && normal_in->
link &&
2410 if (color_in->
link) {
2414 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, color);
2431 compiler.
add_node(normal_offset, data_y_offset, data_z_offset, data_w_offset);
2482MetallicBsdfNode::MetallicBsdfNode() :
BsdfNode(get_node_type())
2492 return (!anisotropy_input->
link &&
fabsf(anisotropy) <= 1e-4f);
2497 if (shader->has_surface_link()) {
2539 compiler.
add_node(NODE_CLOSURE_BSDF,
2554 compiler.
parameter(
this,
"distribution");
2555 compiler.
parameter(
this,
"fresnel_type");
2556 compiler.
add(
this,
"node_metallic_bsdf");
2587GlossyBsdfNode::GlossyBsdfNode() :
BsdfNode(get_node_type())
2596 return (!anisotropy_input->
link &&
fabsf(anisotropy) <= 1e-4f);
2601 if (shader->has_surface_link()) {
2625 tangent = compiler.
is_linked(tangent) ? tangent :
nullptr;
2631 input(
"Anisotropy"),
2638 compiler,
input(
"Roughness"),
input(
"Anisotropy"),
input(
"Rotation"),
nullptr, tangent);
2644 compiler.
parameter(
this,
"distribution");
2645 compiler.
add(
this,
"node_glossy_bsdf");
2672GlassBsdfNode::GlassBsdfNode() :
BsdfNode(get_node_type())
2685 compiler.
parameter(
this,
"distribution");
2686 compiler.
add(
this,
"node_glass_bsdf");
2713RefractionBsdfNode::RefractionBsdfNode() :
BsdfNode(get_node_type())
2727 compiler.
parameter(
this,
"distribution");
2728 compiler.
add(
this,
"node_refraction_bsdf");
2753ToonBsdfNode::ToonBsdfNode() :
BsdfNode(get_node_type())
2768 compiler.
add(
this,
"node_toon_bsdf");
2792SheenBsdfNode::SheenBsdfNode() :
BsdfNode(get_node_type())
2805 compiler.
parameter(
this,
"distribution");
2806 compiler.
add(
this,
"node_sheen_bsdf");
2825DiffuseBsdfNode::DiffuseBsdfNode() :
BsdfNode(get_node_type())
2837 compiler.
add(
this,
"node_diffuse_bsdf");
2851 static NodeEnum subsurface_method_enum;
2856 "Subsurface Method",
2857 subsurface_method_enum,
2873 SOCKET_IN_FLOAT(subsurface_anisotropy,
"Subsurface Anisotropy", 0.0f);
2906PrincipledBsdfNode::PrincipledBsdfNode() :
BsdfBaseNode(get_node_type())
2918 if (emission_in->
link) {
2921 if (strength_in->
link) {
2946 (subsurface_scale_in->
link !=
NULL || subsurface_scale != 0.0f);
2951 if (shader->has_surface_link()) {
2954 if (!tangent_in->
link) {
2974 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, weight);
2979 int specular_ior_level_offset = compiler.
stack_assign(
input(
"Specular IOR Level"));
2981 int diffuse_roughness_offset = compiler.
stack_assign(
input(
"Diffuse Roughness"));
2992 int transmission_weight_offset = compiler.
stack_assign(
input(
"Transmission Weight"));
2993 int anisotropic_rotation_offset = compiler.
stack_assign(
input(
"Anisotropic Rotation"));
2994 int subsurface_radius_offset = compiler.
stack_assign(
input(
"Subsurface Radius"));
2997 int subsurface_anisotropy_offset = compiler.
stack_assign(
input(
"Subsurface Anisotropy"));
3001 int thin_film_thickness_offset = compiler.
stack_assign(
input(
"Thin Film Thickness"));
3017 specular_ior_level_offset, roughness_offset, specular_tint_offset, anisotropic_offset),
3020 sheen_roughness_offset,
3021 diffuse_roughness_offset));
3025 ior_offset, transmission_weight_offset, anisotropic_rotation_offset, coat_normal_offset),
3029 coat_weight_offset, coat_roughness_offset, coat_ior_offset, coat_tint_offset));
3039 compiler.
add_node(subsurface_ior_offset,
3040 subsurface_radius_offset,
3041 subsurface_scale_offset,
3042 subsurface_anisotropy_offset);
3045 emission_strength_offset,
3046 emission_color_offset,
3047 thin_film_thickness_offset),
3050 thin_film_ior_offset);
3055 compiler.
parameter(
this,
"distribution");
3056 compiler.
parameter(
this,
"subsurface_method");
3057 compiler.
add(
this,
"node_principled_bsdf");
3080TranslucentBsdfNode::TranslucentBsdfNode() :
BsdfNode(get_node_type())
3092 compiler.
add(
this,
"node_translucent_bsdf");
3109TransparentBsdfNode::TransparentBsdfNode() :
BsdfNode(get_node_type())
3121 compiler.
add(
this,
"node_transparent_bsdf");
3141RayPortalBsdfNode::RayPortalBsdfNode() :
BsdfNode(get_node_type())
3153 compiler.
add(
this,
"node_ray_portal_bsdf");
3184SubsurfaceScatteringNode::SubsurfaceScatteringNode() :
BsdfNode(get_node_type())
3196 input(
"Anisotropy"),
3197 input(
"Roughness"));
3204 compiler.
add(
this,
"node_subsurface_scattering");
3211 return (normal_in->
link &&
3230EmissionNode::EmissionNode() :
ShaderNode(get_node_type()) {}
3237 if (color_in->
link || strength_in->
link) {
3242 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, color * strength);
3250 compiler.
add(
this,
"node_emission");
3258 if ((!color_in->
link && color ==
zero_float3()) || (!strength_in->
link && strength == 0.0f)) {
3278BackgroundNode::BackgroundNode() :
ShaderNode(get_node_type()) {}
3285 if (color_in->
link || strength_in->
link) {
3290 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, color * strength);
3298 compiler.
add(
this,
"node_background");
3306 if ((!color_in->
link && color ==
zero_float3()) || (!strength_in->
link && strength == 0.0f)) {
3325HoldoutNode::HoldoutNode() :
ShaderNode(get_node_type()) {}
3331 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, value);
3337 compiler.
add(
this,
"node_holdout");
3361AmbientOcclusionNode::AmbientOcclusionNode() :
ShaderNode(get_node_type()) {}
3373 if (!distance_in->
link && distance == 0.0f) {
3377 compiler.
add_node(NODE_AMBIENT_OCCLUSION,
3393 compiler.
add(
this,
"node_ambient_occlusion");
3410 if (color_in->
link) {
3414 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, color);
3422 if (param2 ==
nullptr) {
3425 compiler.
add_node(NODE_CLOSURE_VOLUME,
3433 compiler.
add_node(NODE_CLOSURE_VOLUME,
3442 compile(compiler,
nullptr,
nullptr,
nullptr);
3465AbsorptionVolumeNode::AbsorptionVolumeNode() :
VolumeNode(get_node_type())
3477 compiler.
add(
this,
"node_absorption_volume");
3509ScatterVolumeNode::ScatterVolumeNode() :
VolumeNode(get_node_type())
3543 compiler.
add(
this,
"node_scatter_volume");
3554 SOCKET_IN_STRING(temperature_attribute,
"Temperature Attribute", ustring());
3572PrincipledVolumeNode::PrincipledVolumeNode() :
VolumeNode(get_node_type())
3575 density_attribute = ustring(
"density");
3576 temperature_attribute = ustring(
"temperature");
3581 if (shader->has_volume) {
3585 if (density_in->
link || density > 0.0f) {
3586 attributes->add_standard(density_attribute);
3587 attributes->add_standard(color_attribute);
3590 if (blackbody_in->
link || blackbody_intensity > 0.0f) {
3591 attributes->add_standard(temperature_attribute);
3612 if (color_in->
link) {
3616 compiler.
add_node(NODE_CLOSURE_SET_WEIGHT, color);
3619 compiler.
add_node(NODE_PRINCIPLED_VOLUME,
3639 compiler.
add_node(attr_density, attr_color, attr_temperature);
3645 density_attribute = ustring(
"geom:" + density_attribute.string());
3648 color_attribute = ustring(
"geom:" + color_attribute.string());
3651 temperature_attribute = ustring(
"geom:" + temperature_attribute.string());
3654 compiler.
add(
this,
"node_principled_volume");
3670 static NodeEnum parametrization_enum;
3683 absorption_coefficient,
"Absorption Coefficient",
make_float3(0.245531f, 0.52f, 1.365f));
3708PrincipledHairBsdfNode::PrincipledHairBsdfNode() :
BsdfBaseNode(get_node_type())
3717 if (aspect_ratio != 1.0f ||
input(
"Aspect Ratio")->link) {
3731 if (!
input(
"Random")->link) {
3765 int absorption_coefficient_ofs = compiler.
stack_assign(
input(
"Absorption Coefficient"));
3797 compiler.
encode_uchar4(offset_ofs, ior_ofs, color_ofs, parametrization),
3803 tint_ofs, melanin_ofs, melanin_redness_ofs, absorption_coefficient_ofs),
3820 compiler.
encode_uchar4(coat_ofs, random_in_ofs, random_color_ofs, radial_roughness_ofs),
3840 compiler.
parameter(
this,
"parametrization");
3841 compiler.
add(
this,
"node_principled_hair_bsdf");
3867HairBsdfNode::HairBsdfNode() :
BsdfNode(get_node_type())
3877 tangent = compiler.
is_linked(tangent) ? tangent :
nullptr;
3880 compiler,
input(
"RoughnessU"),
input(
"RoughnessV"),
input(
"Offset"),
nullptr, tangent);
3886 compiler.
add(
this,
"node_hair_bsdf");
3908GeometryNode::GeometryNode() :
ShaderNode(get_node_type())
3915 if (shader->has_surface_link()) {
3916 if (!
output(
"Tangent")->links.empty()) {
3919 if (!
output(
"Pointiness")->links.empty()) {
3922 if (!
output(
"Random Per Island")->links.empty()) {
3937 geom_node = NODE_GEOMETRY_BUMP_DX;
3938 attr_node = NODE_ATTR_BUMP_DX;
3941 geom_node = NODE_GEOMETRY_BUMP_DY;
3942 attr_node = NODE_ATTR_BUMP_DY;
3945 out =
output(
"Position");
3946 if (!out->links.empty()) {
3951 if (!out->links.empty()) {
3956 if (!out->links.empty()) {
3960 out =
output(
"True Normal");
3961 if (!out->links.empty()) {
3965 out =
output(
"Incoming");
3966 if (!out->links.empty()) {
3970 out =
output(
"Parametric");
3971 if (!out->links.empty()) {
3975 out =
output(
"Backfacing");
3976 if (!out->links.empty()) {
3980 out =
output(
"Pointiness");
3981 if (!out->links.empty()) {
3991 out =
output(
"Random Per Island");
3992 if (!out->links.empty()) {
4008 compiler.
parameter(
"bump_offset",
"dx");
4011 compiler.
parameter(
"bump_offset",
"dy");
4014 compiler.
parameter(
"bump_offset",
"center");
4017 compiler.
add(
this,
"node_geometry");
4041TextureCoordinateNode::TextureCoordinateNode() :
ShaderNode(get_node_type()) {}
4045 if (shader->has_surface_link()) {
4047 if (!
output(
"Generated")->links.empty()) {
4050 if (!
output(
"UV")->links.empty()) {
4056 if (shader->has_volume) {
4058 if (!
output(
"Generated")->links.empty()) {
4075 texco_node = NODE_TEX_COORD_BUMP_DX;
4076 attr_node = NODE_ATTR_BUMP_DX;
4077 geom_node = NODE_GEOMETRY_BUMP_DX;
4080 texco_node = NODE_TEX_COORD_BUMP_DY;
4081 attr_node = NODE_ATTR_BUMP_DY;
4082 geom_node = NODE_GEOMETRY_BUMP_DY;
4085 out =
output(
"Generated");
4086 if (!out->links.empty()) {
4105 if (!out->links.empty()) {
4110 if (!out->links.empty()) {
4121 if (!out->links.empty()) {
4123 if (use_transform) {
4132 if (!out->links.empty()) {
4137 if (!out->links.empty()) {
4141 out =
output(
"Reflection");
4142 if (!out->links.empty()) {
4155 compiler.
parameter(
"bump_offset",
"dx");
4158 compiler.
parameter(
"bump_offset",
"dy");
4161 compiler.
parameter(
"bump_offset",
"center");
4165 compiler.
parameter(
"is_background",
true);
4170 compiler.
parameter(
this,
"use_transform");
4172 compiler.
parameter(
"object_itfm", ob_itfm);
4176 compiler.
add(
this,
"node_texture_coordinate");
4193UVMapNode::UVMapNode() :
ShaderNode(get_node_type()) {}
4197 if (shader->has_surface) {
4199 if (!
output(
"UV")->links.empty()) {
4200 if (attribute !=
"") {
4201 attributes->add(attribute);
4221 texco_node = NODE_TEX_COORD_BUMP_DX;
4222 attr_node = NODE_ATTR_BUMP_DX;
4225 texco_node = NODE_TEX_COORD_BUMP_DY;
4226 attr_node = NODE_ATTR_BUMP_DY;
4229 if (!out->links.empty()) {
4234 if (attribute !=
"") {
4249 compiler.
parameter(
"bump_offset",
"dx");
4252 compiler.
parameter(
"bump_offset",
"dy");
4255 compiler.
parameter(
"bump_offset",
"center");
4260 compiler.
add(
this,
"node_uv_map");
4287LightPathNode::LightPathNode() :
ShaderNode(get_node_type()) {}
4293 out =
output(
"Is Camera Ray");
4294 if (!out->links.empty()) {
4298 out =
output(
"Is Shadow Ray");
4299 if (!out->links.empty()) {
4303 out =
output(
"Is Diffuse Ray");
4304 if (!out->links.empty()) {
4308 out =
output(
"Is Glossy Ray");
4309 if (!out->links.empty()) {
4313 out =
output(
"Is Singular Ray");
4314 if (!out->links.empty()) {
4318 out =
output(
"Is Reflection Ray");
4319 if (!out->links.empty()) {
4323 out =
output(
"Is Transmission Ray");
4324 if (!out->links.empty()) {
4328 out =
output(
"Is Volume Scatter Ray");
4329 if (!out->links.empty()) {
4333 out =
output(
"Ray Length");
4334 if (!out->links.empty()) {
4338 out =
output(
"Ray Depth");
4339 if (!out->links.empty()) {
4343 out =
output(
"Diffuse Depth");
4344 if (!out->links.empty()) {
4348 out =
output(
"Glossy Depth");
4349 if (!out->links.empty()) {
4353 out =
output(
"Transparent Depth");
4354 if (!out->links.empty()) {
4358 out =
output(
"Transmission Depth");
4359 if (!out->links.empty()) {
4366 compiler.
add(
this,
"node_light_path");
4385LightFalloffNode::LightFalloffNode() :
ShaderNode(get_node_type()) {}
4393 if (!out->links.empty()) {
4394 compiler.
add_node(NODE_LIGHT_FALLOFF,
4402 if (!out->links.empty()) {
4403 compiler.
add_node(NODE_LIGHT_FALLOFF,
4410 out =
output(
"Constant");
4411 if (!out->links.empty()) {
4412 compiler.
add_node(NODE_LIGHT_FALLOFF,
4422 compiler.
add(
this,
"node_light_falloff");
4441ObjectInfoNode::ObjectInfoNode() :
ShaderNode(get_node_type()) {}
4446 if (!out->links.empty()) {
4451 if (!out->links.empty()) {
4456 if (!out->links.empty()) {
4460 out =
output(
"Object Index");
4461 if (!out->links.empty()) {
4465 out =
output(
"Material Index");
4466 if (!out->links.empty()) {
4471 if (!out->links.empty()) {
4478 compiler.
add(
this,
"node_object_info");
4493 SOCKET_OUT_QUATERNION(rotation,
"Rotation");
4502ParticleInfoNode::ParticleInfoNode() :
ShaderNode(get_node_type()) {}
4506 if (!
output(
"Index")->links.empty()) {
4509 if (!
output(
"Random")->links.empty()) {
4512 if (!
output(
"Age")->links.empty()) {
4515 if (!
output(
"Lifetime")->links.empty()) {
4518 if (!
output(
"Location")->links.empty()) {
4522 if (!
output(
"Rotation")->links.empty())
4525 if (!
output(
"Size")->links.empty()) {
4528 if (!
output(
"Velocity")->links.empty()) {
4531 if (!
output(
"Angular Velocity")->links.empty()) {
4543 if (!out->links.empty()) {
4548 if (!out->links.empty()) {
4553 if (!out->links.empty()) {
4557 out =
output(
"Lifetime");
4558 if (!out->links.empty()) {
4562 out =
output(
"Location");
4563 if (!out->links.empty()) {
4569 out =
output(
"Rotation");
4570 if (!out->links.empty()) {
4576 if (!out->links.empty()) {
4580 out =
output(
"Velocity");
4581 if (!out->links.empty()) {
4585 out =
output(
"Angular Velocity");
4586 if (!out->links.empty()) {
4594 compiler.
add(
this,
"node_particle_info");
4613HairInfoNode::HairInfoNode() :
ShaderNode(get_node_type()) {}
4617 if (shader->has_surface_link()) {
4620 if (!intercept_out->
links.empty()) {
4624 if (!
output(
"Length")->links.empty()) {
4628 if (!
output(
"Random")->links.empty()) {
4640 out =
output(
"Is Strand");
4641 if (!out->links.empty()) {
4645 out =
output(
"Intercept");
4646 if (!out->links.empty()) {
4652 if (!out->links.empty()) {
4657 out =
output(
"Thickness");
4658 if (!out->links.empty()) {
4662 out =
output(
"Tangent Normal");
4663 if (!out->links.empty()) {
4668 if (!out->links.empty()) {
4676 compiler.
add(
this,
"node_hair_info");
4692PointInfoNode::PointInfoNode() :
ShaderNode(get_node_type()) {}
4696 if (shader->has_surface_link()) {
4697 if (!
output(
"Random")->links.empty()) {
4709 out =
output(
"Position");
4710 if (!out->links.empty()) {
4715 if (!out->links.empty()) {
4720 if (!out->links.empty()) {
4728 compiler.
add(
this,
"node_point_info");
4745VolumeInfoNode::VolumeInfoNode() :
ShaderNode(get_node_type()) {}
4752 if (shader->has_volume) {
4753 if (!
output(
"Color")->links.empty()) {
4756 if (!
output(
"Density")->links.empty()) {
4759 if (!
output(
"Flame")->links.empty()) {
4762 if (!
output(
"Temperature")->links.empty()) {
4773 if (!color_out->
links.empty()) {
4775 attr->set_attribute(ustring(
"color"));
4777 graph->relink(color_out, attr->
output(
"Color"));
4781 if (!density_out->
links.empty()) {
4783 attr->set_attribute(ustring(
"density"));
4785 graph->relink(density_out, attr->
output(
"Fac"));
4789 if (!flame_out->
links.empty()) {
4791 attr->set_attribute(ustring(
"flame"));
4793 graph->relink(flame_out, attr->
output(
"Fac"));
4797 if (!temperature_out->
links.empty()) {
4799 attr->set_attribute(ustring(
"temperature"));
4801 graph->relink(temperature_out, attr->
output(
"Fac"));
4820VertexColorNode::VertexColorNode() :
ShaderNode(get_node_type()) {}
4824 if (!(
output(
"Color")->links.empty() && output(
"Alpha")->links.empty())) {
4825 if (layer_name !=
"") {
4826 attributes->add_standard(layer_name);
4841 if (layer_name !=
"") {
4842 layer_id = compiler.
attribute(layer_name);
4851 node = NODE_VERTEX_COLOR_BUMP_DX;
4854 node = NODE_VERTEX_COLOR_BUMP_DY;
4857 node = NODE_VERTEX_COLOR;
4867 compiler.
parameter(
"bump_offset",
"dx");
4870 compiler.
parameter(
"bump_offset",
"dy");
4873 compiler.
parameter(
"bump_offset",
"center");
4876 if (layer_name.empty()) {
4877 compiler.
parameter(
"layer_name", ustring(
"geom:vertex_color"));
4881 compiler.
parameter(
"name", (
string(
"geom:") + layer_name.c_str()).c_str());
4884 compiler.
parameter(
"layer_name", layer_name.c_str());
4888 compiler.
add(
this,
"node_vertex_color");
4903ValueNode::ValueNode() :
ShaderNode(get_node_type()) {}
4919 compiler.
parameter(
"value_value", value);
4920 compiler.
add(
this,
"node_value");
4935ColorNode::ColorNode() :
ShaderNode(get_node_type()) {}
4946 if (!color_out->
links.empty()) {
4948 compiler.
add_node(NODE_VALUE_V, value);
4956 compiler.
add(
this,
"node_value");
4972AddClosureNode::AddClosureNode() :
ShaderNode(get_node_type())
4984 compiler.
add(
this,
"node_add_closure");
4993 if (!closure1_in->
link) {
4996 else if (!closure2_in->
link) {
5016MixClosureNode::MixClosureNode() :
ShaderNode(get_node_type())
5028 compiler.
add(
this,
"node_mix_closure");
5038 if (closure1_in->
link == closure2_in->
link) {
5043 else if (!fac_in->
link) {
5049 else if (fac >= 1.0f) {
5070MixClosureWeightNode::MixClosureWeightNode() :
ShaderNode(get_node_type()) {}
5079 compiler.
add_node(NODE_MIX_CLOSURE,
5105InvertNode::InvertNode() :
ShaderNode(get_node_type()) {}
5112 if (!fac_in->
link) {
5114 if (!color_in->
link) {
5118 else if (fac == 0.0f) {
5138 compiler.
add(
this,
"node_invert");
5180MixNode::MixNode() :
ShaderNode(get_node_type()) {}
5205 compiler.
add(
this,
"node_mix");
5214 folder.
fold_mix(mix_type, use_clamp);
5257MixColorNode::MixColorNode() :
ShaderNode(get_node_type()) {}
5266 int fac_in_stack_offset = compiler.
stack_assign(fac_in);
5272 compiler.
encode_uchar4(use_clamp, blend_type, use_clamp_result),
5273 compiler.
encode_uchar4(fac_in_stack_offset, a_in_stack_offset, b_in_stack_offset),
5281 compiler.
parameter(
this,
"use_clamp_result");
5282 compiler.
add(
this,
"node_mix_color");
5289 fac =
clamp(fac, 0.0f, 1.0f);
5313MixFloatNode::MixFloatNode() :
ShaderNode(get_node_type()) {}
5322 int fac_in_stack_offset = compiler.
stack_assign(fac_in);
5329 compiler.
encode_uchar4(fac_in_stack_offset, a_in_stack_offset, b_in_stack_offset),
5336 compiler.
add(
this,
"node_mix_float");
5343 fac =
clamp(fac, 0.0f, 1.0f);
5368MixVectorNode::MixVectorNode() :
ShaderNode(get_node_type()) {}
5377 int fac_in_stack_offset = compiler.
stack_assign(fac_in);
5383 compiler.
encode_uchar4(use_clamp, fac_in_stack_offset, a_in_stack_offset, b_in_stack_offset),
5390 compiler.
add(
this,
"node_mix_vector");
5397 fac =
clamp(fac, 0.0f, 1.0f);
5422MixVectorNonUniformNode::MixVectorNonUniformNode() :
ShaderNode(get_node_type()) {}
5431 int fac_in_stack_offset = compiler.
stack_assign(fac_in);
5436 NODE_MIX_VECTOR_NON_UNIFORM,
5437 compiler.
encode_uchar4(use_clamp, fac_in_stack_offset, a_in_stack_offset, b_in_stack_offset),
5444 compiler.
add(
this,
"node_mix_vector_non_uniform");
5478CombineColorNode::CombineColorNode() :
ShaderNode(get_node_type()) {}
5495 int green_stack_offset = compiler.
stack_assign(green_in);
5496 int blue_stack_offset = compiler.
stack_assign(blue_in);
5497 int color_stack_offset = compiler.
stack_assign(color_out);
5502 compiler.
encode_uchar4(red_stack_offset, green_stack_offset, blue_stack_offset),
5503 color_stack_offset);
5509 compiler.
add(
this,
"node_combine_color");
5527CombineRGBNode::CombineRGBNode() :
ShaderNode(get_node_type()) {}
5555 compiler.
add(
this,
"node_combine_rgb");
5573CombineXYZNode::CombineXYZNode() :
ShaderNode(get_node_type()) {}
5601 compiler.
add(
this,
"node_combine_xyz");
5619CombineHSVNode::CombineHSVNode() :
ShaderNode(get_node_type()) {}
5635 compiler.
add_node(NODE_COMBINE_HSV,
5644 compiler.
add(
this,
"node_combine_hsv");
5660GammaNode::GammaNode() :
ShaderNode(get_node_type()) {}
5676 else if (folder.
is_one(gamma_in)) {
5696 compiler.
add(
this,
"node_gamma");
5714BrightContrastNode::BrightContrastNode() :
ShaderNode(get_node_type()) {}
5730 compiler.
add_node(NODE_BRIGHTCONTRAST,
5739 compiler.
add(
this,
"node_brightness");
5763SeparateColorNode::SeparateColorNode() :
ShaderNode(get_node_type()) {}
5770 for (
int channel = 0; channel < 3; channel++) {
5771 if (outputs[channel] == folder.
output) {
5786 int color_stack_offset = compiler.
stack_assign(color_in);
5788 int green_stack_offset = compiler.
stack_assign(green_out);
5789 int blue_stack_offset = compiler.
stack_assign(blue_out);
5792 NODE_SEPARATE_COLOR,
5795 compiler.
encode_uchar4(red_stack_offset, green_stack_offset, blue_stack_offset));
5801 compiler.
add(
this,
"node_separate_color");
5819SeparateRGBNode::SeparateRGBNode() :
ShaderNode(get_node_type()) {}
5824 for (
int channel = 0; channel < 3; channel++) {
5825 if (outputs[channel] == folder.
output) {
5852 compiler.
add(
this,
"node_separate_rgb");
5870SeparateXYZNode::SeparateXYZNode() :
ShaderNode(get_node_type()) {}
5875 for (
int channel = 0; channel < 3; channel++) {
5876 if (outputs[channel] == folder.
output) {
5903 compiler.
add(
this,
"node_separate_xyz");
5921SeparateHSVNode::SeparateHSVNode() :
ShaderNode(get_node_type()) {}
5928 for (
int channel = 0; channel < 3; channel++) {
5929 if (outputs[channel] == folder.
output) {
5944 compiler.
add_node(NODE_SEPARATE_HSV,
5953 compiler.
add(
this,
"node_separate_hsv");
5973HSVNode::HSVNode() :
ShaderNode(get_node_type()) {}
5995 compiler.
add(
this,
"node_hsv");
6014AttributeNode::AttributeNode() :
ShaderNode(get_node_type()) {}
6023 if (!color_out->
links.empty() || !vector_out->
links.empty() || !fac_out->
links.empty() ||
6024 !alpha_out->
links.empty())
6026 attributes->add_standard(attribute);
6029 if (shader->has_volume) {
6046 attr_node = NODE_ATTR_BUMP_DX;
6049 attr_node = NODE_ATTR_BUMP_DY;
6052 if (!color_out->
links.empty() || !vector_out->
links.empty()) {
6053 if (!color_out->
links.empty()) {
6057 if (!vector_out->
links.empty()) {
6063 if (!fac_out->
links.empty()) {
6067 if (!alpha_out->
links.empty()) {
6076 compiler.
parameter(
"bump_offset",
"dx");
6079 compiler.
parameter(
"bump_offset",
"dy");
6082 compiler.
parameter(
"bump_offset",
"center");
6086 compiler.
parameter(
"name", (
string(
"geom:") + attribute.c_str()).c_str());
6089 compiler.
parameter(
"name", attribute.c_str());
6092 compiler.
add(
this,
"node_attribute");
6108CameraNode::CameraNode() :
ShaderNode(get_node_type()) {}
6124 compiler.
add(
this,
"node_camera");
6142FresnelNode::FresnelNode() :
ShaderNode(get_node_type()) {}
6159 compiler.
add(
this,
"node_fresnel");
6178LayerWeightNode::LayerWeightNode() :
ShaderNode(get_node_type()) {}
6187 if (!fresnel_out->
links.empty()) {
6188 compiler.
add_node(NODE_LAYER_WEIGHT,
6196 if (!facing_out->
links.empty()) {
6197 compiler.
add_node(NODE_LAYER_WEIGHT,
6208 compiler.
add(
this,
"node_layer_weight");
6224WireframeNode::WireframeNode() :
ShaderNode(get_node_type()) {}
6246 compiler.
parameter(
"bump_offset",
"dx");
6249 compiler.
parameter(
"bump_offset",
"dy");
6252 compiler.
parameter(
"bump_offset",
"center");
6254 compiler.
parameter(
this,
"use_pixel_size");
6255 compiler.
add(
this,
"node_wireframe");
6270WavelengthNode::WavelengthNode() :
ShaderNode(get_node_type()) {}
6283 compiler.
add(
this,
"node_wavelength");
6298BlackbodyNode::BlackbodyNode() :
ShaderNode(get_node_type()) {}
6320 compiler.
add(
this,
"node_blackbody");
6337OutputNode::OutputNode() :
ShaderNode(get_node_type())
6347 if (displacement_in->
link) {
6356 compiler.
add(
this,
"node_output_surface");
6359 compiler.
add(
this,
"node_output_volume");
6362 compiler.
add(
this,
"node_output_displacement");
6392MapRangeNode::MapRangeNode() :
ShaderNode(get_node_type()) {}
6398 if (!result_out->
links.empty()) {
6401 graph->add(clamp_node);
6402 graph->relink(result_out, clamp_node->
output(
"Result"));
6403 graph->connect(result_out, clamp_node->
input(
"Value"));
6408 clamp_node->set_min(to_min);
6414 clamp_node->set_max(to_max);
6430 int value_stack_offset = compiler.
stack_assign(value_in);
6435 int steps_stack_offset = compiler.
stack_assign(steps_in);
6436 int result_stack_offset = compiler.
stack_assign(result_out);
6442 from_min_stack_offset, from_max_stack_offset, to_min_stack_offset, to_max_stack_offset),
6443 compiler.
encode_uchar4(range_type, steps_stack_offset, result_stack_offset));
6455 compiler.
add(
this,
"node_map_range");
6484VectorMapRangeNode::VectorMapRangeNode() :
ShaderNode(get_node_type()) {}
6498 int value_stack_offset = compiler.
stack_assign(vector_in);
6499 int from_min_stack_offset = compiler.
stack_assign(from_min_in);
6500 int from_max_stack_offset = compiler.
stack_assign(from_max_in);
6501 int to_min_stack_offset = compiler.
stack_assign(to_min_in);
6502 int to_max_stack_offset = compiler.
stack_assign(to_max_in);
6503 int steps_stack_offset = compiler.
stack_assign(steps_in);
6504 int result_stack_offset = compiler.
stack_assign(vector_out);
6507 NODE_VECTOR_MAP_RANGE,
6510 from_min_stack_offset, from_max_stack_offset, to_min_stack_offset, to_max_stack_offset),
6511 compiler.
encode_uchar4(steps_stack_offset, use_clamp, range_type, result_stack_offset));
6518 compiler.
add(
this,
"node_vector_map_range");
6541ClampNode::ClampNode() :
ShaderNode(get_node_type()) {}
6562 int value_stack_offset = compiler.
stack_assign(value_in);
6565 int result_stack_offset = compiler.
stack_assign(result_out);
6569 compiler.
encode_uchar4(min_stack_offset, max_stack_offset, clamp_type),
6570 result_stack_offset);
6577 compiler.
add(
this,
"node_clamp");
6594OutputAOVNode::OutputAOVNode() :
ShaderNode(get_node_type())
6602 offset = scene->film->get_aov_offset(scene, name.string(),
is_color);
6604 offset = scene->film->get_aov_offset(scene, name.string(),
is_color);
6617 assert(offset >= 0);
6693MathNode::MathNode() :
ShaderNode(get_node_type()) {}
6699 if (!result_out->
links.empty()) {
6702 clamp_node->set_min(0.0f);
6703 clamp_node->set_max(1.0f);
6704 graph->add(clamp_node);
6705 graph->relink(result_out, clamp_node->
output(
"Result"));
6706 graph->connect(result_out, clamp_node->
input(
"Value"));
6728 int value1_stack_offset = compiler.
stack_assign(value1_in);
6729 int value2_stack_offset = compiler.
stack_assign(value2_in);
6730 int value3_stack_offset = compiler.
stack_assign(value3_in);
6731 int value_stack_offset = compiler.
stack_assign(value_out);
6736 compiler.
encode_uchar4(value1_stack_offset, value2_stack_offset, value3_stack_offset),
6737 value_stack_offset);
6743 compiler.
add(
this,
"node_math");
6798VectorMathNode::VectorMathNode() :
ShaderNode(get_node_type()) {}
6807 if (folder.
output == output(
"Value")) {
6810 else if (folder.
output == output(
"Vector")) {
6827 int vector1_stack_offset = compiler.
stack_assign(vector1_in);
6828 int vector2_stack_offset = compiler.
stack_assign(vector2_in);
6829 int param1_stack_offset = compiler.
stack_assign(param1_in);
6838 int vector3_stack_offset = compiler.
stack_assign(vector3_in);
6842 compiler.
encode_uchar4(vector1_stack_offset, vector2_stack_offset, param1_stack_offset),
6843 compiler.
encode_uchar4(value_stack_offset, vector_stack_offset));
6844 compiler.
add_node(vector3_stack_offset);
6850 compiler.
encode_uchar4(vector1_stack_offset, vector2_stack_offset, param1_stack_offset),
6851 compiler.
encode_uchar4(value_stack_offset, vector_stack_offset));
6858 compiler.
add(
this,
"node_vector_math");
6887VectorRotateNode::VectorRotateNode() :
ShaderNode(get_node_type()) {}
6898 compiler.
add_node(NODE_VECTOR_ROTATE,
6911 compiler.
parameter(
this,
"rotate_type");
6913 compiler.
add(
this,
"node_vector_rotate");
6941VectorTransformNode::VectorTransformNode() :
ShaderNode(get_node_type()) {}
6949 NODE_VECTOR_TRANSFORM,
6950 compiler.
encode_uchar4(transform_type, convert_from, convert_to),
6956 compiler.
parameter(
this,
"transform_type");
6957 compiler.
parameter(
this,
"convert_from");
6959 compiler.
add(
this,
"node_vector_transform");
6987BumpNode::BumpNode() :
ShaderNode(get_node_type())
7019 compiler.
parameter(
this,
"use_object_space");
7020 compiler.
add(
this,
"node_bump");
7052 if (curves.size() == 0) {
7059 result[0] =
rgb_ramp_lookup(curves.data(),
pos[0],
true, extrapolate, curves.size()).x;
7060 result[1] =
rgb_ramp_lookup(curves.data(),
pos[1],
true, extrapolate, curves.size()).y;
7061 result[2] =
rgb_ramp_lookup(curves.data(),
pos[2],
true, extrapolate, curves.size()).z;
7066 else if (!fac_in->
link && fac == 0.0f) {
7077 if (curves.size() == 0) {
7092 for (
int i = 0; i < curves.size(); i++) {
7099 if (curves.size() == 0) {
7106 compiler.
parameter(
this,
"extrapolate");
7107 compiler.
add(
this, name);
7139RGBCurvesNode::RGBCurvesNode() :
CurvesNode(get_node_type()) {}
7175VectorCurvesNode::VectorCurvesNode() :
CurvesNode(get_node_type()) {}
7211FloatCurveNode::FloatCurveNode() :
ShaderNode(get_node_type()) {}
7220 if (curve.size() == 0) {
7224 float pos = (value - min_x) / (max_x - min_x);
7230 else if (!fac_in->
link && fac == 0.0f) {
7238 if (curve.size() == 0) {
7246 compiler.
add_node(NODE_FLOAT_CURVE,
7255 for (
int i = 0; i < curve.size(); i++) {
7262 if (curve.size() == 0) {
7269 compiler.
parameter(
this,
"extrapolate");
7270 compiler.
add(
this,
"node_float_curve");
7291RGBRampNode::RGBRampNode() :
ShaderNode(get_node_type()) {}
7295 if (ramp.size() == 0 || ramp.size() != ramp_alpha.size()) {
7300 float f =
clamp(fac, 0.0f, 1.0f) * (ramp.size() - 1);
7303 int i =
clamp((
int)f, 0, ramp.size() - 1);
7304 float t = f - (
float)i;
7306 bool use_lerp = interpolate && t > 0.0f;
7308 if (folder.
output == output(
"Color")) {
7312 else if (folder.
output == output(
"Alpha")) {
7313 float alpha =
float_ramp_lookup(ramp_alpha.data(), fac, use_lerp,
false, ramp_alpha.size());
7321 if (ramp.size() == 0 || ramp.size() != ramp_alpha.size()) {
7336 for (
int i = 0; i < ramp.size(); i++) {
7343 if (ramp.size() == 0 || ramp.size() != ramp_alpha.size()) {
7348 compiler.
parameter_array(
"ramp_alpha", ramp_alpha.data(), ramp_alpha.size());
7349 compiler.
parameter(
this,
"interpolate");
7351 compiler.
add(
this,
"node_rgb_ramp");
7366SetNormalNode::SetNormalNode() :
ShaderNode(get_node_type()) {}
7373 compiler.
add_node(NODE_CLOSURE_SET_NORMAL,
7380 compiler.
add(
this,
"node_set_normal");
7388 has_emission =
false;
7408 char *node_memory = (
char *)
operator new(node_size + inputs_size);
7409 memset(node_memory, 0, node_size + inputs_size);
7418 memcpy(node_memory + node_size, (
char *)from + node_size, inputs_size);
7422 node->set_owner(from->owner);
7430 size_t num_inputs = type->inputs.size();
7438 size_t offset = memory - (
char *)
this;
7445 const_cast<NodeType *
>(
type)->register_output(name, name, socket_type);
7487NormalMapNode::NormalMapNode() :
ShaderNode(get_node_type()) {}
7492 if (attribute.empty()) {
7497 attributes->add(ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7498 attributes->add(ustring((
string(attribute.c_str()) +
".tangent_sign").c_str()));
7510 int attr = 0, attr_sign = 0;
7513 if (attribute.empty()) {
7518 attr = compiler.
attribute(ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7520 ustring((
string(attribute.c_str()) +
".tangent_sign").c_str()));
7536 if (attribute.empty()) {
7537 compiler.
parameter(
"attr_name", ustring(
"geom:tangent"));
7538 compiler.
parameter(
"attr_sign_name", ustring(
"geom:tangent_sign"));
7541 compiler.
parameter(
"attr_name", ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7543 ustring((
string(attribute.c_str()) +
".tangent_sign").c_str()));
7548 compiler.
add(
this,
"node_normal_map");
7557 static NodeEnum direction_type_enum;
7575TangentNode::TangentNode() :
ShaderNode(get_node_type()) {}
7579 if (shader->has_surface_link()) {
7581 if (attribute.empty()) {
7585 attributes->add(ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7602 if (attribute.empty()) {
7606 attr = compiler.
attribute(ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7622 if (attribute.empty()) {
7623 compiler.
parameter(
"attr_name", ustring(
"geom:tangent"));
7626 compiler.
parameter(
"attr_name", ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7630 compiler.
parameter(
this,
"direction_type");
7632 compiler.
add(
this,
"node_tangent");
7651BevelNode::BevelNode() :
ShaderNode(get_node_type()) {}
7669 compiler.
add(
this,
"node_bevel");
7694DisplacementNode::DisplacementNode() :
ShaderNode(get_node_type()) {}
7699 if ((height - midlevel == 0.0f) || (scale == 0.0f)) {
7713 compiler.
add_node(NODE_DISPLACEMENT,
7725 compiler.
add(
this,
"node_displacement");
7751VectorDisplacementNode::VectorDisplacementNode() :
ShaderNode(get_node_type()) {}
7765 if (attribute.empty()) {
7770 attributes->add(ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7771 attributes->add(ustring((
string(attribute.c_str()) +
".tangent_sign").c_str()));
7784 int attr = 0, attr_sign = 0;
7787 if (attribute.empty()) {
7792 attr = compiler.
attribute(ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7794 ustring((
string(attribute.c_str()) +
".tangent_sign").c_str()));
7798 compiler.
add_node(NODE_VECTOR_DISPLACEMENT,
7812 if (attribute.empty()) {
7813 compiler.
parameter(
"attr_name", ustring(
"geom:tangent"));
7814 compiler.
parameter(
"attr_sign_name", ustring(
"geom:tangent_sign"));
7817 compiler.
parameter(
"attr_name", ustring((
string(attribute.c_str()) +
".tangent").c_str()));
7819 ustring((
string(attribute.c_str()) +
".tangent_sign").c_str()));
7824 compiler.
add(
this,
"node_vector_displacement");
MINLINE float signf(float f)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
@ 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_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_MATH_FLOORED_MODULO
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
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 producing a negative Combine Generate a color from its and blue Hue Saturation Apply a color transformation in the HSV color model Specular Similar to the Principled BSDF node but uses the specular workflow instead of which functions by specifying the facing(along normal) reflection color. Energy is not conserved
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 and value channels Color Retrieve a color attribute
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void constant_fold(const ConstantFolder &folder)
void attributes(Shader *shader, AttributeRequestSet *attributes)
static AttributeStandard name_standard(const char *name)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
BsdfBaseNode(const NodeType *node_type)
BsdfNode(const NodeType *node_type)
void compile(SVMCompiler &compiler, ShaderInput *bsdf_y, ShaderInput *bsdf_z, ShaderInput *data_y=nullptr, ShaderInput *data_z=nullptr, ShaderInput *data_w=nullptr)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
static bool colorspace_is_data(ustring colorspace)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void make_constant_clamp(float value, bool clamp) const
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(float value) const
ShaderOutput *const output
void fold_mix(NodeMix type, 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)
ConvertNode(SocketType::Type from, SocketType::Type to, bool autoconvert=false)
CurvesNode(const NodeType *node_type)
void compile(SVMCompiler &compiler, int type, ShaderInput *value_in, ShaderOutput *value_out)
void constant_fold(const ConstantFolder &folder, ShaderInput *value_in)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
ImageParams image_params() const
ShaderNode * clone(ShaderGraph *graph) const
void attributes(Shader *shader, AttributeRequestSet *attributes)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void attributes(Shader *shader, AttributeRequestSet *attributes)
virtual void get_uv_tiles(ustring map, unordered_set< int > &tiles)=0
void attributes(Shader *shader, AttributeRequestSet *attributes)
void simplify_settings(Scene *scene)
void attributes(Shader *shader, AttributeRequestSet *attributes)
ShaderNode * clone(ShaderGraph *graph) const
int svm_slot(const int tile_index=0) const
ImageHandle add_image(const string &filename, const ImageParams ¶ms)
InterpolationType interpolation
ImageParams image_params() const
void attributes(Shader *shader, AttributeRequestSet *attributes)
void cull_tiles(Scene *scene, ShaderGraph *graph)
ShaderNode * clone(ShaderGraph *graph) const
void constant_fold(const ConstantFolder &folder)
int add_ies(const string &ies)
int add_ies_from_file(const string &filename)
void remove_ies(int slot)
void expand(ShaderGraph *graph)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void expand(ShaderGraph *graph)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void attributes(Shader *shader, AttributeRequestSet *attributes)
void add(ShaderNode *node, const char *name, bool isfilepath=false)
void parameter_array(const char *name, const float f[], int arraylen)
void parameter_texture_ies(const char *name, int svm_slot)
void parameter_texture(const char *name, ustring filename, ustring colorspace)
void parameter(ShaderNode *node, const char *name)
void parameter_color_array(const char *name, const array< float3 > &f)
void parameter_color(const char *name, float3 f)
void add_input(ustring name, SocketType::Type type, const int flags=0)
static OSLNode * create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from=NULL)
ShaderNode * clone(ShaderGraph *graph) const
void add_output(ustring name, SocketType::Type type)
char * input_default_value()
virtual void simplify_settings(Scene *scene)
void attributes(Shader *shader, AttributeRequestSet *attributes)
ImageParams image_params() const
~PointDensityTextureNode()
ShaderNode * clone(ShaderGraph *graph) const
void attributes(Shader *shader, AttributeRequestSet *attributes)
void attributes(Shader *shader, AttributeRequestSet *attributes)
bool has_surface_bssrdf()
void simplify_settings(Scene *scene)
bool has_surface_emission()
bool has_surface_transparent()
void attributes(Shader *shader, AttributeRequestSet *attributes)
void attributes(Shader *shader, AttributeRequestSet *attributes)
bool has_surface_transparent()
void attributes(Shader *shader, AttributeRequestSet *attributes)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
ShaderGraph * current_graph
void add_node(ShaderNodeType type, int a=0, int b=0, int c=0)
void stack_clear_offset(SocketType::Type type, int offset)
int stack_assign_if_linked(ShaderInput *input)
uint encode_uchar4(uint x, uint y=0, uint z=0, uint w=0)
uint attribute_standard(ustring name)
void stack_link(ShaderInput *input, ShaderOutput *output)
uint closure_mix_weight_offset()
bool is_linked(ShaderInput *input)
uint get_bump_state_offset()
uint attribute(ustring name)
int stack_find_offset(int size)
int stack_assign(ShaderOutput *output)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
T * create_node(Args &&...args)
ShaderNode * add(ShaderNode *node)
float linear_rgb_to_gray(float3 c)
float3 rec709_to_scene_linear(float3 c)
ShaderInput * input(const char *name)
ShaderNodeSpecialType special_type
ShaderOutput * output(const char *name)
virtual void compile(SVMCompiler &compiler)=0
virtual void attributes(Shader *shader, AttributeRequestSet *attributes)
vector< ShaderInput * > links
void simplify_settings(Scene *scene)
float get_sun_average_radiance()
void attributes(Shader *shader, AttributeRequestSet *attributes)
void attributes(Shader *shader, AttributeRequestSet *attributes)
void compile_end(SVMCompiler &compiler, ShaderInput *vector_in, int vector_offset)
Transform compute_transform()
void compile(SVMCompiler &compiler, int offset_in, int offset_out)
int compile_begin(SVMCompiler &compiler, ShaderInput *vector_in)
TextureMapping tex_mapping
void attributes(Shader *shader, AttributeRequestSet *attributes)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void constant_fold(const ConstantFolder &folder)
void attributes(Shader *shader, AttributeRequestSet *attributes)
void expand(ShaderGraph *graph)
void constant_fold(const ConstantFolder &folder)
void attributes(Shader *shader, AttributeRequestSet *attributes)
void expand(ShaderGraph *graph)
void attributes(Shader *shader, AttributeRequestSet *attributes)
void compile(SVMCompiler &compiler, ShaderInput *density, ShaderInput *param1=nullptr, ShaderInput *param2=nullptr)
VolumeNode(const NodeType *node_type)
void push_back_slow(const T &t)
ccl_device float3 svm_combine_color(NodeCombSepColorType type, float3 color)
ccl_device float3 svm_separate_color(NodeCombSepColorType type, float3 color)
ccl_device_noinline_cpu float3 svm_mix(NodeMix type, float t, float3 c1, float3 c2)
ccl_device_noinline_cpu float3 svm_mix_clamped_factor(NodeMix type, float t, float3 c1, float3 c2)
ccl_device_inline float3 svm_brightness_contrast(float3 color, float brightness, float contrast)
CCL_NAMESPACE_BEGIN ustring u_colorspace_auto
local_group_size(16, 16) .push_constant(Type b
#define CCL_NAMESPACE_END
draw_view in_light_buf[] float
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
ccl_global const KernelWorkTile * tile
@ NODE_ENVIRONMENT_MIRROR_BALL
@ NODE_ENVIRONMENT_EQUIRECTANGULAR
@ NODE_ATTR_OUTPUT_FLOAT_ALPHA
@ NODE_ATTR_OUTPUT_FLOAT3
@ NODE_BUMP_OFFSET_CENTER
@ NODE_WAVE_BANDS_DIRECTION_Z
@ NODE_WAVE_BANDS_DIRECTION_DIAGONAL
@ NODE_WAVE_BANDS_DIRECTION_Y
@ NODE_WAVE_BANDS_DIRECTION_X
@ NODE_INFO_CURVE_IS_STRAND
@ NODE_INFO_CURVE_TANGENT_NORMAL
@ NODE_INFO_CURVE_THICKNESS
@ NODE_PRINCIPLED_HAIR_CHIANG
@ NODE_PRINCIPLED_HAIR_HUANG
@ NODE_NOISE_HYBRID_MULTIFRACTAL
@ NODE_NOISE_RIDGED_MULTIFRACTAL
@ NODE_NOISE_HETERO_TERRAIN
@ NODE_NOISE_MULTIFRACTAL
@ NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT
@ NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD
@ NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA
@ NODE_PRINCIPLED_HAIR_REFLECTANCE
@ NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION
@ NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
@ NODE_TEXCO_VOLUME_GENERATED
@ NODE_TEXCO_DUPLI_GENERATED
@ SHADER_TYPE_DISPLACEMENT
@ NODE_VORONOI_N_SPHERE_RADIUS
@ NODE_VORONOI_DISTANCE_TO_EDGE
@ NODE_INFO_PAR_ANGULAR_VELOCITY
@ NODE_IMAGE_COMPRESS_AS_SRGB
@ NODE_IMAGE_ALPHA_UNASSOCIATE
@ NODE_TEX_VOXEL_SPACE_WORLD
@ NODE_TEX_VOXEL_SPACE_OBJECT
@ NODE_LP_ray_transmission
@ NODE_LP_ray_transparent
#define SVM_STACK_INVALID
@ 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_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_INFO_POINT_POSITION
@ NODE_VECTOR_TRANSFORM_TYPE_NORMAL
@ NODE_VECTOR_TRANSFORM_TYPE_VECTOR
@ NODE_VECTOR_TRANSFORM_TYPE_POINT
@ NODE_BLEND_QUADRATIC_SPHERE
#define CLOSURE_WEIGHT_CUTOFF
@ NODE_WAVE_RINGS_DIRECTION_Y
@ NODE_WAVE_RINGS_DIRECTION_SPHERICAL
@ NODE_WAVE_RINGS_DIRECTION_X
@ NODE_WAVE_RINGS_DIRECTION_Z
@ NODE_LAYER_WEIGHT_FACING
@ NODE_LAYER_WEIGHT_FRESNEL
@ NODE_NORMAL_MAP_TANGENT
@ NODE_NORMAL_MAP_BLENDER_WORLD
@ NODE_NORMAL_MAP_BLENDER_OBJECT
@ NODE_LIGHT_FALLOFF_QUADRATIC
@ NODE_LIGHT_FALLOFF_LINEAR
@ NODE_LIGHT_FALLOFF_CONSTANT
@ ATTR_STD_CURVE_INTERCEPT
@ ATTR_STD_GENERATED_TRANSFORM
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_UV_TANGENT_SIGN
@ ATTR_STD_RANDOM_PER_ISLAND
CCL_NAMESPACE_BEGIN ccl_device float3 svm_mapping(NodeMappingType type, float3 vector, float3 location, float3 rotation, float3 scale)
ccl_device_inline float average(const float2 a)
ccl_device_inline float reduce_max(const float2 a)
ccl_device_inline float2 interp(const float2 a, const float2 b, float t)
ccl_device_inline float3 one_float3()
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
CCL_NAMESPACE_BEGIN ccl_device void svm_vector_math(ccl_private float *value, ccl_private float3 *vector, NodeVectorMathType type, float3 a, float3 b, float3 c, float param1)
ccl_device float svm_math(NodeMathType type, float a, float b, float c)
ccl_device float3 svm_math_blackbody_color_rec709(float t)
ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma)
color rgb_ramp_lookup(color ramp[], float at, int interpolate, int extrapolate)
#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_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_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, int offset, float f, bool interpolate, bool extrapolate, int table_size)
@ 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_OUTPUT
@ SHADER_SPECIAL_TYPE_CLOSURE
@ SHADER_SPECIAL_TYPE_OSL
static void sky_texture_precompute_hosek(SunSky *sunsky, float3 dir, float turbidity, float ground_albedo)
static float2 sky_spherical_coordinates(float3 dir)
static float sky_perez_function(float lam[6], float theta, float gamma)
#define TEXTURE_MAPPING_DEFINE(TextureNode)
static void sky_texture_precompute_preetham(SunSky *sunsky, float3 dir, float turbidity)
static void sky_texture_precompute_nishita(SunSky *sunsky, bool sun_disc, float sun_size, float sun_intensity, float sun_elevation, float sun_rotation, float altitude, float air_density, float dust_density)
void SKY_arhosekskymodelstate_free(SKY_ArHosekSkyModelState *state)
SKY_ArHosekSkyModelState * SKY_arhosek_xyz_skymodelstate_alloc_init(const double turbidity, const double albedo, const double elevation)
void SKY_nishita_skymodel_precompute_sun(float sun_elevation, float angular_diameter, float altitude, float air_density, float dust_density, float *r_pixel_bottom, float *r_pixel_top)
bool string_endswith(const string_view s, const string_view end)
void insert(const char *x, int y)
static NodeType * add(const char *name, CreateFunc create, Type type=NONE, const NodeType *base=NULL)
float get_float(const SocketType &input) const
float3 get_float3(const SocketType &input) const
void set_owner(const NodeOwner *owner_)
SKY_ArHosekSkyModelConfiguration configs[11]
ImageManager * image_manager
ShaderManager * shader_manager
LightManager * light_manager
static bool is_float3(Type type)
static ustring type_name(Type type)
static void * zero_default_value()
ccl_device_inline float sqr(float a)
ccl_device_inline float4 float3_to_float4(const float3 a)
ccl_device_inline int clamp(int a, int mn, int mx)
@ IMAGE_ALPHA_CHANNEL_PACKED
@ IMAGE_ALPHA_UNASSOCIATED
#define TEX_IMAGE_MISSING_R
#define TEX_IMAGE_MISSING_B
#define TEX_IMAGE_MISSING_G
ccl_device_inline size_t align_up(size_t offset, size_t alignment)
ccl_device_inline size_t divide_up(size_t x, size_t y)