pcwrite
VEX function
Writes data to a point cloud file.
Contexts: surface, displace, fog, light, shadow, photon, image3d, chop, cop, pop, sop, cvex
See also: pcopen, pcexport, File node
Overview
-
pcwrite(string filename, string data_channel_name, data_channel_value, ... [string option, option_value ...])
This function writes data for the current shading point out to a point cloud file.
The first argument is the name of the file to write to. You can read the resulting file into a geometry network with the File surface node. Houdini expects point cloud files to use the .pc extension (Houdini will use the extension to determine how to import the file).
Subsequent arguments specify one or more pairs of a channel name (a string naming the attribute you're saving, such as "P", "N", "v", "area", "u", etc.) and value (the value you wish to store).
pcwrite("out.pc", "P", P, "N", N)
To write a variable as a vector type instead of a triple, append :vector to the channel name.
pcwrite("out.pc", "P", P, "N:vector", N)
Options
|
|
When you pass this argument along with a value of pcwrite("out.pc", "P", P, "interpolate", 1) (Note that this means you can’t use |
|
|
For photon generation modes, add the number of points stored to the total number of photons, for the purposes of progress reporting and termination of photon map generation. |
Example
surface dumpsomepoints(string fname = "points.$F4.pc"; int do_cull = 0; float keepamt = 0.05) { vector nn = normalize(frontface(N, I)); int rval=0; float A = area(P,"smooth",0); // area without smoothed derivs if( !do_cull || do_cull & (nrandom()<keepamt) ) { if( do_cull && keepamt > 0 ) { A = A/keepamt; } rval = pcwrite(fname, "interpolate", 1, "P", ptransform("space:camera","space:world", P), "N", ntransform("space:camera","space:world", normalize(N)), "area", A); // output an "area" channel in pc } Cf =abs(nn)*rval; }