Jump to content

DonRomano

Members
  • Content count

    151
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

  • Days Won

    6

DonRomano last won the day on April 6

DonRomano had the most liked content!

Community Reputation

52 Excellent

1 Follower

About DonRomano

  • Rank
    Initiate
  • Birthday 03/06/1998

Personal Information

  • Name
    Romain
  • Location
    France

Recent Profile Visitors

715 profile views
  1. [Solved] External python script in HDA modules

    To import a specific script in Python you need to append the folder where it is to the python path (the path contains all the paths to the different modules it loads). You can do it using the sys module : import sys sys.path.append("/path/to/the/folder/where/my/script/is/myscript.py") import myscript And if you want to import just a specific function from your file and not all the file : import sys sys.path.append("/path/to/the/folder/where/my/script/is/myscript.py") from myscript import myfunction Cheers,
  2. RBF Deformer with python issue

    Hey guys, I started writing a deformer using rbf (Radial Basis Function) with python, my aim is to reproduce the one made by Artem Smirnov in his reel : https://vimeo.com/338885866 Currently I try to get it working on geometry and then I'll implement it for volumes I'm experiencing an issue and I don't really know from where it's coming : the deformation is kind of inverted on the other side of the geometry, where the geometry should not move and stay where it is, and I don't know what causes this. Input 1 is the mesh, Input 2 is the rest lattice and Input 3 is the deformed lattice Here's the code : import numpy as np node = hou.pwd() inputs = node.inputs() geo1 = node.geometry() geo2 = inputs[1].geometry() geo3 = inputs[2].geometry() radius_parm = float(node.evalParm("radius")) kernel_parm = node.evalParm("kernels") kernel_names = "gaussian,thinPlateSpline,linear".split(",") kernel = kernel_names[kernel_parm] ##################################################### #distance calculation def ext_arrs(A,B, precision="float64"): nA,dim = A.shape A_ext = np.ones((nA,dim*3),dtype=precision) A_ext[:,dim:2*dim] = A A_ext[:,2*dim:] = A**2 nB = B.shape[0] B_ext = np.ones((dim*3,nB),dtype=precision) B_ext[:dim] = (B**2).T B_ext[dim:2*dim] = -2.0*B.T return A_ext, B_ext def pdist_squareformed(a, b): A_ext, B_ext = ext_arrs(a, b) dist = A_ext.dot(B_ext) np.fill_diagonal(dist,0) return dist def thinPlateSpline(x, r): arg = x / r result = arg * arg result = np.where(arg > 0, result * np.log(arg), result) return result def gaussianSpline(x, r): result = np.exp(-(x * x) / (r * r)) return result def linear(x, r): result = x / r return result def rbf(x, kernel, radius): if kernel == "gaussian": result = gaussianSpline(x, radius) if kernel == "thinPlateSpline": result = thinPlateSpline(x, radius) if kernel == "linear": result = linear(x, radius) return result ##################################################### #SETUP GEO POSITIONS MATRICES numpt1 = len(geo1.iterPoints()) matrixQ1 = np.zeros((numpt1, 3)) numpt2 = len(geo2.iterPoints()) matrixQ2 = np.zeros((numpt2, 3)) numpt3 = len(geo3.iterPoints()) matrixQ3 = np.zeros((numpt3, 3)) #geo i = 0; for p1 in geo1.points(): matrixQ1[i, 0] = p1.position()[0] matrixQ1[i, 1] = p1.position()[1] matrixQ1[i, 2] = p1.position()[2] i += 1 #lattice j = 0; for p2 in geo2.points(): matrixQ2[j, 0] = p2.position()[0] matrixQ2[j, 1] = p2.position()[1] matrixQ2[j, 2] = p2.position()[2] j += 1 #deformed lattice k = 0; for p3 in geo3.points(): matrixQ3[k, 0] = p3.position()[0] matrixQ3[k, 1] = p3.position()[1] matrixQ3[k, 2] = p3.position()[2] k += 1 ##################################################### #CALCULATE WEIGHTS npts, dim = matrixQ2.shape H = np.zeros((npts + 3 + 1, npts + 3 + 1)) H[:npts, :npts] = rbf(np.sqrt(pdist_squareformed(matrixQ2, matrixQ2)), kernel, radius_parm) H[npts, :npts] = 1.0 H[:npts, npts] = 1.0 H[:npts, -3:] = matrixQ2 H[-3:, :npts] = matrixQ2.T RH = np.zeros((npts + 3 + 1, dim)) RH[:npts, :] = matrixQ3 weights = np.linalg.solve(H, RH) ##################################################### #DEFORMATION npts2, dim2 = matrixQ1.shape G = np.zeros((npts2, npts + 3 + 1)) G[:, :npts] = rbf(np.sqrt(pdist_squareformed(matrixQ1, matrixQ2)), kernel, radius_parm) G[:, :npts] = 1.0 G[:, -3:] = matrixQ1 new_pos = np.asarray(np.dot(G, weights)) ##################################################### #SET POS s = 0; for p in geo1.points(): newX = new_pos[s, 0] newY = new_pos[s, 1] newZ = new_pos[s, 2] p.setPosition((newX, newY, newZ)) s += 1
  3. Thin Sheet Fluid

    Well, I didnt get my head into the tool for a long time, but i'll say the snap distance, a smaller distance threshold and a smaller emission threshold Hey, it was for testing purpose but I ended up not using it because it was not optimal, and I forgot to delete it ! Cheers,
  4. Boat explosion

    Hello guys, So after many many retakes, here's a new version of the rbd simulation. What do you think of it ? rbd_sim_deformed_mesh_021.mov https://streamable.com/2fs36b Cheers,
  5. Accessing ptnum on a wrangle

    Depending on what you're trying to do, you can either use the nearpoint() function which will return the closest point of the geo in the second input (to the point you're iterating on), or maybe you can setup a custom id attribute on both points, and then use the findattribval() function to find the corresponding point. Another possibility is to iterate through a point cloud, and there are many other way.. Cheers
  6. PythonLoader

    Hey guys, Here's my first HDA : the PythonLoader. It's a python sop node which you can use to write, save, load and execute script within Houdini. It can be very useful to test script for future shelf tools, iterate through similar nodes, load multiple files... all kind of python operation we can make in Houdini. You can save those scripts to re-use them later, modify them or even share ! Tested and working on Houdini 18, let me know if you encounter any problem with another os or Houdini version ! It's free and you can get it here : https://gumroad.com/l/UnmRE Cheers,
  7. PythonLoader

    I didn't know where to post it exactly but I'll post it there too !
  8. PythonLoader

    Hey guys, Here's my first HDA : the PythonLoader. It's a python sop node which you can use to write, save, load and execute script within Houdini. It can be very useful to test script for future shelf tools, iterate through similar nodes, load multiple files... all kind of python operation we can make in Houdini. You can save those scripts to re-use them later, modify them or even share ! Tested and working on Houdini 18, let me know if you encounter any problem with another os or Houdini version ! It's free and you can get it here : https://gumroad.com/l/UnmRE Cheers,
  9. Multiparm (list) parameter linking

    Hey, you can setup a python callback script which dynamically reference the parameters from your hda to the wrangle. Here's a quick example : listparm_hda = kwargs["node"].parm("list") list_hda = listparm_hda.multiParmInstances() children = kwargs["node"].children() for child in children: if "wrangle" in children: wrangle = children else: continue listparm_wrangle = wrangle.parm("list") list_wrangle = listparm_hda.multiParmInstances() i = 0 for parm in list_hda: p1 = parm p2 = list_wrangle[i] p2.set(p1) p2.expression() i += 1 Cheers,
  10. I don't understand what you're trying to achieve, what's your goal here. Do you want just some particles to slide on the red geometry and some other to keep their way or is it something completely different ?
  11. What about sharing your file ? We'll be able to see what's not working and not wasting our breath here. It may come from another node.. Cheers,
  12. Use a compare node to check if the @Cd.r is greater than your threshold value, and then drive a switch with that so it should cast rays only on the red geo :
  13. Keyframing with Python seems buggy?

    It's the same a "normal" python scripting : import module1 import module2 import module3
  14. I don't understand what's your goal here. If you want to replace your script by another script using some condition, create a python module in your hda with your different functions and call them in the menu using hou.pwd().hdaModule.myFunction().
  15. Hey, if you want to put a script into the hda menu script, it must return a dictionnary with your menu items and their id, like def myMenu(): do something items = {"0" : "item1", "1" : "item2"} return items myMenu() I don't know if that seems clear to you, but as you replace the "classic" item list by a script, it must return some items, and those items are evaluated as a dictionnary. Cheers,
×