Blender V5.3
interpolation.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2024 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
6
7#include "kernel/types.h"
8#include "scene/attribute.h"
9#include "scene/mesh.h"
10
11#include "util/color.h"
12
14
15/* Classes for interpolation to use float math for byte value, for precision. */
16template<typename T> struct SubdFloat {
17 using Type = T;
18 using AccumType = T;
19
20 static Type read(const Type &value)
21 {
22 return value;
23 }
24
25 static Type output(const Type &value)
26 {
27 return value;
28 }
29};
30
31struct SubdByte {
32 using Type = uchar4;
34
35 static AccumType read(const Type &value)
36 {
37 return color_uchar4_to_float4(value);
38 }
39
40 static Type output(const AccumType &value)
41 {
42 return color_float4_to_uchar4(value);
43 }
44};
45
46struct SubdNormal {
49
50 static AccumType read(const Type &value)
51 {
52 return value.decode();
53 }
54
55 static Type output(const AccumType &value)
56 {
57 return packed_normal(value);
58 }
59};
60
64
65 static AccumType read(const Type &value)
66 {
67 return float3(value);
68 }
69
70 static Type output(const AccumType &value)
71 {
72 return packed_float3(value);
73 }
74};
75
79
80 static AccumType read(const Type &value)
81 {
82 return make_float4(value);
83 }
84
85 static Type output(const AccumType &value)
86 {
87 return make_quaternion(value.x, value.y, value.z, value.w);
88 }
89};
90
91#ifdef WITH_OPENSUBDIV
93 OsdMesh &osd_mesh,
94 OsdData &osd_data)
95#else
97#endif
98 : mesh(mesh)
99#ifdef WITH_OPENSUBDIV
100 ,
101 osd_mesh(osd_mesh),
102 osd_data(osd_data)
103#endif
104{
105}
106
108{
109 if (mesh.get_num_subd_faces() == 0) {
110 return;
111 }
112
113 for (const Attribute &subd_attr : mesh.subd_attributes.attributes) {
114 if (!support_interp_attribute(subd_attr)) {
115 continue;
116 }
117 Attribute &mesh_attr = mesh.attributes.copy(subd_attr);
118 setup_attribute(subd_attr, mesh_attr);
119 }
120}
121
123{
124 switch (attr.std) {
125 /* Smooth normals are computed from derivatives, for linear interpolate. */
128 if (mesh.get_subdivision_type() == Mesh::SUBDIVISION_CATMULL_CLARK) {
129 return false;
130 }
131 break;
132 /* Center step position is computed by patch evaluation during dicing.
133 * Only interpolate position when there are motion steps. */
135 if (!attr.has_motion()) {
136 return false;
137 }
138 break;
139 /* PTex coordinates will be computed by subdivision. */
141 case ATTR_STD_PTEX_UV:
142 return false;
143 default:
144 break;
145 }
146
147 /* Skip element types that should not exist for subd attributes anyway. */
148 switch (attr.element) {
157 break;
158 default:
159 return false;
160 }
161
162 return true;
163}
164
166{
167 if (subd_attr.element & ATTR_ELEMENT_IS_BYTE) {
168 setup_attribute_type<SubdByte>(subd_attr, mesh_attr);
169 }
170 else if (subd_attr.element & ATTR_ELEMENT_IS_NORMAL) {
171 setup_attribute_type<SubdNormal>(subd_attr, mesh_attr);
172 }
173 else if (Attribute::same_storage(subd_attr.type, TypeFloat)) {
174 setup_attribute_type<SubdFloat<float>>(subd_attr, mesh_attr);
175 }
176 else if (Attribute::same_storage(subd_attr.type, TypeFloat2)) {
177 setup_attribute_type<SubdFloat<float2>>(subd_attr, mesh_attr);
178 }
179 else if (Attribute::same_storage(subd_attr.type, TypeVector)) {
180 setup_attribute_type<SubdPackedFloat3>(subd_attr, mesh_attr);
181 }
182 else if (Attribute::same_storage(subd_attr.type, TypeFloat4) ||
183 Attribute::same_storage(subd_attr.type, TypeRGBA))
184 {
185 setup_attribute_type<SubdFloat<float4>>(subd_attr, mesh_attr);
186 }
187 else if (Attribute::same_storage(subd_attr.type, TypeQuaternion)) {
188 setup_attribute_type<SubdQuaternion>(subd_attr, mesh_attr);
189 }
190}
191
192template<typename T>
194 Attribute &mesh_attr,
195 const int motion_step)
196{
197 SubdAttribute attr;
198
199 /* motion_step -1 selects the center step, other select motion steps. */
200 const int attr_step = motion_step + 1;
201 assert(attr_step == 0 || subd_attr.has_motion());
202 const typename T::Type *subd_data = subd_attr.data<typename T::Type>(attr_step);
203 typename T::Type *mesh_data = mesh_attr.data_for_write<typename T::Type>(attr_step);
204
205 assert(mesh_data != nullptr);
206
207 attr.interp = [this, subd_data, mesh_data](const int /*patch_index*/,
208 const int face_index,
209 const int corner,
210 const int *vert_index,
211 const float2 *vert_uv,
212 const int vert_num) {
213 /* Interpolate values at vertices. */
214 const int *subd_face_corners = mesh.get_subd_face_corners().data();
215
216 Mesh::SubdFace face = mesh.get_subd_face(face_index);
217
218 if (face.is_quad()) {
219 /* Simple case for quads. */
220 const typename T::AccumType value0 = T::read(
221 subd_data[subd_face_corners[face.start_corner + 0]]);
222 const typename T::AccumType value1 = T::read(
223 subd_data[subd_face_corners[face.start_corner + 1]]);
224 const typename T::AccumType value2 = T::read(
225 subd_data[subd_face_corners[face.start_corner + 2]]);
226 const typename T::AccumType value3 = T::read(
227 subd_data[subd_face_corners[face.start_corner + 3]]);
228
229 for (int i = 0; i < vert_num; i++) {
230 const float2 uv = vert_uv[i];
231 const typename T::AccumType value = interp(
232 interp(value0, value1, uv.x), interp(value3, value2, uv.x), uv.y);
233 mesh_data[vert_index[i]] = T::output(value);
234 }
235 }
236 else {
237 /* Other n-gons are split into n quads. */
238
239 /* Compute value at center of polygon. */
240 typename T::AccumType value_center = T::read(
241 subd_data[subd_face_corners[face.start_corner]]);
242 for (int j = 1; j < face.num_corners; j++) {
243 value_center += T::read(subd_data[subd_face_corners[face.start_corner + j]]);
244 }
245 value_center /= (float)face.num_corners;
246
247 /* Compute value at corner at adjacent vertices. */
248 const typename T::AccumType value_corner = T::read(
249 subd_data[subd_face_corners[face.start_corner + corner]]);
250 const typename T::AccumType value_prev =
251 0.5f * (value_corner +
252 T::read(subd_data[subd_face_corners[face.start_corner +
253 mod(corner - 1, face.num_corners)]]));
254 const typename T::AccumType value_next =
255 0.5f * (value_corner +
256 T::read(subd_data[subd_face_corners[face.start_corner +
257 mod(corner + 1, face.num_corners)]]));
258
259 for (int i = 0; i < vert_num; i++) {
260 const float2 uv = vert_uv[i];
261
262 /* Interpolate. */
263 const typename T::AccumType value = interp(
264 interp(value_corner, value_next, uv.x), interp(value_prev, value_center, uv.x), uv.y);
265
266 mesh_data[vert_index[i]] = T::output(value);
267 }
268 }
269 };
270
271 vertex_attributes.push_back(std::move(attr));
272}
273
274#ifdef WITH_OPENSUBDIV
275template<typename T>
276void SubdAttributeInterpolation::setup_attribute_vertex_smooth(const Attribute &subd_attr,
277 Attribute &mesh_attr,
278 const int motion_step)
279{
280 SubdAttribute attr;
281
282 // TODO: Avoid computing derivative weights when not needed
283 // TODO: overhead of FindPatch and EvaluateBasis with vertex position
284 const int num_refiner_verts = osd_data.refiner->GetNumVerticesTotal();
285 const int num_local_points = osd_data.patch_table->GetNumLocalPoints();
286 const int num_base_verts = mesh.get_num_subd_base_verts();
287
288 /* Refine attribute data to get patch coordinates. */
289 attr.refined_data.resize((num_refiner_verts + num_local_points) * sizeof(typename T::AccumType));
290 typename T::AccumType *subd_data = reinterpret_cast<typename T::AccumType *>(
291 attr.refined_data.data());
292
293 const int attr_step = motion_step + 1;
294 assert(attr_step == 0 || subd_attr.has_motion());
295 const typename T::Type *base_src = subd_attr.data<typename T::Type>(attr_step);
296 typename T::AccumType *base_dst = subd_data;
297 for (int i = 0; i < num_base_verts; i++) {
298 base_dst[i] = T::read(base_src[i]);
299 }
300
301 Far::PrimvarRefiner primvar_refiner(*osd_data.refiner);
302 typename T::AccumType *src = subd_data;
303 for (int i = 0; i < osd_data.refiner->GetMaxLevel(); i++) {
304 typename T::AccumType *dest = src + osd_data.refiner->GetLevel(i).GetNumVertices();
305 primvar_refiner.Interpolate(
306 i + 1, (OsdValue<typename T::AccumType> *)src, (OsdValue<typename T::AccumType> *&)dest);
307 src = dest;
308 }
309
310 if (num_local_points) {
311 osd_data.patch_table->ComputeLocalPointValues(
312 (OsdValue<typename T::AccumType> *)subd_data,
313 (OsdValue<typename T::AccumType> *)(subd_data + num_refiner_verts));
314 }
315
316 /* Evaluate patches at limit. */
317 assert(attr_step == 0 || mesh_attr.has_motion());
318 typename T::Type *mesh_data = mesh_attr.data_for_write<typename T::Type>(attr_step);
319 assert(mesh_data != nullptr);
320
321 /* Compute motion normals alongside positions. */
322 packed_normal *mesh_normal_data = nullptr;
323 if constexpr (std::is_same_v<typename T::AccumType, float3>) {
324 if (motion_step >= 0 && mesh_attr.std == ATTR_STD_POSITION && mesh_attr.has_motion()) {
326 if (attr_normal) {
327 attr_normal->add_motion(&mesh);
328 mesh_normal_data = attr_normal->data_for_write<packed_normal>(attr_step);
329 }
330 }
331 }
332
333 attr.interp = [this, subd_data, mesh_data, mesh_normal_data](const int patch_index,
334 const int /*face_index*/,
335 const int /*corner*/,
336 const int *vert_index,
337 const float2 *vert_uv,
338 const int vert_num) {
339 for (int i = 0; i < vert_num; i++) {
340 /* Compute patch weights. */
341 const float2 uv = vert_uv[i];
342
343 const Far::PatchTable::PatchHandle &handle = *osd_data.patch_map->FindPatch(
344 patch_index, (double)uv.x, (double)uv.y);
345
346 float p_weights[20], du_weights[20], dv_weights[20];
347 osd_data.patch_table->EvaluateBasis(handle, uv.x, uv.y, p_weights, du_weights, dv_weights);
348 Far::ConstIndexArray cv = osd_data.patch_table->GetPatchVertices(handle);
349
350 /* Compute position. */
351 typename T::AccumType value = subd_data[cv[0]] * p_weights[0];
352 for (int k = 1; k < cv.size(); k++) {
353 value += subd_data[cv[k]] * p_weights[k];
354 }
355 mesh_data[vert_index[i]] = T::output(value);
356
357 /* Optionally compute normal. */
358 if (mesh_normal_data) {
359 if constexpr (std::is_same_v<typename T::AccumType, float3>) {
360 float3 du = zero_float3();
361 float3 dv = zero_float3();
362 for (int k = 0; k < cv.size(); k++) {
363 const float3 p = subd_data[cv[k]];
364 du += p * du_weights[k];
365 dv += p * dv_weights[k];
366 }
367 mesh_normal_data[vert_index[i]] = packed_normal(
368 safe_normalize_fallback(cross(du, dv), make_float3(0.0f, 0.0f, 1.0f)));
369 }
370 }
371 }
372 };
373
374 vertex_attributes.push_back(std::move(attr));
375}
376
377#endif
378
379template<typename T>
381 Attribute &mesh_attr,
382 const int motion_step)
383{
384 SubdAttribute attr;
385
386 /* Interpolate values at corners. */
387 const int attr_step = motion_step + 1;
388 assert(attr_step == 0 || subd_attr.has_motion());
389 const typename T::Type *subd_data = subd_attr.data<typename T::Type>(attr_step);
390 typename T::Type *mesh_data = mesh_attr.data_for_write<typename T::Type>(attr_step);
391
392 assert(mesh_data != nullptr);
393
394 attr.interp = [this, subd_data, mesh_data](const int /*patch_index*/,
395 const int face_index,
396 const int corner,
397 const int *triangle_index,
398 const float2 *triangle_uv,
399 const int triangle_num) {
400 Mesh::SubdFace face = mesh.get_subd_face(face_index);
401
402 if (face.is_quad()) {
403 /* Simple case for quads. */
404 const typename T::AccumType value0 = T::read(subd_data[face.start_corner + 0]);
405 const typename T::AccumType value1 = T::read(subd_data[face.start_corner + 1]);
406 const typename T::AccumType value2 = T::read(subd_data[face.start_corner + 2]);
407 const typename T::AccumType value3 = T::read(subd_data[face.start_corner + 3]);
408
409 for (size_t i = 0; i < triangle_num; i++) {
410 for (int j = 0; j < 3; j++) {
411 const float2 uv = triangle_uv[(i * 3) + j];
412 const typename T::AccumType value = interp(
413 interp(value0, value1, uv.x), interp(value3, value2, uv.x), uv.y);
414 mesh_data[triangle_index[i] * 3 + j] = T::output(value);
415 }
416 }
417 }
418 else {
419 /* Other n-gons are split into n quads. */
420
421 /* Compute value at center of polygon. */
422 typename T::AccumType value_center = T::read(subd_data[face.start_corner]);
423 for (int j = 1; j < face.num_corners; j++) {
424 value_center += T::read(subd_data[face.start_corner + j]);
425 }
426 value_center /= (float)face.num_corners;
427
428 /* Compute value at corner at adjacent vertices. */
429 const typename T::AccumType value_corner = T::read(subd_data[face.start_corner + corner]);
430 const typename T::AccumType value_prev =
431 0.5f * (value_corner +
432 T::read(subd_data[face.start_corner + mod(corner - 1, face.num_corners)]));
433 const typename T::AccumType value_next =
434 0.5f * (value_corner +
435 T::read(subd_data[face.start_corner + mod(corner + 1, face.num_corners)]));
436
437 for (size_t i = 0; i < triangle_num; i++) {
438 for (int j = 0; j < 3; j++) {
439 const float2 uv = triangle_uv[(i * 3) + j];
440
441 /* Interpolate. */
442 const typename T::AccumType value = interp(interp(value_corner, value_next, uv.x),
443 interp(value_prev, value_center, uv.x),
444 uv.y);
445
446 mesh_data[triangle_index[i] * 3 + j] = T::output(value);
447 }
448 }
449 }
450 };
451
452 triangle_attributes.push_back(std::move(attr));
453}
454
455#ifdef WITH_OPENSUBDIV
456template<typename T>
457void SubdAttributeInterpolation::setup_attribute_corner_smooth(Attribute &mesh_attr,
458 const int channel,
459 const vector<char> &merged_values)
460{
461 SubdAttribute attr;
462
463 // TODO: Avoid computing derivative weights when not needed
464 const int num_refiner_fvars = osd_data.refiner->GetNumFVarValuesTotal(channel);
465 const int num_local_points = osd_data.patch_table->GetNumLocalPointsFaceVarying(channel);
466 const int num_base_fvars = osd_data.refiner->GetLevel(0).GetNumFVarValues(channel);
467
468 /* Refine attribute data to get patch coordinates. */
469 attr.refined_data.resize((num_refiner_fvars + num_local_points) * sizeof(typename T::AccumType));
470 typename T::AccumType *refined_data = reinterpret_cast<typename T::AccumType *>(
471 attr.refined_data.data());
472
473 const typename T::Type *base_src = reinterpret_cast<const typename T::Type *>(
474 merged_values.data());
475 typename T::AccumType *base_dst = refined_data;
476 for (int i = 0; i < num_base_fvars; i++) {
477 base_dst[i] = T::read(base_src[i]);
478 }
479
480 Far::PrimvarRefiner primvar_refiner(*osd_data.refiner);
481 typename T::AccumType *src = refined_data;
482 for (int i = 0; i < osd_data.refiner->GetMaxLevel(); i++) {
483 typename T::AccumType *dest = src + osd_data.refiner->GetLevel(i).GetNumFVarValues(channel);
484 primvar_refiner.InterpolateFaceVarying(i + 1,
485 (OsdValue<typename T::AccumType> *)src,
486 (OsdValue<typename T::AccumType> *&)dest,
487 channel);
488 src = dest;
489 }
490
491 if (num_local_points) {
492 osd_data.patch_table->ComputeLocalPointValuesFaceVarying(
493 (OsdValue<typename T::AccumType> *)refined_data,
494 (OsdValue<typename T::AccumType> *)(refined_data + num_refiner_fvars),
495 channel);
496 }
497
498 /* Evaluate patches at limit. */
499 const typename T::AccumType *subd_data = refined_data;
500 typename T::Type *mesh_data = reinterpret_cast<typename T::Type *>(mesh_attr.data_for_write());
501
502 assert(mesh_data != nullptr);
503
504 attr.interp = [this, subd_data, mesh_data, channel](const int patch_index,
505 const int /*face_index*/,
506 const int /*corner*/,
507 const int *triangle_index,
508 const float2 *triangle_uv,
509 const int triangle_num) {
510 for (size_t i = 0; i < triangle_num; i++) {
511 for (int j = 0; j < 3; j++) {
512 /* Compute patch weights. */
513 const float2 uv = triangle_uv[(i * 3) + j];
514 const Far::PatchTable::PatchHandle &handle = *osd_data.patch_map->FindPatch(
515 patch_index, (double)uv.x, (double)uv.y);
516
517 float p_weights[20], du_weights[20], dv_weights[20];
518 osd_data.patch_table->EvaluateBasisFaceVarying(handle,
519 uv.x,
520 uv.y,
521 p_weights,
522 du_weights,
523 dv_weights,
524 nullptr,
525 nullptr,
526 nullptr,
527 channel);
528 Far::ConstIndexArray cv = osd_data.patch_table->GetPatchFVarValues(handle, channel);
529
530 /* Compute position. */
531 typename T::AccumType value = subd_data[cv[0]] * p_weights[0];
532 for (int k = 1; k < cv.size(); k++) {
533 value += subd_data[cv[k]] * p_weights[k];
534 }
535 mesh_data[triangle_index[i] * 3 + j] = T::output(value);
536 }
537 }
538 };
539
540 triangle_attributes.push_back(std::move(attr));
541}
542#endif
543
544template<typename T>
546 Attribute &mesh_attr)
547{
548 /* Copy value from face to triangle. */
549 SubdAttribute attr;
550 const typename T::Type *subd_data = reinterpret_cast<const typename T::Type *>(subd_attr.data());
551 typename T::Type *mesh_data = reinterpret_cast<typename T::Type *>(mesh_attr.data_for_write());
552
553 assert(mesh_data != nullptr);
554
555 attr.interp = [subd_data, mesh_data](const int /*patch_index*/,
556 const int face_index,
557 const int /*corner*/,
558 const int *triangle_index,
559 const float2 * /*triangle_uv*/,
560 const int triangle_num) {
561 for (int i = 0; i < triangle_num; i++) {
562 mesh_data[triangle_index[i]] = subd_data[face_index];
563 }
564 };
565
566 triangle_attributes.push_back(std::move(attr));
567}
568
569template<typename T>
571 Attribute &mesh_attr)
572{
573 switch (subd_attr.element) {
575 case ATTR_ELEMENT_MESH: {
576 /* Uniform attributes don't need interpolation, just copy data. */
577 assert(mesh_attr.size == subd_attr.size);
578 memcpy(mesh_attr.data_for_write(), subd_attr.data(), subd_attr.data_sizeof());
579 break;
580 }
583 /* Center step. Position center is computed by patch evaluation
584 * during dicing, so skip it here. */
585 if (subd_attr.std != ATTR_STD_POSITION) {
586#ifdef WITH_OPENSUBDIV
587 if (mesh.get_subdivision_type() == Mesh::SUBDIVISION_CATMULL_CLARK) {
588 /* Only smoothly interpolation known position-like attributes. */
589 switch (subd_attr.std) {
593 setup_attribute_vertex_smooth<T>(subd_attr, mesh_attr);
594 break;
595 default:
596 setup_attribute_vertex_linear<T>(subd_attr, mesh_attr);
597 break;
598 }
599 }
600 else
601#endif
602 {
603 setup_attribute_vertex_linear<T>(subd_attr, mesh_attr);
604 }
605 }
606 /* Motion steps. */
607 if (subd_attr.has_motion()) {
608 for (int step = 0; step < subd_attr.motion.size(); step++) {
609#ifdef WITH_OPENSUBDIV
610 if (mesh.get_subdivision_type() == Mesh::SUBDIVISION_CATMULL_CLARK) {
611 setup_attribute_vertex_smooth<T>(subd_attr, mesh_attr, step);
612 }
613 else
614#endif
615 {
616 setup_attribute_vertex_linear<T>(subd_attr, mesh_attr, step);
617 }
618 }
619 }
620 break;
621 }
625#ifdef WITH_OPENSUBDIV
626 if (osd_mesh.use_smooth_fvar(subd_attr)) {
627 for (const auto &merged_fvar : osd_mesh.merged_fvars) {
628 if (&merged_fvar.attr == &subd_attr) {
629 if constexpr (std::is_same_v<typename T::Type, float2>) {
630 setup_attribute_corner_smooth<T>(mesh_attr, merged_fvar.channel, merged_fvar.values);
631 return;
632 }
633 }
634 }
635 }
636#endif
637 setup_attribute_corner_linear<T>(subd_attr, mesh_attr);
638 /* Motion steps. */
639 if (subd_attr.has_motion()) {
640 for (int step = 0; step < subd_attr.motion.size(); step++) {
641 setup_attribute_corner_linear<T>(subd_attr, mesh_attr, step);
642 }
643 }
644 break;
645 }
646 case ATTR_ELEMENT_FACE: {
647 setup_attribute_face<T>(subd_attr, mesh_attr);
648 break;
649 }
650 default:
651 break;
652 }
653}
654
Attribute & copy(const Attribute &attr)
list< Attribute > attributes
Attribute * find(ustring name) const
AttributeElement element
vector< Buffer > motion
const T * data(const int step=0) const
T * data_for_write(const int step=0)
bool has_motion() const
TypeDesc type
void add_motion(const Geometry *geom)
AttributeStandard std
size_t data_sizeof() const
static bool same_storage(const TypeDesc a, const TypeDesc b)
AttributeSet attributes
size_t get_num_subd_faces() const
Definition scene/mesh.h:221
size_t get_num_subd_base_verts() const
Definition scene/mesh.h:229
AttributeSet subd_attributes
Definition scene/mesh.h:169
SubdFace get_subd_face(const size_t index) const
@ SUBDIVISION_CATMULL_CLARK
Definition scene/mesh.h:116
void setup_attribute_face(const Attribute &subd_attr, Attribute &mesh_attr)
void setup_attribute_type(const Attribute &subd_attr, Attribute &mesh_attr)
void setup_attribute_corner_linear(const Attribute &subd_attr, Attribute &mesh_attr, const int motion_step=-1)
void setup_attribute(const Attribute &subd_attr, Attribute &mesh_attr)
vector< SubdAttribute > triangle_attributes
bool support_interp_attribute(const Attribute &attr) const
vector< SubdAttribute > vertex_attributes
void setup_attribute_vertex_linear(const Attribute &subd_attr, Attribute &mesh_attr, const int motion_step=-1)
ccl_device_inline float4 color_uchar4_to_float4(const uchar4 c)
Definition color.h:45
ccl_device uchar4 color_float4_to_uchar4(const float4 c)
Definition color.h:25
#define CCL_NAMESPACE_END
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
#define assert(assertion)
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
VecBase< float, 2 > float2
VecBase< float, 3 > float3
@ ATTR_ELEMENT_VERTEX_NORMAL
@ ATTR_ELEMENT_CORNER_BYTE
@ ATTR_ELEMENT_CORNER_NORMAL
@ ATTR_ELEMENT_CORNER
@ ATTR_ELEMENT_OBJECT
@ ATTR_ELEMENT_VERTEX
@ ATTR_ELEMENT_IS_BYTE
@ ATTR_ELEMENT_IS_NORMAL
@ ATTR_ELEMENT_FACE
@ ATTR_ELEMENT_MESH
@ ATTR_STD_VERTEX_NORMAL
@ ATTR_STD_POSITION_UNDISPLACED
@ ATTR_STD_PTEX_FACE_ID
@ ATTR_STD_POSITION_UNDEFORMED
@ ATTR_STD_POSITION
@ ATTR_STD_CORNER_NORMAL
@ ATTR_STD_PTEX_UV
@ ATTR_STD_GENERATED
ccl_device_inline float interp(const float a, const float b, const float t)
Definition math_base.h:549
ccl_device_inline float3 safe_normalize_fallback(const float3 a, const float3 fallback)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
Definition math_float3.h:17
#define T
#define make_float4
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
std::function< void(const int, const int, const int, const int *, const float2 *, const int)> interp
vector< char > refined_data
static AccumType read(const Type &value)
float4 AccumType
static Type output(const AccumType &value)
static Type read(const Type &value)
static Type output(const Type &value)
static Type output(const AccumType &value)
packed_normal Type
static AccumType read(const Type &value)
static Type output(const AccumType &value)
packed_float3 Type
static AccumType read(const Type &value)
static AccumType read(const Type &value)
static Type output(const AccumType &value)
float x
float y
float y
Definition sky_math.h:225
float z
Definition sky_math.h:225
float x
Definition sky_math.h:225
float w
Definition sky_math.h:225
ccl_device_inline_method float3 decode() const
packed_normal()=default
ccl_device_inline Quaternion make_quaternion(const float w, const float x, const float y, const float z)