Blender  V3.3
hydra/mesh.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2022 NVIDIA Corporation
3  * Copyright 2022 Blender Foundation */
4 
5 #include "hydra/mesh.h"
6 #include "hydra/geometry.inl"
7 #include "scene/mesh.h"
8 
9 #include <pxr/base/gf/vec2f.h>
10 #include <pxr/imaging/hd/extComputationUtils.h>
11 
13 
14 namespace {
15 
16 template<typename T>
17 VtValue ComputeTriangulatedUniformPrimvar(VtValue value, const VtIntArray &primitiveParams)
18 {
19  T output;
20  output.reserve(primitiveParams.size());
21  const T &input = value.Get<T>();
22 
23  for (size_t i = 0; i < primitiveParams.size(); ++i) {
24  const int faceIndex = HdMeshUtil::DecodeFaceIndexFromCoarseFaceParam(primitiveParams[i]);
25 
26  output.push_back(input[faceIndex]);
27  }
28 
29  return VtValue(output);
30 }
31 
32 VtValue ComputeTriangulatedUniformPrimvar(VtValue value,
33  const HdType valueType,
34  const VtIntArray &primitiveParams)
35 {
36  switch (valueType) {
37  case HdTypeFloat:
38  return ComputeTriangulatedUniformPrimvar<VtFloatArray>(value, primitiveParams);
39  case HdTypeFloatVec2:
40  return ComputeTriangulatedUniformPrimvar<VtVec2fArray>(value, primitiveParams);
41  case HdTypeFloatVec3:
42  return ComputeTriangulatedUniformPrimvar<VtVec3fArray>(value, primitiveParams);
43  case HdTypeFloatVec4:
44  return ComputeTriangulatedUniformPrimvar<VtVec4fArray>(value, primitiveParams);
45  default:
46  TF_RUNTIME_ERROR("Unsupported attribute type %d", static_cast<int>(valueType));
47  return VtValue();
48  }
49 }
50 
52  const HdType valueType,
53  HdMeshUtil &meshUtil)
54 {
55  if (meshUtil.ComputeTriangulatedFaceVaryingPrimvar(
56  HdGetValueData(value), value.GetArraySize(), valueType, &value)) {
57  return value;
58  }
59 
60  return VtValue();
61 }
62 
63 } // namespace
64 
65 Transform convert_transform(const GfMatrix4d &matrix)
66 {
67  return make_transform(matrix[0][0],
68  matrix[1][0],
69  matrix[2][0],
70  matrix[3][0],
71  matrix[0][1],
72  matrix[1][1],
73  matrix[2][1],
74  matrix[3][1],
75  matrix[0][2],
76  matrix[1][2],
77  matrix[2][2],
78  matrix[3][2]);
79 }
80 
81 HdCyclesMesh::HdCyclesMesh(const SdfPath &rprimId
82 #if PXR_VERSION < 2102
83  ,
84  const SdfPath &instancerId
85 #endif
86  )
87  : HdCyclesGeometry(rprimId
88 #if PXR_VERSION < 2102
89  ,
90  instancerId
91 #endif
92  ),
93  _util(&_topology, rprimId)
94 {
95 }
96 
98 {
99 }
100 
102 {
103  HdDirtyBits bits = HdCyclesGeometry::GetInitialDirtyBitsMask();
104  bits |= HdChangeTracker::DirtyPoints | HdChangeTracker::DirtyNormals |
105  HdChangeTracker::DirtyPrimvar | HdChangeTracker::DirtyTopology |
106  HdChangeTracker::DirtyDisplayStyle | HdChangeTracker::DirtySubdivTags;
107  return bits;
108 }
109 
110 HdDirtyBits HdCyclesMesh::_PropagateDirtyBits(HdDirtyBits bits) const
111 {
112  if (bits & (HdChangeTracker::DirtyMaterialId)) {
113  // Update used shaders from geometry subsets if any exist in the topology
114  bits |= HdChangeTracker::DirtyTopology;
115  }
116 
117  if (bits & (HdChangeTracker::DirtyTopology | HdChangeTracker::DirtyDisplayStyle |
118  HdChangeTracker::DirtySubdivTags)) {
119  // Do full topology update when display style or subdivision changes
120  bits |= HdChangeTracker::DirtyTopology | HdChangeTracker::DirtyDisplayStyle |
121  HdChangeTracker::DirtySubdivTags;
122  }
123 
124  if (bits & (HdChangeTracker::DirtyTopology)) {
125  // Changing topology clears the geometry, so need to populate everything again
126  bits |= HdChangeTracker::DirtyPoints | HdChangeTracker::DirtyNormals |
127  HdChangeTracker::DirtyPrimvar;
128  }
129 
130  return bits;
131 }
132 
133 void HdCyclesMesh::Populate(HdSceneDelegate *sceneDelegate, HdDirtyBits dirtyBits, bool &rebuild)
134 {
135  if (HdChangeTracker::IsTopologyDirty(dirtyBits, GetId())) {
136  PopulateTopology(sceneDelegate);
137  }
138 
139  if (dirtyBits & HdChangeTracker::DirtyPoints) {
140  PopulatePoints(sceneDelegate);
141  }
142 
143  // Must happen after topology update, so that normals attribute size can be calculated
144  if (dirtyBits & HdChangeTracker::DirtyNormals) {
145  PopulateNormals(sceneDelegate);
146  }
147 
148  // Must happen after topology update, so that appropriate attribute set can be selected
149  if (dirtyBits & HdChangeTracker::DirtyPrimvar) {
150  PopulatePrimvars(sceneDelegate);
151  }
152 
153  rebuild = (_geom->triangles_is_modified()) || (_geom->subd_start_corner_is_modified()) ||
154  (_geom->subd_num_corners_is_modified()) || (_geom->subd_shader_is_modified()) ||
155  (_geom->subd_smooth_is_modified()) || (_geom->subd_ptex_offset_is_modified()) ||
156  (_geom->subd_face_corners_is_modified());
157 }
158 
159 void HdCyclesMesh::PopulatePoints(HdSceneDelegate *sceneDelegate)
160 {
161  VtValue value;
162 
163  for (const HdExtComputationPrimvarDescriptor &desc :
164  sceneDelegate->GetExtComputationPrimvarDescriptors(GetId(), HdInterpolationVertex)) {
165  if (desc.name == HdTokens->points) {
166  auto valueStore = HdExtComputationUtils::GetComputedPrimvarValues({desc}, sceneDelegate);
167  const auto valueStoreIt = valueStore.find(desc.name);
168  if (valueStoreIt != valueStore.end()) {
169  value = std::move(valueStoreIt->second);
170  }
171  break;
172  }
173  }
174 
175  if (value.IsEmpty()) {
176  value = GetPoints(sceneDelegate);
177  }
178 
179  if (!value.IsHolding<VtVec3fArray>()) {
180  TF_WARN("Invalid points data for %s", GetId().GetText());
181  return;
182  }
183 
184  const auto &points = value.UncheckedGet<VtVec3fArray>();
185 
186  TF_VERIFY(points.size() >= static_cast<size_t>(_topology.GetNumPoints()));
187 
188  array<float3> pointsDataCycles;
189  pointsDataCycles.reserve(points.size());
190  for (const GfVec3f &point : points) {
191  pointsDataCycles.push_back_reserved(make_float3(point[0], point[1], point[2]));
192  }
193 
194  _geom->set_verts(pointsDataCycles);
195 }
196 
197 void HdCyclesMesh::PopulateNormals(HdSceneDelegate *sceneDelegate)
198 {
199  _geom->attributes.remove(ATTR_STD_FACE_NORMAL);
200  _geom->attributes.remove(ATTR_STD_VERTEX_NORMAL);
201 
202  // Authored normals should only exist on triangle meshes
203  if (_geom->get_subdivision_type() != Mesh::SUBDIVISION_NONE) {
204  return;
205  }
206 
207  VtValue value;
208  HdInterpolation interpolation = HdInterpolationCount;
209 
210  for (int i = 0; i < HdInterpolationCount && interpolation == HdInterpolationCount; ++i) {
211  for (const HdExtComputationPrimvarDescriptor &desc :
212  sceneDelegate->GetExtComputationPrimvarDescriptors(GetId(),
213  static_cast<HdInterpolation>(i))) {
214  if (desc.name == HdTokens->normals) {
215  auto valueStore = HdExtComputationUtils::GetComputedPrimvarValues({desc}, sceneDelegate);
216  const auto valueStoreIt = valueStore.find(desc.name);
217  if (valueStoreIt != valueStore.end()) {
218  value = std::move(valueStoreIt->second);
219  interpolation = static_cast<HdInterpolation>(i);
220  }
221  break;
222  }
223  }
224  }
225 
226  if (value.IsEmpty()) {
227  interpolation = GetPrimvarInterpolation(sceneDelegate, HdTokens->normals);
228  if (interpolation == HdInterpolationCount) {
229  return; // Ignore missing normals
230  }
231 
232  value = GetNormals(sceneDelegate);
233  }
234 
235  if (!value.IsHolding<VtVec3fArray>()) {
236  TF_WARN("Invalid normals data for %s", GetId().GetText());
237  return;
238  }
239 
240  const auto &normals = value.UncheckedGet<VtVec3fArray>();
241 
242  if (interpolation == HdInterpolationConstant) {
243  TF_VERIFY(normals.size() == 1);
244 
245  const GfVec3f constantNormal = normals[0];
246 
247  float3 *const N = _geom->attributes.add(ATTR_STD_VERTEX_NORMAL)->data_float3();
248  for (size_t i = 0; i < _geom->get_verts().size(); ++i) {
249  N[i] = make_float3(constantNormal[0], constantNormal[1], constantNormal[2]);
250  }
251  }
252  else if (interpolation == HdInterpolationUniform) {
253  TF_VERIFY(normals.size() == static_cast<size_t>(_topology.GetNumFaces()));
254 
255  float3 *const N = _geom->attributes.add(ATTR_STD_FACE_NORMAL)->data_float3();
256  for (size_t i = 0; i < _geom->num_triangles(); ++i) {
257  const int faceIndex = HdMeshUtil::DecodeFaceIndexFromCoarseFaceParam(_primitiveParams[i]);
258 
259  N[i] = make_float3(normals[faceIndex][0], normals[faceIndex][1], normals[faceIndex][2]);
260  }
261  }
262  else if (interpolation == HdInterpolationVertex || interpolation == HdInterpolationVarying) {
263  TF_VERIFY(normals.size() == static_cast<size_t>(_topology.GetNumPoints()) &&
264  static_cast<size_t>(_topology.GetNumPoints()) == _geom->get_verts().size());
265 
266  float3 *const N = _geom->attributes.add(ATTR_STD_VERTEX_NORMAL)->data_float3();
267  for (size_t i = 0; i < _geom->get_verts().size(); ++i) {
268  N[i] = make_float3(normals[i][0], normals[i][1], normals[i][2]);
269  }
270  }
271  else if (interpolation == HdInterpolationFaceVarying) {
272  TF_VERIFY(normals.size() == static_cast<size_t>(_topology.GetNumFaceVaryings()));
273 
274  if (!_util.ComputeTriangulatedFaceVaryingPrimvar(
275  normals.data(), normals.size(), HdTypeFloatVec3, &value)) {
276  return;
277  }
278 
279  const auto &normalsTriangulated = value.UncheckedGet<VtVec3fArray>();
280 
281  // Cycles has no standard attribute for face-varying normals, so this is a lossy transformation
282  float3 *const N = _geom->attributes.add(ATTR_STD_FACE_NORMAL)->data_float3();
283  for (size_t i = 0; i < _geom->num_triangles(); ++i) {
284  GfVec3f averageNormal = normalsTriangulated[i * 3] + normalsTriangulated[i * 3 + 1] +
285  normalsTriangulated[i * 3 + 2];
286  GfNormalize(&averageNormal);
287 
288  N[i] = make_float3(averageNormal[0], averageNormal[1], averageNormal[2]);
289  }
290  }
291 }
292 
293 void HdCyclesMesh::PopulatePrimvars(HdSceneDelegate *sceneDelegate)
294 {
295  Scene *const scene = (Scene *)_geom->get_owner();
296 
297  const bool subdivision = _geom->get_subdivision_type() != Mesh::SUBDIVISION_NONE;
298  AttributeSet &attributes = subdivision ? _geom->subd_attributes : _geom->attributes;
299 
300  const std::pair<HdInterpolation, AttributeElement> interpolations[] = {
301  std::make_pair(HdInterpolationFaceVarying, ATTR_ELEMENT_CORNER),
302  std::make_pair(HdInterpolationUniform, ATTR_ELEMENT_FACE),
303  std::make_pair(HdInterpolationVertex, ATTR_ELEMENT_VERTEX),
304  std::make_pair(HdInterpolationVarying, ATTR_ELEMENT_VERTEX),
305  std::make_pair(HdInterpolationConstant, ATTR_ELEMENT_OBJECT),
306  };
307 
308  for (const auto &interpolation : interpolations) {
309  for (const HdPrimvarDescriptor &desc :
310  GetPrimvarDescriptors(sceneDelegate, interpolation.first)) {
311  // Skip special primvars that are handled separately
312  if (desc.name == HdTokens->points || desc.name == HdTokens->normals) {
313  continue;
314  }
315 
316  VtValue value = GetPrimvar(sceneDelegate, desc.name);
317  if (value.IsEmpty()) {
318  continue;
319  }
320 
321  const ustring name(desc.name.GetString());
322 
324  if (desc.role == HdPrimvarRoleTokens->textureCoordinate) {
325  std = ATTR_STD_UV;
326  }
327  else if (interpolation.first == HdInterpolationVertex) {
328  if (desc.name == HdTokens->displayColor || desc.role == HdPrimvarRoleTokens->color) {
330  }
331  else if (desc.name == HdTokens->normals) {
333  }
334  }
335  else if (desc.name == HdTokens->displayColor &&
336  interpolation.first == HdInterpolationConstant) {
337  if (value.IsHolding<VtVec3fArray>() && value.GetArraySize() == 1) {
338  const GfVec3f color = value.UncheckedGet<VtVec3fArray>()[0];
339  _instances[0]->set_color(make_float3(color[0], color[1], color[2]));
340  }
341  }
342 
343  // Skip attributes that are not needed
344  if ((std != ATTR_STD_NONE && _geom->need_attribute(scene, std)) ||
345  _geom->need_attribute(scene, name)) {
346  const HdType valueType = HdGetValueTupleType(value).type;
347 
348  if (!subdivision) {
349  // Adjust attributes for polygons that were triangulated
350  if (interpolation.first == HdInterpolationUniform) {
351  value = ComputeTriangulatedUniformPrimvar(value, valueType, _primitiveParams);
352  if (value.IsEmpty()) {
353  continue;
354  }
355  }
356  else if (interpolation.first == HdInterpolationFaceVarying) {
357  value = ComputeTriangulatedFaceVaryingPrimvar(value, valueType, _util);
358  if (value.IsEmpty()) {
359  continue;
360  }
361  }
362  }
363 
364  ApplyPrimvars(attributes, name, value, interpolation.second, std);
365  }
366  }
367  }
368 }
369 
370 void HdCyclesMesh::PopulateTopology(HdSceneDelegate *sceneDelegate)
371 {
372  // Clear geometry before populating it again with updated topology
373  _geom->clear(true);
374 
375  const HdDisplayStyle displayStyle = GetDisplayStyle(sceneDelegate);
376  _topology = HdMeshTopology(GetMeshTopology(sceneDelegate), displayStyle.refineLevel);
377 
378  const TfToken subdivScheme = _topology.GetScheme();
379  if (subdivScheme == PxOsdOpenSubdivTokens->bilinear && _topology.GetRefineLevel() > 0) {
380  _geom->set_subdivision_type(Mesh::SUBDIVISION_LINEAR);
381  }
382  else if (subdivScheme == PxOsdOpenSubdivTokens->catmullClark && _topology.GetRefineLevel() > 0) {
383  _geom->set_subdivision_type(Mesh::SUBDIVISION_CATMULL_CLARK);
384  }
385  else {
386  _geom->set_subdivision_type(Mesh::SUBDIVISION_NONE);
387  }
388 
389  const bool smooth = !displayStyle.flatShadingEnabled;
390  const bool subdivision = _geom->get_subdivision_type() != Mesh::SUBDIVISION_NONE;
391 
392  // Initialize lookup table from polygon face to material shader index
393  VtIntArray faceShaders(_topology.GetNumFaces(), 0);
394 
395  HdGeomSubsets const &geomSubsets = _topology.GetGeomSubsets();
396  if (!geomSubsets.empty()) {
397  array<Node *> usedShaders = std::move(_geom->get_used_shaders());
398  // Remove any previous materials except for the material assigned to the prim
399  usedShaders.resize(1);
400 
401  std::unordered_map<SdfPath, int, SdfPath::Hash> materials;
402 
403  for (const HdGeomSubset &geomSubset : geomSubsets) {
404  TF_VERIFY(geomSubset.type == HdGeomSubset::TypeFaceSet);
405 
406  int shader = 0;
407  const auto it = materials.find(geomSubset.materialId);
408  if (it != materials.end()) {
409  shader = it->second;
410  }
411  else {
412  const auto material = static_cast<const HdCyclesMaterial *>(
413  sceneDelegate->GetRenderIndex().GetSprim(HdPrimTypeTokens->material,
414  geomSubset.materialId));
415 
416  if (material && material->GetCyclesShader()) {
417  shader = static_cast<int>(usedShaders.size());
418  usedShaders.push_back_slow(material->GetCyclesShader());
419 
420  materials.emplace(geomSubset.materialId, shader);
421  }
422  }
423 
424  for (int face : geomSubset.indices) {
425  faceShaders[face] = shader;
426  }
427  }
428 
429  _geom->set_used_shaders(usedShaders);
430  }
431 
432  const VtIntArray vertIndx = _topology.GetFaceVertexIndices();
433  const VtIntArray vertCounts = _topology.GetFaceVertexCounts();
434 
435  if (!subdivision) {
436  VtVec3iArray triangles;
437  _util.ComputeTriangleIndices(&triangles, &_primitiveParams);
438 
439  _geom->reserve_mesh(_topology.GetNumPoints(), triangles.size());
440 
441  for (size_t i = 0; i < _primitiveParams.size(); ++i) {
442  const int faceIndex = HdMeshUtil::DecodeFaceIndexFromCoarseFaceParam(_primitiveParams[i]);
443 
444  const GfVec3i triangle = triangles[i];
445  _geom->add_triangle(triangle[0], triangle[1], triangle[2], faceShaders[faceIndex], smooth);
446  }
447  }
448  else {
449  PxOsdSubdivTags subdivTags = GetSubdivTags(sceneDelegate);
450  _topology.SetSubdivTags(subdivTags);
451 
452  size_t numNgons = 0;
453  size_t numCorners = 0;
454  for (int vertCount : vertCounts) {
455  numNgons += (vertCount == 4) ? 0 : 1;
456  numCorners += vertCount;
457  }
458 
459  _geom->reserve_subd_faces(_topology.GetNumFaces(), numNgons, numCorners);
460 
461  // TODO: Handle hole indices
462  size_t faceIndex = 0;
463  size_t indexOffset = 0;
464  for (int vertCount : vertCounts) {
465  _geom->add_subd_face(&vertIndx[indexOffset], vertCount, faceShaders[faceIndex], smooth);
466 
467  faceIndex++;
468  indexOffset += vertCount;
469  }
470 
471  const VtIntArray creaseLengths = subdivTags.GetCreaseLengths();
472  if (!creaseLengths.empty()) {
473  size_t numCreases = 0;
474  for (int creaseLength : creaseLengths) {
475  numCreases += creaseLength - 1;
476  }
477 
478  _geom->reserve_subd_creases(numCreases);
479 
480  const VtIntArray creaseIndices = subdivTags.GetCreaseIndices();
481  const VtFloatArray creaseWeights = subdivTags.GetCreaseWeights();
482 
483  indexOffset = 0;
484  size_t creaseLengthOffset = 0;
485  size_t createWeightOffset = 0;
486  for (int creaseLength : creaseLengths) {
487  for (int j = 0; j < creaseLength - 1; ++j, ++createWeightOffset) {
488  const int v0 = creaseIndices[indexOffset + j];
489  const int v1 = creaseIndices[indexOffset + j + 1];
490 
491  float weight = creaseWeights.size() == creaseLengths.size() ?
492  creaseWeights[creaseLengthOffset] :
493  creaseWeights[createWeightOffset];
494 
495  _geom->add_edge_crease(v0, v1, weight);
496  }
497 
498  indexOffset += creaseLength;
499  creaseLengthOffset++;
500  }
501 
502  const VtIntArray cornerIndices = subdivTags.GetCornerIndices();
503  const VtFloatArray cornerWeights = subdivTags.GetCornerWeights();
504 
505  for (size_t i = 0; i < cornerIndices.size(); ++i) {
506  _geom->add_vertex_crease(cornerIndices[i], cornerWeights[i]);
507  }
508  }
509 
510  _geom->set_subd_dicing_rate(1.0f);
511  _geom->set_subd_max_level(_topology.GetRefineLevel());
512  _geom->set_subd_objecttoworld(_instances[0]->get_tfm());
513  }
514 }
515 
516 void HdCyclesMesh::Finalize(PXR_NS::HdRenderParam *renderParam)
517 {
518  _topology = HdMeshTopology();
519  _primitiveParams.clear();
520 
522 }
523 
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
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 Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise 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 point
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input 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 a color
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
virtual void Finalize(PXR_NS::HdRenderParam *renderParam) override
Definition: geometry.inl:188
PXR_NS::HdInterpolation GetPrimvarInterpolation(PXR_NS::HdSceneDelegate *sceneDelegate, const PXR_NS::TfToken &name) const
Definition: geometry.inl:241
PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override
Definition: geometry.inl:48
std::vector< CCL_NS::Object * > _instances
PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override
Definition: hydra/mesh.cpp:101
HdCyclesMesh(const PXR_NS::SdfPath &rprimId, const PXR_NS::SdfPath &instancerId={})
Definition: hydra/mesh.cpp:81
void Finalize(PXR_NS::HdRenderParam *renderParam) override
Definition: hydra/mesh.cpp:516
~HdCyclesMesh() override
Definition: hydra/mesh.cpp:97
size_t size() const
void push_back_reserved(const T &t)
T * resize(size_t newsize)
void reserve(size_t newcapacity)
void push_back_slow(const T &t)
Scene scene
Material material
smooth(Type::VEC4, "color_mul") .smooth(Type gpFillTexture gpSceneDepthTexture materials[GPENCIL_MATERIAL_BUFFER_LEN]
Definition: gpencil_info.hh:29
HDCYCLES_NAMESPACE_OPEN_SCOPE void ApplyPrimvars(AttributeSet &attributes, const ustring &name, VtValue value, AttributeElement elem, AttributeStandard std)
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
Definition: hydra/config.h:17
Transform convert_transform(const GfMatrix4d &matrix)
Definition: hydra/mesh.cpp:65
ccl_device_inline Transform make_transform(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l)
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
AttributeStandard
Definition: kernel/types.h:612
@ ATTR_STD_UV
Definition: kernel/types.h:616
@ ATTR_STD_VERTEX_NORMAL
Definition: kernel/types.h:614
@ ATTR_STD_NONE
Definition: kernel/types.h:613
@ ATTR_STD_VERTEX_COLOR
Definition: kernel/types.h:619
@ ATTR_STD_FACE_NORMAL
Definition: kernel/types.h:615
@ ATTR_ELEMENT_CORNER
Definition: kernel/types.h:604
@ ATTR_ELEMENT_OBJECT
Definition: kernel/types.h:599
@ ATTR_ELEMENT_VERTEX
Definition: kernel/types.h:602
@ ATTR_ELEMENT_FACE
Definition: kernel/types.h:601
#define N
#define T
#define make_float3(x, y, z)
Definition: metal/compat.h:204
VtValue ComputeTriangulatedFaceVaryingPrimvar(VtValue value, const HdType valueType, HdMeshUtil &meshUtil)
Definition: hydra/mesh.cpp:51
VtValue ComputeTriangulatedUniformPrimvar(VtValue value, const HdType valueType, const VtIntArray &primitiveParams)
Definition: hydra/mesh.cpp:32
MutableSpan< float3 > normals
smooth(Type::FLOAT, "mask_weight")
@ SUBDIVISION_NONE
Definition: scene/mesh.h:120
@ SUBDIVISION_LINEAR
Definition: scene/mesh.h:121
@ SUBDIVISION_CATMULL_CLARK
Definition: scene/mesh.h:122