Jump to content

Search the Community

Showing results for tags 'array'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
    • Tools (HDA's etc.)
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 27 results

  1. Handling array in Vex

    Hi, In Python, we can create a "quick array" with conditions in a single line: a1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] a2 = [0, 2, 4, 6, 8] a3 = [i for i in a1 if i not in a2] >>>> a3 == [1, 3, 5, 7, 9] In vex, I know how to do it the long way: int a1[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; int a2[] = [0, 2, 4, 6, 8]; int a3; foreach( int i; a1 ){ if( find(a2, i) >= 0 ){ append(a3, i); } } >>>> a3 == [1, 3, 5, 7, 9] Is there a faster way to do this kind of things, maybe like in Python? Thanks!
  2. Hi guys, Im a little stumped on a vex issue im having whilst trying to utilize the nearpoints function when building an array. The idea is that i have multiple curves, each with different colour values, which i group the end points of and then run a function which gathers all the nearest points to each of these endpoints and assigns them to an array. (this is currently working as can be seen in my spreadsheet.) However, i then wish to take this array that has been created for each of the endpoints and run an if statement through it that says if the points in the array have a different colour value to the end point they belong to then add them to a group. Im then hoping to perform a nearpoint function using this group as a filter to get the nearest point that belongs to any curve other than itself. Im unfortunately having an issue with this if statement as it seems to only output points 0-9 regardless of the previous rules set in the code. Help is really appreciated as im truly stumped on this one. Thanks in advance guys! Nearest_Points_Array_Problem.hip
  3. Hi folks, I'm having a bit of trouble with exporting an array of integers to alembic. When i create an array on the geometry and export it to alembic and import it back into Houdini again, the array is changed to an integer with the value of 0. Even if I fill in the attribute name in the ropAlembic node at the `detail array attributes`, it's converted to an integer again. Is this something alembic can't handle or am I doing something wrong? I'm totally confused right now! Hopefully somebody can help? Thnx!
  4. Hi, I'm trying to store a size of some objects into an array using 'foreach loop'. And it works in a single pass mode, but not in normal mode. And I have no idea why Try to switch single pass mode on and off and check attributes on detail stacked_boxes_q.hipnc
  5. vex - arrays

    Hi Guys, I am wondering if there is any way in vex to compare between two arrays to get the difference. Please let me know is there any way to do this, below is what I am trying to do s[]@attribsA = detailintrinsic(0, "pointattributes"); s[]@attribsB = detailintrinsic(1, "pointattributes"); s[]@AB = @attribsA - @attribsB; //need mismatched attributes in a s[]@BA = @attribsB - @attribsA; //need mismatched attributes in b Thanks a lot in advance!
  6. Hi everyone ! I'm learning VEX (from CGwiki and Entagma) and I don't understand why the result of the following code is 0 whereas it should be 3... what did I misunderstand ? int myarray[] = {2, 3, 4, 5}; int foo = myarray[1]; printf("%i \n",i@foo); Thanks ! Alexandre
  7. Hi! I'm struggling to understand how arrays work Could somebody please explain why am I seeing different results in geometry spreadsheet and in console made by 'printf' function? I mean, why does every primitive in spreadsheet contain the same set of points in its arrays? I'm puzzled. One more question: How can I compare contents of different arrays? primitives_array_q.hipnc
  8. Custom struct as attribute

    I have a custom struct in VEX (Houdini 16.5). It's nothing special, just a few simple values combined (no arrays). Is it possible to create an attribute out of a custom Struct in vex? Is it possible to do that for an array of custom structs? I guess it's something like: adddetailattrib(0,"name","myStruct"); adddetailattrib(0,"name","myStruct[]"); setdetailattrib(0,"name",myStructObject,"set"); These kinda seem to succeed in creating an attribute, but I don't seem to be able to add values to those. Also I would like to be able to use the @ syntax for quickly defining attributes for custom structs. (Something like: myStruct@myAttribute;) Is that possible? (Note that I can create variables, with code like: myStruct myVariable = myStruct(1,2,3); and myStruct myArrayVariable[]; But I specifically am interested in creating attributes on the geometry that would persist between wrangle nodes and especially be visible in the geometry spreadsheet.)
  9. Hi, I've been trying for a couple of hours to get my array points into a group. The idea is that I want to delete every face that is not colliding with a ray/line (first collision/one collision point per face). I used "intersectionanalysis", which gave me the points and faces I want to preserve but now I'm not able to group those array points or blast them any other way. Please let me know if you have an idea. Thanks raycollisionTest.hip
  10. I'm making an effect very much like this one from Entagma: https://vimeo.com/194277211 I've adjusted it a little and I noticed that some of the curves that get created collapse onto each other. I think it even happens at the very first frame. You can see that by the white parts of the lines. Those are the last created points. When two white parts meet, it means the curves collapsed and continues as 1 curve. What the setup does is it has a bunch of points as the active searching points. Each of these find target points in front of them and saves those in an array. Then a random point from within the array gets chosen and used to make the polywire. Sometimes, mainly at the very beginning, the searching points are close enough together so that they might find the same target points. This is where I believe the issue lies. What I would like to achieve is that I can check between the arrays on each of the points to see if they have similar target points and if so, remove those from one of the arrays. Or that when points get targeted by one searching point, they instantly get marked so that they can't be found again before the end of the timestep/solve. At this moment, I'm still trying to figure that one out. Any tips for this are much appreciated. Eckhart ObjectMaterialize.v005_00.hip
  11. Custom VEX function input type

    Hi there, I'm trying to wrap my head around custom vex functions, mainly from a theoretical point at this stage so not really addressing a specific use, just general knowledge. When I create a VEX function I believe that I have to specify exactly what type of data it is expecting from the arguments and exactly what type of data it will return. eg. function int my_function(float a){ return int(a); } in which case I have to feed it an INT argument and it will always return an INT value. My question is this, is there any way of creating a VEX function which can accept multiple arguments, but not fail if one or more of those arguments are absent when the function is called? Or better yet a way of taking a single argument with out specifying what type of data that argument should be? I'm guessing that this is somehow possible as most of the existing Houdini VEX functions work with multiple flavours of input. Thanks in advance. M
  12. Array Function VEX

    Hi there, I'm playing around with creating some custom VEX functions and came across something a bit odd that I just can't seem to get working. If I want to create a custom function that returns an array, say a vector array I will need to declare the return type at the beginning, according to the docs the following should work // A function which returns an array of vectors vector[] rgb_array() { ... }; However if I run this in a wrangle I get a syntax error on line1. Is this a bug? Or am I declaring my function type incorrectly? Thanks in advance m
  13. The Array Enigma 101

    So for the last view weeks I've been learning vex, great stuff. So now I want to turn my new awesome vex knowledge into practise. The goal of this operation is the measure the distance between each point to their closest neighbour. First, I use the pcfind function to grab the nearest point of each point number and put them in an array. Second, now I like to grab the values from the array and put them into a distance function. (BUT HOW?) I find array a bit of a vague concept. I get its a list of values, but I'm not really sure if the point numbers in the array also hold the position vector. Not sure if I'm doing this right, and probably there better way. If this method is right, pretty please help me out. kind regards, The new kid on the block measure_distance_nearpoint.hip
  14. It looks like it's possible to set point attributes all at once instead of looping through them one at a time. I was trying to do it with NumPy, but can't quite get it right. Seems to be problem with the custom attribute being an array. Given an array with the same shape,i.e., number of points x array size it looks like it should work, but doesn't. Incidentally, the NumPy array will contain data from a file. I can't tell there's a better way to pull file data straight into something like VEX, hence the NumPy array. Here's my test code: node = hou.pwd() g = node.geometry() pt0 = [1.0, 0.0, 0.0] point = g.createPoint() point.setPosition(pt0) pt_1 = [0.5, 0.5, -1.0] point_2 = g.createPoint() point_2.setPosition(pt_1) pt_2 = [1.5, -2.5, 0.0] point_3 = g.createPoint() point_3.setPosition(pt_2) g.addArrayAttrib(hou.attribType.Point, "MyFloats", hou.attribData.Float, 8) gp = g.points() # This works fine ''' gb0 = (0.5, 0.3, 0.1, 0.1, 0.6, 0.2, 0.3, 0.8) gp[0].setAttribValue("MyFloats", gb0) gb1 = (0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1) gp[1].setAttribValue("MyFloats", gb1) gb2 = (0.7, 0.6, 0.1, 0.5, 0.1, 0.2, 0.8, 0.9) gp[2].setAttribValue("MyFloats", gb2) ''' import numpy as np y = np.arange(24, dtype=np.float32).reshape(3,8) g.setPointFloatAttribValues("MyFloats", y) # error print g.pointFloatAttribValues("MyFloats") # error
  15. Hi all, I have an arrays-in-loops puzzle. I thought of a shortcut to do a thing, it doesn't seem to work, and I should move on -- except I would like to understand why it doesn't work. Minimal background: I've got some point data, I've polywired it together using Connect Adjacent Pieces, and gotten a restlength on the primitives from that. I need to set a pscale on the points before moving on to my next step. Half the distance to the nearest neighbor is good enough for now. I could use nearpoints() to figure that out (and it seems to work!), but I thought, "hey, I already have restlengths; why not just look up the shortest restlength and use that?" That turns out not to work, or at least not as I think it should. Where have I gone wrong? After my connect step, each point ends up connected to 4-20 other points by primitives with restlengths between .9 and 3.9. My first stab at this was: use pointprims() to get an array of primitives associate with each point; create an empty float array to hold the restlengths; foreach loop over the primitives, read the restlength with primattrib(), and push the result onto the lengths array; sort() the lengths array into a new array; read out the shortest length and use that to calculate a pscale. Here's the actual code: int myprims[] = pointprims(0, @ptnum); float mylens[] = {}; foreach (int myndx; myprims) { float mytmp = primattrib(0, "restlength", myprims[myndx], 0); // f@checktmp = mytemp; push(mylens, mytmp); // f@checkrslt = mylens[myndx]; } float lensort[] = sort(mylens); float shortest = lensort[0]; f@pscale = shortest/2; I think it's failing at the push statement. If I write out mytmp as a point attribute just before I push it, I get a reasonable number (commented code). If I check the stored value right after the push, I get either zero or the restlength of prim zero. If I check after the foreach loop completes, I get restlength of prim zero. So the push doesn't work. Looks like example code in the docs, but I'm missing something. Any thoughts?
  16. Creating a force array in vex

    Hi all, I am struggling to write a force array per particle, i have an float array per particle named "upforce" and i want to use this array as my "y" force. Any tips? Thanks
  17. Read point array attribute from detail wrangle

    I am in a detail wrangle and want to read the first component of a point array attribute. Unfortunately neither point() nor attrib() seem to offer this. I couldnt find suitable array functions, either. int npts = npoints(0); i[]@prim_list[npts]; for(int i = 0; i < npts; i++){ @prim_list[i] = point(0, "sourceprim", i).[0]; // try to access first component }
  18. VEX array of structs

    Hello, I'm a newbie with vex and I'm trying to create an array of structs. In my wrangle node I defined the struct in the outer code section as suggested here my struct looks like this: struct node { int pt; int nbrs[ ]; } In my code I later declare node nd; node array[ ]; I manage to initialise the nd variable normally. Then I tried the following int pt = nd.pt; //works fine int nbrs[] = nd.nbrs; //works fine array[0] = nd; //seems to work fine pt = array[0].pt; //nope nd = array[0]; //nope By doesn't work I mean that the node turns red saying the following Error The sub-network output operator failed to cook: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1 Warning: Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Error: Vex error: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1) Failed to resolve VEX code op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1 Unable to load shader 'op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1'. Warning Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Warning Errors or warnings encountered during VEX compile: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1). Warning Vex error: /obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1: Internal compiler error. (15,1) Failed to resolve VEX code op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1 Unable to load shader 'op:/obj/new_version/tree/growing_alg/find_neighbour/outer_code/attribvop1' Any ideas? Thank you Marta
  19. Hello! First time poster (also posted on sidefx forums) ~ I have a wrangle set after an assemble sop and am currently having success with: string shatter_points = chs('Pieces_to_Break'); if(@name != shatter_points) removepoint(0,@ptnum); Where Pieces_to_Break can contain one name. Effectively this deletes all but the named packed primitive. I'd like to amend this so that I can enter an array of pieces to “keep”. Any thoughts? Thanks in advance!!
  20. Hello! First time poster (also posted on sidefx forums) ~ I have a wrangle set after an assemble sop and am currently having success with: string shatter_points = chs('Pieces_to_Break'); if(@name != shatter_points) removepoint(0,@ptnum); Where Pieces_to_Break can contain one name. Effectively this deletes all but the named packed primitive. I'd like to amend this so that I can enter an array of pieces to “keep”. Any thoughts? Thanks in advance!!
  21. Hello, Trying to read a vector array from another point at a certain index. From my understanding of Houdini something like this should work. vector tempArray[] = point(0,"vectorArrayAttrib",pointToReadFrom); vector v = tempArray[index]; Unfortunately this method is returning an empty array from the point() function. If this is not the right way to go about doing this please let me know. Any help welcomed. Thanks.
  22. Hello,I'm attempting to create the slitscan/timeshift effect. I'm creating a vector array in a for loop, each loop has an attrib from map and a wrangle that appends Cd to a vector array. It works when the attrib from map is always reading from the same file. When I change the attrib from map file read expression to anything that has to do with $F or the meta nodes iteration Houdini crashes. I have a test scene that has documentation and even nodes setup to create test frames to work with.If it is a matter of the way that multiple files cannot be read at once please let me know. If someone knows of a better way to read from multiple files at once and/or achieve this effect please let me know. I'm aware that after effects has this effect and uses gradients to determine which frame to look up color from. While that method is great, I'd like to be able to write the gradients/lookups in vex to achieve results. Any help greatly appreciated. -T concept_025_slitScan_v001.hiplc
  23. Hi I need an array wich stores a range of numbers, starting at zero and ending at @numpt (total amount of points in a geometry). Is there a fast way to do this apart from filling the array in a for loop? Thanks
  24. Ok, I have many objects separated into point groups by unique suffixes. I'd like to split the suffix integer value from the array of group names. Then assign that integer to a custom attribute. I'm terrible at VEX so any suggestions would be greatly appreciated.
  25. Access array attribute wrangle

    Hey, I have a bunch of points with 3 float attributes, b[0] b[1], b[2] If I want to access only the second attribute, specifically through a wrangle (for learning), how would I do this? I've tried @foo = point(@p,"b",1) but that only returns the first attribute value. Presumably because I'm not asking for an array? Thanks!
×