pcopen VEX function

Returns a handle to a point cloud file.

Contexts: image3d, chop, cop, pop, sop, surface, displace, fog, light, shadow, photon, cvex

See also: pcwrite, pcfilter, pciterate, pcunshaded 2 more , pcimport, pcclose


  1. int pcopen(string filename, string Pchannel, vector P, float radius, int maxpoints)

  2. int pcopen(string filename, string Pchannel, vector P, string Nchannel, vector N, float radius, int maxpoints)

This function opens a point cloud file (.pc) and queues up access to the points centered around a certain location P within radius, based on point positions found in Pchannel. You can then iterate over the points with pcunshaded or pciterate.

Only the maxpoints closest points within the given radius will be queued.

The file name may use the op: syntax to reference SOP geometry in the OP contexts. The Pchannel parameter indicates the channel in the texture which contains the position to be searched. The P parameter specifies the search query position.

Optionally, the Nchannel specifies a direction channel and the N vector specifies a search direction. Only points which are pointed in the same direction (i.e. dot(N, Npoint) > 0) will be queued.

You can specify an additional string parameter "prefix", with the next parameter being a channel prefix string, used to reference tiled block files.


int handle = pcopen(texturename, "P", P, maxdistance, maxpoints);
while (pcunshaded(handle, "irradiance"))
   pcimport(handle, "P", cloudP);
   pcimport(handle, "N", cloudN);
   ir = computeIrraciance(cloudP, cloudN);
   pcexport(handle, "irradiance", ir);
pcfilter(handle, radius, "irradiance", ir);