Jump to content


  • Content count

  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

8 Neutral

About Alain2131

  • Rank

Personal Information

  • Name
  • Location

Recent Profile Visitors

468 profile views
  1. Copy multiple objects to multiple point in loop

    Hey there, So for the setpointgroup You misunderstood the process a bit. It does not actually use the detail attribute - the detail attribute is simply set, and not used anymore in the wrangle. int iteration = detail(1, "iteration"); // Gets the current iteration value of the loop, using the detail attribute of foreach_begin1_metadata2 (that is the input 1) int ptCount = npoints(0); // This returns the number of points (in this case, how many chunks you have) // The rand() function produces a random number between 0 and 1 // Using it with the iteration value makes it yield a different number for each scattered point // Since the number is between 0 and 1, if I multiply it by the number of chunks (in this case 20), you'll have a number ranging from 0 to 20 // Doing fit01(rand(iteration + ch("seed")), 0, ptCount) would essentially give the same result. Make use of what you're most confortable with ! int toKeep = int(rand(iteration + ch("seed")) * ptCount); // Maybe that using the same names for those next lines was a bit confusing setdetailattrib(0, "toKeep", toKeep); // This places the variable toKeep in a detail attribute named toKeep. A simple copy/paste setpointgroup(0, "toKeep", toKeep, 1); // This uses the variable toKeep (which has nothing to do with the detail attribute) to say "I want to set a group on the points, please use the geometry of the input 0, the group name is "toKeep" (if it doesn't exist, it creates it), put it on the point number toKeep (which contains a value ranging from 0 to 20), and tell that point to be in the group (the 1 takes care of that)". Because by default groups are initialised at 0, all the other points won't be in the group Another way of doing it is this int iteration = detail(1, "iteration"); int ptCount = npoints(0); int toKeep = fit01(rand(iteration + ch("seed")), 0, ptCount); setpointgroup(0, "currentChunk", toKeep, 1); Hopefully this isn't more confusing To understand the nmin/nmax values in the fit01, you need to understand the principle behind the whole wrangle. Just to mention, those stands for OMin (Original Min), OMax (Original Max), NMin (New Min), NMax (New Max) The idea is to give a different number for each scattered point that represents one of the chunk you have. So if the number is 13, well, simply keep the chunk #13, remove everything else, and copy that chunk on the current scattered point of the loop. So for the nmin, we want the lowest chunk number, which is 0. You can see that in the geometry spreadsheet. As for the nmax, in this case this is the number of chunks that you have, since this is the whole idea of that setup. So, it is ptCount. There is no omin/omax, this is only for the fit() function. The fit01() assumes omin=0 and omax=1. As for the Attribute VOP method, I can't currently produce a scene file since I'm at work. But here's a picture of a few corrections You were using the ptnum output, which is the current number of the point. Just use the numpt, this is the point count (hovering your mouse over it tells you what it is) Using the fit does the exact same result as the multiply. Use what you want ! As for creating a group from the detail attribute, I now understand what you mean. It's because of the VOP method that doesn't have an easy way of doing groups. As far as I know. I've never created groups with it (although is it definitely possible), so I don't know how to set a group the way we need in VOP. Sorry 'bout that. EDIT : I don't know if that makes it simpler, but this may make the connection a bit better between VEX and VOP int iteration = detail(1, "iteration"); int toKeep = int(rand(iteration + ch("seed")) * @numpt); // Using the @numpt, which is the same name as in VOP // That way we get rid of the whole ptCount line setpointgroup(0, "toKeep", toKeep, 1);
  2. Copy multiple objects to multiple point in loop

    No worries The two functions do something similar setdetailattrib -> There are points, vertex, primitive and detail attribute on any piece of geo. Detail is an convenient way to set something that is "global" to the piece of geo you currently have, as it is only there once in memory (instead of on all the points/verts/prims). So go in the details tab of the geometry spreadsheet, and you'll see a "toKeep" attribute. For its use, see below.. setpointgroup -> It does what it says - it sets a point group, much like the group node does. See in the points tab of the geometry spreadsheet, when seleting the wrangle you'll have a new group, named "toKeep". For its use, again, see below.. Oh well, I've just seen that you said that you know what the functions does. Eh ¯\_(ツ)_/¯ Why I said that using groups is easier is for what's below the wrangle. There are two blast node. Why two ? One to showcase the attribute workflow (setdetailattribute), and the other to showcase the group workflow (setpointgroup). If you see the blast nodes underneath the wrangle, one is for the group workflow, and one is for the attribute workflow. The only difference is what's in the "Group" parameter. Using the group workflow, you simply put "toKeep". That's it, easy enough. Using the attribute workflow, the syntax is weirder. `detail(0, "toKeep", 0)` This means "go and get me a detail attribute of the input 0 (the only one in this case) with the name of 'toKeep'", and the last 0 I'm not sure. And the `` are important. I think this is used to return a string, but don't quote me on that. Now, why I said that I could have used an attribute instead is that it is just a bit less expensive memory side, since it's just one attribute instead of one on all the points. But the gain is sooooooooo small that eh, whatever (unless you have millions of pieces, in that case maybe consider it). It all boils down to your personal preference Hope that clears it up a bit !
  3. Copy multiple objects to multiple point in loop

    Hey there ! copyToPoints_1.hipnc Here's what I did. Your pieces were already packed, which is needed for my setup. In the for each loop where you copy the pieces to the points, I added a wrangle that gathers the iteration value of the loop. Based on that, I generated a random number going from 0 to the max number of points (rand(iteration)*pointCount), which gave me the piece that will be copied onto the point of the current loop iteration. I then created a group containing only that piece (yesh I know I could have used an attribute instead, but the group is simpler to understand) and deleted what's not in that group. Hope that's useful ! Have a great day
  4. Causing Waves in the clouds

    This could be a start cloud_flyby_velocity.hip Basically, using the tube idea, use the normals as velocity and add it to the simulation. Hope that's useful !
  5. Houdini not exporting geometry to FBX?

    @zarralax Sorry for the delay, didn't see it. Unsure what you mean by saying "retain each objects' pivot" This could apply to multiple things 1 - Inherit the container's pivot 2 - If it is a packed prim, take that pivot (packedfulltransform) 3 - Take the center as a pivot They could be added as parameters to the tool, if this is what you mean @art3mis I'm glad it's useful !
  6. Hey guys ! Let's lay out the bases. What's the big idea. To start with, I've got some skinned mesh (a tree or something) that I want a wire sim to be applied to. I get the bones' position and parenting information, create a polyline representation of the bones, and then send that to a wire sim. I then need to gather the result and apply it back to the bones. The problem is - the information from the wire sim (pos and orient) are world-space. I need them local-space to be written back onto the bones, and I need them "zero-based", so that a local translation is not applied two times, idem for rotation. Don't know how to make that conversion. Now ! For what I've actually managed to achieve. For the test, I've got no geometry, only very simple bones (a two-bones chain), and I got them into sops in polyline, and the sim is applied to it. I now need to write that info to the bones. That's where I hit a wall. Can someone help me with that ? Either by how to convert the world-space wire sim to the local-space of the bones, or by some trick with nodes (such as sticky/rivets, which is what I'm trying in the hip file). See the aforementioned for some of the tests that I did. TL;DR : I need to transfer a wire sim (that has its initial positions from bones) to their respective bones. See hip file for current tests state. Thanks ! wire_to_bones.hip
  7. I've figured it out. I'm not sure what the timeshift does, but it's not what I need. I need the shift node, with $C put into the Scroll Offset, and change the Units to Frames in the Common tab. The shift node needs to be placed somewhere that has more than one channel (duh), and in my case under the math node was the correct location. The behavior will the that the first channel will have 0 frame of offset, the second will have 1 frame of offset, the third will have 2 frames, and so on. If I would have left the Units in Seconds, it would be 0, 1, 2 seconds of offset. Makes sense, but I didn't know about that when asking the question. Sooo, yeah, that's it ! Thanks for reading !
  8. Hey guys ! I'm starting out in CHOP, so be gentle. I'm trying some things to get going, and already hit a roadblock. I got a geo node that I'm assigning the rx rotation from CHOP, adding a sin wave to it. Works well. But where I'm stuck is that I'm trying to add that same animation to a second geo node, but I want to add some sort of time offset between the two animations. So I'm thinking "Let's add a timeshift node under the constant, and use some kind of global variable (I believe $C ? Or @C ? unsure) to make a random number for each channel as an offset number !" Sooo, that didn't work. $C and @C doesn't return anything interesting (aka. not 0 or not erroring out). Maybe I understand this wrong ? If so I'm unsure as to how to use those global variables. Also, as a side note, I've seen chan[X-Y] being used sometimes in videos, but didn't find it in the help. Nevermind found it, gotta learn to use it now. It's in the Common parameter section of a lot of CHOP nodes. So ! Is the idea wrong ? How should I approach this ? Thanks in advance ! chop_timeoffset_test.hip EDIT : P.S. I've just noticed that in the help, it says When processing multiple channels, [...]. So I believe placing the timeshift under the math node would be more appropriate. But even doing so it stills errors out. Also, there's this - but I haven't been able to make it work. I tried the different combinations of Reference and Unit Values, to no avail.
  9. [SOLVED] [VEX] point() function returning "old" value

    Sorry for double-post, but I think this deserves it. I think I figured it out. I had three ideas to fix the problem. 1 - Don't write the positions and matrices to the geometry. Instead, generate a duplicate of all the attributes in memory using arrays 'n things, and modify those instead. Only at the end would I write the result to the points. I ruled it out pretty fast because I was lazy (what a hassle it would have been). How to represent multiple matrices and positions while keeping the point they belong to referenced without dictionary-like features ? Can I even make an array of matrices ? Maybe, don't know, again, a hassle. Not much thought put into this one. 2 - Convert the code to work running over points, and set the attributes using the @ syntax, so that when looping the values would be correctly returned. Ruled it out. A hassle. 3 - The problem was to loop over the points, set some attributes, read some, set the new matrix and pos, then loop again with the new geometry. A job perfectly suited for the for loop in count mode, with Fetch Feedback and Feedback Each Iteration. I did some (small) tweaks, and it works ! Yay ! See set_point_transformation_matrices_working.hip
  10. [SOLVED] [VEX] point() function returning "old" value

    Hey guys, thanks for the fast replies ! I see now, it makes sense. I was a bit confused by the @ syntax which was able to read the "correct" value. But unfortunately I can't use two different wrangles to fix my problem. I'll explain a bit more. I have some points, representing bones position. Those points starts with the original bones' position and rotation (with a rot attribute). What I need, is with one node to write some position/rotation that the "bones" needs to perform in a temp attribute (tempPos & tempRot) on all the required points. No problem there. Then, I need to apply the transformation on the points. That's where the problem is. In the test case, I only apply some transformation on the two first bones of the chain. I worked out how to apply the transformation to the points in local. So that works. But each transformations gets overridden by the next one, so that only the last one gets taken into account, because of the reason mentioned above. If I override the master loop which loops over all points and simply place two wrangles one after the other saying the first is i=0, and the second i=1, it works as intended. But that's not a viable solution in my case. See set_point_transformation_matrices.hip Thanks ! P.S. There is some major flaws in my math. I just found out that any other points than the two firsts doesn't work properly. It has nothing to do with the matter at hand, it's just a forewarning. UPDATE : I figured out the math/logic - I had the world position inside the matrices instead of the local position. Fixed that. So yeah, last problem is the one explained in this post. Hip file updated.
  11. Hello guys ! I noticed that in vex, if you modify an attribute and then read it back using the point() function (or prim(), or anything not using the @ nomenclature), it will return the input value, not the modified one. See this code, running over Detail vector thePos = point(0, "P", 0); // Input point's pos is {0,0,0} thePos += {1,2,3}; setpointattrib(0, "P", 0, thePos); thePos = point(0, "P", 0); printf("%d ", thePos); // Prints {0,0,0} instead of {1,2,3} I mean, even this code doesn't work ! No input, running over Detail addpoint(0, {1,2,3}); vector thePos = point(0, "P", 0); printf("%d ", thePos); // Prints {0,0,0} instead of {1,2,3} But interestingly enough, when running over Points (or prim or whatever), this happens //Input is one point, at {0,0,0} @P += {1,2,3}; vector thePos = point(0, "P", 0); printf("Real pos : %d\n", @P); // Prints {1,2,3} printf("Problem pos : %d\n\n", thePos); //Still prints {0,0,0} Not sure what that means, but it can't be applied in my case, as I need to run over Detail. Just wanted to point it out. I need to be able to modify some point attributes (pos and others) and then read them back when running over Detail. How can I do that ? Is it possible ? Thanks in advance ! point_old_value.hip
  12. Hey folks ! I have some animated geometry (in the example scene it's from dop, but any animated geo could be used), and I'm trying to separate the pieces in a subnet of geo nodes, then animate the geo node from the pieces' movement. In other words - extract sop animation to obj level. I have the geo nodes with the position keyed and working. It's for the rotation that I'm struggling. I tried two methods : 1 - I used the extractTransform node, and it's almost working, but there's a slight rotation offset. Why is that so ? 2 - I tried to create the matrix myself and extract the rotation from that using VEX. The matrix building and rotation computing //Inputs : // 0 - Animated center // 1 - Animated geo // 2 - Static center // 3 - Static geo // m = moving | s = static vector p0m = point(0, "P", 0); // Center (animated) vector p1m = point(1, "P", 0); // Z axis (animated) vector p2m = point(1, "P", 1); // Y axis (animated) vector p0s = point(2, "P", 0); // Center (static) vector p1s = point(3, "P", 0); // Z axis (static) vector p2s = point(3, "P", 1); // Y axis (static) vector zAxism = normalize(p0m - p1m); vector tempYAxism = normalize(p2m - p1m); vector yAxism = normalize(cross(tempYAxism, zAxism)); matrix mm = maketransform(zAxism, yAxism, p0m); vector zAxiss = normalize(p0s - p1s); vector tempYAxiss = normalize(p2s - p1s); vector yAxiss = normalize(cross(tempYAxiss, zAxiss)); matrix ms = maketransform(zAxiss, yAxiss, p0s); //mm -= ms; vector theRotm = cracktransform(0, 0, 1, p0m, mm); vector theRots = cracktransform(0, 0, 1, p0s, ms); theRotm -= theRots; setpointattrib(0, "rot", 0, theRotm); But the rotation is not right, it looked like the axis were not the right one (like X belonged to Y or smth). I played around with the vectors order, to no avail. I'm interested to know why the extractTransform doesn't work correctly, but what I'm really looking forward is to know what's wrong with the second method. Thanks in advance ! Here's the scene : extractRot_tests.hip
  13. [PYTHON] Getting current frame over network using rpyc

    Hey Alex, thanks for the answer ! I'll send an RFE as you proposed But do you think this is because I'm using rpyc in Maya instead of hrpyc ? I don't really know what I'm doing, I'm just poking around Meanwhile, fcur does return the correct frame ! Noice ! Thanks for that =)
  14. See this page print node.parm("theParm").description()
  15. Python from string parameter

    Okay, I see now My bad, here's the "right-er" info here In fact, it's "exec" that you want exec(kwargs['node'].parm('python').eval()) See below for the test I did