PCwrite from vops

   7691   15   2
User Avatar
Member
14 posts
Joined: July 2012
Offline
Hello sidefx forum,
I would like to know how to procedurally write point clouds from a vopsop.

I'm scattering points over a surface and I would like to create a point cloud based on these scattered points.

This point cloud will record the ID and position of each point so that a shader can sample the nearest X points and do various fun stuff after that.

Currently the pic/hip file attached is creating a scatterCloud.pc file of Okb (with no information).
(the other method approach in the attached hip file reads a point cloud from an input to the vopsop, I hope this isn't the only method of writing point clouds on the fly because I guess that would mean creating a bunch of geometry attributes to be read by the shader and this seems less elegant ((and I'm confused by how to do it as you can see)) )

Anyway I'd appreciate any advice on procedurally writing point clouds or help with my muddled hip file.

Thanks a lot,
Mat

Attachments:
pcwritevopsop.hipnc (181.4 KB)
pcwritevopsop.png (114.0 KB)

User Avatar
Member
696 posts
Joined: March 2009
Offline
I might be wrong, but I've only seen the workflow you're using inside a shader. In that case Mantra reads the shader network and writes out the point cloud.
You could use the ROP output driver or a file SOP to write out your point cloud though…

Cheers
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
14 posts
Joined: July 2012
Offline
Thanks,
That's my fear, but I was pretty sure you could use a pc write inside a vopsop.
The rop output driver/file sop cannot be triggered procedurally can they?
They must be manually activated?
User Avatar
Member
8642 posts
Joined: July 2007
Online
you can
but instead of writing geometry to pointcloud just access it with from the vopsopREAD like this
op:`opinputpath(“.”,1)`
so it will take geometry from second input as a file, so no need to write it to disk
there is plenty of examples of this on forums

however if you want to write points in SOPs and read them back in the shader you can just save pointcloud to disk as normal geometry through ROP output SOP or geometry ROP
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
14 posts
Joined: July 2012
Offline
Thanks,
yeah, I know about the dynamically resolved pathy thing but I'm trying to procedurally write a point cloud so that in can be used in different shaders as you said.
I would like to be able to write this point cloud automatically if some user parameters are changed (number of scattered point e.t.c) and it seems like the geometry rop and rop output driver both need to be activated by physically clicking ‘render’.
I want something that automatically writes the cloud if the values are changed
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Candide
Thanks,
yeah, I know about the dynamically resolved pathy thing but I'm trying to procedurally write a point cloud so that in can be used in different shaders as you said.
I would like to be able to write this point cloud automatically if some user parameters are changed (number of scattered point e.t.c) and it seems like the geometry rop and rop output driver both need to be activated by physically clicking ‘render’.
I want something that automatically writes the cloud if the values are changed

You can achieve this with FileSOP set to write/automatic mode. This is error prone though, not sure if it's worth an efforts.
User Avatar
Member
8642 posts
Joined: July 2007
Online
or you can set python callback script on parameters of your asset you want to invoke recalculation, so if they are changed it will simply execute ROP output driver
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
14 posts
Joined: July 2012
Offline
Much appreciated folks.
User Avatar
Member
14 posts
Joined: July 2012
Offline
Can I ask one more question?
I am trying to dynamically resolve a path to a scatter sop from the shop context.
I am using the value:

`opinputpath(“/obj/projectionSubnet/combo/POINTS_OUT”, 0)`

in the point cloud texture parameter for the pc open vop. I've also tried:

op:`opinputpath(“/obj/projectionSubnet/combo/POINTS_OUT”, 0)`

but these don't seem to be working. Ideally I'd like to do this by relative path. Something like:

op:`opinputpath(“../../combo/POINTS_OUT”, 0)`

Any help would be appreciated
User Avatar
Member
696 posts
Joined: March 2009
Offline
The op: command requires an absolute path. You can use the opfullpath expression together with/instead of the opinputpath:

http://www.sidefx.com/docs/houdini12.0/expressions/opfullpath [sidefx.com]

So from the vop SOP it would be something like this:
op:`opfullpath(opinputpath(“.”,0))`


Cheers
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
8642 posts
Joined: July 2007
Online
Candide

I am trying to dynamically resolve a path to a scatter sop from the shop context.

you cannot reference geometry like this from SHOP context, since mantra will not be able to access that path, it's better if you save it to the disk as a file
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
696 posts
Joined: March 2009
Offline
right… I missed that little part about the shop context!
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
14 posts
Joined: July 2012
Offline
Cheers guys, this is working OK.

I have a new crisis now. I cannot understand pcexport. I'm trying to accumulate information on shaded points by reading and writing data to/from a point cloud.

As a test I am trying to read data from a point cloud (with a single point), add to it, and export that data back to the point cloud (to accumulate with each shaded point). I have this code in my vex shader:

int handleGlobal;
int success;
int newVar;
int oldVar;
handleGlobal = pcopen(“…/PC/global.pc”, “P”, { 0, 0, 0 }, 1, 1);
pcfilter(handleGlobal, “myVar”, oldVar);
newVar = oldVar + 3;

success1=pcexport(handleGlobal, “myVar”, newVar);
pcclose(handleGlobal);

success1 is returning 1 so the export is sort of working but the point cloud is not getting written to.

Any ideas? Am I using pcexport wrongly?
User Avatar
Member
1390 posts
Joined: July 2005
Offline
pcexport exports data to the memory to be utilized down the chain, but it will never to written to a file. pcwrite does write to a file, but IIRC it can do this only in shading context.
User Avatar
Member
691 posts
Joined: June 2006
Offline
What is the main difference between *.pc and *.bgeo (for point cloud processing); For shading what is the best to use.

Thanks!!!
Feel The Knowledge, Kiss The Goat!!!
http://www.linkedin.com/in/alejandroecheverry [linkedin.com]
http://vimeo.com/lordpazuzu/videos [vimeo.com]
User Avatar
Member
1390 posts
Joined: July 2005
Offline
alejandro
What is the main difference between *.pc and *.bgeo (for point cloud processing); For shading what is the best to use.
Thanks!!!

Unlike bgeo, which is general geometry container, pc uses tiled block format internally (the same used by rat textures). They are supposed to be more efficient on load and more graceful for RAM, although it's hard to tell, since ifaik no one has posted any test cases .
  • Quick Links