Jump to content

Search the Community

Showing results for tags 'vex'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Lounge/General chat
    • Education
    • Jobs
    • Marketplace
  • 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 609 results

  1. Hello, I have a for each connected loop, and I created a meta import node. To access the node using the detail function in a wrangle I have to use the back ticks to get the value of the iteration otherwise it just shows 0 without the back ticks. Can some please explain to me why we need to use the detail function in back ticks, for example `detail("../eachP/", "iteration", 1);` in a wrangle node for it to work? Thanks, This is with back ticks This is without back ticks
  2. Analogous Colors

    I would like to color a set of primitives using random analogous color pairs. (or triadic/tetradic etc) The color sop node provides this information but only as a guide to choose from. How would i go about this? i suppose vex is the way to go but i don't have a clue as to which functions or what method should be used. Any tips?
  3. where I can find the list of global attributes in houdini like pscale animated etc etc .
  4. Hello, Can someone please explain to me what a linear vertex is properly? I thought I understood it when I was initially trying with lines but once I applied the function on the grid, everything seems wrong. I understood it as, primvertex points to the point number, so vertex 2 of primitive 1 should return 2 but instead it is returning 6. Not sure why? The same function with lines give me the correct answer.
  5. Hi guys, I would like to get a way to add more deform to a ribbon. Pathdeform is helping but I would like to add some area to rotate my ribbon. I tried "attribute transfer" to rotate @N without succes.. Any help would be appreciate. Thank you.
  6. I want to know if a group exists in my geo stream. Found a solution in this old topic but doesnt seem to work Any ideas? check_for_group.hip
  7. Hi, I've some experience with VEX in SOP land but I'm new to Mantra shading and I want to get better at writing vex shaders. What would be the modern way of doing that? In particular, I'm not entirely sure if I could simply write my code and hit compile (the way I would with OSL in RenderMan) without ever leaving Houdini or restarting the renderer for that matter. For instance, I managed to compile the following from a vfl (a modified sidefx example) into an HDA (.\vcc -l "%HOME%\houdini18.5\vex\hcartoon.hda" "%HOME%\houdini18.5\vex\hcartoon.vfl") and it's available under /SHOP/Digital Assets and it works. #include <shading.h> #pragma opname hcartoon #pragma oplabel "HCartoon" #pragma opicon SHOP_surface #pragma label colora "Color A" #pragma label colorb "Color B" #pragma hint colora color #pragma hint colorb color #pragma hint Cd hidden surface hcartoon( vector colora={0.2, 0.5, 0}; vector colorb={0, 0.2, 0.8}; vector Cd=1; ) { vector Cx; illuminance(P){ Cx = Cl; shadow(Cl); if (Cl == Cx){ Cf = colora; } else{ Cf = colorb; } } } However, isn't there a more straightforward way? Do I always have to compile to HDA and write all those pragmas? I was hoping for something like an attribute wrangler approach. So, there's the Surface Shader Builder (vopsurface) that I have to admit I don't quite get as far as writing code goes. Snippet? Inline? How about inputs and outputs in it? Surely not with pragmas in there, right? I tried with a snippet, got a compile error 'Invalid return type (surface)'. If anyone can help me with it, that'd be awesome! Thanks, Hristo
  8. Hey, so I am trying to create something similar to this. The reason for this is that I am attempting to create a procedural wall tool like the one made by Marc Chevry here: https://www.artstation.com/marcchevry/blog/YMYR/making-of-minimoys-procedural-wall This image is actually from another artist who attempted the same thing. They have split it into four stages, obviously I would eventually want to get the same final outcome as them. However what I am trying to do is create the grid with randomised offsets and 'tilts' or angles, for each of the inside vertices, whilst keeping the outside edges straight. I have been trying to do this for the past week and keep getting stuck so any help or adjustments would be great. Here is the code I currently have. As you can see, the it doesn't ignore the edges, and if I add more rows to the grid it gets very bunched up. I am very new to this so please explain to me asif I had no idea what I was doing!:) Also just to add, if there was a way to do this without vex, just using nodes or similar, this would also be okay! Thanks for your help in advance, I really appreciate it! I just have been stuck on this for a few weeks now and I can't figure out what to do! Thanks again:) vert_offset_v2.hipnc
  9. Hi everyone, I posted some progress in another thread (Sidewalks - PathDeform? - Modeling - od|forum (odforce.net)). My VEX code for detecting intersecting geometry only seems to work on some parts of the model, whereas on others it does not seem to work at all. My idea for the code was to iterate over all points and fire a ray each up and down, to see if there is more than one intersection (it seems it generates always 1 intersection, for the self intersection), and if the point intersects with the geo, its added to a point group, so it can be fused at a later point. What could be the reason, that it only works on some parts of the model? vector RayDDown = {0,-100,0}; vector RayDUp= {0,100,0}; vector hitPos[]; int hitPrims[]; vector hitUVW[]; float tol = 0.00001; float ttol = 0.00001; int expand = 0; int stepping = 2; expand = expand * stepping; i@IntersectDown = intersect_all(0,@P, RayDDown, hitPos, hitPrims, hitUVW, tol, ttol); if (@IntersectDown > 1) { setpointgroup(0,"Intersecting", @ptnum-expand, 1, "set"); setpointgroup(0,"Intersecting", @ptnum, 1, "set"); setpointgroup(0,"Intersecting", @ptnum+expand, 1, "set"); } i@IntersectUp = intersect_all(0,@P, RayDUp, hitPos, hitPrims, hitUVW, tol, ttol); if (@IntersectUp >1) { setpointgroup(0,"Intersecting", @ptnum-expand, 1, "set"); setpointgroup(0,"Intersecting", @ptnum, 1, "set"); setpointgroup(0,"Intersecting", @ptnum+expand, 1, "set"); } I also included a screenshot illustrating the problem. Thanks in advance!
  10. Volumesampleindex returning 0

    Hi, I'm currently trying to implement a smoke volume that wraps around the X-axis. Essentially taking the values of the final voxels on the +X axis and applying them to -X. The VEX below should be doing what I want, but its returning zero every time. Am I missing something? I've tried deriving the voxel coordinate procedurally, as well as manually specifying a good known coordinate, and every time I get an empty result. Its driving me mad! float scratchpad = chf('scratchpad'); int far_voxel = floor(ch('../smokeobject1/sizex') / ch('../smokeobject1/divsize')); vector sample_pos = volumeindextopos(0, "density", set(far_voxel, @iy, @iz)); if(@ix == 0){ //f@density = 1.0; //f@density = volumeindex(0, "density", set(far_voxel, i@iy, i@iz)); //v@vel = volumeindex(0, "vel", set(far_voxel, i@iy, i@iz)); f@density = volumesample(0, "density", sample_pos); v@vel = volumesamplev(0, "vel", sample_pos); } The commented out lines are different methods I've tried with no success. So far I've tried using volumeindex to read the voxel values directly, and volumesample using a position derived from volumeindextopos. No dice Any ideas folks? (the attached image shows the current behavior using the wrangle VEX above. What should be happening is the density and velocity values on +X boundary should be being copied into the -X boundary voxels)
  11. Shift Array Vex

    How can I shift values in an array using a for loop? For example: [0,0,0,1,1,1]->[1,0,0,0,1,1] I would think that this code would work but it does not. Any help would be appreciated. for(int j = 0; j < 6; j++ ){ if(@new_tile_array[@new_prim_id] == 1){ break; } else{ int popped = pop(@new_tile_array); append(@new_tile_array,popped); } }
  12. POP Force Mass Remap

    Hello Everyone I noticed that many parameters have a "Use VEXpressions" checkbox and i try to understand them. In my example i would like to remap the mass of the pieces by VEX. Preferably using a Ramp! And all that inside the local VEX of the POP Force :-) So that there is a better distribution of pieces in Y. I can't make it work... should it?
  13. Hello, I'm trying to automate cogs rotation using vex and a formula I've found online. The basic scenario is the following : one cog 'parent' and one cog 'child'. The cog 'parent' is animated (simple animation on Y axis) and will drive the cog 'child' by the following formula : (cog 'parent') * (-cog 'parent' teeth / cog 'child' teeth) this is quite easy. In the example I provided I 'hardcoded' the teeth count but it is calculated procedurally in a larger setup. All my cogs are packed primitive so I used matrices to modify their rotation. The main problem is when I extract the rotation of the cog 'parent' to modify it, converting the matrix4 into a matrix3 then into a quaternion then into Euler then into degree, it looks like the angle in degree can't go beyond 360°. The rotation in degrees takes weird values. At the frame 87 the extracted rotation Y of the cog 'parent' is 89.5836 degrees but at the frame 88 it's -269.375 which is the same value of angle (90° = 270°) but since the cog 'child' is not symmetrical I can see 'jumping' and If I calculate velocity on top of that the vector between these two frames will be wrong. The value at the frame 88 should be 90.625 not -269.375. I feel like the conversion doesn't allow for value bigger than 360°. I feel like I'm missing on a small thing that can be easily fixed. Is there a solution ? I've tried putting a modulo 360 somewhere but that didn't change anything I've tried dealing only with matrices without converting them but that's out of my knowledge (multiplying the rotation matrices by the ratio driven/driving so (cog 'child' teeth / cog 'parent' teeth) . Thank you for your time, Stay safe. cogs_automation_problem.hiplc
  14. VEX points edge selection issue.

    Hi guys, I have a simple problem that i can't find robust solution for. Using VEX and pcopen, I can select the corner points on a box no problem. int cornerPointCloud = pcopen(0,"P",@P,1.1,100); if(pcnumfound(cornerPointCloud)>4) { setpointgroup(0, "bottomCornerPoints", @ptnum,1, "set"); } What I actually want is to be able to select the entire edge, like this. Any idea guys?
  15. Hello guys! I have a simple C++ code which should be used by VEX in Houdini. I need to access to geometry data in specific node from current frame till frame 1 in backward direction until certain condition is met. The problem is that this access cause a huge impact on runtime when using wetmap function in a point wrangle node! Here is the sample: #include <iostream> #include <VEX/VEX_VexOp.h> #include <OP/OP_Director.h> #include <GU/GU_Detail.h> #include <SOP/SOP_Node.h> #include <GEO/GEO_VolumeSampler.h> #include <GU/GU_PrimVolume.h> #include <GU/GU_SopResolver.h> #include <VM/VM_Math.h> #include <OP/OP_AutoLockInputs.h> template <VEX_Precision PREC> static void wetmap(int argc, void *argv[], void *) { VEXvec3<PREC> *resultCd = static_cast<VEXvec3<PREC>*>(argv[0]); const char *surfaceAddress = static_cast<const char *>(argv[1]); VEXvec3<PREC> *P = static_cast<VEXvec3<PREC>*>(argv[2]); VEXvec3<PREC> *Cd = static_cast<VEXvec3<PREC>*>(argv[3]); *resultCd = VEXvec3<PREC>{0, 1, 0}; SOP_Node *surfaceNode = OPgetDirector()->findSOPNode(surfaceAddress); exint currentFrame = CHgetFrameFromTime(CHgetEvalTime()); OP_Context context; VEXvec3<PREC> color{0, 0, 1}; if(surfaceNode != nullptr) { for (exint i = currentFrame; i > 0; --i) { context.setTime(CHgetTimeFromFrame(i)); GU_DetailHandle gd_handle = surfaceNode->getCookedGeoHandle(context); } } } void newVEXOp(void *) { using UT::Literal::operator""_sh; new VEX_VexOp("wetness@&VSVV"_sh, // Signature wetmap<VEX_32>, // Evaluator 32 wetmap<VEX_64> // Evaluator 64 ); } I also try to lock the referenced node input just like SOP node examples in HDK but it makes no difference! This is an image of use case: After couple of frames pointwrangle1 become slow to cook and I don't know why! Can anyone help me? Thanks in advance!
  16. VEX Array Functions

    Harder, Better, Faster, Stronger please! Looking for some voodoo to optimize these snippets... Find Unique Elements in One Array function int[] unique_elements (int arr[]) { int _arr[] = sort(arr); for (int i=0; i<len(_arr); i++) { while(_arr[i] == _arr[i+1]) pop(_arr,i); } return _arr; } Get Duped Elements in One Array function int[] duped_elements (int arr[]) { int _arr[] = sort(arr); int result[] = {}; int dupe; for (int i=0; i<len(_arr); i++) { while(_arr[i] == _arr[i+1]) { dupe = pop(_arr,i); } append(result, dupe); } return result; } Find Common Elements in Two Arrays function int[] common_elements (int arr1[]; int arr2[]) { int result[]; foreach (int i; unique_elements(arr1)) { foreach (int j; unique_elements(arr2)) { if (i==j) push(result,j); } } return result; } Find Different Elements in Two Arrays function int[] different_elements (int arr1[]; int arr2[]) { int result[]; int _arr1[] = unique_elements(arr1); int _arr2[] = unique_elements(arr2); foreach(int i; _arr1) { if(find(_arr2,i)<0) append(result,i); } foreach(int j; _arr2) { if(find(_arr1,j)<0) append(result,j); } return result; } Swap Arrays function int[] swap (int arr1[]; int arr2[]) { int temp[] = arr1; arr1 = arr2; arr2 = temp; return {1}; } Here's some of what I was using to test it... these are all based on arrays of integers but could be tweaked obviously for other types. i[]@arr1 = {3, 2, 15, 27, 1, 3}; i[]@arr2 = {3, 2, 3, 15, 41, 41, 1, 2, 2}; i[]@arr_comm = common_elements (@arr1, @arr2); i[]@arr_diff = different_elements (@arr1, @arr2); i[]@arr_uniq = unique_elements (@arr1); i[]@arr_dupe = duped_elements (@arr2);
  17. Hi folks ! A tutorial about recursive backtracker in vex to create mazes. The idea is simple : You get your adjacent neighbours and check if they are not visited, if not, you randomly choose one and move to it. If no valid neighbours, you backtrack the stack of your previous positions and check if there is a valid neighbour until you find one. If the stack is empty no valid cells are left so the maze is done. recursive_backtracking_001.hiplc
  18. CurlNoise + Vex Help :(

    Hi there! Houdini noob here ^^ Some days ago I found this image on the internet and I really liked it so I thought about trying to replicate it but maybe animating it hehe to me it seemed like it could be made using curl noise fields so I followed the entagma's vex 101 tutorial and I manage to make this little animation as a test, and I really liked it. I think is pretty close to the image, BUT i have 2 issues with it that i don't really know how to fix or adjust a little, so i was wondering is maybe some of you guys could help me a bit or at least guide me to the right path. https://imgur.com/a/wyg2zMS First: Looping it, is it possible to loop The curlnoise or the curlxnoise? Or is there any other noise function that would produce a similar result but easier to loop Second: Is there any way to soften the curlnoise behavior in these spots? https://imgur.com/a/rLB40Hf My best idea so far i just placing the camera in a place where these intersections aren't in frame haha but would love to know if it's possible at least to make those somewhat less dramatic? CurlNoiseTest_v1.hip
  19. Hi I'm trying to make a chain of points follow a curve, maintaining the distance between them. I can achieve this in a rough way by using primuv/ primitive attribute in vops and offseting the U value by the distance. However this doesn't preserve the length L, due to the curvature. How would I find the 'chord' points of the curve along the vector P1P2 ? Another way to think of this would be the intersection of the curve and a sphere of radius L. Are there helper functions already part of Houdini that will allow me to do this? Thanks
  20. time based lerp/conditions in VEX

    Hi everyone. I'm hoping someone could take a look at this VEX and help me simplify it/point towards a more standardized way of handling time based conditions and blends in the DOP context, as I keep hacking together things to fill the similar requirements but it's always really over complex. 'm searching for nearby points on prims in the 2nd input of this wrangle and if found snapping my position to the nearest point on that prim, plus adding a bit of the velocity. I want to start a timer from the time that the point is found and run that through two ramps; one to lerp the position and the other for the velocity. Clearly its very convoluted and i'm also setting a lot of extraneous attributes, as I find if I try to use variables they often get reset each frame. It would be amazing if I could cut this number of lines in this down, or just get some tips on making it more readable. Many thanks, H window_odforce.hiplc
  21. Stopping particles popnet

    Hello everyone! The guys need help how to slow down or stop a particle based on its age. That is, the more her age. the slower she moved and then stopped altogether deceleration.hip
  22. Trying to get sin wave through pscale

    Hey all, I'm trying to get a sin wave to vary the size of pscale driven geometry through vex over time. I can get it to affect the scale initially but it doesn't fluctuate it over time. Anyone want to have a look and see what I'm doing wrong here? pscale_sin.hip
  23. Displace points along normal in VEX

    Hello everyone ! I want some points to be displaced along their N, for various reasons it needs to be in VEX. But some points doesn't react as they should. I tried the same workflow in VOP and it works perfectly (but once again, I need to do it in VEX ^^"). Do you have any idea where there can be a problem ? (I put the hipfile for a better understanding !) Disp along normal VEX.hipnc
  24. I'm new to VEX, and I am having a hard time remembering the functions, conditions etc. I guess I need more practice, but how can I get good at using them in create ways to solve problems better?
  25. setdetailattrib "min" issue

    Hi everyone, Simple question for ya'll this morning. I've just found out that the setdetailattrib has modes which can apparently return min/max and more. The max seems to work fine, but the min not so much. Always returns 0 in my case. Just add this in a wrangle of some scattered points or anything. f@noise = anoise(v@P, chi("turbulence"), chf("roughness"), chf("attenuation")) + chf("offset_min"); setdetailattrib(0,"min",@noise,"min"); setdetailattrib(0,"max",@noise,"max"); Is this a bug? Thanks