Jump to content

Leaderboard


Popular Content

Showing most liked content on 03/11/2018 in all areas

  1. 1 point
    Ok, what about something like this... Place this code in the Pre-Frame Script field of the rop_geometry1 node. Remember to switch code processing from the default of Hscript to Python. It basically scans the input folder on every frame change and uses the frame number as an index into the retrieved list. It re-writes the file1 input path and the rop_geometry1 output path to match the current file being processed. The results are stored in a folder named results, so you will have to manually create that. Quite a bit of hard coding, but it does seem to work. Just don't rename nodes and populate the input and output paths to match your folders. USAGE: Click Render on the rop_geometry1 node. # Process a series of .OBJ files. import os input_path = r"F:\Keep\Models\Rocks" output_path = r"F:\Keep\Models\Rocks\result" def returnFilesLike(passedFolderName, passedFileExtension = ".obj"): result = [] for file in os.listdir(passedFolderName): if file.endswith(passedFileExtension): result.append(os.path.join(passedFolderName,file)) return result lst_files = returnFilesLike(input_path, ".obj") l = len(lst_files) if (l>0): frame = hou.intFrame() if frame <= l: # Frame is within range of object count in this folder. file_source = os.path.split(lst_files[frame])[1] file_node = hou.node("/obj/geo1/file1") file_node.parm("file").set(lst_files[frame]) file_dest = os.path.join(output_path,file_source) rop_node = hou.node("/obj/geo1/rop_geometry1") rop_node.parm("sopoutput").set(file_dest) ap_re_process_folder_of_OBJs.hiplc
  2. 1 point
    Ok, this was a nice learning project, a lot of things can be improved, but i'm done with it and i'll share the source code, as i promised. Hope this will be useful for learning purpose. Happy New Year! YouTube Source code
  3. 1 point
    my approach using one liners... vu_CurveLerp.hipnc
  4. 1 point
    Here is some method: fit_circles_to_curves.v4.hipnc
  5. 1 point
    Hi, here is my project file for assembling effect I showed in my previous shot. It's not perfect and it needs some improvements. Juraj project_forum.zip
  6. 1 point
    I'm sure you can't do it without an additional data. For example, is it possible to retain transform matrix on points of original geometry? Then yes, just multiply it by inverse. Dealing with object transforms is the most straightforward way, and you need only transform, simple box with some snapping techniques with desired transform is fine. Extract Transform OBJ. There is another nice method I didn't found in Houdini, maybe it will fit you. If you have at least two triangles, or any arbitrary 3 points transformed, of before-transform and after-transform states (for example, if you store rest position or if you could recreate it more or less exact), then you may easily calculate transform matrix between them using triangles's "local spaces" created from triangles's sides. Here the code for Primitive Wrangle (I used "0" as group, it runs only for first polygon) with two identical geometries on inputs, where second is arbitrarily transformed. // Create a basis from points of triangle. matrix3 basis_from_triangle(vector p1, p2, p3) { // Axes vectors. May not be orthogonal. vector X, Y, Z; Z = p2 - p1; X = p3 - p1; Y = normalize(cross(Z, X)) * length(p2 - p3); return set(X, Y, Z); } // Calculate rotation matrix rotating triangle ABC into triangle DEF. matrix3 rotation_between_triangles(vector a, b, c, d, e, f) { matrix3 basisABC, basisDEF; basisABC = basis_from_triangle(a, b, c); basisDEF = basis_from_triangle(d, e, f); return invert(basisABC) * basisDEF; } // Calculate transform matrix transforming triangle ABC into triangle DEF. matrix transform_between_triangles(vector a, b, c, d, e, f) { matrix transform = ident(); matrix3 r = rotation_between_triangles(a, b, c, d, e, f); transform *= r; translate(transform, d - a * transform); return transform; } 4@transform = transform_between_triangles(point(1, "P", primpoint(1, @primnum, 0)), point(1, "P", primpoint(1, @primnum, 1)), point(1, "P", primpoint(1, @primnum, 2)), point(0, "P", primpoint(0, @primnum, 0)), point(0, "P", primpoint(0, @primnum, 1)), point(0, "P", primpoint(0, @primnum, 2))); Now, transform points using Point Wrangle with second input as geometry, simply getting first primitive's transform attribute. @P *= matrix(prim(1, "transform", 0)); Or, being contemporary, Deformation Wrangle, because it is exactly why it was created. pos *= matrix(prim(1, "transform", 0)); It will properly transform attributes you need to have transformed. With Point Wrangle you need to use other wrangles to transform vertex normals or other attributes. Actually, for normals only there is special checkbox on Point Wrangle, and sometimes it works. betweentria.hipnc
×