2
$\begingroup$

I am learning Open Shading Language these days, but I don't know how to use pointcloud_write(...) and pointcloud_search(...), what does pointcloud actually mean ? how to create a pointcloud in blender ? how to use pointcloud_write(...) and pointcloud_search(...),?

$\endgroup$

1 Answer 1

1
$\begingroup$

I was quite intrigued by these functions and tried to following the code examples in the OSL language specification but without success. On digging into the Cycles code, however, it becomes clear why this was not working :

int OSLRenderServices::pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 &center,
                                         float radius, int max_points, bool sort,
                                         size_t *out_indices, float *out_distances, int derivs_offset)
{
    return 0;
}

int OSLRenderServices::pointcloud_get(OSL::ShaderGlobals *sg, ustring filename, size_t *indices, int count,
                                      ustring attr_name, TypeDesc attr_type, void *out_data)
{
    return 0;
}

bool OSLRenderServices::pointcloud_write(OSL::ShaderGlobals *sg,
                                         ustring filename, const OSL::Vec3 &pos,
                                         int nattribs, const ustring *names,
                                         const TypeDesc *types,
                                         const void **data)
{
    return false;
}

The functions merely return 0 or false and perform no action. Therefore, it appears that this functionality has not yet been implemented in the current version of Cycles.

The source can be found in the Blender GIT Cycles repository at https://git.blender.org/gitweb/gitweb.cgi/cycles.git/blob/HEAD:/src/kernel/osl/osl_services.cpp

$\endgroup$
2
  • $\begingroup$ If it's not sprinkled over too many files, could you make that Cycles code reference into a link? I've often felt the need to go in and see what's happening, but I'm no good at searching the code efficiently, and I'm not building Blender for myself, (yet) $\endgroup$
    – Robin Betts
    Commented Oct 2, 2018 at 9:22
  • $\begingroup$ @RobinBetts Sure - I've updated the answer to include a link to the Blender repo for that file. From there you should be able to navigate the rest of the repository. If you have 'git' installed you can download a full clone of the repository with git clone git://git.blender.org/cycles.git. $\endgroup$ Commented Oct 2, 2018 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .