Blender V4.3
hydra/volume.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 NVIDIA Corporation
2 * SPDX-FileCopyrightText: 2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: Apache-2.0 */
5
6#include "hydra/volume.h"
7#include "hydra/field.h"
8#include "hydra/geometry.inl"
9#include "scene/volume.h"
10
12
13// clang-format off
15 (openvdbAsset)
16);
17// clang-format on
18
19HdCyclesVolume::HdCyclesVolume(const SdfPath &rprimId
20#if PXR_VERSION < 2102
21 ,
22 const SdfPath &instancerId
23#endif
24 )
25 : HdCyclesGeometry(rprimId
26#if PXR_VERSION < 2102
27 ,
28 instancerId
29#endif
30 )
31{
32}
33
35
37{
39 bits |= HdChangeTracker::DirtyVolumeField;
40 return bits;
41}
42
43void HdCyclesVolume::Populate(HdSceneDelegate *sceneDelegate, HdDirtyBits dirtyBits, bool &rebuild)
44{
45 Scene *const scene = (Scene *)_geom->get_owner();
46
47 if (dirtyBits & HdChangeTracker::DirtyVolumeField) {
48 for (const HdVolumeFieldDescriptor &field : sceneDelegate->GetVolumeFieldDescriptors(GetId()))
49 {
50 if (const auto openvdbAsset = static_cast<HdCyclesField *>(
51 sceneDelegate->GetRenderIndex().GetBprim(_tokens->openvdbAsset, field.fieldId)))
52 {
53 const ustring name(field.fieldName.GetString());
54
58 }
61 }
64 }
67 }
70 }
73 }
74
75 // Skip attributes that are not needed
76 if ((std != ATTR_STD_NONE && _geom->need_attribute(scene, std)) ||
77 _geom->need_attribute(scene, name))
78 {
79 Attribute *const attr = (std != ATTR_STD_NONE) ?
80 _geom->attributes.add(std) :
81 _geom->attributes.add(name, TypeFloat, ATTR_ELEMENT_VOXEL);
82 attr->data_voxel() = openvdbAsset->GetImageHandle();
83 }
84 }
85 }
86
87 rebuild = true;
88 }
89}
90
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 Attribute
static const char * standard_name(AttributeStandard std)
ImageHandle & data_voxel()
HdCyclesGeometry(const PXR_NS::SdfPath &rprimId, const PXR_NS::SdfPath &instancerId)
Definition geometry.inl:23
PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override
Definition geometry.inl:49
HdCyclesVolume(const PXR_NS::SdfPath &rprimId, const PXR_NS::SdfPath &instancerId={})
PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override
~HdCyclesVolume() override
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
HDCYCLES_NAMESPACE_OPEN_SCOPE TF_DEFINE_PRIVATE_TOKENS(_tokens,(openvdbAsset))
AttributeStandard
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_NONE
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_VOLUME_FLAME
@ ATTR_STD_VOLUME_VELOCITY
@ ATTR_STD_VOLUME_COLOR
@ ATTR_STD_VOLUME_HEAT
@ ATTR_ELEMENT_VOXEL