1 /* 2 * Copyright 2011-2013 Blender Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __SVM_TYPES_H__ 18 #define __SVM_TYPES_H__ 19 20 CCL_NAMESPACE_BEGIN 21 22 /* Stack */ 23 24 /* SVM stack has a fixed size */ 25 #define SVM_STACK_SIZE 255 26 /* SVM stack offsets with this value indicate that it's not on the stack */ 27 #define SVM_STACK_INVALID 255 28 29 #define SVM_BUMP_EVAL_STATE_SIZE 9 30 31 /* Nodes */ 32 33 /* Known frequencies of used nodes, used for selective nodes compilation 34 * in the kernel. Currently only affects split OpenCL kernel. 35 * 36 * Keep as defines so it's easy to check which nodes are to be compiled 37 * from preprocessor. 38 * 39 * Lower the number of group more often the node is used. 40 */ 41 #define NODE_GROUP_LEVEL_0 0 42 #define NODE_GROUP_LEVEL_1 1 43 #define NODE_GROUP_LEVEL_2 2 44 #define NODE_GROUP_LEVEL_3 3 45 #define NODE_GROUP_LEVEL_4 4 46 #define NODE_GROUP_LEVEL_MAX NODE_GROUP_LEVEL_4 47 48 #define NODE_FEATURE_VOLUME (1 << 0) 49 #define NODE_FEATURE_HAIR (1 << 1) 50 #define NODE_FEATURE_BUMP (1 << 2) 51 #define NODE_FEATURE_BUMP_STATE (1 << 3) 52 #define NODE_FEATURE_VORONOI_EXTRA (1 << 4) 53 /* TODO(sergey): Consider using something like ((uint)(-1)). 54 * Need to check carefully operand types around usage of this 55 * define first. 56 */ 57 #define NODE_FEATURE_ALL \ 58 (NODE_FEATURE_VOLUME | NODE_FEATURE_HAIR | NODE_FEATURE_BUMP | NODE_FEATURE_BUMP_STATE | \ 59 NODE_FEATURE_VORONOI_EXTRA) 60 61 #define NODES_GROUP(group) ((group) <= __NODES_MAX_GROUP__) 62 #define NODES_FEATURE(feature) ((__NODES_FEATURES__ & (feature)) != 0) 63 64 typedef enum ShaderNodeType { 65 NODE_END = 0, 66 NODE_SHADER_JUMP, 67 NODE_CLOSURE_BSDF, 68 NODE_CLOSURE_EMISSION, 69 NODE_CLOSURE_BACKGROUND, 70 NODE_CLOSURE_SET_WEIGHT, 71 NODE_CLOSURE_WEIGHT, 72 NODE_EMISSION_WEIGHT, 73 NODE_MIX_CLOSURE, 74 NODE_JUMP_IF_ZERO, 75 NODE_JUMP_IF_ONE, 76 NODE_GEOMETRY, 77 NODE_CONVERT, 78 NODE_TEX_COORD, 79 NODE_VALUE_F, 80 NODE_VALUE_V, 81 NODE_ATTR, 82 NODE_VERTEX_COLOR, 83 NODE_GEOMETRY_BUMP_DX, 84 NODE_GEOMETRY_BUMP_DY, 85 NODE_SET_DISPLACEMENT, 86 NODE_DISPLACEMENT, 87 NODE_VECTOR_DISPLACEMENT, 88 NODE_TEX_IMAGE, 89 NODE_TEX_IMAGE_BOX, 90 NODE_TEX_NOISE, 91 NODE_SET_BUMP, 92 NODE_ATTR_BUMP_DX, 93 NODE_ATTR_BUMP_DY, 94 NODE_VERTEX_COLOR_BUMP_DX, 95 NODE_VERTEX_COLOR_BUMP_DY, 96 NODE_TEX_COORD_BUMP_DX, 97 NODE_TEX_COORD_BUMP_DY, 98 NODE_CLOSURE_SET_NORMAL, 99 NODE_ENTER_BUMP_EVAL, 100 NODE_LEAVE_BUMP_EVAL, 101 NODE_HSV, 102 NODE_CLOSURE_HOLDOUT, 103 NODE_FRESNEL, 104 NODE_LAYER_WEIGHT, 105 NODE_CLOSURE_VOLUME, 106 NODE_PRINCIPLED_VOLUME, 107 NODE_MATH, 108 NODE_VECTOR_MATH, 109 NODE_RGB_RAMP, 110 NODE_GAMMA, 111 NODE_BRIGHTCONTRAST, 112 NODE_LIGHT_PATH, 113 NODE_OBJECT_INFO, 114 NODE_PARTICLE_INFO, 115 NODE_HAIR_INFO, 116 NODE_TEXTURE_MAPPING, 117 NODE_MAPPING, 118 NODE_MIN_MAX, 119 NODE_CAMERA, 120 NODE_TEX_ENVIRONMENT, 121 NODE_TEX_SKY, 122 NODE_TEX_GRADIENT, 123 NODE_TEX_VORONOI, 124 NODE_TEX_MUSGRAVE, 125 NODE_TEX_WAVE, 126 NODE_TEX_MAGIC, 127 NODE_TEX_CHECKER, 128 NODE_TEX_BRICK, 129 NODE_TEX_WHITE_NOISE, 130 NODE_NORMAL, 131 NODE_LIGHT_FALLOFF, 132 NODE_IES, 133 NODE_RGB_CURVES, 134 NODE_VECTOR_CURVES, 135 NODE_TANGENT, 136 NODE_NORMAL_MAP, 137 NODE_INVERT, 138 NODE_MIX, 139 NODE_SEPARATE_VECTOR, 140 NODE_COMBINE_VECTOR, 141 NODE_SEPARATE_HSV, 142 NODE_COMBINE_HSV, 143 NODE_VECTOR_ROTATE, 144 NODE_VECTOR_TRANSFORM, 145 NODE_WIREFRAME, 146 NODE_WAVELENGTH, 147 NODE_BLACKBODY, 148 NODE_MAP_RANGE, 149 NODE_CLAMP, 150 NODE_BEVEL, 151 NODE_AMBIENT_OCCLUSION, 152 NODE_TEX_VOXEL, 153 NODE_AOV_START, 154 NODE_AOV_COLOR, 155 NODE_AOV_VALUE, 156 /* NOTE: for best OpenCL performance, item definition in the enum must 157 * match the switch case order in svm.h. */ 158 } ShaderNodeType; 159 160 typedef enum NodeAttributeType { 161 NODE_ATTR_FLOAT = 0, 162 NODE_ATTR_FLOAT2, 163 NODE_ATTR_FLOAT3, 164 NODE_ATTR_RGBA, 165 NODE_ATTR_MATRIX 166 } NodeAttributeType; 167 168 typedef enum NodeGeometry { 169 NODE_GEOM_P = 0, 170 NODE_GEOM_N, 171 NODE_GEOM_T, 172 NODE_GEOM_I, 173 NODE_GEOM_Ng, 174 NODE_GEOM_uv 175 } NodeGeometry; 176 177 typedef enum NodeObjectInfo { 178 NODE_INFO_OB_LOCATION, 179 NODE_INFO_OB_COLOR, 180 NODE_INFO_OB_INDEX, 181 NODE_INFO_MAT_INDEX, 182 NODE_INFO_OB_RANDOM 183 } NodeObjectInfo; 184 185 typedef enum NodeParticleInfo { 186 NODE_INFO_PAR_INDEX, 187 NODE_INFO_PAR_RANDOM, 188 NODE_INFO_PAR_AGE, 189 NODE_INFO_PAR_LIFETIME, 190 NODE_INFO_PAR_LOCATION, 191 NODE_INFO_PAR_ROTATION, 192 NODE_INFO_PAR_SIZE, 193 NODE_INFO_PAR_VELOCITY, 194 NODE_INFO_PAR_ANGULAR_VELOCITY 195 } NodeParticleInfo; 196 197 typedef enum NodeHairInfo { 198 NODE_INFO_CURVE_IS_STRAND, 199 NODE_INFO_CURVE_INTERCEPT, 200 NODE_INFO_CURVE_THICKNESS, 201 /*fade for minimum hair width transpency*/ 202 /*NODE_INFO_CURVE_FADE,*/ 203 NODE_INFO_CURVE_TANGENT_NORMAL, 204 NODE_INFO_CURVE_RANDOM, 205 } NodeHairInfo; 206 207 typedef enum NodeLightPath { 208 NODE_LP_camera = 0, 209 NODE_LP_shadow, 210 NODE_LP_diffuse, 211 NODE_LP_glossy, 212 NODE_LP_singular, 213 NODE_LP_reflection, 214 NODE_LP_transmission, 215 NODE_LP_volume_scatter, 216 NODE_LP_backfacing, 217 NODE_LP_ray_length, 218 NODE_LP_ray_depth, 219 NODE_LP_ray_diffuse, 220 NODE_LP_ray_glossy, 221 NODE_LP_ray_transparent, 222 NODE_LP_ray_transmission, 223 } NodeLightPath; 224 225 typedef enum NodeLightFalloff { 226 NODE_LIGHT_FALLOFF_QUADRATIC, 227 NODE_LIGHT_FALLOFF_LINEAR, 228 NODE_LIGHT_FALLOFF_CONSTANT 229 } NodeLightFalloff; 230 231 typedef enum NodeTexCoord { 232 NODE_TEXCO_NORMAL, 233 NODE_TEXCO_OBJECT, 234 NODE_TEXCO_CAMERA, 235 NODE_TEXCO_WINDOW, 236 NODE_TEXCO_REFLECTION, 237 NODE_TEXCO_DUPLI_GENERATED, 238 NODE_TEXCO_DUPLI_UV, 239 NODE_TEXCO_VOLUME_GENERATED 240 } NodeTexCoord; 241 242 typedef enum NodeMix { 243 NODE_MIX_BLEND = 0, 244 NODE_MIX_ADD, 245 NODE_MIX_MUL, 246 NODE_MIX_SUB, 247 NODE_MIX_SCREEN, 248 NODE_MIX_DIV, 249 NODE_MIX_DIFF, 250 NODE_MIX_DARK, 251 NODE_MIX_LIGHT, 252 NODE_MIX_OVERLAY, 253 NODE_MIX_DODGE, 254 NODE_MIX_BURN, 255 NODE_MIX_HUE, 256 NODE_MIX_SAT, 257 NODE_MIX_VAL, 258 NODE_MIX_COLOR, 259 NODE_MIX_SOFT, 260 NODE_MIX_LINEAR, 261 NODE_MIX_CLAMP /* used for the clamp UI option */ 262 } NodeMix; 263 264 typedef enum NodeMathType { 265 NODE_MATH_ADD, 266 NODE_MATH_SUBTRACT, 267 NODE_MATH_MULTIPLY, 268 NODE_MATH_DIVIDE, 269 NODE_MATH_SINE, 270 NODE_MATH_COSINE, 271 NODE_MATH_TANGENT, 272 NODE_MATH_ARCSINE, 273 NODE_MATH_ARCCOSINE, 274 NODE_MATH_ARCTANGENT, 275 NODE_MATH_POWER, 276 NODE_MATH_LOGARITHM, 277 NODE_MATH_MINIMUM, 278 NODE_MATH_MAXIMUM, 279 NODE_MATH_ROUND, 280 NODE_MATH_LESS_THAN, 281 NODE_MATH_GREATER_THAN, 282 NODE_MATH_MODULO, 283 NODE_MATH_ABSOLUTE, 284 NODE_MATH_ARCTAN2, 285 NODE_MATH_FLOOR, 286 NODE_MATH_CEIL, 287 NODE_MATH_FRACTION, 288 NODE_MATH_SQRT, 289 NODE_MATH_INV_SQRT, 290 NODE_MATH_SIGN, 291 NODE_MATH_EXPONENT, 292 NODE_MATH_RADIANS, 293 NODE_MATH_DEGREES, 294 NODE_MATH_SINH, 295 NODE_MATH_COSH, 296 NODE_MATH_TANH, 297 NODE_MATH_TRUNC, 298 NODE_MATH_SNAP, 299 NODE_MATH_WRAP, 300 NODE_MATH_COMPARE, 301 NODE_MATH_MULTIPLY_ADD, 302 NODE_MATH_PINGPONG, 303 NODE_MATH_SMOOTH_MIN, 304 NODE_MATH_SMOOTH_MAX, 305 } NodeMathType; 306 307 typedef enum NodeVectorMathType { 308 NODE_VECTOR_MATH_ADD, 309 NODE_VECTOR_MATH_SUBTRACT, 310 NODE_VECTOR_MATH_MULTIPLY, 311 NODE_VECTOR_MATH_DIVIDE, 312 313 NODE_VECTOR_MATH_CROSS_PRODUCT, 314 NODE_VECTOR_MATH_PROJECT, 315 NODE_VECTOR_MATH_REFLECT, 316 NODE_VECTOR_MATH_DOT_PRODUCT, 317 318 NODE_VECTOR_MATH_DISTANCE, 319 NODE_VECTOR_MATH_LENGTH, 320 NODE_VECTOR_MATH_SCALE, 321 NODE_VECTOR_MATH_NORMALIZE, 322 323 NODE_VECTOR_MATH_SNAP, 324 NODE_VECTOR_MATH_FLOOR, 325 NODE_VECTOR_MATH_CEIL, 326 NODE_VECTOR_MATH_MODULO, 327 NODE_VECTOR_MATH_FRACTION, 328 NODE_VECTOR_MATH_ABSOLUTE, 329 NODE_VECTOR_MATH_MINIMUM, 330 NODE_VECTOR_MATH_MAXIMUM, 331 NODE_VECTOR_MATH_WRAP, 332 NODE_VECTOR_MATH_SINE, 333 NODE_VECTOR_MATH_COSINE, 334 NODE_VECTOR_MATH_TANGENT, 335 } NodeVectorMathType; 336 337 typedef enum NodeClampType { 338 NODE_CLAMP_MINMAX, 339 NODE_CLAMP_RANGE, 340 } NodeClampType; 341 342 typedef enum NodeMapRangeType { 343 NODE_MAP_RANGE_LINEAR, 344 NODE_MAP_RANGE_STEPPED, 345 NODE_MAP_RANGE_SMOOTHSTEP, 346 NODE_MAP_RANGE_SMOOTHERSTEP, 347 } NodeMapRangeType; 348 349 typedef enum NodeMappingType { 350 NODE_MAPPING_TYPE_POINT, 351 NODE_MAPPING_TYPE_TEXTURE, 352 NODE_MAPPING_TYPE_VECTOR, 353 NODE_MAPPING_TYPE_NORMAL 354 } NodeMappingType; 355 356 typedef enum NodeVectorRotateType { 357 NODE_VECTOR_ROTATE_TYPE_AXIS, 358 NODE_VECTOR_ROTATE_TYPE_AXIS_X, 359 NODE_VECTOR_ROTATE_TYPE_AXIS_Y, 360 NODE_VECTOR_ROTATE_TYPE_AXIS_Z, 361 NODE_VECTOR_ROTATE_TYPE_EULER_XYZ, 362 } NodeVectorRotateType; 363 364 typedef enum NodeVectorTransformType { 365 NODE_VECTOR_TRANSFORM_TYPE_VECTOR, 366 NODE_VECTOR_TRANSFORM_TYPE_POINT, 367 NODE_VECTOR_TRANSFORM_TYPE_NORMAL 368 } NodeVectorTransformType; 369 370 typedef enum NodeVectorTransformConvertSpace { 371 NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD, 372 NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT, 373 NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA 374 } NodeVectorTransformConvertSpace; 375 376 typedef enum NodeConvert { 377 NODE_CONVERT_FV, 378 NODE_CONVERT_FI, 379 NODE_CONVERT_CF, 380 NODE_CONVERT_CI, 381 NODE_CONVERT_VF, 382 NODE_CONVERT_VI, 383 NODE_CONVERT_IF, 384 NODE_CONVERT_IV 385 } NodeConvert; 386 387 typedef enum NodeMusgraveType { 388 NODE_MUSGRAVE_MULTIFRACTAL, 389 NODE_MUSGRAVE_FBM, 390 NODE_MUSGRAVE_HYBRID_MULTIFRACTAL, 391 NODE_MUSGRAVE_RIDGED_MULTIFRACTAL, 392 NODE_MUSGRAVE_HETERO_TERRAIN 393 } NodeMusgraveType; 394 395 typedef enum NodeWaveType { NODE_WAVE_BANDS, NODE_WAVE_RINGS } NodeWaveType; 396 397 typedef enum NodeWaveBandsDirection { 398 NODE_WAVE_BANDS_DIRECTION_X, 399 NODE_WAVE_BANDS_DIRECTION_Y, 400 NODE_WAVE_BANDS_DIRECTION_Z, 401 NODE_WAVE_BANDS_DIRECTION_DIAGONAL 402 } NodeWaveBandsDirection; 403 404 typedef enum NodeWaveRingsDirection { 405 NODE_WAVE_RINGS_DIRECTION_X, 406 NODE_WAVE_RINGS_DIRECTION_Y, 407 NODE_WAVE_RINGS_DIRECTION_Z, 408 NODE_WAVE_RINGS_DIRECTION_SPHERICAL 409 } NodeWaveRingsDirection; 410 411 typedef enum NodeWaveProfile { 412 NODE_WAVE_PROFILE_SIN, 413 NODE_WAVE_PROFILE_SAW, 414 NODE_WAVE_PROFILE_TRI, 415 } NodeWaveProfile; 416 417 typedef enum NodeSkyType { NODE_SKY_PREETHAM, NODE_SKY_HOSEK, NODE_SKY_NISHITA } NodeSkyType; 418 419 typedef enum NodeGradientType { 420 NODE_BLEND_LINEAR, 421 NODE_BLEND_QUADRATIC, 422 NODE_BLEND_EASING, 423 NODE_BLEND_DIAGONAL, 424 NODE_BLEND_RADIAL, 425 NODE_BLEND_QUADRATIC_SPHERE, 426 NODE_BLEND_SPHERICAL 427 } NodeGradientType; 428 429 typedef enum NodeVoronoiDistanceMetric { 430 NODE_VORONOI_EUCLIDEAN, 431 NODE_VORONOI_MANHATTAN, 432 NODE_VORONOI_CHEBYCHEV, 433 NODE_VORONOI_MINKOWSKI, 434 } NodeVoronoiDistanceMetric; 435 436 typedef enum NodeVoronoiFeature { 437 NODE_VORONOI_F1, 438 NODE_VORONOI_F2, 439 NODE_VORONOI_SMOOTH_F1, 440 NODE_VORONOI_DISTANCE_TO_EDGE, 441 NODE_VORONOI_N_SPHERE_RADIUS, 442 } NodeVoronoiFeature; 443 444 typedef enum NodeBlendWeightType { 445 NODE_LAYER_WEIGHT_FRESNEL, 446 NODE_LAYER_WEIGHT_FACING 447 } NodeBlendWeightType; 448 449 typedef enum NodeTangentDirectionType { 450 NODE_TANGENT_RADIAL, 451 NODE_TANGENT_UVMAP 452 } NodeTangentDirectionType; 453 454 typedef enum NodeTangentAxis { 455 NODE_TANGENT_AXIS_X, 456 NODE_TANGENT_AXIS_Y, 457 NODE_TANGENT_AXIS_Z 458 } NodeTangentAxis; 459 460 typedef enum NodeNormalMapSpace { 461 NODE_NORMAL_MAP_TANGENT, 462 NODE_NORMAL_MAP_OBJECT, 463 NODE_NORMAL_MAP_WORLD, 464 NODE_NORMAL_MAP_BLENDER_OBJECT, 465 NODE_NORMAL_MAP_BLENDER_WORLD, 466 } NodeNormalMapSpace; 467 468 typedef enum NodeImageProjection { 469 NODE_IMAGE_PROJ_FLAT = 0, 470 NODE_IMAGE_PROJ_BOX = 1, 471 NODE_IMAGE_PROJ_SPHERE = 2, 472 NODE_IMAGE_PROJ_TUBE = 3, 473 } NodeImageProjection; 474 475 typedef enum NodeImageFlags { 476 NODE_IMAGE_COMPRESS_AS_SRGB = 1, 477 NODE_IMAGE_ALPHA_UNASSOCIATE = 2, 478 } NodeImageFlags; 479 480 typedef enum NodeEnvironmentProjection { 481 NODE_ENVIRONMENT_EQUIRECTANGULAR = 0, 482 NODE_ENVIRONMENT_MIRROR_BALL = 1, 483 } NodeEnvironmentProjection; 484 485 typedef enum NodeBumpOffset { 486 NODE_BUMP_OFFSET_CENTER, 487 NODE_BUMP_OFFSET_DX, 488 NODE_BUMP_OFFSET_DY, 489 } NodeBumpOffset; 490 491 typedef enum NodeTexVoxelSpace { 492 NODE_TEX_VOXEL_SPACE_OBJECT = 0, 493 NODE_TEX_VOXEL_SPACE_WORLD = 1, 494 } NodeTexVoxelSpace; 495 496 typedef enum NodeAO { 497 NODE_AO_ONLY_LOCAL = (1 << 0), 498 NODE_AO_INSIDE = (1 << 1), 499 NODE_AO_GLOBAL_RADIUS = (1 << 2), 500 } NodeAO; 501 502 typedef enum ShaderType { 503 SHADER_TYPE_SURFACE, 504 SHADER_TYPE_VOLUME, 505 SHADER_TYPE_DISPLACEMENT, 506 SHADER_TYPE_BUMP, 507 } ShaderType; 508 509 typedef enum NodePrincipledHairParametrization { 510 NODE_PRINCIPLED_HAIR_REFLECTANCE = 0, 511 NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION = 1, 512 NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION = 2, 513 NODE_PRINCIPLED_HAIR_NUM, 514 } NodePrincipledHairParametrization; 515 516 /* Closure */ 517 518 typedef enum ClosureType { 519 /* Special type, flags generic node as a non-BSDF. */ 520 CLOSURE_NONE_ID, 521 522 CLOSURE_BSDF_ID, 523 524 /* Diffuse */ 525 CLOSURE_BSDF_DIFFUSE_ID, 526 CLOSURE_BSDF_OREN_NAYAR_ID, 527 CLOSURE_BSDF_DIFFUSE_RAMP_ID, 528 CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID, 529 CLOSURE_BSDF_PRINCIPLED_SHEEN_ID, 530 CLOSURE_BSDF_DIFFUSE_TOON_ID, 531 CLOSURE_BSDF_TRANSLUCENT_ID, 532 533 /* Glossy */ 534 CLOSURE_BSDF_REFLECTION_ID, 535 CLOSURE_BSDF_MICROFACET_GGX_ID, 536 CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID, 537 CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID, 538 CLOSURE_BSDF_MICROFACET_BECKMANN_ID, 539 CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID, 540 CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID, 541 CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID, 542 CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, 543 CLOSURE_BSDF_PHONG_RAMP_ID, 544 CLOSURE_BSDF_GLOSSY_TOON_ID, 545 CLOSURE_BSDF_HAIR_REFLECTION_ID, 546 547 /* Transmission */ 548 CLOSURE_BSDF_REFRACTION_ID, 549 CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, 550 CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, 551 CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID, 552 CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID, 553 CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID, 554 CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID, 555 CLOSURE_BSDF_SHARP_GLASS_ID, 556 CLOSURE_BSDF_HAIR_PRINCIPLED_ID, 557 CLOSURE_BSDF_HAIR_TRANSMISSION_ID, 558 559 /* Special cases */ 560 CLOSURE_BSDF_BSSRDF_ID, 561 CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID, 562 CLOSURE_BSDF_TRANSPARENT_ID, 563 564 /* BSSRDF */ 565 CLOSURE_BSSRDF_CUBIC_ID, 566 CLOSURE_BSSRDF_GAUSSIAN_ID, 567 CLOSURE_BSSRDF_PRINCIPLED_ID, 568 CLOSURE_BSSRDF_BURLEY_ID, 569 CLOSURE_BSSRDF_RANDOM_WALK_ID, 570 CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID, 571 572 /* Other */ 573 CLOSURE_HOLDOUT_ID, 574 575 /* Volume */ 576 CLOSURE_VOLUME_ID, 577 CLOSURE_VOLUME_ABSORPTION_ID, 578 CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID, 579 580 CLOSURE_BSDF_PRINCIPLED_ID, 581 582 NBUILTIN_CLOSURES 583 } ClosureType; 584 585 /* watch this, being lazy with memory usage */ 586 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID) 587 #define CLOSURE_IS_BSDF_DIFFUSE(type) \ 588 (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_TRANSLUCENT_ID) 589 #define CLOSURE_IS_BSDF_GLOSSY(type) \ 590 ((type >= CLOSURE_BSDF_REFLECTION_ID && type <= CLOSURE_BSDF_HAIR_REFLECTION_ID) || \ 591 (type == CLOSURE_BSDF_HAIR_PRINCIPLED_ID)) 592 #define CLOSURE_IS_BSDF_TRANSMISSION(type) \ 593 (type >= CLOSURE_BSDF_REFRACTION_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID) 594 #define CLOSURE_IS_BSDF_BSSRDF(type) \ 595 (type == CLOSURE_BSDF_BSSRDF_ID || type == CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID) 596 #define CLOSURE_IS_BSDF_SINGULAR(type) \ 597 (type == CLOSURE_BSDF_REFLECTION_ID || type == CLOSURE_BSDF_REFRACTION_ID || \ 598 type == CLOSURE_BSDF_TRANSPARENT_ID) 599 #define CLOSURE_IS_BSDF_TRANSPARENT(type) (type == CLOSURE_BSDF_TRANSPARENT_ID) 600 #define CLOSURE_IS_BSDF_MULTISCATTER(type) \ 601 (type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID || \ 602 type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID) 603 #define CLOSURE_IS_BSDF_MICROFACET(type) \ 604 ((type >= CLOSURE_BSDF_MICROFACET_GGX_ID && type <= CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID) || \ 605 (type >= CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID && \ 606 type <= CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID) || \ 607 (type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID)) 608 #define CLOSURE_IS_BSDF_MICROFACET_FRESNEL(type) \ 609 (type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID || \ 610 type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID || \ 611 type == CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID || \ 612 type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID) 613 #define CLOSURE_IS_BSDF_OR_BSSRDF(type) (type <= CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID) 614 #define CLOSURE_IS_BSSRDF(type) \ 615 (type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID) 616 #define CLOSURE_IS_DISK_BSSRDF(type) \ 617 (type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_BURLEY_ID) 618 #define CLOSURE_IS_VOLUME(type) \ 619 (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID) 620 #define CLOSURE_IS_VOLUME_SCATTER(type) (type == CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID) 621 #define CLOSURE_IS_VOLUME_ABSORPTION(type) (type == CLOSURE_VOLUME_ABSORPTION_ID) 622 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID) 623 #define CLOSURE_IS_PHASE(type) (type == CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID) 624 #define CLOSURE_IS_GLASS(type) \ 625 (type >= CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID && type <= CLOSURE_BSDF_SHARP_GLASS_ID) 626 #define CLOSURE_IS_PRINCIPLED(type) (type == CLOSURE_BSDF_PRINCIPLED_ID) 627 628 #define CLOSURE_WEIGHT_CUTOFF 1e-5f 629 630 CCL_NAMESPACE_END 631 632 #endif /* __SVM_TYPES_H__ */ 633