79 if (!preserve_shaders) {
91 return (motion_steps > 1) ? 2.0f * step / (motion_steps - 1) - 1.0f : 0.0f;
96 if (motion_steps > 1) {
99 for (
int step = 0; step < motion_steps; step++) {
101 if (step_time == time) {
106 if (step != motion_steps / 2) {
137 foreach (
Node *node, used_shaders) {
159 foreach (
Node *node, used_shaders) {
200 og->object_name_map.clear();
201 og->object_names.clear();
203 for (
size_t i = 0; i < scene->
objects.size(); i++) {
206 og->object_name_map[
object->name] = i;
207 og->object_names.push_back(object->
name);
225 switch (kernel_type) {
275 size_t vert_size = 0;
278 size_t curve_size = 0;
279 size_t curve_key_size = 0;
280 size_t curve_segment_size = 0;
282 size_t point_size = 0;
284 size_t patch_size = 0;
285 size_t face_size = 0;
286 size_t corner_size = 0;
289 bool prim_offset_changed =
false;
292 Mesh *mesh =
static_cast<Mesh *
>(geom);
294 prim_offset_changed = (mesh->
prim_offset != tri_size);
296 mesh->vert_offset = vert_size;
299 mesh->patch_offset = patch_size;
300 mesh->face_offset = face_size;
301 mesh->corner_offset = corner_size;
303 vert_size += mesh->verts.size();
311 if (mesh->patch_table) {
312 mesh->patch_table_offset = patch_size;
313 patch_size += mesh->patch_table->
total_size();
318 corner_size += mesh->subd_face_corners.size();
321 Hair *hair =
static_cast<Hair *
>(geom);
329 curve_key_size += hair->get_curve_keys().size();
335 prim_offset_changed = (pointcloud->
prim_offset != point_size);
341 if (prim_offset_changed) {
369 bool volume_images_updated =
false;
377 Mesh *mesh =
static_cast<Mesh *
>(geom);
381 foreach (
Node *node, geom->get_used_shaders()) {
396 Mesh *mesh =
static_cast<Mesh *
>(geom);
408 Mesh *mesh =
static_cast<Mesh *
>(geom);
418 Mesh *mesh =
static_cast<Mesh *
>(geom);
419 mesh->tag_verts_modified();
420 mesh->tag_subd_dicing_rate_modified();
421 mesh->tag_subd_max_level_modified();
422 mesh->tag_subd_objecttoworld_modified();
441 if (!volume_images_updated) {
442 progress.
set_status(
"Updating Meshes Volume Bounds");
444 volume_images_updated =
true;
456 Hair *hair =
static_cast<Hair *
>(geom);
468 Mesh *mesh =
static_cast<Mesh *
>(geom);
509 scene->
bvh =
nullptr;
612 progress.
set_status(
"Updating Displacement Images");
615 set<int> bump_images;
617 bool has_osl_node =
false;
624 bool need_shadow_transparency =
false;
626 Hair *hair =
static_cast<Hair *
>(geom);
630 foreach (
Node *node, geom->get_used_shaders()) {
634 if (!is_true_displacement && !need_shadow_transparency) {
651 bump_images.insert(slot);
663 OSLShaderManager::osl_image_slots(device, image_manager, bump_images);
667 foreach (
int slot, bump_images) {
676 progress.
set_status(
"Updating Volume Images");
679 set<int> volume_images;
697 volume_images.insert(slot);
703 foreach (
int slot, volume_images) {
721 bool true_displacement_used =
false;
722 bool curve_shadow_transparency_used =
false;
723 size_t total_tess_needed = 0;
735 Mesh *mesh =
static_cast<Mesh *
>(geom);
752 true_displacement_used =
true;
756 Hair *hair =
static_cast<Hair *
>(geom);
758 curve_shadow_transparency_used =
true;
774 if (total_tess_needed) {
778 {
"device_update (adaptive subdivision)", time});
784 dicing_camera->get_full_height());
785 dicing_camera->update(scene);
793 Mesh *mesh =
static_cast<Mesh *
>(geom);
795 string msg =
"Tessellating ";
796 if (mesh->
name ==
"") {
801 "%s %u/%u", mesh->
name.c_str(), (
uint)(i + 1), (
uint)total_tess_needed);
806 mesh->subd_params->
camera = dicing_camera;
824 if (true_displacement_used || curve_shadow_transparency_used) {
828 {
"device_update (displacement: load images)", time});
841 if (true_displacement_used || curve_shadow_transparency_used) {
845 {
"device_update (displacement: copy meshes to device)", time});
867 bool displacement_done =
false;
868 bool curve_shadow_transparency_done =
false;
884 Mesh *mesh =
static_cast<Mesh *
>(geom);
885 if (
displace(device, scene, mesh, progress)) {
886 displacement_done =
true;
890 Hair *hair =
static_cast<Hair *
>(geom);
892 curve_shadow_transparency_done =
true;
914 if (displacement_done || curve_shadow_transparency_done) {
918 {
"device_update (displacement: attributes)", time});
934 bool need_update_scene_bvh = (scene->
bvh ==
nullptr ||
947 need_update_scene_bvh =
true;
978 object->compute_bounds(motion_blur);
986 if (need_update_scene_bvh) {
1007 {
"device_update (copy meshes to device)", time});
1023 Mesh *mesh =
static_cast<Mesh *
>(geom);
1094 og->object_name_map.clear();
1095 og->object_names.clear();
1104 update_flags |=
flag;
list< Attribute > attributes
bool modified(AttrKernelDataType kernel_type) const
static AttrKernelDataType kernel_type(const Attribute &attr)
ImageHandle & data_voxel()
static BVHLayout best_bvh_layout(BVHLayout requested_layout, BVHLayoutMask supported_layouts)
device_vector< uint > points_shader
device_vector< float2 > prim_time
device_vector< uint > patches
device_vector< float4 > points
device_vector< uint > prim_visibility
device_vector< float4 > attributes_float4
device_vector< KernelCurveSegment > curve_segments
device_vector< float2 > attributes_float2
device_vector< AttributeMap > attributes_map
device_vector< KernelCurve > curves
device_vector< packed_uint3 > tri_vindex
device_vector< int > object_node
device_vector< packed_float3 > attributes_float3
device_vector< int > prim_object
device_vector< float4 > curve_keys
device_vector< packed_float3 > tri_vnormal
device_vector< int4 > bvh_leaf_nodes
device_vector< uint > tri_shader
device_vector< packed_float3 > tri_verts
device_vector< float > attributes_float
device_vector< float2 > tri_patch_uv
device_vector< uint > tri_patch
device_vector< int > prim_type
device_vector< int4 > bvh_nodes
device_vector< int > prim_index
device_vector< uchar4 > attributes_uchar4
virtual void const_copy_to(const char *name, void *host, size_t size)=0
virtual void * get_cpu_osl_memory()
virtual BVHLayoutMask get_bvh_layout_mask(uint kernel_features) const =0
void device_update_displacement_images(Device *device, Scene *scene, Progress &progress)
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress)
void geom_calc_offset(Scene *scene, BVHLayout bvh_layout)
void device_update_attributes(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress)
void update_osl_globals(Device *device, Scene *scene)
void create_volume_mesh(const Scene *scene, Volume *volume, Progress &progress)
void device_free(Device *device, DeviceScene *dscene, bool force_free)
void tag_update(Scene *scene, uint32_t flag)
void device_update_bvh(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress)
void collect_statistics(const Scene *scene, RenderStats *stats)
void device_update_mesh(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress)
void device_update_preprocess(Device *device, Scene *scene, Progress &progress)
void device_update_volume_images(Device *device, Scene *scene, Progress &progress)
bool displace(Device *device, Scene *scene, Mesh *mesh, Progress &progress)
Transform transform_normal
void compute_bvh(Device *device, DeviceScene *dscene, SceneParams *params, Progress *progress, size_t n, size_t total)
float motion_time(int step) const
bool need_update_bvh_for_offset
bool has_true_displacement() const
bool need_build_bvh(BVHLayout layout) const
bool is_pointcloud() const
int motion_step(float time) const
bool is_instanced() const
bool has_motion_blur() const
void tag_update(Scene *scene, bool rebuild)
bool need_attribute(Scene *scene, AttributeStandard std)
Geometry(const NodeType *node_type, const Type type)
bool transform_negative_scaled
void tag_bvh_update(bool rebuild)
virtual void clear(bool preserve_shaders=false)
bool need_shadow_transparency()
size_t curve_segment_offset
size_t num_curves() const
bool update_shadow_transparency(Device *device, Scene *scene, Progress &progress)
size_t num_segments() const
CurveShapeType curve_shape
VDBImageLoader * vdb_loader(const int tile_index=0) const
int svm_slot(const int tile_index=0) const
void device_update_slot(Device *device, Scene *scene, size_t slot, Progress *progress)
void tag_update(Scene *scene, uint32_t flag)
void add_entry(const NamedSizeEntry &entry)
void add_entry(const NamedTimeEntry &entry)
void tag_update(Scene *scene, uint32_t flag)
void device_update_flags(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress, bool bounds_valid=true)
void set_status(const string &status_, const string &substatus_="")
CurveShapeType hair_shape
list< ShaderNode * > nodes
ShaderNodeSpecialType special_type
bool need_update_attribute
NODE_DECLARE ShaderGraph * graph
bool need_update_displacement
EmissionSampling emission_sampling
void free_if_need_realloc(bool force_free)
#define CCL_NAMESPACE_END
@ ATTR_STD_POSITION_UNDISPLACED
@ ATTR_STD_MOTION_VERTEX_POSITION
@ BVH_LAYOUT_MULTI_HIPRT_EMBREE
@ BVH_LAYOUT_MULTI_EMBREEGPU
@ BVH_LAYOUT_MULTI_METAL_EMBREE
@ BVH_LAYOUT_MULTI_EMBREEGPU_EMBREE
@ BVH_LAYOUT_MULTI_OPTIX_EMBREE
#define SOCKET_NODE_ARRAY(name, ui_name, node_type,...)
#define SOCKET_UINT(name, ui_name, default_value,...)
#define SOCKET_BOOLEAN(name, ui_name, default_value,...)
#define NODE_ABSTRACT_DEFINE(structname)
CCL_NAMESPACE_BEGIN typedef KernelBVHLayout BVHLayout
static void update_device_flags_attribute(uint32_t &device_update_flags, const AttributeSet &attributes)
static void update_attribute_realloc_flags(uint32_t &device_update_flags, const AttributeSet &attributes)
@ DEVICE_MESH_DATA_NEEDS_REALLOC
@ DEVICE_POINT_DATA_MODIFIED
@ DEVICE_POINT_DATA_NEEDS_REALLOC
@ ATTR_FLOAT4_NEEDS_REALLOC
@ ATTR_UCHAR4_NEEDS_REALLOC
@ ATTR_FLOAT2_NEEDS_REALLOC
@ DEVICE_MESH_DATA_MODIFIED
@ DEVICE_CURVE_DATA_MODIFIED
@ ATTR_FLOAT_NEEDS_REALLOC
@ DEVICE_CURVE_DATA_NEEDS_REALLOC
@ ATTR_FLOAT3_NEEDS_REALLOC
@ SHADER_SPECIAL_TYPE_IMAGE_SLOT
@ SHADER_SPECIAL_TYPE_OSL
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
void set_screen_size(int width_, int height_)
int num_ptex_faces() const
void tessellate(DiagSplit *split)
size_t get_num_subd_faces() const
void add_vertex_normals()
AttributeSet subd_attributes
size_t num_triangles() const
SubdFace get_subd_face(size_t index) const
static NodeType * add(const char *name, CreateFunc create, Type type=NONE, const NodeType *base=NULL)
void dereference_all_used_nodes()
size_t get_total_size_in_bytes() const
Node(const NodeType *type, ustring name=ustring())
size_t num_points() const
vector< Geometry * > geometry
MotionType need_motion() const
vector< Shader * > shaders
ImageManager * image_manager
vector< Object * > objects
ObjectManager * object_manager
LightManager * light_manager
SceneUpdateStats * update_stats
GeometryManager * geometry_manager
string full_report() const
void push(TaskRunFunction &&task)
void wait_work(Summary *stats=NULL)