sebkaine Posted November 28, 2013 Share Posted November 28, 2013 (edited) Hi guys i am trying to implement this pseudo code for i from 0 to Npt get P of currentPoint; get the pointCloud that contain the position to search in (point with @solve=0); get the ptnum of the closestPoint to currentPoint; set @order of currentPoint = i; set @solve of the closestPoint = 1; set currentPoint = ptnum of closestPoint; i++;[/CODE]But it's hard to know where to implement it.i don't think a pure VOPSOP with inline code would fit ,as it will break SIMD treatment.i don't know anything about python in Houdini so it could be the way to go ?at the moment i am trying to implement this in a foreach statement with vopsop for closestPoint search[b]But i don't know how to get in my VOPSOP the current value of the foreach (i variable in my pseudo code) ?[/b]Well any advise on[b] how to elegantly implement this in H would be great[/b], as i am still confuse when to use VOPSOP / Python / For each etc ... Many Thanks for your timeE Edited November 28, 2013 by sebkaine Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted November 28, 2013 Share Posted November 28, 2013 As i can see from your code, this is doable in vex with no problem. If you looping over all your points, why would you need nested FOR LOOP in vopsop? It is already doing a "loop" for you. You always have position as global P attribute, so you just need to open point cloud, look up value, set @order && @solve attributes. Anyway, even if you need to make for loop inside VOPSOP, go ahead, this is no problem.It is still be faster then Python or ForEachSop. You cant do all this in python, but there is no easy access to point clouds. 1 Quote Link to comment Share on other sites More sharing options...
edward Posted November 29, 2013 Share Posted November 29, 2013 Hi guys i am trying to implement this pseudo code So you're trying to do a walk through a point cloud by going to next the closest unvisited point on each iteration, keeping track of the order in which you visited the points. This might be easiest just using a Point Wrangle SOP to write the code in VEX directly. Feed it a single point representing your start point, so your program just runs for that 1 point (unthreaded). Once in VEX, do the walk inside using a for loop. For each iteration in your loop, do a pcopen() to query, and then loop through the results using pcunshaded(). Once you get the first closest point (check if it's not your start point), write to the "order" channel using pcexport(). In theory, pcunshaded() won't pick it again because it is now written to. The pcopen() docs page has an example of this approach. I think you'll need to make sure that your point cloud geo already has the "order" attribute (defaulted to 0). 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted November 30, 2013 Author Share Posted November 30, 2013 (edited) Alex and Edwards many thanks for taking the time to help ! All is pretty clear for me now , It's a good news to know that VEX is the way to go , as it is far more intuitive than using this foreach stuff ... My problem is that as i am still a houdini beginner, i haven't a clear representation on many stuff ... - the first grey area, is how precisly does the VOPSOP inline code excecute the code ? VOPSOP works on point so to my understanding the code you write, will be excecuted in a SIMD way. All point will excecute the code in parallel and the excecution is done again at each frame. - So if i use a for loop inside a inlineCode in a VOPSOP. this forloop will be excecuted in parallel by each point so for exemple if i have a 1845 pt geo, it will perform this forloop 1845 and here is my problem ... cause from what i have understand it will perform an operation 1845 thus 1844 operation are useless. In fact i only need this evaluation to excecute only once. So that's why i said to myself well you must find a way to excecute a VEX code, but without repeating all the instruction in a useless way. But maybe all my assertion are wrong - i love the inline code in vopsop , i like the point wrangle , but for me and from what i have read in the doc they are exactly the same thing as the code is excecuted per point in a SIMD way. So i was searching how to excecute VEX in a houdini tree but excecute it once like you would do in maya with a simple MEL script for ex. But maybe i am trying to apply a Maya logic on this , and that i have to switch my logic to embrass the houdini one ... - The other hard part is that houdini use tons of languages VEX/Python/Hscript/Expression so it's hard to figure when to use the good one. I try to stay with VEX as much as i can cause i love his clean c synthax it's close from Mel and Rsl. But i don't know excatly when i have to use VEX and when i have to use Python ? Well my post is kinda confuse ... but for my problem i will go like you said Inline code in Vopsop or pointWrangle (they are the same thing ?) make a for loop and like edward say use pcopen, pcunshaded and pcexport to make the solve. If you guys has any link to a good intro on how to manage scripting in H , and how things works precisly and how the code is excecuted , it would be great ! Thanks again for yout Light ! Edited November 30, 2013 by sebkaine Quote Link to comment Share on other sites More sharing options...
yongbin Posted December 1, 2013 Share Posted December 1, 2013 Hi, sebkaine. For the first question, I suggest you to use attribwrangle, because it can run only once(detail). In houdini13, wrangle has became really powerful. So, you can do almost everything related in geometry with wrangle(vex). But if you want over that, most of times there is only one options which is python. Python is more flexible, and can be applied overall area. I used it for create my own interface or modify dops. Quote Link to comment Share on other sites More sharing options...
sebkaine Posted December 1, 2013 Author Share Posted December 1, 2013 (edited) Hi Kim ! Thanks for your help , i precise i am still on H 12.5 because i need Maxwell Plugin ... so maybe i don't have all the new options in my Car ... I have check the attribute VOPSOP which looks to be at the end the exact same thing that the attribute Wrangler. all the Wrangler stuff looks to be a new flavor of the inline code inside a VOP. The thing with wrangler nodes is that i don't understand what they offer compare to vopsop+inline code. You loose all the UI elements tools and the code doesn't offer more than inline. I have prepare a simple scene were i have merge all the different way to modify an object in SOP with script, i have try to add clear comment to explain what i have catch from now. As you will see in the scene i'm afraid that a lot of stuff remain unclear to me. For exemple the fact that attribute Wrangler or VOPSOP is a CVEX code is not very clear. In fact if you go CVEX in SOP context some operation are not accessible , so again i don't see what you gain compare to VOPSOP + Inline (i love VOPSOP + inline thats why i repeat myself 100 times ... ) Thanks for the info for your use of Pyhton in H it's store in my HDD-Brain As you will see in my scene there is still a lot of confusion about all those scripting path , but i guess confusion is the price to pay if you want to drive fast cars like Houdini ... Cheers E scriptLevel.hipnc Edited December 1, 2013 by sebkaine Quote Link to comment Share on other sites More sharing options...
yongbin Posted December 2, 2013 Share Posted December 2, 2013 Hi, I saw your scene. I can clearly understand, what's in your mind. You are right. Point wrangle is just a wrapper of vopsop+inline code. vopsop is little more flexible than just wrangle. Especially if you have to export many params, (like for noise vop). vopsop is much better option. Cause you can export many params at once. But surely you can export parameters in wrangle too. Click the gear icon, and "Edit Parameter Interface". In the window you can add parameters. Then import(or reference) it with ch("parmname") I like wrangle because I don't have to go inside. Dive in and out again and again make me quickly tired. Also, you can comment in wrangle. But if you want color it, I am afraid that you can't.. So, freely choose it. It is matter of taste! Vopsop vs Attribvop(vex vs cvex), I don't know what is really different between two. I heard that cvex is made by C and so faster than just vex. But I'm not sure about it. In H13, You can choose iterate type in attribwrangle. But we can't do that for vopsop. So I suggested it to you. But in H12.5, I guess there is no significant difference. And yes, Python is slow... Don't iterate it with 1000000 points . But many times it is acceptable for me. In H13(sorry, again!), python comes with numpy! So, you could do more things with python without worry of speed. That's all I know. Cheers, 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted December 2, 2013 Author Share Posted December 2, 2013 (edited) Again Many thanks for your help Kim ! Thanks to your post i can see a little bit more blue beetween all those clouds. I have check H help of former version like 10, 11, and 12 all those new flavor nodes doesn't exist (Point Wrangle / Attribute Wrangle / Attribute VOP) so here is what i have catch from all the info i get from you and other post. Point Wrangle like you say offer quick feedback as you can instantly type few vex line. It is a cool tool for quick attribute creation/modification or simple point modification. if we go further it can replace the pointSOP and avoid the mess of the Ugly Expression synthax , as it is (to my taste ... ) far more readable than all those opimputhpath stuff and point(opinputhpath blaaablaaa ...), so keeping direct access to clean VEX code is definitly a plus, and i'm gonna start to use those point wrangle since Now ! VOPSOP + Inline + Bloc, Is the nirvanna for complex point manipulation where you have all you can dream to create / modify attribute and points, you also can build UI stuff easily , so it is the cool choice for complex work on point. AttributVOP and Attribute Wrangle are the new kid on the bloc . The name is a false friend as it doesn't look to be dedicated to work on attribute point only. From what i see it's an extension of VEX. In his original form VEX was a manipulation language and his primary target was point. Now sesi want to introduce the same workflow and power than VOPSOP but on other levels like Detail/Primitive/Vertex. So this new attribute VOPSOP is the tool to use to do in VEX all that VOPSOP or Point wrangle can't - creating / deleting point - work on primitive/detail/vertex attribute In the same idea the attribute Wrangle could be use to replace the vertex and primitive SOP while attributVOP would be for more complex operation As it is not possible to create or delete anything in a sop vexgeo { } form they bypass this limitation by using CVEX from what i grab from the doc CVEX is an actual program written in VEX or built with VOP networks usually by the TD/Artist that gets called by a run-time procedural written in c++ by a developer utilizing the HDK. Geometry gets built and passed out of the procedural to the cvex program which processes the geometry then returns the result back to the procedural. So in this case they use some HDK stuff in the back to do what we can't do in VEX , and VEX here is only the gateway, i think it is why they are using the cvex attribute1{ } synthax. Python is more like a workflow helper like MEL it is use to build stuff or delete stuff , automate task that you would do manually. but it's also an important tool to know, But for manipulation of data VEX is the best way to go ... well there should be some mistake but i think i can start to understand things better ! and the Houdini Help doesn't help a lot on this ... Thanks again for taking the time to help me ! I've attach a scene that sum up all ( i guess .... ) Cheers E scriptLevel02.hipnc Edited December 2, 2013 by sebkaine Quote Link to comment Share on other sites More sharing options...
edward Posted December 14, 2013 Share Posted December 14, 2013 - So if i use a for loop inside a inlineCode in a VOPSOP. this forloop will be excecuted in parallel by each point so for exemple if i have a 1845 pt geo, it will perform this forloop 1845 and here is my problem ... cause from what i have understand it will perform an operation 1845 thus 1844 operation are useless. Exactly, which is why I said to run your VEX stuff on a *single* input point. 1 Quote Link to comment Share on other sites More sharing options...
Tesla's fan Posted July 8, 2014 Share Posted July 8, 2014 Do u mean this? link point one by one with closest point and not repeat? My english is bad, can not help u too much. line2.hip Quote Link to comment Share on other sites More sharing options...
sergio Posted July 23, 2014 Share Posted July 23, 2014 Do u mean this? link point one by one with closest point and not repeat? My english is bad, can not help u too much. Hi guu, i was trying to implement something similar to this and came by your file. it is great but i have 2 questions. - is it possible to add a vertex each frame or do it in a loop so it add 3 vertices each frame? - is it possible to delete vertex or primitives inside attrib wrangle sop? thank you and sorry if it sounds noob because thats what i am Quote Link to comment Share on other sites More sharing options...
Tesla's fan Posted July 29, 2014 Share Posted July 29, 2014 Hi guu, i was trying to implement something similar to this and came by your file. it is great but i have 2 questions. - is it possible to add a vertex each frame or do it in a loop so it add 3 vertices each frame? - is it possible to delete vertex or primitives inside attrib wrangle sop? thank you and sorry if it sounds noob because thats what i am Hi , I think you can try this inside a sopSolver. Because it relate to time.In fact I am not sure. Maby you can reference this tutorial https://cmivfx.com/store/573-houdini+vein+work Quote Link to comment Share on other sites More sharing options...
sergio Posted August 7, 2014 Share Posted August 7, 2014 Hi , I think you can try this inside a sopSolver. Because it relate to time.In fact I am not sure. Maby you can reference this tutorial https://cmivfx.com/store/573-houdini+vein+work Ok thanks. will research a little bit more on that. Quote Link to comment Share on other sites More sharing options...
Tesla's fan Posted August 11, 2014 Share Posted August 11, 2014 Hi guu, i was trying to implement something similar to this and came by your file. it is great but i have 2 questions. - is it possible to add a vertex each frame or do it in a loop so it add 3 vertices each frame? - is it possible to delete vertex or primitives inside attrib wrangle sop? thank you and sorry if it sounds noob because thats what i am Just drag the time line between 1 to 99 line3.hip Quote Link to comment Share on other sites More sharing options...
sergio Posted August 11, 2014 Share Posted August 11, 2014 Just drag the time line between 1 to 99 Yep thats it. thank you very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.