Jump to content

konstantin magnus

  • Content count

  • Donations

    0.00 CAD 
  • Joined

  • Last visited

  • Days Won


Everything posted by konstantin magnus

  1. Resample Curve by N attribute

    Hi philpappas, to extract main features of your curve you could first measure its curvature with the new measure SOP or by calculating the dot product of your tangents (see attachment). Afterwards a derivation of the curvature might be useful to only keep "break points" that are important to the visual appearance of your curve. I just would not know how to calculate this though. curve_curvature.hiplc
  2. Tileable Noise

    Hi Niels, I tried the torus route as suggested on twitter: float r_torus = chf('radius_torus'); float r_tube = chf('radius_tube'); float freq = chf('frequency'); v@pos_rest = v@P; vector bbox = relbbox(0, v@P) * M_TWO_PI; v@P.x = (r_torus + r_tube * cos(bbox.x)) * cos(bbox.z); v@P.y = (r_torus + r_tube * cos(bbox.x)) * sin(bbox.z); v@P.z = r_tube * sin(bbox.x); v@Cd = noise(v@P * vector(freq)); v@P = v@pos_rest; seamless_noise.hip
  3. (Animated) dashed line?

    Yes, you could take the convertline SOP, promote the wave attribute to primitives and delete by this attribute. @DévinOdforce: I attached an example. dashed_curves_prims.hiplc
  4. (Animated) dashed line?

    Let a sine wave run across your curves, set the dash length with frequency, animate by adding time and define the gap size by comparing the value with a custom threshold. float u = vertexprimindex(0, @vtxnum) / float(primvertexcount(0, @primnum)); float u_length = u * primintrinsic(0, 'measuredperimeter', @primnum); float u_anim = (u_length + @Time * chf('speed')); int waves = sin(u_anim * M_PI * chf('frequency')) < chf('gaps'); v@Cd = hsvtorgb( set(u, 1.0, 1.0) ) * waves; If you want your dashed line to be static just replace u_anim inside the sin() function by u_length. dashed_curves.hiplc
  5. On a grid-node just right-click in order to switch the expression language to Python and use this:
  6. Orient noise pattern along vectors

    Great idea @f1480187, creating the rotation matrices from the cage lines is definitely cleaner!
  7. Orient noise pattern along vectors

    I aligned vector directions towards some curves (ie. outer edges). How would I orient a stretched noise pattern accordingly? oriented_noise.hiplc
  8. Orient noise pattern along vectors

    Thanks for your help @tmdag. I had to invert the rotation matrix. So its: vector freq = chv('frequency'); vector dir = normalize( minpos(1, v@P) - v@P ); vector rect = normalize( cross(v@N, dir) ); vector nml = normalize( cross(dir, rect) ); matrix3 rot = set(dir, nml, rect); float deform = noise(v@P * invert(rot) * freq); v@P += v@N * deform * 0.05;
  9. Orient noise pattern along vectors

    I have made some progress in making the wrinkles run towards the outer edges. Unfortunately i still get lots of warping issues that I can't quite explain. Ideally I want all folds to run in a parallel manner towards their nearest outer edge. This is the code I am currently using: vector pos_b = minpos(1, v@P); vector dir = normalize(pos_b - v@P); vector rect = cross(v@N, dir); vector nml = cross(dir, rect); matrix3 rot = set(dir, nml, rect); vector freq = {8, 1, 40}; vector pos = rot * v@P * freq; float deform = noise(pos); v@P += v@N * deform * 0.05; folds_wrinkles_2.hiplc
  10. Hi, I was shaping a hex nut with VEX when two geometry questions arose: How can I mathematically define the offset from a circle to an n-gon? Currently I am multiplying by a magic number: sin(u_mod) * 0.12. How can I multiply vectors so they end up on an infinite plane defined by a position and a normal? Kind of what planepointdistance() does, but rather intersecting the plane with the points vector than just returning the closest position on the plane. Also I would not want to shoot rays around but rather set this mathematically. Here is how I deform the tubes outer points at the moment: float u = atan(v@P.z, v@P.x); float u_mod = abs(sin(u * 3)); float u_fit = fit01(u_mod, 0.75, 1.0); vector nml_flat = normalize(v@N * {1, 0, 1}); v@P -= nml_flat * sin(u_mod) * 0.12; v@P.y *= u_fit; Thank you! hex_nut.hiplc
  11. Multiply vectors to a plane (Trigonometry questions)

    One question remains: How would one scale radial vectors so a circle turns into an n-gon?
  12. Multiply vectors to a plane (Trigonometry questions)

    Well, there wouldnt been a single line without your brain ; )
  13. Multiply vectors to a plane (Trigonometry questions)

    Thank you! And yes, by 'multiplying vectors' I was thinking of extending or shortening them, not thinking of using cross products here. So this is a visual summary in 5 steps: When we want to project the grey points from the inner circle on the plane of the outer points and their normals (turqoise), we aim in the opposite direction facing away from the plane points by subtracting circle point positions from the plane positions (yellow), create rectangular vectors to the plane normals by calculating a cross product of the aim direction and the plane points normals (red), and build the cross product of the planes normals and the rectangular directions while adding the planes position (green). When applying this result to the circle points positions, all points are projected on their targeted planes. int pt_plane = nearpoint(1, v@P); vector pos_plane = point(1, 'P', pt_plane); vector nml_plane = point(1, 'N', pt_plane); v@dir = v@P - pos_plane; // yellow v@rect = cross(v@dir, nml_plane); // red v@proj = cross(nml_plane, v@rect) + pos_plane; // green v@P = v@proj; project_on_plane.hiplc
  14. Multiply vectors to a plane (Trigonometry questions)

    I exposed some parameters, in case someone is looking for a screw nut / cog wheel generator ; ) hex_nut.hiplc
  15. Carve Contour Lines In Car Body

    An even smoother result can also be reached by simply using the deltamush node. You can multiply the strength of this effect by this: vector delta = point(1, 'P', @ptnum) - v@P; v@P += delta * chf('strength'); surface_deltamush.hiplc
  16. Carve Contour Lines In Car Body

    You could divide the distance to the borders by the maximum distance for each cell, modify this gradient to make it curved and use this to push the surfaces inwards. surface_inwards.hiplc
  17. Python: Loop delete geometry

    Thank you again! It performs nicely for exporting some sliced cityscapes that need 3d printing.
  18. Python: Loop delete geometry

    I want to export single tiles of a grid by their id attribute with Python. Because saveToFile() is lacking any filter options, I am trying to use a loop for deleting all redundant primitives before each export. Unfortunately once primitives have been deleted for the first time, they are gone for all subsequent loops, too. node = hou.pwd() geo = node.geometry() dir_exp = node.evalParm('dir_export') id_values = geo.primIntAttribValues("id") id_count = len(set(id_values)) # is there a more hou way to count unique attribute values? for iteration in range(id_count): geo_change = geo path_export = dir_exp + 'segment' + str(iteration) + '.obj' prims = [p for p in geo_change.prims() if p.attribValue('id') != iteration] geo_change.deletePrims(prims) # how can I keep the full geo data for the remaining loops? geo_change.saveToFile(path_export) How can I keep the full geometry for each loop? And are there any better ways to export geometry parts based on attributes with Python? landscape_slice_export.hiplc
  19. [SOLVED] Animate points of polyline and keep distance?

    Ok, then just get their initial position on the curve using xyzdist() and assign the updated position with primuv() like before. chain_move_2.hiplc
  20. [SOLVED] Animate points of polyline and keep distance?

    It´s either irregular or it has to be rearranged. Just keep the resample node in there.
  21. [SOLVED] Animate points of polyline and keep distance?

    Hi Devin, here is another way to make a chain move. chain_move.hiplc
  22. How do I dynamically create and remove SOP nodes from a Multiparm Block List? dynamic_create_remove.hiplc
  23. Generating Tile Geometry

    I have created a tutorial on dart throwing a while ago: https://www.youtube.com/watch?v=Y1UC3T9l15U
  24. [SOLVED] Animate points of polyline and keep distance?

  25. VEX Function: npointsgroup

    npointsgroup() returns the number of all points within a specific group. So if there are 5 points in a group, it will always return 5. Its not meant for iterating over points. int pts = npointsgroup(0, 'group1'); inpointgroup() however returns whether a certain point @ptnum is in a specific group or not (0 or 1). v@Cd = vector(0.0); if( inpointgroup(0, 'group1', @ptnum) != 0){ v@Cd.r = 1.0; } Or more compact: int in_grp = inpointgroup(0, 'group1', @ptnum); v@Cd = set( float(in_grp) , 0.0, 0.0);