pcopen returns a handle of type int, what is that int referencing?

   2414   1   2
User Avatar
Member
11 posts
Joined: Nov. 2017
Offline
I am looking over the documentation here http://www.sidefx.com/docs/houdini/vex/functions/pcopen.html [www.sidefx.com]

and it says that pcopen Returns a handle to a point cloud file. The handle is of type int so I assume that it is referencing something, but I can't intuit what is being referenced. My best guess is that there is an array of point cloud files or objects somewhere and this handle is the index.

I have a scatter node with 24 points being passed into the first input of a wrangle node (run over points) where I have the following code:

int handle= pcopen(0, "P", @P, 2.1, 10);

printf("P = %g", handle);

handle equals 0 for every node.

Can someone point me in the direction of any documentation that defines handle, or can anyone help me wrap my head around what the handle is referencing in the context of pcopen?
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
A handle in programming (I aint no programmer btw) is an abstract reference to a resource. In the case of point clouds, that resource would be referencing blocks of memory that contain the point cloud.

It is opaque by definition so you will not be able to see that remote resource until you query it through the functions provided along with the given handle. The pc functions require that handle to “find” the remote point cloud data.

Point Clouds were a god send in the old days of micropolygon rendering where you had no way of peering beyond the current shade point for various Global Illumination strategies and for baking illumination for performance.

Point Clouds were pre-computed to contain lighting information for the surface and saved prior to rendering. When the render is running you can open up a point cloud (a remote resource in memory) and then with the provided pc functions query that remote point cloud with the handle returned from pcopen() usually from the current position to “see” beyond the current shade point. Very useful! Subsequent pc functions require that handle to find the point cloud to both read and write in to the separate memory.

Point Clouds quickly spread throughout Houdini via VEX and gave us the ability to create a very fast way to query neighbor points to a given position for all kinds of useful tasks. Wet Maps, convolutions (blurs/sharpens), and more. Well beyond their original implementation within VEX and Mantra.


Point clouds are still quite useful as they are sparse by nature. VDB grids can also perform the same tasks as well as volumes. VDBs and volumes come with extra features such as fast integration methods to do stuff like gradient from normal with SDF and more.

Lots of choices these days.
There's at least one school like the old school!
  • Quick Links