recursion in point clouds

   4196   6   0
User Avatar
Member
5 posts
Joined:
Offline
Hi All,
I'm working on a project where I'm dealing with a recursive calculation on a couple of points.

Say I have 10 points, I leave point 0 untouched, for point 1 I take the P of point zero and do a calculation with it and write it back to the P of point 1.
For point 2 I use the EDITED P of point 1 and write it back to point 2…and so on.

I think point clouds are the best way to achieve this (?), since vops itself is SIMD and I really would like this to work fast (preferably real-time) but I can't get it to work.

I'm stuck at the point where I have to “fetch” the previous point data from the pointcloud. I'm trying to achieve this by subtracting 1 from the handle and then a pcimport…I'll keep getting an error saying the the pcloud its called before its opened…

So my question is..does anybody know how to pull information from a point cloud form a different point than it is working on? And did anyone try to do something like this? Are there better ways maybe?

Thanks Alot,

cheers, Koen
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
hmm, it is a bit difficult to figure out what exactly you need or want to do. (scene file?)

Here are a couple of things that might help:
The SIMD architecture will do all the points simultaneously (you have to think about it as if all the points go to different threads - so they can't influence each other sequentially within the same vop), so whatever operation you are doing, you should do it to the “current point”, that operation is than applied to all points.

I do not know what kind of calculation you are doing or what info you need. If you simply need the point position of another point, you could use an import vop and link the point number to “the current point number - 1”.

If you now require this vop to be run a lot of times, you should use a foreach and NOT merge the results. That way you will apply that same vopsop to the geometry 10 times (kinda like putting 10 operators in a row).

You can use a pointcloud and create a string parameter for the file. You can point this string to the first incoming input:
op:`opinputpath('.',0)`
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
5 posts
Joined:
Offline
Hi Peter,
Thanks for your reply. Basically what I wan't to do in vops is: take point - do calculation - save result - go to next point - etc. Where result is always dependent on the result of the point processed before. Exactly like stacking 10 nodes (I got it to work this way).

But I would like to keep it all in vops (especially for the challenge and the last time ive used the for each it was preeety slow).

The SIMD architecture will do all the points simultaneously (you have to think about it as if all the points go to different threads - so they can't influence each other sequentially within the same vop), so whatever operation you are doing, you should do it to the “current point”, that operation is than applied to all points.

This is exactly what I'm wondering about now…I thought you could make a pointcloud iterate through the points on a point per point basis. (bypassing the SIMD processing), using a pciterate - whileloop - pcexport combination. But thats not right then? Maybe my logic is al wrong….I try to get a scene file up tomorrow when I'm back at work.

Thanks,

cheeers Koen
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
ahh, I understand what you are trying to do now.

Unfortunately that type of operation is not possible in a single vop.

the pcopen, pciterate and pcexport will not help you in this aspect either. The pcexport only works in the shading context if I remember correctly. But apart from that you should see the “pcopen/pcfilter” very similar to an “import” vop. This will still not allow you to iterate over each point sequentially inside a single vop.

You almost have to think that when the geometry enters your vop sop, it becomes locked. Each point has access to the locked geometry, but because all the points are executed in parallel they do not have access to the modified version of each other.

As you state, the biggest problem is that your operation is depending on the result of the calculation of the previous point. This is very similar to a dynamical system whereby the calculation is based on a previous frame.

A foreach will allow you to do those type of calculations on a single frame, and a sopsolver with a single point (initial condition) can “leave a trail” of points behind of it's previous calculation. These are concepts typical to fractal systems or aggregation. And because of their dependence on previous point/frame calculation, they can not be made parallel. - Only parts of the calculation for a single frame can be made parallel (and it is within this calculation that you can really make optimizations and make it as fast as possible), but not the entire sequence. So you will probably have to take the speed hit .

There is a way to do it in a single vop, but it would be very expensive. Each point would have to calculate all the iterations of the point it depends on. Kind of like you have 50 frames of a particle system, you send it to 50 different machine:
*) machine_1 will calculate frame 1, so it only needs to calculate 1->1
*) machine_25 will calculate frame 25, so it needs to calculate 1->25
*) machine_50 will calculate frame 50, so it needs to calculate 1->50
I think this is a bad approach as the IO overhead versus calculating all the previous frames is not that high.


Ps. On a side note, if you are interested in dynamical systems, this is a really good book: http://www.amazon.co.uk/Chaos-Making-Science-James-Gleick/dp/0749386061/ref=sr_1_2?ie=UTF8&s=books&qid=1277977966&sr=8-2 [amazon.co.uk]
This is one of the books of a list I made a while ago: http://www.amazon.co.uk/Technical-Directors-books/lm/R3ES60SQKYX1EM/ref=cm_lmt_dtpa_f_1_rdssss0 [amazon.co.uk]
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
519 posts
Joined:
Offline
not sure if it helps but can't you use a for loop in this case where the itterator is the point number? You start with point 0, calculate the value in the loop, export the value to the next loop and then calculate the value for the 2nd point etc.
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
Okay, I could not resist and implemented a quick clifford attractor vopsop showing this off.

And with 5000 points it's actually still pretty responsive. I'm still amazed at the speed of vops .

Implemented from this site:
http://local.wasp.uwa.edu.au/~pbourke/fractals/clifford/ [local.wasp.uwa.edu.au]

You can make that in 3d by simply adding another term for the Y component with millions of points and then you get something like this (at some point that turns into a data management and rendering issue - I've done this kind of stuff in a python program procedural at rendertime - both in Houdini& mantra as well as with renderman):
http://www.peterclaes.be/video/pca_0032.avi [peterclaes.be]

Anyway, that shows what you wanted I think.
– I must say that I am pretty curious as to what you are planning to use it for. Dynamical systems tend to catch my interest .

Attachments:
vopsop_loop_01.hip (106.3 KB)

Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
5 posts
Joined:
Offline
Thanks for the reply's guys and sorry for my late reply (soccer and deadlines ). Peter, thats good stuff..thanks for your clear explanation.

It's not really a project it tend using this on, but the question came up when I was trying to make a kind of sop based raytracing vop. Since I want to be able to use this realtime, controlling the direction with a midi controller and seeying the bounced ray in realtime…i thought it was best to stay of foreaches and pythonsops.
Project is a bit on the shelf right now but the question kept popping up…so thats why

I'll have a look at your scene file and let you know what i think.

nice list aswell…ill have a look at that book!

Thanks, cheers, Koen
  • Quick Links